⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@AntoineRichard
Copy link
Collaborator

Description

Adds back support for Rigid bodies.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions bot added the isaac-lab Related to Isaac Lab team label Jan 14, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 14, 2026

Greptile Summary

  • Implements full rigid body physics support for the Newton backend by adding comprehensive RigidObject classes, property setters, and external force handling to match PhysX functionality
  • Updates Newton physics engine dependency to specific commit e45db2c7400ecb4ff8ea022b7c9e41d386884bc8 that contains rigid body features and optimizes memory management through lazy initialization and buffer reuse
  • Adds extensive test suite and benchmarking framework with 18+ test cases covering rigid body operations, though many tests are disabled due to known CPU-specific Newton bugs

Important Files Changed

Filename Overview
source/isaaclab_newton/isaaclab_newton/assets/rigid_object/rigid_object_data.py Major refactor implementing lazy initialization and memory optimization for rigid body data container; contains debug prints and potential syntax errors that need attention
source/isaaclab_newton/isaaclab_newton/assets/rigid_object/rigid_object.py Complete Newton RigidObject implementation with external forces, property setters, and physics integration; contains debug prints and device parameter inconsistencies
source/isaaclab/test/assets/test_rigid_object.py New comprehensive test suite for rigid body functionality; most tests disabled due to CPU-specific Newton bugs and missing dependencies
source/isaaclab/isaaclab/sim/simulation_context.py Adds Newton backend device configuration and debug output; includes uncommented simulation play call that may affect existing behavior

Confidence score: 2/5

  • This PR requires careful review due to extensive changes to core physics systems and potential runtime issues from debug code and syntax errors
  • Score lowered due to numerous debug print statements in production code, potential syntax errors (missing parentheses in tuple creation), and many disabled tests indicating incomplete implementation
  • Pay close attention to rigid_object_data.py and rigid_object.py files which contain the most critical changes and potential issues

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

18 files reviewed, 30 comments

Edit Code Review Agent Settings | Greptile


class RigidObject(FactoryBase):
class RigidObject(FactoryBase, BaseRigidObject):
"""Factory for creating articulation instances."""
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Docstring incorrectly refers to 'articulation instances' instead of 'rigid object instances'

Suggested change
"""Factory for creating articulation instances."""
"""Factory for creating rigid object instances."""

Comment on lines +466 to +475
"""Benchmark a single property of ArticulationData.
Args:
articulation_data: The ArticulationData instance.
mock_view: The mock view for setting random data.
property_name: Name of the property to benchmark.
config: Benchmark configuration.
Returns:
BenchmarkResult with timing statistics.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Docstring incorrectly references ArticulationData instead of RigidObjectData

Suggested change
"""Benchmark a single property of ArticulationData.
Args:
articulation_data: The ArticulationData instance.
mock_view: The mock view for setting random data.
property_name: Name of the property to benchmark.
config: Benchmark configuration.
Returns:
BenchmarkResult with timing statistics.
"""
"""Benchmark a single property of RigidObjectData.
Args:
rigid_object_data: The RigidObjectData instance.
mock_view: The mock view for setting random data.
property_name: Name of the property to benchmark.
config: Benchmark configuration.
Returns:
BenchmarkResult with timing statistics.
"""

Comment on lines +580 to +585
"""Run all benchmarks for ArticulationData.
Args:
config: Benchmark configuration.
Returns:
Tuple of (List of BenchmarkResults, hardware_info dict).
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Docstring incorrectly references ArticulationData instead of RigidObjectData

Suggested change
"""Run all benchmarks for ArticulationData.
Args:
config: Benchmark configuration.
Returns:
Tuple of (List of BenchmarkResults, hardware_info dict).
"""Run all benchmarks for RigidObjectData.
Args:
config: Benchmark configuration.
Returns:
Tuple of (List of BenchmarkResults, hardware_info dict).
"""

"""Generate Warp inputs for set_masses."""
return {
"masses": wp.from_torch(
torch.rand(config.num_instances, config.num_bodies, device=config.device, dtype=torch.float32),
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Mass values should be positive - consider using torch.rand(...) + 0.1 to ensure non-zero masses

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

def play(self):
"""Starts the simulation."""

print("Playing simulation")
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Debug print statement should be removed before production release

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +1706 to +1709
print(f"Body com: {wp.to_torch(self._sim_bind_body_com_pos_b)}")
print(f"Body com shape: {wp.to_torch(self._sim_bind_body_com_pos_b).shape}")
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Debug print statements should be removed in production code

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +377 to +378
print(f"Pose: {wp.to_torch(pose)}")
self._update_array_with_array_masked(pose, self._data.root_link_pose_w, env_mask, self.num_instances)
print(f"Root link pose: {wp.to_torch(self._data.root_link_pose_w)}")
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Debug print statements should be removed before merging to production

Suggested change
print(f"Pose: {wp.to_torch(pose)}")
self._update_array_with_array_masked(pose, self._data.root_link_pose_w, env_mask, self.num_instances)
print(f"Root link pose: {wp.to_torch(self._data.root_link_pose_w)}")
self._update_array_with_array_masked(pose, self._data.root_link_pose_w, env_mask, self.num_instances)

Comment on lines +546 to +551
print(self.num_instances, self.num_bodies)
print(f"Masses: {wp.to_torch(masses)}")
env_mask = make_masks_from_torch_ids(self.num_instances, env_ids, env_mask, device=self.device)
body_mask = make_masks_from_torch_ids(self.num_bodies, body_ids, body_mask, device=self.device)
print(f"Env mask: {env_mask}")
print(f"Body mask: {body_mask}")
print(f"Masses: {wp.to_torch(masses)}")
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Multiple debug print statements should be removed before production deployment

Suggested change
print(self.num_instances, self.num_bodies)
print(f"Masses: {wp.to_torch(masses)}")
env_mask = make_masks_from_torch_ids(self.num_instances, env_ids, env_mask, device=self.device)
body_mask = make_masks_from_torch_ids(self.num_bodies, body_ids, body_mask, device=self.device)
print(f"Env mask: {env_mask}")
print(f"Body mask: {body_mask}")
print(f"Masses: {wp.to_torch(masses)}")
env_mask = make_masks_from_torch_ids(self.num_instances, env_ids, env_mask, device=self.device)
body_mask = make_masks_from_torch_ids(self.num_bodies, body_ids, body_mask, device=self.device)

Comment on lines +662 to +678
env_mask_ = None
body_mask_ = None
if isinstance(forces, torch.Tensor) or isinstance(torques, torch.Tensor):
if forces is not None:
forces, env_mask, body_mask = self._torch_to_warp_dual_index(
forces,
self.num_instances,
self.num_bodies,
env_ids,
body_ids,
env_mask,
body_mask,
dtype=wp.float32,
forces = make_complete_data_from_torch_dual_index(
forces, self.num_instances, self.num_bodies, env_ids, body_ids, dtype=wp.vec3f, device=self.device
)
if torques is not None:
torques, env_mask, body_mask = self._torch_to_warp_dual_index(
torques,
self.num_instances,
self.num_bodies,
env_ids,
body_ids,
env_mask,
body_mask,
dtype=wp.float32,
torques = make_complete_data_from_torch_dual_index(
torques, self.num_instances, self.num_bodies, env_ids, body_ids, dtype=wp.vec3f, device=self.device
)
env_mask = make_masks_from_torch_ids(self.num_instances, env_ids, env_mask, device=self.device)
body_mask = make_masks_from_torch_ids(self.num_bodies, body_ids, body_mask, device=self.device)
# solve for None masks
if env_mask is None:
env_mask = self._data.ALL_ENV_MASK
if body_mask is None:
body_mask = self._data.ALL_BODY_MASK
if env_mask_ is None:
env_mask_ = self._data.ALL_ENV_MASK
if body_mask_ is None:
body_mask_ = self._data.ALL_BODY_MASK
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Variable naming inconsistency: env_mask_ and body_mask_ are created but env_mask and body_mask are used in the logic. The underscore variables appear unused. Are the underscore variables (env_mask_, body_mask_) intended to be used instead of the non-underscore versions in the None checks?


@pytest.mark.skip(reason="For now let's not do that...")
@pytest.mark.parametrize("num_cubes", [1, 2])
@pytest.mark.parametrize("device", ["cuda", "cpu"])
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Device parameter inconsistent - uses "cuda" instead of "cuda:0" like other tests

Suggested change
@pytest.mark.parametrize("device", ["cuda", "cpu"])
@pytest.mark.parametrize("device", ["cuda:0", "cpu"])

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Additional Comments (8)

  1. source/isaaclab/isaaclab/assets/rigid_object/rigid_object.py, line 20-30 (link)

    syntax: Multiple references to 'articulation' instead of 'rigid object' in docstrings and comments create confusion about the class's actual purpose

  2. source/isaaclab_newton/test/assets/rigid_object/test_rigid_object.py, line 6-19 (link)

    syntax: Docstring incorrectly refers to 'Articulation class' throughout instead of 'RigidObject class'

  3. source/isaaclab/isaaclab/sim/_impl/newton_manager.py, line 124-131 (link)

    style: Debug print statements should be removed before production release

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

  4. source/isaaclab/isaaclab/sim/_impl/newton_manager.py, line 148-149 (link)

    style: Debug print statement should be removed before production release

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

  5. source/isaaclab/isaaclab/sim/_impl/newton_manager.py, line 193 (link)

    style: Debug print statement should be removed before production release

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

  6. source/isaaclab_newton/test/assets/rigid_object/test_rigid_object_data.py, line 6 (link)

    syntax: Docstring incorrectly refers to 'ArticulationData' instead of 'RigidObjectData'

  7. source/isaaclab_newton/test/assets/rigid_object/test_rigid_object_data.py, line 245 (link)

    syntax: Variable named 'articulation_data' should be 'rigid_object_data' for consistency

  8. source/isaaclab_newton/test/assets/rigid_object/test_rigid_object_data.py, line 254-268 (link)

    syntax: Multiple references to 'articulation_data' should be 'rigid_object_data'

18 files reviewed, 16 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +466 to +475
"""Benchmark a single property of ArticulationData.
Args:
articulation_data: The ArticulationData instance.
mock_view: The mock view for setting random data.
property_name: Name of the property to benchmark.
config: Benchmark configuration.
Returns:
BenchmarkResult with timing statistics.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Docstring incorrectly references ArticulationData instead of RigidObjectData

