-
Notifications
You must be signed in to change notification settings - Fork 98
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
Fix URDF fixed joint reduction of plugins #745
Fix URDF fixed joint reduction of plugins #745
Conversation
There is special handling in the parser_urdf code to update plugin fields when links are merged together during fixed joint reduction. A test for this was added to sdf6 in gazebosim#500. A portion of this test is applied directly to the sdf10 branch to illustrate that it is broken. Signed-off-by: Steve Peters <[email protected]>
I believe the tinyxml2 API has an extra root element in documents compared to the tinyxml API, which broke the untested ReduceSDFExtension*FrameReplace functions. This fixes the Plugin function, as confirmed by the fixed test. Signed-off-by: Steve Peters <[email protected]>
Codecov Report
@@ Coverage Diff @@
## sdf10 #745 +/- ##
==========================================
+ Coverage 87.76% 88.38% +0.62%
==========================================
Files 65 65
Lines 10409 10410 +1
==========================================
+ Hits 9135 9201 +66
+ Misses 1274 1209 -65
Continue to review full report at Codecov.
|
|
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.
by accounting for the extra root element in the tinyxml2 document API.
ouch :/
Changes look good to me.
src/parser_urdf.cc
Outdated
@@ -3588,17 +3588,18 @@ void ReduceSDFExtensionPluginFrameReplace( | |||
{ | |||
std::string linkName = _link->name; | |||
std::string parentLinkName = _link->getParent()->name; | |||
if ((*_blobIt)->FirstChildElement()->Name() == _pluginName) | |||
tinyxml2::XMLElement *rootElement = (*_blobIt)->FirstChildElement(); |
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.
add a comment here that there is an extra root element in tinyxml2?
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.
ok, I think it's not an issue with the tinyxml2 API but actually a change in how we used it from #264...
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.
we changed what we store in the SDFExtension data structure here: 6dd6d07#diff-2bc5ca23bcfc66fe173f513399bec8065b1cb4e607d741566517d7368e6bce0fL1315-L1320
I'll update the PR description accordingly
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.
I just refactored the fix in b98b827: I change the function signature so it now accepts an XMLElement
pointer instead of an XMLDocument
iterator. Then we can call FirstChildElement()
once and pass the resulting pointer, which simplifies the implementation in ReduceSDFExtensionPluginFrameReplace
I'll fix the other functions in follow-up pull requests if you think this approach is ok
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.
yep the approach looks good to me.
Pass an XMLElement pointer instead of an iterator to an XMLDocument to simplify the API calls in ReduceSDFExtensionPluginFrameReplace. Signed-off-by: Steve Peters <[email protected]>
This pull request has been mentioned on Gazebo Community. There might be relevant details there: https://community.gazebosim.org/t/new-ignition-releases-2022-03-25-fortress-edifice-citadel/1343/1 |
Repeat fix from gazebosim#745 to account for the extra root element in documents created with tinyxml2. Signed-off-by: Steve Peters <[email protected]>
Fix ReduceSDFExtensionJointFrameReplace by repeating fix from #745 to account for the extra root element in documents created with tinyxml2. This includes a test case for a URDF with a chain of links with fixed joint reduction and an SDFormat joint embedded in a <gazebo> block whose parent and child are reduced links. This confirms that the parent and child link names are updated properly during fixed joint reduction. Signed-off-by: Steve Peters <[email protected]>
🦟 Bug fix
Fixes bug in URDF conversion for libsdformat10+
Summary
While attempting to merge forward #500 from 9 -> 10 (follow-up to #741), I found that the test added in #500 was failing. The test passes on the
sdf6
andsdf9
branches, which usetinyxml
, but was failing in my first merge attempt tosdf10
, which usestinyxml2
. To simplify matters, I ported a simplified form of the test from #500 directly tosdf10
in 787abbc to illustrate the failure inReduceSDFExtensionPluginFrameReplace
. The test is fixed in c02e63d by accounting for the extra root elementin the tinyxml2 document APIin theblobs
data structure added in #264.Note that there are many other
ReduceSDFExtension*FrameReplace
functions inparser_urdf.cc
that are untested and likely suffer this same error. I will open an issue to document this.Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge