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

dartsim: fix handling inertia matrix pose rotation #351

Merged
merged 2 commits into from
Aug 1, 2022

Conversation

scpeters
Copy link
Member

@scpeters scpeters commented Jun 5, 2022

🦟 Bug fix

Fixes a bug in moment of inertia calculation

Summary

When loading a model from SDF in the dartsim plugin, the moment of inertia matrix is currently applying any rotations in the //inertial/pose two times, since the rotations are applied explicitly in SDFFeatures.cc, but they are already applied in math::Inertial::Moi.

I confirmed the bug with a slightly modified version of the inertia_rotations test world from gazebo classic. That world has multiple 1x4x9 boxes with identical inertia values that are expressed with different inertial pose rotations. The boxes are initially standing up on a ground plane. Setting gravity to [2, 0, -9.8] causes the boxes to tip over, and they should move at the same rate and hit the ground at the same time. This works properly in gazebo-classic with DART but not fortress or citadel.

I'll upload a copy of the example world for use with fortress as well as screen captures of my testing and then mark this ready for review.

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.

When loading a model from SDF, the moment of inertia matrix
is currently applying any rotations in the //inertial/pose
two times, since the rotations are applied explicitly, but
they are already applied in math::Inertial::Moi.

Signed-off-by: Steve Peters <[email protected]>
@github-actions github-actions bot added the 🏯 fortress Ignition Fortress label Jun 5, 2022
@codecov
Copy link

codecov bot commented Jun 5, 2022

Codecov Report

❗ No coverage uploaded for pull request base (ign-physics5@e91c58a). Click here to learn what that means.
The diff coverage is n/a.

@@               Coverage Diff               @@
##             ign-physics5     #351   +/-   ##
===============================================
  Coverage                ?   76.84%           
===============================================
  Files                   ?      129           
  Lines                   ?     5960           
  Branches                ?        0           
===============================================
  Hits                    ?     4580           
  Misses                  ?     1380           
  Partials                ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us.

@chapulina chapulina added the DART DART engine label Jun 6, 2022
@scpeters scpeters marked this pull request as ready for review July 7, 2022 00:35
@scpeters scpeters requested review from azeey and mxgrey as code owners July 7, 2022 00:35
@scpeters scpeters requested a review from JoanAguilar July 20, 2022 16:43
@chapulina chapulina added the bug Something isn't working label Jul 23, 2022
Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, I was wondering about this. Is there a way we can write a test here to catch that?

Also, would it be possible to target this at Citadel?

dartsim/src/SDFFeatures.cc Outdated Show resolved Hide resolved
Copy link
Contributor

@JoanAguilar JoanAguilar left a comment

Choose a reason for hiding this comment

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

Looks good to me. I second the idea of having an automated test to catch future regressions.

@scpeters
Copy link
Member Author

Also, would it be possible to target this at Citadel?

yes, I'll target this at Citadel

@scpeters
Copy link
Member Author

Thanks for the fix, I was wondering about this. Is there a way we can write a test here to catch that?

I second the idea of having an automated test to catch future regressions.

it will be easiest to write the test using the common test framework, which is now added in Garden, so I'll make a separate PR for garden once this is merged forward

@chapulina
Copy link
Contributor

yes, I'll target this at Citadel

Let's merge this into Fortress so it catches the next bus to Garden. We should backport it to Citadel soon.

@chapulina chapulina enabled auto-merge (squash) August 1, 2022 15:54
@chapulina chapulina merged commit 4ef1d65 into ign-physics5 Aug 1, 2022
@chapulina chapulina deleted the scpeters/fix_inertial_pose_rotation branch August 1, 2022 16:48
scpeters added a commit that referenced this pull request Nov 9, 2023
When loading a model from SDF, the moment of inertia matrix
is currently applying any rotations in the //inertial/pose
two times, since the rotations are applied explicitly, but
they are already applied in math::Inertial::Moi.

Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Louise Poubel <[email protected]>
scpeters added a commit that referenced this pull request Nov 13, 2023
When loading a model from SDF, the moment of inertia matrix
is currently applying any rotations in the //inertial/pose
two times, since the rotations are applied explicitly, but
they are already applied in math::Inertial::Moi.

Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Louise Poubel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working DART DART engine 🏯 fortress Ignition Fortress
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants