Fix eq_objtype mismatch for joint equality constraints#2459
Conversation
Don't pass objtype to spec.add_equality() for joint equality constraints. The spec API sets eq_objtype=3 when objtype is specified, but MuJoCo's XML parser produces eq_objtype=0. Omitting objtype matches the XML behavior. Remove eq_/neq model skip from FrankaEmikaPanda and FrankaFr3V2 — both pass model comparison without it. Update Fr3V2 dynamics comment (qpos drift is from body_ipos diff, not equality constraints). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughMuJoCo equality-constraint creation for joint and mimic constraints now calls Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@newton/tests/test_mujoco_solver.py`:
- Around line 8810-8816: Replace the warp-path-specific access to
solver.mjw_model.eq_objtype with the backend-agnostic
solver.mj_model.eq_objtype, compare the full arrays
(solver.mj_model.eq_objtype.numpy().flatten()) to native_model.eq_objtype (not
just [:1]), and add an assertion that solver.mj_model.neq (or mj_model.neq)
matches the first element where appropriate so compile-time metadata and
number-of-equalities are verified consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 6e7d50e1-94ef-44e4-97f5-76395c6a1483
📒 Files selected for processing (3)
newton/_src/solvers/mujoco/solver_mujoco.pynewton/tests/test_menagerie_mujoco.pynewton/tests/test_mujoco_solver.py
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Use solver.mj_model (backend-agnostic) instead of solver.mjw_model. Assert neq matches first, then compare full eq_objtype arrays instead of slicing [:1]. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The pre-release audit found user-facing commits that landed since v1.1.0 without an [Unreleased] entry. Backfill five of them here. Kamino-related commits (newton-physics#2280, newton-physics#2517, newton-physics#2554, newton-physics#2575) are intentionally omitted: Kamino is still alpha and not currently tracked in CHANGELOG. - Changed: contact-conversion overhead reduction in SolverMuJoCo ([newton-physicsGH-2393](newton-physics#2393)) - Fixed: target_voxel_size ignored on the texture-SDF path ([newton-physicsGH-2464](newton-physics#2464)) - Fixed: Newton-to-mujoco-warp material-combination mismatch ([newton-physicsGH-2439](newton-physics#2439)) - Fixed: eq_objtype mismatch on joint equality / mimic constraints in SolverMuJoCo ([newton-physicsGH-2459](newton-physics#2459)) - Fixed: _tiled_sum_kernel launch-dim handling under warp-lang 1.13 ([newton-physicsGH-2546](newton-physics#2546))
Description
Fix
eq_objtypemismatch between Newton and native MuJoCo for joint equality constraints.Part of #2170
Root cause
Newton's solver passed
objtype=mujoco.mjtObj.mjOBJ_JOINTtospec.add_equality(), causingeq_objtype=3in the compiled model. Native MuJoCo (from XML) produceseq_objtype=0. The spec API and XML parser set this field differently.Fix
Don't pass
objtypetospec.add_equality()for joint equality constraints. MuJoCo sets it automatically, matching the XML behavior.Impact
{"eq_", "neq"}inmodel_skip_fieldsChecklist
CHANGELOG.mdhas been updated (if user-facing change) — N/A, internal fixTest plan
Bug fix
Steps to reproduce:
eq_objtypebetween Newton's mjwarp model and native MuJoComjOBJ_JOINT), native has 0Minimal reproduction:
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests