How to use conditional includes in xacro?

asked 2016-06-06 11:21:31 -0600

a_stumpf gravatar image

Hi all!

When I'm using if-conditions in xacro like the example below, the substitution macro ($(find.... )) of the xacro:include statement will be evaluated independent of the if-result causing errors when the package is missing.

<xacro:if value="$(arg use_extension)">
    <xacro:include filename="$(find my_extra_package)/urdf/my_robot_extension.urdf.xacro.xml" />

I intend to have optional packages included which are not available by default. For this purpose I expected to use xacro:if analogously as the if-statement in launch files to enable or disable parts of the xacro file.

Is there a proper way to model such things?

(I'm using ROS Indigo with Ubuntu 14.04.)


edit retag flag offensive close merge delete