-
Notifications
You must be signed in to change notification settings - Fork 291
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 initialization of world components when enabling velocity checks #2777
base: gz-sim9
Are you sure you want to change the base?
Fix initialization of world components when enabling velocity checks #2777
Conversation
369ac76
to
f7e26fb
Compare
Friendly ping :) @mjcarroll, @scpeters, @azeey. Could any of you guys take a quick look at this PR to see if I'm in the right track? |
Signed-off-by: Gabriel Pacheco <[email protected]>
* Not all models of test/worlds/mesh_inertia_calculation.sdf are initialized with zero pose * Bug gazebosim#2774 was forcing all `link.WorldPose` to be zero after calling `link.EnableVelocityChecks` Signed-off-by: Gabriel Pacheco <[email protected]> # Conflicts: # test/integration/mesh_inertia_calculation.cc
f7e26fb
to
b928b4a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## gz-sim9 #2777 +/- ##
===========================================
+ Coverage 68.93% 68.94% +0.01%
===========================================
Files 345 345
Lines 33296 33319 +23
===========================================
+ Hits 22952 22972 +20
- Misses 10344 10347 +3 ☔ View full report in Codecov by Sentry. |
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.
this makes sense to me; thanks for the contribution!
I just have a few small comments on some test expectations that I think can be removed
EXPECT_EQ(link.WorldInertialPose(*ecm).value(), gz::math::Pose3d::Zero); | ||
// Check the Inertial Pose and Link Pose. Their world poses should be the | ||
// same since the inertial pose relative to the link is zero. | ||
EXPECT_EQ(link.WorldPose(*ecm).value(), worldPose(linkEntity, *ecm)); |
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.
EXPECT_EQ(link.WorldPose(*ecm).value(), worldPose(linkEntity, *ecm)); |
this expectation seems unnecessary based on the comments; I would remove it
@@ -219,13 +222,12 @@ void cylinderColladaMeshWithNonCenterOriginInertiaCalculation( | |||
link.WorldInertiaMatrix(*ecm).value().Equal(inertiaMatrix, 0.005)); | |||
|
|||
// Check the Inertial Pose and Link Pose | |||
EXPECT_EQ(link.WorldPose(*ecm).value(), gz::math::Pose3d::Zero); | |||
EXPECT_EQ(link.WorldPose(*ecm).value(), worldPose(linkEntity, *ecm)); |
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.
EXPECT_EQ(link.WorldPose(*ecm).value(), worldPose(linkEntity, *ecm)); |
this expectation seems unnecessary based on the comments; I would remove it
@@ -318,7 +320,7 @@ TEST(MeshInertiaCalculationTest, CylinderColladaOptimizedMeshInertiaCalculation) | |||
EXPECT_TRUE(actualIxyxzyz.Equal( | |||
meshInertial.MassMatrix().OffDiagonalMoments(), 3.5)); | |||
// Check the Inertial Pose and Link Pose | |||
EXPECT_EQ(link.WorldPose(*ecm).value(), gz::math::Pose3d::Zero); | |||
EXPECT_EQ(link.WorldPose(*ecm).value(), worldPose(linkEntity, *ecm)); |
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.
EXPECT_EQ(link.WorldPose(*ecm).value(), worldPose(linkEntity, *ecm)); |
this expectation seems unnecessary based on the comments; I would remove it
🦟 Bug fix
Fixes #2774
Summary
When using the link API to enable velocity checks for a link that does not yet have the world ECM components (
WorldPose
,WorldLinearVelocity
,WorldAngularVelocity
), typically before the physics system plugin does its first update loop, such components will be initialized with their default constructor, zeroing values that might not be zero. One more evident example is the link world pose that could have already been initialized.gz-sim/src/Link_TEST.cc
colcon build --packages-select gz-sim9
./bin/UNIT_Link_TEST --gtest-filter=*EnableVelocityChecks*
Checklist
codecheck
passed (See contributing)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.