机器人技能学习-robosuite-0-入门介绍

文章目录

前言

资料太少、资料太少、资料太少,重要的事说三边,想根据自己实际场景自定义下机器人,结果发现无路可走,鉴于缺少参考文献,现在这里记录下,主要内容为官网信息,如有不合适的地方,望留言

模块介绍

结构很清晰,就是不会,以下是整体的框架图:

仿真模型三要素

要素 数量 解释 备注
机器人模型 一个或多个 包含夹具及机器人上的附属物
物体模型 0个或多个 能操作的目标物
Arena 有且仅有一个 机器人工作场景,包含桌子等

关键组件解释:

组件 作用 备注
Robots 实际动作者
Controls 解析相关指令转换成低层次语言传给物理引擎 会影响robot的运动学分量
Sensors 从MjSim对象中检索信息,并将观测结果生成机器人接受的物理信号

实战

案例1:从 demo 中创建自己的 env

目的 :将系统案例中的 Lift 剥离出来,形成自己的环境 MyLiftEnv ,并能在 ALL_ENVIRONMENTS 中找到该场景类。

  1. 将系统中的 Lift.py 复制到 robosuite_learn/demos/envs/MyLIftEnv.py,从此, MyLiftEnv 场景就是专属自己的,可以在里面尽情更改;
  2. 修改 robosuite/robosuite/__init__.py,添加代码:
python 复制代码
import sys
sys.path.append("robosuite_learn/demos/envs/") 

# Manipulation environments
from robosuite.environments.manipulation.lift import Lift
# from robosuite.environments.manipulation.myEnv import MyEnv
from MyLiftEnv import MyLiftEnv
  1. main 函数中更改引入的环境名,即可调用
python 复制代码
    options["env_name"] = 'MyLiftEnv' # 'MyLiftEnv' # choose_environment()
    robots_index = ['UR5e'] # ['Sawyer', 'Panda', 'Jaco','Kinova3','IIWA','UR5e']
    options["robots"] = robots_index[i] # choose_robots(exclude_bimanual=True)
    # Choose controller
    controller_name = 'OSC_POSE' # choose_controller()
    # Load the desired controller
    options["controller_configs"] = load_controller_config(default_controller=controller_name)
    # initialize the task
    env = suite.make(
       **options,
       has_renderer=True,
       has_offscreen_renderer=False,
       ignore_done=True,
       use_camera_obs=False,
       control_freq=20,
    )
    env.reset()
    env.viewer.set_camera(camera_id=0)

案例2:更换属于自己的物体

描述 :将物体改成自己的数据,并手动控制机器人实现装配工作

物体描述:

<mujoco model="refrigerator-box">
  <asset>
    <texture file="../textures/blue-wood.png" type="cube" name="steel-metal"/>
    <material name="smetal" reflectance="1.0" shininess="1.0" specular="1.0" texrepeat="1 1" texture="steel-metal" texuniform="true"/>
  </asset>
  <worldbody>
    <body>
      <body name="object">
        <geom pos=" 0.02 0 0.0" size="0.002 0.04 0.04" type="box" solimp="0.998 0.998 0.001" solref="0.02 1" density="100" friction="0.95 0.3 0.1" group="0" condim="4" material="smetal" />
        <geom pos="-0.02 0 0.0" size="0.002 0.04 0.04" type="box" solimp="0.998 0.998 0.001" solref="0.02 1" density="100" friction="0.95 0.3 0.1" group="0" condim="4" material="smetal" />
        <geom pos="0 -0.04 0.0" size="0.02 0.002 0.04" type="box" solimp="0.998 0.998 0.001" solref="0.02 1" density="100" friction="0.95 0.3 0.1" group="0" condim="4" material="smetal" />
        <geom pos="0 0.04 0.0"  size="0.02 0.002 0.04" type="box" solimp="0.998 0.998 0.001" solref="0.02 1" density="100" friction="0.95 0.3 0.1" group="0" condim="4" material="smetal" />
        <geom pos="0 0 -0.0399"  size="0.02 0.04 0.002" type="box" solimp="0.998 0.998 0.001" solref="0.02 1" density="100" friction="0.95 0.3 0.1" group="0" condim="4" material="smetal" />
      </body>
      <site rgba="0 0 0 0" size="0.005" pos="0 0 -0.1105" name="bottom_site"/>
      <site rgba="0 0 0 0" size="0.005" pos="0 0 0.1105" name="top_site"/>
      <site rgba="0 0 0 0" size="0.005" pos="0.0865 0.1005 0" name="horizontal_radius_site"/>
    </body>
  </worldbody>
