前言
資料太少、資料太少、資料太少,重要的事說三邊,想根據(jù)自己實(shí)際場(chǎng)景自定義下機(jī)器人,結(jié)果發(fā)現(xiàn)無路可走,鑒于缺少參考文獻(xiàn),現(xiàn)在這里記錄下,主要內(nèi)容為官網(wǎng)信息,如有不合適的地方,望留言
模塊介紹
結(jié)構(gòu)很清晰,就是不會(huì),以下是整體的框架圖:
仿真模型三要素
要素 | 數(shù)量 | 解釋 | 備注 |
---|---|---|---|
機(jī)器人模型 | 一個(gè)或多個(gè) | 包含夾具及機(jī)器人上的附屬物 | |
物體模型 | 0個(gè)或多個(gè) | 能操作的目標(biāo)物 | |
Arena | 有且僅有一個(gè) | 機(jī)器人工作場(chǎng)景,包含桌子等 |
關(guān)鍵組件解釋:
組件 | 作用 | 備注 |
---|---|---|
Robots | 實(shí)際動(dòng)作者 | |
Controls | 解析相關(guān)指令轉(zhuǎn)換成低層次語言傳給物理引擎 | 會(huì)影響robot的運(yùn)動(dòng)學(xué)分量 |
Sensors | 從MjSim對(duì)象中檢索信息,并將觀測(cè)結(jié)果生成機(jī)器人接受的物理信號(hào) |
實(shí)戰(zhàn)
案例1:從 demo 中創(chuàng)建自己的 env
目的:將系統(tǒng)案例中的 Lift 剝離出來,形成自己的環(huán)境 MyLiftEnv,并能在 ALL_ENVIRONMENTS
中找到該場(chǎng)景類。
- 將系統(tǒng)中的
Lift.py
復(fù)制到robosuite_learn/demos/envs/MyLIftEnv.py
,從此,MyLiftEnv
場(chǎng)景就是專屬自己的,可以在里面盡情更改; - 修改
robosuite/robosuite/__init__.py
,添加代碼:
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
- 在
main
函數(shù)中更改引入的環(huán)境名,即可調(diào)用
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:更換屬于自己的物體
描述:將物體改成自己的數(shù)據(jù),并手動(dòng)控制機(jī)器人實(shí)現(xiàn)裝配工作
物體描述:
<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>
同時(shí)在場(chǎng)景中,也把當(dāng)前的物體導(dǎo)入即可。
效果展示如下圖:
BUG1:曾經(jīng)出現(xiàn)的問題
在進(jìn)行手動(dòng)裝配的時(shí)候,出現(xiàn)drawer
無法塞入box
的空間中的現(xiàn)象,如下圖所示,初步懷疑,對(duì)于 box
的描述不充分,導(dǎo)致無法體現(xiàn)空洞的表征;
問題探討,從官方提供的demo
數(shù)據(jù)中找到一個(gè)類似的場(chǎng)景,把其中一個(gè)件插入到另外一個(gè)件中:
于是,找到相關(guān) xml
模型,并進(jìn)行交叉測(cè)試:文章來源:http://www.zghlxwxcb.cn/news/detail-784564.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-784564.html
到了這里,關(guān)于機(jī)器人技能學(xué)習(xí)-robosuite-0-入門介紹的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!