gazebosim/sdformat

URDF->SDF conversion: surface properties are only retained for nameless collisions and collisions named `$LINKNAME_collision`

Open

#333 opened on Aug 7, 2020

 (2 comments) (0 reactions) (0 assignees)C++ (122 forks)auto 404
URDFbughelp wantedmajor

Repository metrics

Stars
 (216 stars)
PR merge metrics
 (PR metrics pending)

Description

test.urdf:

<robot name="test">
        <link name="root">
                <inertial>
                        <origin rpy="0 0 0" xyz="0 0 0"/>
                        <mass value="1e-5"/>
                        <inertia ixx="1e-3" ixy="1e-6" ixz="1e-6" iyy="1e-3" iyz="1e-6" izz="1e-3"/>
                </inertial>
                <collision name="root_collision">
                        <geometry><cylinder length="1.0" radius="1.0" /></geometry>
                </collision>
        </link>
        <gazebo reference="root">
                <collision>
                        <surface><contact><ode><kp>5.0</kp></ode></contact></surface>
                </collision>
        </gazebo>
</robot>

If I convert this URDF to SDF (using sdformat 8), I end up with:

<sdf version='1.6'>
  <model name='test'>
    <link name='root'>
      <pose>0 0 0 0 -0 0</pose>
      <inertial>
        <pose>0 0 0 0 -0 0</pose>
        <mass>1e-05</mass>
        <inertia>
          <ixx>0.001</ixx>
          <ixy>1e-06</ixy>
          <ixz>1e-06</ixz>
          <iyy>0.001</iyy>
          <iyz>1e-06</iyz>
          <izz>0.001</izz>
        </inertia>
      </inertial>
      <collision name='root_collision_collision'>
        <pose>0 0 0 0 -0 0</pose>
        <geometry>
          <cylinder>
            <length>1</length>
            <radius>1</radius>
          </cylinder>
        </geometry>
        <surface>
          <contact>
            <ode>
              <kp>5</kp>
            </ode>
          </contact>
          <friction>
            <ode/>
          </friction>
        </surface>
      </collision>
      <gravity>1</gravity>
      <velocity_decay/>
    </link>
  </model>
</sdf>

That is correct. The same result is achieved when the collision in URDF has no name. However, If I set the collision name to anything else, the surface tags are left out (even though there is only a single collision):

<sdf version='1.6'>
  <model name='test'>
    <link name='root'>
      <pose>0 0 0 0 -0 0</pose>
      <inertial>
        <pose>0 0 0 0 -0 0</pose>
        <mass>1e-05</mass>
        <inertia>
          <ixx>0.001</ixx>
          <ixy>1e-06</ixy>
          <ixz>1e-06</ixz>
          <iyy>0.001</iyy>
          <iyz>1e-06</iyz>
          <izz>0.001</izz>
        </inertia>
      </inertial>
      <collision name='root_fixed_joint_lump__asd_collision'>
        <pose>0 0 0 0 -0 0</pose>
        <geometry>
          <cylinder>
            <length>1</length>
            <radius>1</radius>
          </cylinder>
        </geometry>
      </collision>
      <gravity>1</gravity>
      <velocity_decay/>
    </link>
  </model>
</sdf>

I get it that if there are multiple collisions, the gazebo tag has to reference them exactly by their name. But when there is a single collision, It'd make sense to me if the conversion script applied the collision tag contents to it.

And what would be the correct name to reference in the gazebo tag? For collision named asd, I tried root_fixed_joint_lump__asd, root_fixed_joint_lump__asd_collision and root_fixed_joint_lump__asd_collision_collision, but none works.

Contributor guide