Suggested change
"""Benchmark a single property of ArticulationData.
Args:
articulation_data: The ArticulationData instance.
mock_view: The mock view for setting random data.
property_name: Name of the property to benchmark.
config: Benchmark configuration.
Returns:
BenchmarkResult with timing statistics.
"""
"""Benchmark a single property of RigidObjectData.
Args:
rigid_object_data: The RigidObjectData instance.
mock_view: The mock view for setting random data.
property_name: Name of the property to benchmark.
config: Benchmark configuration.
Returns:
BenchmarkResult with timing statistics.
"""

Comment on lines +580 to +585
"""Run all benchmarks for ArticulationData.
Args:
config: Benchmark configuration.
Returns:
Tuple of (List of BenchmarkResults, hardware_info dict).
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Docstring incorrectly references ArticulationData instead of RigidObjectData

Suggested change
"""Run all benchmarks for ArticulationData.
Args:
config: Benchmark configuration.
Returns:
Tuple of (List of BenchmarkResults, hardware_info dict).
"""Run all benchmarks for RigidObjectData.
Args:
config: Benchmark configuration.
Returns:
Tuple of (List of BenchmarkResults, hardware_info dict).

#
# SPDX-License-Identifier: BSD-3-Clause

"""Mock interfaces for testing and benchmarking ArticulationData class."""
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Docstring refers to 'ArticulationData class' but this file is for rigid object testing

Suggested change
"""Mock interfaces for testing and benchmarking ArticulationData class."""
"""Mock interfaces for testing and benchmarking RigidObjectData class."""

Comment on lines +184 to +187
def set_root_transforms(self, state, transforms: wp.array):
print(f"Setting root transforms: {transforms}")
print(f"Root transforms: {self._root_transforms}")
self._root_transforms.assign(transforms)
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Debug print statements should be removed before production release

Suggested change
def set_root_transforms(self, state, transforms: wp.array):
print(f"Setting root transforms: {transforms}")
print(f"Root transforms: {self._root_transforms}")
self._root_transforms.assign(transforms)
def set_root_transforms(self, state, transforms: wp.array):
self._root_transforms.assign(transforms)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +871 to +870
tmp_pose = wp.zeros((self.num_instances,), dtype=wp.transformf, device=self._device)
tmp_velocity = wp.zeros((self.num_instances,), dtype=wp.spatial_vectorf, device=self._device)
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Device parameter inconsistent - uses self._device instead of self.device like other methods

Suggested change
tmp_pose = wp.zeros((self.num_instances,), dtype=wp.transformf, device=self._device)
tmp_velocity = wp.zeros((self.num_instances,), dtype=wp.spatial_vectorf, device=self._device)
tmp_pose = wp.zeros((self.num_instances,), dtype=wp.transformf, device=self.device)
tmp_velocity = wp.zeros((self.num_instances,), dtype=wp.spatial_vectorf, device=self.device)

Comment on lines 78 to 79
"""Test zero instantiated articulation data."""
# Setup the articulation data
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Test method docstring incorrectly mentions 'articulation data' instead of 'rigid object data'

Suggested change
"""Test zero instantiated articulation data."""
# Setup the articulation data
"""Test zero instantiated rigid object data."""
# Setup the rigid object data

@@ -111,792 +98,28 @@ def test_zero_instantiated(self, mock_newton_manager, num_instances: int, num_do
def test_settable(self, mock_newton_manager, num_instances: int, num_dofs: int, device: str):
"""Test that the articulation data is settable."""
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Comment incorrectly refers to 'articulation data' instead of 'rigid object data'

Suggested change
"""Test that the articulation data is settable."""
"""Test that the rigid object data is settable."""

)
assert torch.all(wp.to_torch(rigid_object_data.default_root_vel) == torch.ones(num_instances, 6, device=device))
# Prime the articulation data
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Comment incorrectly refers to 'articulation data' instead of 'rigid object data'

Suggested change
# Prime the articulation data
# Prime the rigid object data

@AntoineRichard AntoineRichard force-pushed the antoiner/rigid_body_upgrade branch from fdf4241 to 8afadee Compare January 14, 2026 09:12
@github-actions github-actions bot added documentation Improvements or additions to documentation asset New asset feature or request infrastructure labels Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

asset New asset feature or request documentation Improvements or additions to documentation infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant