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

Fix static URDF models with fixed joints #1193

Merged
merged 4 commits into from
Nov 5, 2022

Conversation

scpeters
Copy link
Member

@scpeters scpeters commented Nov 3, 2022

🦟 Bug fix

Allows URDF models with fixed joint reduction to be declared as <static>

Summary

Our URDF parser extensions allow a <static>1</static> tag inside a <gazebo/> element (with no reference attribute) to declare the model as static. Currently, the SDFExtension data structure does not indicate whether any value for <static> was specified or not, so every <gazebo> block will cause a <static>0</static> value to be added to the resulting SDFormat model. As of #1148, every URDF fixed joint that is reduced (ie. without <preserveFixedJoint>1</preserveFixedJoint>) will add a <gazebo> block with <frame> elements, which would prevent those models from being marked as static. This is illustrated with the fixed_joint_static.urdf example added in 2dc5c1f with a failing test.

A fix is included in 6580927?w=1 (without whitespace) by adding a flag to indicate when the <static> element has been set in an SDFExtension.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

This demonstrates a bug that prevents models with
fixed joint reduction from being declared as static.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Add a boolean flag to indicate when setStaticFlag has
been set, since all the other variables in SDFExtension
have these flags.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters scpeters requested a review from azeey as a code owner November 3, 2022 01:04
@github-actions github-actions bot added Gazebo 1️1️ Dependency of Gazebo classic version 11 🏰 citadel Ignition Citadel labels Nov 3, 2022
@codecov
Copy link

codecov bot commented Nov 3, 2022

Codecov Report

Merging #1193 (7ca2b38) into sdf9 (b19e217) will increase coverage by 0.39%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             sdf9    #1193      +/-   ##
==========================================
+ Coverage   87.94%   88.33%   +0.39%     
==========================================
  Files          64       63       -1     
  Lines       10118    10075      -43     
==========================================
+ Hits         8898     8900       +2     
+ Misses       1220     1175      -45     
Impacted Files Coverage Δ
src/SDFExtension.cc 100.00% <100.00%> (+50.56%) ⬆️
src/parser_urdf.cc 85.17% <100.00%> (+0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters scpeters force-pushed the scpeters/urdf_static_fixed_joint branch from 699faa3 to 985f38a Compare November 3, 2022 05:19
@@ -74,6 +75,7 @@ SDFExtension::SDFExtension(const SDFExtension &_ge)
this->material = _ge.material;
this->visual_blobs = _ge.visual_blobs;
this->collision_blobs = _ge.collision_blobs;
this->isSetStaticFlag = _ge.isSetStaticFlag;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do something about this line in codecov ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed the SDFExtension copy constructor and destructor so the class can follow the rule of zero. That should improve coverage.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coverage checker is green; removed 45 missed lines

Delete destructor and copy constructor.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters scpeters merged commit 9374f0e into sdf9 Nov 5, 2022
@scpeters scpeters deleted the scpeters/urdf_static_fixed_joint branch November 5, 2022 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel Gazebo 1️1️ Dependency of Gazebo classic version 11
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants