-
Notifications
You must be signed in to change notification settings - Fork 371
Fix DART crash caused by non-positive definite spatial inertia #3247
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: momo <[email protected]>
Signed-off-by: momo <[email protected]>
Signed-off-by: momo <[email protected]>
|
There is a regression introduced in the buoyancy tests. Is it possible to fix this? |
Signed-off-by: momo <[email protected]>
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.
Pull request overview
This PR fixes a crash in the DART physics engine caused by non-positive definite spatial inertia matrices, often resulting from invalid fluid_added_mass coefficients. The fix adds validation using Eigen::LLT decomposition to check matrix positive definiteness before passing inertial properties to the physics engine.
Key changes:
- Added spatial inertia matrix validation in both
CreateModelEntitiesandCreateLinkEntitiesfunctions - Implemented fallback logic to replace invalid inertia with safe defaults (preserved mass, identity-like inertia tensor, preserved CoM pose)
- Added error logging to alert users when invalid inertial properties are detected
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
I tried to fix this , can you review it ? |
arjo129
left a comment
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.
Co-pilot rightfully points out a few minor things to fix. FWIW, if the inertia matrix is misconfigured due to added mass issues, the end user seeing weird physics is not the end of the world, but printing an error is definitely worth while as its a common complaint Ive heard of from people configuring added mass.
Lets try to avoid const_casts though.
Co-authored-by: Copilot <[email protected]> Signed-off-by: Oscmoar07 <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Oscmoar07 <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Oscmoar07 <[email protected]>
|
I wil do changes as belows
|
🦟 Bug fix
Fixes #3246
Summary
Previously, if a model contained invalid inertial properties (specifically, a non-positive definite spatial inertia matrix, often caused by incorrect
fluid_added_masscoefficients), the invalid matrix was passed directly to DART, triggering an assertion failure(Assertion !math::isNan(partialAcceleration) failed)and causing the server to abort.This patch adds a validation step in
Physics.cc(both in CreateModelEntities and CreateLinkEntities) usingEigen::LLTdecomposition to ensure the spatial inertia matrix is positive definite before passing it to the physics engine.Checklist
codecheckpassed (See contributing)