ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To add to @gvdhoorn's good information, xacro is a XML-based macro language to help with writing larger/more complicated URDFs as described xacro wiki. One example provided there is

<xacro:macro name="pr2_arm" params="suffix parent reflect">
  <pr2_upperarm suffix="${suffix}" reflect="${reflect}" parent="${parent}" />
  <pr2_forearm suffix="${suffix}" reflect="${reflect}" parent="elbow_flex_${suffix}" />
</xacro:macro>

<xacro:pr2_arm suffix="left" reflect="1" parent="torso" />
<xacro:pr2_arm suffix="right" reflect="-1" parent="torso" />

which expands to

<pr2_upperarm suffix="left" reflect="1" parent="torso" />
<pr2_forearm suffix="left" reflect="1" parent="elbow_flex_left" />
<pr2_upperarm suffix="right" reflect="-1" parent="torso" />
<pr2_forearm suffix="right" reflect="-1" parent="elbow_flex_right" />

Basically, if you have multiple arms, you can define it as a macro once, then use that macro to produce extra arms more efficiently/clearly. The two arms in the example aren't so bad, but imagine defining 6 legs for a hexapod, with several links and motors each!

As for the meshes, the URDF documentation provides an explanation of where URDF files use meshes. Similarly, Gazebo uses meshes to define geometry. They're often used to define more complex visual and collision elements, like in this brief Gazebo tutorial for attaching meshes. The robot's model file (.sdf in this case) refers to the mesh from the chassis link's visual element like this:

<visual name='visual'>
  <geometry>
    <mesh>
      <uri>model://pioneer2dx/meshes/chassis.dae</uri>
    </mesh>
  </geometry>
</visual>