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

I presume it's due to the indirect second include of the 'materials.urdf.xacro' file, just like the problems you would have in C++ without '#pragma once' or the '#ifndef ... => #define ... => #endif' construct.

So is there an equivalent to this in urdf/xacro files?

Not that I know of.

Personally I work around this by using "anonymous" materials and using a macro to create them. See here for an example.

It's actually an error from the URDF parser, not xacro itself (it doesn't care).

You may also want to look into namespace support in xacro.

I presume it's due to the indirect second include of the 'materials.urdf.xacro' file, just like the problems you would have in C++ without '#pragma once' or the '#ifndef ... => #define ... => #endif' construct.

So is there an equivalent to this in urdf/xacro files?

Not that I know of.

Personally I work around this by using "anonymous" materials and using a macro to create them. See here for an example.

It's actually an error from the URDF parser, not xacro itself (it doesn't care).

You may also want to look into namespace support in xacro.


Edit: I've never tried it, but perhaps the conditional support in xacro can now prevent pieces of xacro from being evaluated. You could use that to wrap everything in a xacro:if and then set a xacro:property inside the body.