Preserve explicit mass for small MJCF geoms - #4160
Conversation
Replace the one-cubic-centimeter unit-density cutoff with the volume of a cube measuring 0.1 mm on each side. This preserves authored mass and inertia for realistic small primitives while retaining a guard for effectively degenerate geometry. Add regression coverage above and below the new cutoff.
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe MJCF importer now applies explicit mass scaling to small sphere, cylinder, capsule, and ellipsoid geoms when their reference mass meets the new cutoff. Tests cover masses and inertia above and below the cutoff. ChangesMJCF small primitive mass handling
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to MJCF imports now preserve explicitly authored mass and inertia for small supported primitive geoms while retaining degenerate-geometry protection. Boundary and primitive regression coverage support merge readiness with no remaining actionable risk. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Context
Using a sphere collider the size of a human finger tip fails in the MJCF pipeline. This PR tries to resolve this.
[This PR is AI generated, but human reviewed]
Description
Preserve authored mass and inertia for small MJCF sphere, cylinder, capsule, and ellipsoid geoms.
The previous one-cubic-centimeter unit-density cutoff incorrectly discarded explicit mass for realistic small primitives. Lower the cutoff to the volume of a cube measuring 0.1 mm on each side while retaining protection against effectively degenerate geometry.
Add regression coverage for small primitives and values immediately above and below the new cutoff.
Checklist
Test plan
uv run --extra dev -m newton.tests -k test_explicit_geom_mass_for_small_primitivesBug fix
Steps to reproduce:
Minimal reproduction:
Before this change, the mass and inertia are zero. Afterward, the authored mass is
0.1and the inertia is nonzero.Summary by CodeRabbit
Bug Fixes
Tests