-
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
Xacro should not use plain 'include' tags but only namespaced ones. #9
Conversation
This would be useful for people who want to reuse models in gazebo, since sdf has its own include tag. If this goes into hydro, we should also put a deprecation warning in groovy so people have a chance to change their models. |
Looks good but I agree with @scpeters that a deprecation warning in groovy is needed so that stuff doesn't break unexpectedly for people when they install hydro. @davetcoleman do you have time to add that in a pull request to groovy-devel? |
+1 |
I just had a look through some urdf's (for instance the pr2 xacro files), and it seems like use of include instead of xacro:include is pretty widespread. To make things easier, we should probably give people a script to fix their files. The following seems to work:
Thoughts on the best way to notify people of the change and provide the script? We could just include this one liner in the deprecation message in groovy. Would it also make sense for a plain "include" to raise an error in hydro? Would be better than silently failing to do the include. |
Yeah, I like that idea. Maybe we could include the sed line in a script (call it "migrate" or something) that we package with the groovy version which takes proper input arguments, and suggest people call that.
I'd even say we should just deprecate it in hydro, and not force an error until igloo. |
+1
+1
A plain include is not a bad thing if it is used in the proper context, e.g.
So it would have to be fairly context aware to know when to throw an error. I'm not sure we could test for every possible edge case - e.g. ppl with custom tags in URDF.
It won't be that silent since parts of your robot won't properly load in Rviz/Gazebo/MoveIt.
That's a long time from now to have something broken and causing issues with Gazebo. The new yearly release cycle requires us to make more changes between releases. |
What is the workflow we are trying to enable for people using gazebo who also use URDF? Do they keep a bunch of xacro files which expand into a urdf which is then converted into an sdf? If that is the case, than this <include tag shouldn't be a problem because it doesn't exist in URDF, right? |
Adding a couple more people for opinions on how disruptive this change will be for users: @chadrockey @ahendrix |
I haven't touched this stuff seriously in a long time, but it looks like xacro is always limited to the form:
and Gazebo is always
Is it possible for xacro to not parse include tags unless they have the filename attribute? (Or attributes in general?) |
Chad, great idea. We would use this workaround for Groovy and Hyrdo, but with a deprecated warning if your Xacro include doesn't have the namespace. In Igloo we'll remove this workaround and require the Does this sound good to everyone? I'll make a new pull request soon. |
Yeah, that sounds like a good workaround. |
…ings if not present.
Okay, I've just updated the pull request with the new changes. This update will cause a deprecated warning for every plain element that doesn't immediately contain a Gazebo element within it. It includes the quick fix script which I have tested works on the PR2 xacro files. The message is:
This should definitely go into Hydro, but should it go into Groovy? |
This kind of major change shouldn't be backported to an already released On Tue, Jun 11, 2013 at 3:41 PM, Dave Coleman notifications@github.comwrote:
|
Ok, I think its ready for hydro-devel |
if elt.tagName == 'include': | ||
check_next = next_element(elt) | ||
# check if there is a <uri> element within the <include> tag | ||
if check_next.tagName == 'uri': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in a gazebo <include>
tag, is the <uri>
tag guaranteed to be first? Couldn't it be <name>
or <pose>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, no guarantee. in fact, i believe just the existence of child elements is enough to conclude xacro should not be involved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed. can you change that before we merge?
… of an <include> tag
Ok, now an tag is considered a Xacro one if it has no child elements (and a deprecated warning is thrown) but Xacro ignores the tag if it has child elements (i.e. Gazebo's element). |
Aaaaalmost there. The only problem with this is minidom creates text nodes which count as child nodes. So if someone wrote <include filename="foo">
</include> Then childNodes is [<DOM Text node "u'\n'">] Which evaluates to True, and not be expanded, even though it probably should. Can we filter out text nodes for the purpose of this check? |
Good point, fixed. |
Xacro should not use plain 'include' tags but only namespaced ones.
I've merged this. If we find corner cases where we need to tweak the workaround, we can do that in separate pull requests. |
Hah! It totally worked! I just launched some stuff, got a ton of these warnings, copy/pasted the suggested sed line, and re-launched. Perfect! |
Awesome! I've update the Xacro documentation with a note about the Hydro deprecation |
Changes since 1.7.3: 1.9.2 (2014-07-11) ------------------ * add a few more tests to exercise the symbol table a bit more * allow for recursive evaluation of properties in expressions * add useful debugging information when parameters are not set * stop test from failing the second time it is run * unified if/unless handling, correctly handle floating point expressions * floating point expressions not equal zero are now evaluated as True * changed quotes to omit cmake warning * Contributors: Robert Haschke, Mike Ferguson 1.9.1 (2014-06-21) ------------------ * fixup tests so they run * export architecture_independent flag in package.xml * installed relocatable fix * Contributors: Michael Ferguson, Mike Purvis, Scott K Logan 1.9.0 (2014-03-28) ------------------ * Remove the roslint_python glob, use the default one. * Add roslint target to xacro; two whitespace fixes so that it passes. * fix evaluation of integers in if statements also added a unit test, fixes `#15 <https://github.com/ros/xacro/issues/15>`_ * fix setting of _xacro_py CMake var, fixes `#16 <https://github.com/ros/xacro/issues/16>`_ * Add support for globbing multiple files in a single <xacro:include> * code cleanup and python3 support * check for CATKIN_ENABLE_TESTING 1.8.4 (2013-08-06) ------------------ * Merge pull request `#9 <https://github.com/ros/xacro/issues/9>`_ from davetcoleman/hydro-devel Xacro should not use plain 'include' tags but only namespaced ones. * Fix for the fact that minidom creates text nodes which count as child nodes * Removed <uri> checking and made it more general for any child element of an <include> tag * Removed Groovy reference, only being applied to Hydro * Created check for Gazebo's <uri> tabs only only shows deprecated warnings if not present. * Small spelling fix * Xacro should not use plain 'include' tags but only namespaced ones. * Merge pull request `#8 <https://github.com/ros/xacro/issues/8>`_ from piyushk/hydro-devel-conditional xacro conditional blocks * using refined arguments instead of sys.argv for xml file location * adding conditional blocks to xacro 1.8.3 (2013-04-22) ------------------ * bumped version to 1.8.3 for hydro release * backwards compatilibity with rosbuild * adding unit test for substitution args * Adding supoprt for substitution_args 'arg' fields * Remove bin copy of xacro.py
This is an unfortunate conflict because it might break some people's launch files, but xacro currently is not obeying its namespace as it says it does in its documentation. Gazebo's extension has its own that is only used within its element, but Xacro is improperly trying to parse these as Xacro includes.
More details on Gazebo's issue tracker:
https://bitbucket.org/osrf/gazebo/issue/730/xacro-not-compatible-with-urdfs-sdfs
I'm only proposing we make this change in Hydro...
Reviewers
@jonbinney @jbohren @nkoenig @hsu