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

Attempt to correct mass matrix in mesh inertia calculator (backport #2775) #2799

Open
wants to merge 4 commits into
base: gz-sim8
Choose a base branch
from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Feb 27, 2025

🦟 Bug fix

Depends on #2770

Summary

The mesh inertia calculator can potentially generate invalid inertial values for complex / non-water tight meshes. This PR adds a function that attempts to correct the auto-calculated mass matrix if it is strictly positive and within the specified tolerance of satisfying the triangle inequality.

Credits go to @shameekganguly and @scpeters for the mass matrix correction algorithm

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 is an automatic backport of pull request #2775 done by [Mergify](https://mergify.com).

Signed-off-by: Ian Chen <ichen@openrobotics.org>
(cherry picked from commit 1509b0f)
@mergify mergify bot requested a review from mjcarroll as a code owner February 27, 2025 01:00
@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Feb 27, 2025
@scpeters
Copy link
Member

INTEGRATION_mesh_inertia_calculation test failed to run on windows (though it passes on gz-sim9):

173: [==========] Running 3 tests from 1 test suite.
173: [----------] Global test environment set-up.
173: [----------] 3 tests from MeshInertiaCalculationTest
173: [ RUN      ] MeshInertiaCalculationTest.CylinderColladaMeshInertiaCalculation
173: [       OK ] MeshInertiaCalculationTest.CylinderColladaMeshInertiaCalculation (8650 ms)
173: [ RUN      ] MeshInertiaCalculationTest.CylinderColladaMeshWithNonCenterOriginInertiaCalculation
173: [       OK ] MeshInertiaCalculationTest.CylinderColladaMeshWithNonCenterOriginInertiaCalculation (1087 ms)
173: [ RUN      ] MeshInertiaCalculationTest.CylinderColladaOptimizedMeshInertiaCalculation
173/252 Test #173: INTEGRATION_mesh_inertia_calculation ...................***Exception: SegFault 10.35 sec

I'll try rerunning to see if it's flaky

@scpeters
Copy link
Member

INTEGRATION_mesh_inertia_calculation test failed to run on windows (though it passes on gz-sim9):

173: [==========] Running 3 tests from 1 test suite.
173: [----------] Global test environment set-up.
173: [----------] 3 tests from MeshInertiaCalculationTest
173: [ RUN      ] MeshInertiaCalculationTest.CylinderColladaMeshInertiaCalculation
173: [       OK ] MeshInertiaCalculationTest.CylinderColladaMeshInertiaCalculation (8650 ms)
173: [ RUN      ] MeshInertiaCalculationTest.CylinderColladaMeshWithNonCenterOriginInertiaCalculation
173: [       OK ] MeshInertiaCalculationTest.CylinderColladaMeshWithNonCenterOriginInertiaCalculation (1087 ms)
173: [ RUN      ] MeshInertiaCalculationTest.CylinderColladaOptimizedMeshInertiaCalculation
173/252 Test #173: INTEGRATION_mesh_inertia_calculation ...................***Exception: SegFault 10.35 sec

I'll try rerunning to see if it's flaky

failed again but earlier:

Build Status https://build.osrfoundation.org/job/gz_sim-pr-clowin/191/testReport/(root)/INTEGRATION_mesh_inertia_calculation/test_ran/

173: [==========] Running 3 tests from 1 test suite.
173: [----------] Global test environment set-up.
173: [----------] 3 tests from MeshInertiaCalculationTest
173: [ RUN      ] MeshInertiaCalculationTest.CylinderColladaMeshInertiaCalculation
173/252 Test #173: INTEGRATION_mesh_inertia_calculation ...................Exit code 0xc0000374
***Exception:   8.66 sec

@iche033
Copy link
Contributor

iche033 commented Feb 27, 2025

hmm it may have been caused by #2798. I see that the win build passed there, but in a separate non-related PR, the INTEGRATION_mesh_inertia_calculator test failed.

@scpeters
Copy link
Member

hmm it may have been caused by #2798. I see that the win build passed there, but in a separate non-related PR, the INTEGRATION_mesh_inertia_calculator test failed.

I just ran CI for gz-sim8, and the test fails there already, so it looks unrelated to this PR:

@scpeters
Copy link
Member

hmm it may have been caused by #2798. I see that the win build passed there, but in a separate non-related PR, the INTEGRATION_mesh_inertia_calculator test failed.

I just ran CI for gz-sim8, and the test fails there already, so it looks unrelated to this PR:

actually a see a failure as far back as https://build.osrfoundation.org/view/gz-harmonic/job/gz_sim-8-clowin/10/

@iche033
Copy link
Contributor

iche033 commented Feb 28, 2025

hmm it may have been caused by #2798. I see that the win build passed there, but in a separate non-related PR, the INTEGRATION_mesh_inertia_calculator test failed.

I just ran CI for gz-sim8, and the test fails there already, so it looks unrelated to this PR:

actually a see a failure as far back as https://build.osrfoundation.org/view/gz-harmonic/job/gz_sim-8-clowin/10/

oh then it could be due to #2754. The changes here just increase the chance of it failing.

@scpeters
Copy link
Member

reported as flaky test in #2801

Signed-off-by: Ian Chen <ichen@openrobotics.org>
@iche033
Copy link
Contributor

iche033 commented Mar 1, 2025

73e82c3 should fix the crash on Windows. Found that the crash happens on server exit when another server instance is run immediately right after an existing one. An explicit call to server->Stop() seems to get rid of the crash. I got the build to pass 2 times in a row. I'll start another one and if that passes, I'll merge this PR.

@iche033
Copy link
Contributor

iche033 commented Mar 1, 2025

73e82c3 should fix the crash on Windows. Found that the crash happens on server exit when another server instance is run immediately right after an existing one. An explicit call to server->Stop() seems to get rid of the crash. I got the build to pass 2 times in a row. I'll start another one and if that passes, I'll merge this PR.

spoke too soon. It failed again: https://build.osrfoundation.org/job/gz_sim-pr-clowin/202

@iche033 iche033 force-pushed the mergify/bp/gz-sim8/pr-2775 branch 2 times, most recently from f091b04 to 610e7e5 Compare March 3, 2025 21:22
Signed-off-by: Ian Chen <ichen@openrobotics.org>
@iche033 iche033 force-pushed the mergify/bp/gz-sim8/pr-2775 branch from 610e7e5 to ecf3cd5 Compare March 3, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎵 harmonic Gazebo Harmonic
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

2 participants