Strange behavior of xacro namespaced include

asked 2017-02-15 09:28:08 -0600

alextoind gravatar image

updated 2017-02-15 09:28:46 -0600

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 _my_macros_1.xacro_ (using my_namespace_1) and _my_macros_2.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?

edit retag flag offensive close merge delete