-
Notifications
You must be signed in to change notification settings - Fork 292
fix: validate contact surface parameters to prevent LCP solver crashes (DART 7) #2434
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2434 +/- ##
=======================================
Coverage 66.49% 66.49%
=======================================
Files 407 407
Lines 37254 37278 +24
Branches 4901 4906 +5
=======================================
+ Hits 24772 24788 +16
- Misses 12482 12490 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
ebdc799 to
7028b70
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Add validation for NaN/Inf/negative friction, restitution, and slip compliance values in ContactSurface and SoftContactConstraint. Invalid values now log a warning and fall back to defaults. This prevents assertion failures in the LCP solver when malformed SDF files (e.g., <mu>NaN</mu>) propagate invalid values through the constraint system. Fixes gazebosim/gz-physics#841
Fully qualify constraint::DART_DEFAULT_FRICTION_COEFF and constraint::DART_DEFAULT_RESTITUTION_COEFF to avoid ambiguity with dynamics namespace constants. Also refactored validation to use DART_WARN_IF for consistency.
1aaadf5 to
12529fc
Compare
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
ContactSurfaceandSoftContactConstraintProblem
When malformed SDF files contain invalid friction values (e.g.,
<mu>NaN</mu>), these propagate through DART's constraint system and cause an assertion failure indSolveLCP:This crashes simulations in gz-physics and any other downstream consumers.
Solution
Validate contact surface parameters at extraction time in:
DefaultContactSurfaceHandler::computeFrictionCoefficient()DefaultContactSurfaceHandler::computePrimaryFrictionCoefficient()DefaultContactSurfaceHandler::computeSecondaryFrictionCoefficient()DefaultContactSurfaceHandler::computePrimarySlipCompliance()DefaultContactSurfaceHandler::computeSecondarySlipCompliance()DefaultContactSurfaceHandler::computeRestitutionCoefficient()SoftContactConstraint::computeFrictionCoefficient()SoftContactConstraint::computeRestitutionCoefficient()Invalid values are rejected with a warning and replaced with safe defaults.
Testing
Related Issues
Related to gazebosim/gz-physics#841
Checklist