Implement randomization and runtime update of equality constraint data + active #1192#1430
Conversation
…a + active newton-physics#1192 Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughAdds per-constraint equality data and active-state propagation from Newton models into MuJoCo Warp via a new combined kernel and solver wiring, expands the equality-constraint flag docstring, and adds multi-world tests for eq_data and eq_active updates. Changes
Sequence Diagram(s)sequenceDiagram
participant Newton as Newton Model
participant Solver as SolverMuJoCo
participant Kernel as update_eq_data_and_active_kernel
participant MuJoCo as MuJoCo Warp
Newton->>Solver: notify equality_constraint_* updates
Solver->>Kernel: launch with mjc_eq_to_newton_eq, types, anchors, relposes, polycoef, torquescale, enabled
Kernel->>Kernel: map by EqType (CONNECT/JOINT/WELD), pack vec11, set active
Kernel->>MuJoCo: write eq_data[world, mjc_eq] and eq_active[world, mjc_eq]
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
…ate-of-equality-constraint-data-active
…ate-of-equality-constraint-data-active
…ate-of-equality-constraint-data-active
There was a problem hiding this comment.
Pull request overview
This PR implements runtime update and randomization support for equality constraint data (eq_data) and active state (eq_active) in the MuJoCo solver.
Changes:
- Added two new Warp kernels (
update_eq_data_kernelandupdate_eq_active_kernel) to synchronize Newton's equality constraint properties with MuJoCo's internal data structures - Extended
update_eq_properties()to launch the new kernels whenSolverNotifyFlags.EQUALITY_CONSTRAINT_PROPERTIESis set - Enabled
"eq_data"inmodel_fields_to_expandfor multi-world support
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| newton/_src/solvers/flags.py | Updated EQUALITY_CONSTRAINT_PROPERTIES docstring to document all related fields |
| newton/_src/solvers/mujoco/kernels.py | Added update_eq_data_kernel and update_eq_active_kernel to sync equality constraint data |
| newton/_src/solvers/mujoco/solver_mujoco.py | Extended update_eq_properties to call new kernels and enabled eq_data field expansion |
| newton/tests/test_mujoco_solver.py | Added tests for eq_data and eq_active conversion and runtime updates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
adenzler-nvidia
left a comment
There was a problem hiding this comment.
Thanks, 1 comment and can you check whether the copilot suggestions for the tests make any sense?
Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
…ate-of-equality-constraint-data-active
…a + active newton-physics#1192 (newton-physics#1430) Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
…a + active newton-physics#1192 (newton-physics#1430) Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
…a + active newton-physics#1192 (newton-physics#1430) Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
Description
Closes #1192
Implements runtime update and randomization support for equality constraint
eq_dataandeq_activeinSolverMuJoCo.Changes
New Warp kernels (
newton/_src/solvers/mujoco/kernels.py):update_eq_data_kernel: Updates MuJoCo'seq_datafrom Newton's equality constraint properties based on constraint type:CONNECT: copiesequality_constraint_anchorJOINT: copiesequality_constraint_polycoefWELD: copies anchor,equality_constraint_relpose, andequality_constraint_torquescaleupdate_eq_active_kernel: Updates MuJoCo'seq_active(inmjData) from Newton'sequality_constraint_enabledSolver updates (
newton/_src/solvers/mujoco/solver_mujoco.py):update_eq_properties()to launch the new kernels whenSolverNotifyFlags.EQUALITY_CONSTRAINT_PROPERTIESis set"eq_data"inmodel_fields_to_expandfor multi-world supportDocumentation (
newton/_src/solvers/flags.py):EQUALITY_CONSTRAINT_PROPERTIESdocstring to reflect the new fields it coversTests (
newton/tests/test_mujoco_solver.py):test_eq_data_conversion_and_update: validates initial conversion and runtime updates of equality constraint datatest_eq_active_conversion_and_update: validates initial conversion and runtime toggling of constraint enabled stateNewton Migration Guide
Please ensure the migration guide for warp.sim users is up-to-date with the changes made in this PR.
docs/migration.rstis up-to dateBefore your PR is "Ready for review"
newton/tests/test_examples.py)pre-commit run -aSummary by CodeRabbit
Documentation
Improvements
Tests
✏️ Tip: You can customize this high-level summary in your review settings.