-
Notifications
You must be signed in to change notification settings - Fork 99
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 arg resolution with namespaces #307
Comments
Thanks for reporting this issue. Indeed, this was a consequence of the stricter namespace handling introduced recently. |
Thanks for the quick update, I'll test this in the next day or two. |
While it seems that this (may) solve the initial issue cited, it appears to break the set property value in parent functionality, eg <xacro:property name="parent_prop" scope="parent" value="whatever"/> |
In which context does this fail now? |
If I have a parent calling a macro, and that macro does the above |
But there is a non-failing unit test for this: Lines 495 to 501 in 2729327
|
Interesting. I will test further. |
Ok I think I have it. If the parent includes the macro with a namespace and then the parent calls that macro, properties that are set to the parent scope must be accessed with the namespace accessor. This is not how it worked before (though I am not sure if it worked that way before these changes you've made here, or before the other namespace handling introduced recently), but I am not sure if it is a bug or not. Would make sense that setting something in the parent namespace would put the property in the namespace of whatever the parent is in, not whatever my current namespace is, but I could see it the other way as well.
<xacro:macro name="set_property" params="">
<xacro:property name="parent_prop" scope="parent" value="whatever"/>
</xacro:macro>
<xacro:include filename="$(find utils)/urdf/macro_utils.xacro" ns="macro_utils"/>
<xacro:macro_utils.set_property/>
<a foo="${parent_prop}"/></a> <!-- ERROR -->
<a foo="${macro_utils.parent_prop}"/></a> <!-- A-OK -->
|
Interesting example. In this case, essentially, two new scopes are created:
Thus, defining a property within the root scope from within the namespaced macro requires lifting the property by two scopes, which is not yet supported. Actually, We could even have multiple nested namespaced includes, which would create even more scopes.
I will adapt the PR appropriately. |
Fixed via #308 |
After the 1.13.15 update I encounter issues when using macros imported with namespaces.
generic_utils.xacro
I've only tested with a dict input myself (using load yaml), I cannot say if this issue persists elsewhere.
The above setup will result in an error, complaining that
dict_config
is not defined. This will come from within the generic_utils.xacro file.If the namespace on the
include
is omitted so it is just<xacro:include filename="$(find example_pack)/folder/generic_utils.xacro"/>
and subsequent references to the namespace are removed, it seems to work fine.I assume this is something to do with the changes either on #306 or #297.
The text was updated successfully, but these errors were encountered: