当前位置:   article > 正文

robosuite导入自定义机器人

robosuite导入自定义机器人


目的:

实现其他标准/非标准机器人的构建

案例一:

成果展示

添加机器人JAKA ZU 7 这个模型

具体步骤:

URDF文件准备

github 或机器人官网,下载 urdf 模型以及对应的 mesh

xml文件生成

官方提供的 urdf 模型如下:

<?xml version="1.0" encoding="utf-8" ?>
<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com) 
     Commit Version: 1.5.1-0-g916b5db  Build Version: 1.5.7152.31018
     For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
<robot name="jaka_zu7">
    <!-- LINK -->
    <link name="world" />

    <link name="Link_0">     
        <inertial>
            <origin xyz="0.00096371 8.8222E-08 0.019555" rpy="0 0 0" />
            <mass value="4.0392" />
            <inertia ixx="0.0048763" ixy="-1.8056E-07" ixz="2.5196E-05" iyy="0.0068003" iyz="-1.7678E-09" izz="0.010618" />
        </inertial>

        <visual>
            <origin xyz="0 0 0" rpy="0 0 0" />
            <geometry>
                <mesh filename="/home/idm/Downloads/jaka_robot_v2.2/src/jaka_description/meshes/jaka_zu7_meshes/Link_0.STL" />
            </geometry>
            <material name="">
                <color rgba="0.84706 0.84706 0.84706 1" />
            </material>
        </visual>
        <collision>
            <origin xyz="0 0 0" rpy="0 0 0" />
            <geometry>
                <mesh filename="/home/idm/Downloads/jaka_robot_v2.2/src/jaka_description/meshes/jaka_zu7_meshes/Link_0.STL" />
            </geometry>
        </collision>
    </link>
        <gazebo>
        <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
            <robotNamespace>/</robotNamespace>
            <!-- <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
            <legacyModeNS>true</legacyModeNS> -->
        </plugin>
    </gazebo>
</robot>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39

修改最下面,将 gazebo 改成:

    <mujoco>
        <compiler 
        meshdir="/home/idm/Downloads/jaka_robot_v2.2/src/jaka_description/meshes/jaka_zu7_meshes/" 
        balanceinertia="true" 
        discardvisual="false" />
    </mujoco>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

注意修改下 meshdir 的路径。

然后执行 ./compile urdf robot.xml,实现 urdfxml 的转变,后续操作之需要在 xml 的基础上修改即可;

xml修改

原始生成的文件如下:

<mujoco model="jaka_zu7">
    <compiler angle="radian" meshdir="/home/idm/Downloads/jaka_robot_v2.2/src/jaka_description/meshes/jaka_zu7_meshes/" />
    <size njmax="500" nconmax="100" />
    <asset>
        <mesh name="Link_0" file="Link_0.STL" />
        <mesh name="Link_1" file="Link_1.STL" />
        <mesh name="Link_2" file="Link_2.STL" />
        <mesh name="Link_3" file="Link_3.STL" />
        <mesh name="Link_4" file="Link_4.STL" />
        <mesh name="Link_5" file="Link_5.STL" />
        <mesh name="Link_6" file="Link_6.STL" />
    </asset>
    <worldbody>
        <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="0.84706 0.84706 0.84706 1" mesh="Link_0" />
        <geom type="mesh" rgba="0.84706 0.84706 0.84706 1" mesh="Link_0" />
        <body name="Link_1" pos="0 0 0.12015">
            <inertial pos="-2.5186e-07 0.0033226 -0.001509" quat="1 0.00056994 2.2456e-05 6.30952e-05" mass="15.135" diaginertia="0.044302 0.043091 0.030523" />
            <joint name="joint_1" pos="0 0 0" axis="0 0 1" limited="true" range="-6.28 6.28" />
            <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="0.84706 0.84706 0.84706 1" mesh="Link_1" />
            <geom type="mesh" rgba="0.84706 0.84706 0.84706 1" mesh="Link_1" />
            <body name="Link_2" pos="0 0 0" quat="0.707105 0.707108 0 0">
                <inertial pos="0.18 8.8001e-09 -0.14308" quat="0.5 0.5 0.5 0.5" mass="42.872" diaginertia="1.1119 1.0844 0.1014" />
                <joint name="joint_2" pos="0 0 0" axis="0 0 1" limited="true" range="-1.48 4.62" />
                <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="0.84706 0.84706 0.84706 1" mesh="Link_2" />
                <geom type="mesh" rgba="0.84706 0.84706 0.84706 1" mesh="Link_2" />
                <body name="Link_3" pos="0.36 0 0">
                    <inertial pos="0.15515 5.4643e-08 -0.012576" quat="0.517406 0.481957 0.481946 0.517433" mass="16.562" diaginertia="0.28365 0.279787 0.0196608" />
                    <joint name="joint_3" pos="0 0 0" axis="0 0 1" limited="true" range="-3.05 3.05" />
                    <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="0.84706 0.84706 0.84706 1" mesh="Link_3" />
                    <geom type="mesh" rgba="0.84706 0.84706 0.84706 1" mesh="Link_3" />
                    <body name="Link_4" pos="0.30353 0 -0.11501">
                        <inertial pos="-2.1345e-06 -0.0058004 0.0026717" quat="0.699182 0.714944 2.86648e-05 -8.42093e-06" mass="5.5525" diaginertia="0.0092564 0.00897016 0.00522324" />
                        <joint name="joint_4" pos="0 0 0" axis="0 0 1" limited="true" range="-1.48 4.62" />
                        <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="0.84706 0.84706 0.84706 1" mesh="Link_4" />
                        <geom type="mesh" rgba="0.84706 0.84706 0.84706 1" mesh="Link_4" />
                        <body name="Link_5" pos="0 -0.1135 0" quat="0.707105 0.707108 0 0">
                            <inertial pos="-2.0304e-06 -0.0028889 -0.0023424" quat="0.709446 0.70476 -1.15346e-05 9.23912e-07" mass="6.3339" diaginertia="0.012993 0.0127003 0.0058451" />
                            <joint name="joint_5" pos="0 0 0" axis="0 0 1" limited="true" range="-6.28 6.28" />
                            <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="0.84706 0.84706 0.84706 1" mesh="Link_5" />
                            <geom type="mesh" rgba="0.84706 0.84706 0.84706 1" mesh="Link_5" />
                            <body name="Link_6" pos="0 0.107 0" quat="0.707105 -0.707108 0 0">
                                <inertial pos="2.7652e-05 -1.3485e-05 -0.021245" quat="-0.0453216 0.705107 0.0468242 0.7061" mass="1.4169" diaginertia="0.0011337 0.00072384 0.000718438" />
                                <joint name="joint_6" pos="0 0 0" axis="0 0 1" limited="true" range="-6.28 6.28" />
                                <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="0.84706 0.84706 0.84706 1" mesh="Link_6" />
                                <geom type="mesh" rgba="0.84706 0.84706 0.84706 1" mesh="Link_6" />
                            </body>
                        </body>
                    </body>
                </body>
            </body>
        </body>
    </worldbody>
</mujoco>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  1. 首先把 compiler, size 这两行去掉,没用了,然后把 asset 中的 file 修改下路径即可;
  2. 增加代码
<actuator>
        <motor ctrllimited="true" ctrlrange="-150.0 150.0" joint="joint_1" name="torq_j1"/>
        <motor ctrllimited="true" ctrlrange="-150.0 150.0" joint="joint_2" name="torq_j2"/>
        <motor ctrllimited="true" ctrlrange="-150.0 150.0" joint="joint_3" name="torq_j3"/>
        <motor ctrllimited="true" ctrlrange="-28.0 28.0" joint="joint_4" name="torq_j4"/>
        <motor ctrllimited="true" ctrlrange="-28.0 28.0" joint="joint_5" name="torq_j5"/>
        <motor ctrllimited="true" ctrlrange="-28.0 28.0" joint="joint_6" name="torq_j6"/>
</actuator>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  1. link_6 后面加上 right_hand
 <body name="Link_6" pos="0 0.107 0" quat="0.707105 -0.707108 0 0">
 <inertial pos="2.7652e-05 -1.3485e-05 -0.021245" quat="-0.0453216 0.705107 0.0468242 0.7061" mass="1.4169" diaginertia="0.0011337 0.00072384 0.000718438" />
 <joint name="joint_6" pos="0 0 0" axis="0 0 1" limited="true" range="-6.28 6.28" />
 <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="0.84706 0.84706 0.84706 1" mesh="Link_6" />
       <geom type="mesh" rgba="0.84706 0.84706 0.84706 1" mesh="Link_6" />
             <body name="right_hand" pos="0 0.098 0" quat="0.707 -0.707 0 0" >
             <!-- This camera points out from the eef. -->
               <camera mode="fixed" name="eye_in_hand" pos="0.05 0 0" quat="0 0.707108 0.707108 0" fovy="75"/>
        </body>
</body>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

截止到此,该机器人配置文件可用了。

机器人构建

从原有机器人中,随便找个机器人的 py 文件,复制一份,然后该个名字,并在 init 中注册以下就可以了

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/645405
推荐阅读
相关标签
  

闽ICP备14008679号