Skip to content

Fix Previous-Pose Updates for Kinematic Rigid Bodies (VBD)#1447

Merged
eric-heiden merged 3 commits into
newton-physics:mainfrom
jumyungc:rigid-vbd-kinematic-friction
Jan 23, 2026
Merged

Fix Previous-Pose Updates for Kinematic Rigid Bodies (VBD)#1447
eric-heiden merged 3 commits into
newton-physics:mainfrom
jumyungc:rigid-vbd-kinematic-friction

Conversation

@jumyungc

@jumyungc jumyungc commented Jan 23, 2026

Copy link
Copy Markdown
Member

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.

  • The migration guide in docs/migration.rst is up-to date

Before your PR is "Ready for review"

  • Necessary tests have been added and new examples are tested (see newton/tests/test_examples.py)
  • Documentation is up-to-date
  • Code passes formatting and linting checks with pre-commit run -a

Summary by CodeRabbit

  • Refactor

    • Optimized rigid body state tracking and internal velocity calculation timing for improved physics simulation consistency.
    • Improved joint state propagation handling during solver finalization.
  • Tests

    • Added new test coverage for cable gripper interactions with dynamic objects.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: JC <jumyungc@nvidia.com>
Signed-off-by: JC <jumyungc@nvidia.com>
@jumyungc jumyungc added this to the 1.0 Release milestone Jan 23, 2026
@jumyungc jumyungc self-assigned this Jan 23, 2026
@coderabbitai

coderabbitai Bot commented Jan 23, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR modifies the timing of when the previous rigid body pose (body_q_prev) is captured during forward integration. Instead of capturing at the start of the forward step, the code now refreshes it at the end of the velocity update step. Parameter ordering in update_body_velocity is reordered, initial history initialization is adjusted, and a new kinematic gripper test is added.

Changes

Cohort / File(s) Summary
Rigid body solver kernels
newton/_src/solvers/vbd/rigid_vbd_kernels.py
Removed body_q_prev write-back from forward step start; reordered update_body_velocity parameters to move body_q_prev after body_com; updated docstrings to document that previous pose is refreshed at kernel end.
Solver finalization and initialization
newton/_src/solvers/vbd/solver_vbd.py
Changed body_q_prev initialization from zeros to clone of current model.body_q; updated update_body_velocity kernel call signature to match new parameter order; removed outputs from Dahl state arrays (joint_sigma_prev, joint_kappa_prev, joint_dkappa_prev) in joint kernel invocation.
Cable/gripper test
newton/tests/test_cable.py
Added _drive_gripper_boxes_kernel to animate kinematic gripper trajectories; added _cable_kinematic_gripper_picks_capsule_impl test validating gripper-capsule interaction and lift dynamics; registered test via add_function_test.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Suggested labels

bug

Suggested reviewers

  • AnkaChan
  • eric-heiden
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing previous-pose updates specifically for kinematic rigid bodies in the VBD solver, which aligns with the key modifications across the three files (kernel signature reordering, initialization changes, and test additions).
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jan 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_prev update from forward_step_rigid_bodies (which kinematic bodies exit early from) to update_body_velocity (which runs for all bodies)
  • Initialize body_q_prev by 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.

@eric-heiden eric-heiden added this pull request to the merge queue Jan 23, 2026
Merged via the queue into newton-physics:main with commit 4f11e49 Jan 23, 2026
28 checks passed
@jumyungc jumyungc deleted the rigid-vbd-kinematic-friction branch January 24, 2026 00:39
eric-heiden pushed a commit to eric-heiden/newton that referenced this pull request Jan 28, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Mar 9, 2026
3 tasks
mmacklin pushed a commit to mmacklin/newton that referenced this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants