Robotics StackExchange | Archived questions

Strange behavior of xacro namespaced include

Hi all, I don't know if it is a bug or the default behavior, but I was using the namespaced include for the first time and I am a bit confused. I have done something like the following to avoid name clashes:

<xacro:include filename="$(find my_pkg)/urdf/my_macros_1.xacro" ns="my_namespace_1"/>
<xacro:include filename="$(find my_pkg)/urdf/my_macros_2.xacro" ns="my_namespace_2"/>

<xacro:my_namespace_1.build_model my_param="something_useful_for_1">
  <origin xyz="0 0 0" rpy="0 0 0"/>
</xacro:my_namespace_1.build_model>
<xacro:my_namespace_2.build_model my_param="something_useful_for_2">
  <origin xyz="0 0 0" rpy="0 0 0"/>
</xacro:my_namespace_1.build_model>

However it turns out that the name clashes still exist:

unknown macro name: xacro:build_model_part
XacroException(u'unknown macro name: xacro:build_model_part',)

where build_model_part is another macro called inside the two utility files.

The only workaround that I found is to add the namespace inside mymacros1.xacro (using my_namespace_1) and mymacros2.xacro (using my_namespace_2) to every single macro call. This obviously avoid name clashes, but I would have called the macros respectively build_model_1 and build_model_2 instead of applying the namespace inside all the calls...

Where is my mistake?

Asked by alextoind on 2017-02-15 10:28:08 UTC

Comments

Answers