Fix Previous-Pose Updates for Kinematic Rigid Bodies (VBD)#1447
Conversation
Signed-off-by: JC <jumyungc@nvidia.com>
Signed-off-by: JC <jumyungc@nvidia.com>
📝 WalkthroughWalkthroughThe PR modifies the timing of when the previous rigid body pose ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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! |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the previous pose (body_q_prev) was not being updated correctly for kinematic rigid bodies in the VBD solver, leading to incorrect finite-difference velocity calculations and spurious friction forces.
Changes:
- Moved the
body_q_prevupdate fromforward_step_rigid_bodies(which kinematic bodies exit early from) toupdate_body_velocity(which runs for all bodies) - Initialize
body_q_prevby cloning the model's initial poses instead of using zeros to avoid spurious velocities on the first timestep - Added comprehensive test validating that kinematic bodies can transfer motion to dynamic bodies via friction
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| newton/_src/solvers/vbd/rigid_vbd_kernels.py | Removed premature body_q_prev update in forward_step_rigid_bodies; added pose refresh at end of update_body_velocity to capture both dynamic and kinematic body poses |
| newton/_src/solvers/vbd/solver_vbd.py | Changed body_q_prev initialization to clone model poses instead of zeros; updated kernel launch parameters for consistency |
| newton/tests/test_cable.py | Added test kernel and regression test validating kinematic friction transfer (gripper picking up capsule) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ysics#1447) Signed-off-by: JC <jumyungc@nvidia.com>
…ysics#1447) Signed-off-by: JC <jumyungc@nvidia.com>
Description
The previous pose was being updated incorrectly for kinematic rigid bodies; it’s now fixed with just a few lines of change.
Newton 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
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.