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

What exactly should the "meshes" folder have ?

asked 2020-11-22 03:10:44 -0600

electrophod gravatar image

While creating a gazebo simulation of any robot, we need to have a URDF so that Gazebo can understand the description of the robot and render it accordingly. Then what exactly is a xacro file ? Also I have observed a meshes folder many a times which contains all the .dae files. What exactly is it ?

Can someone provide a guide to understand all these simulation related concepts properly ?

edit retag flag offensive close merge delete

Comments

1

Some observations (but not answers, I'll leave that to someone else):

While creating a gazebo simulation of any robot, we need to have a URDF so that Gazebo can understand the description of the robot and render it accordingly

actually, Gazebo doesn't use / understand URDF. It only uses SDF. The reason you still see lots of .urdf and .xacro in Gazebo related packages is because Gazebo comes with a tool which -- on-the-fly -- converts your URDF into an SDF (as best it can, the process is not lossless).

Most pkg maintainers (including me) are just lazy, and prefer to only write and maintain a single model of a robot, so they use .urdf or .xacro, as they know that can also be used with Gazebo.

If you want to be really proper, you'd write a separate .sdf for the simulation model of your robot. The .urdf then describes ...(more)

gvdhoorn gravatar image gvdhoorn  ( 2020-11-22 07:52:38 -0600 )edit
1

.. they are not the same. The latter is used by your control software (ie: ROS), the former is used by your simulator (ie: Gazebo), and they have different purposes and requirements.

Compare this to the situation where you have actual hw: no one expects to be able to use their URDF to produce or manufacture their real robot. Nor do they expect to be able to "spawn" their real robot using the URDF in the real world.

If you consider Gazebo as "a stand-in for reality", having to create a proper simulation model as an analog of your real hw, and additionally having a separate URDF (so not the same file) doesn't seem to strange any more.

Also I have observed a meshes folder many a times which contains all the .dae files

I believe Wikipedia has a good description of what a "mesh" is: wikipedia/Polygon_mesh.

.dae is ...(more)

gvdhoorn gravatar image gvdhoorn  ( 2020-11-22 07:55:53 -0600 )edit

@gvdhoom Thanks for such a detailed answer. I would also like to ask how do we use the .dae placed in meshes in the Gazebo simulation ? Like does Gazebo 'refer' to them while creating the robot model or does it stand to be an alternative to be replaced by the robot SDF/URDF or what ? Basically what is the purpose of having the meshes folder in our ROS package?

electrophod gravatar image electrophod  ( 2020-11-23 01:01:43 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-11-23 09:02:13 -0600

tryan gravatar image

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>
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-11-22 03:10:44 -0600

Seen: 1,134 times

Last updated: Nov 23 '20