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

Bugfix: Resolving Inertial Pose in Collision::CalculateInertial() #1317

Merged
merged 148 commits into from
Aug 31, 2023

Conversation

jasmeet0915
Copy link
Contributor

🦟 Bug fix

Summary

This PR fixes the resolving of inertial pose in Collision::CalculateInertial() by adding the calculated inertial pose returned from Geometry::CalculateInertial() to the pose of the collision.

Also shifted the this->dataPtr->sdf based check for loading the <auto_inertia_params> element from Collision::CalculateInertial() to Collision::Load(). This would allow users to programmatically create collisions and call CalculateInertial() function on them.

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.

Signed-off-by: Jasmeet Singh <[email protected]>
Signed-off-by: Jasmeet Singh <[email protected]>
Signed-off-by: Jasmeet Singh <[email protected]>
Signed-off-by: Jasmeet Singh <[email protected]>
Signed-off-by: Jasmeet Singh <[email protected]>
Signed-off-by: Jasmeet Singh <[email protected]>
Signed-off-by: Jasmeet Singh <[email protected]>
@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Aug 30, 2023
src/Collision.cc Outdated
@@ -287,7 +294,7 @@ void Collision::CalculateInertial(
// Else resolve collision pose in Link Frame and then set as inertial pose
if (this->dataPtr->poseRelativeTo.empty())
{
_inertial.SetPose(this->dataPtr->pose);
_inertial.SetPose(_inertial.Pose() * this->dataPtr->pose);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using notation from http://sdformat.org/tutorials?tut=specify_pose&cat=specification&
X_LI: Pose of the inertial I relative to the link L .
X_LC: Pose of the collision relative to L
X_CG: Pose of the inertial returned by the auto MOI calculator, which we take as being relative to the collision

Since we want _inertial to be in frame L, we would want

X_LG = X_LC * L_CG and X_LG = X_LI`.

So, I think the terms are swapped. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah that makes sense. I have swapped the terms in ca09b95

@azeey azeey added the beta Targeting beta release of upcoming collection label Aug 30, 2023
@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Merging #1317 (73ad771) into sdf14 (1455c69) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 73ad771 differs from pull request most recent head 36ce065. Consider uploading reports for the commit 36ce065 to get more accurate results

@@           Coverage Diff           @@
##            sdf14    #1317   +/-   ##
=======================================
  Coverage   87.47%   87.47%           
=======================================
  Files         134      134           
  Lines       17751    17751           
=======================================
  Hits        15528    15528           
  Misses       2223     2223           
Files Changed Coverage Δ
src/Collision.cc 98.26% <100.00%> (ø)

@azeey azeey merged commit aaea4a5 into gazebosim:sdf14 Aug 31, 2023
@quarkytale quarkytale changed the title Bugifx: Resolving Inertial Pose in Collision::CalculateInertial() Bugfix: Resolving Inertial Pose in Collision::CalculateInertial() Aug 31, 2023
@scpeters scpeters mentioned this pull request Aug 31, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta Targeting beta release of upcoming collection 🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants