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

does the xacro file create a new urdf with the same name automatically or should I make anything else when I change a xacro file?

No, a .xacro file is just that: a file. It is not an active entity by itself. So it will not create any other files, or update other files.

If you want to keep the two "in sync" (ie: ensure that changes in the former appear in the latter), you'll have to convert the .xacro file to a .urdf. You can do that with the following command (after having sourced the appropriate setup.bash file):

xacro input.xacro > output.urdf

This would process the directives in the .xacro command, evaluate them and output corresponding URDF elements. That output is finally redirected into a file.

As far as I know, urdf files can not be changed directly and we need to change the xacro file first.

This is not quite true. You can edit .urdf files just as you can edit .xacros. It's all plain text.

What you may have read somewhere is that it would be advisable to never edit a .urdf which was generated by a call to xacro (ie: the tool I referenced earlier), as that would make managing the two files more difficult: if you ever run xacro input.xacro > output.urdf again, any changes you'd made to output.urdf but which are not part of input.xacro would be overwritten (ie: lost).

So in general, if there is a .xacro, it'd be better to edit the .xacro instead of the generated .urdf.