</mujoco>

<mujoco model="refrigerator-drawer">
  <asset>
    <mesh file="meshes/refrigerator-drawer.STL" name="refrigerator-drawer" scale="0.0012 0.0012 0.0012"/>
    <!-- <mesh file="meshes/refrigerator-box.STL" name="refrigerator-box" scale="0.002 0.002 0.002"/> -->
  </asset>
  <worldbody>
    <body>
      <body name="object">
        <geom pos="0.0 -0.1 0.01" mesh="refrigerator-drawer" type="mesh" solimp="0.998 0.998 0.001" solref="0.001 1" density="1000" friction="0.95 0.3 0.1" group="0" condim="4" rgba="0.13 0.13 0.13 1"/>
        <!-- <geom pos="0.0 0.1 0.01" mesh="refrigerator-box" type="mesh" solimp="0.998 0.998 0.001" solref="0.001 1" density="1000" friction="0.95 0.3 0.1" group="0" condim="4" rgba="0.13 0.13 0.13 1"/> -->
      </body>
      <site rgba="0 0 0 0" size="0.005" pos="0 0 -0.1105" name="bottom_site"/>
      <site rgba="0 0 0 0" size="0.005" pos="0 0 0.1105" name="top_site"/>
      <site rgba="0 0 0 0" size="0.005" pos="0.0865 0.1005 0" name="horizontal_radius_site"/>
    </body>
  </worldbody>
</mujoco>

同时在场景中,也把当前的物体导入即可。

效果展示如下图:

BUG1 :曾经出现的问题

在进行手动装配的时候,出现drawer 无法塞入box 的空间中的现象,如下图所示,初步怀疑,对于 box 的描述不充分,导致无法体现空洞的表征;

问题探讨,从官方提供的demo 数据中找到一个类似的场景,把其中一个件插入到另外一个件中:

于是,找到相关 xml 模型,并进行交叉测试:


从测试情况可以看出,圆环之所以能插入到柱子中,是因为圆环是由**多个基础几何元素组合**得到的 重新修改装配体物体的描述,在这里,之需要更换 `box` 即可:

相关推荐
z樾23 分钟前
Github界面学习
学习
道爷我悟了1 小时前
Vue入门-指令学习-v-html
vue.js·学习·html
计算机学姐2 小时前
基于SpringBoot+Vue的在线投票系统
java·vue.js·spring boot·后端·学习·intellij-idea·mybatis
彤银浦2 小时前
python学习记录7
python·学习
少女忧2 小时前
51单片机学习第六课---B站UP主江协科技
科技·学习·51单片机
邓校长的编程课堂4 小时前
助力信息学奥赛-VisuAlgo:提升编程与算法学习的可视化工具
学习·算法
missmisslulu4 小时前
电容笔值得买吗?2024精选盘点推荐五大惊艳平替电容笔!
学习·ios·电脑·平板
yunhuibin4 小时前
ffmpeg面向对象——拉流协议匹配机制探索
学习·ffmpeg
hengzhepa4 小时前
ElasticSearch备考 -- Search across cluster
学习·elasticsearch·搜索引擎·全文检索·es
蜡笔小新星5 小时前
Python Kivy库学习路线
开发语言·网络·经验分享·python·学习