Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macro namespace resolution #296

Closed
Doomerdinger opened this issue Oct 29, 2021 · 4 comments
Closed

Macro namespace resolution #296

Doomerdinger opened this issue Oct 29, 2021 · 4 comments

Comments

@Doomerdinger
Copy link
Contributor

Say I have file utils.xacro:

  <xacro:macro name="make_link" params="link_name">
    <link name="${link_name}"/>
  </xacro:macro>
  
  <xacro:macro name="make_dummy_link">
    <xacro:make_link link_name="dummy_link"/>
  </xacro:macro>

And then in another file I attempt to use that, but namespaced

  <xacro:include filename="utils.xacro" ns="utils"/>
  
  <xacro:utils.make_dummy_link/>

That will error, complaining that make_link cannot be found.

I assume this is due to make_link also having the utils namespace, so the call to make_link within make_dummy_link fails.

A solution to this is to not use a macro from a different macro defined in the same file.

As a note, if I were to make a file

  <xacro:macro name="make_link" params="link_name">
    <link name="${link_name}"/>
  </xacro:macro>
  
  <xacro:make_link link_name="make_dummy_link"/>

and then include that file with a namespace, it would work fine. It seems to be specifically tied to calling a macro within a macro.

@rhaschke
Copy link
Contributor

That's a very interesting issue. Obviously, we need to "activate" the namespace if a macro is called from that namespace.

@rhaschke
Copy link
Contributor

#297 should fix your issue.

@Doomerdinger
Copy link
Contributor Author

Thanks! I'll be sure to test this when I get a moment, quite busy right now though so it may not be for a week or so.

@rhaschke
Copy link
Contributor

Fixed via #297.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants