Skip to content

[Newton] Articulation & Rigid Object Full Tests#4406

Merged
AntoineRichard merged 29 commits intoisaac-sim:dev/newtonfrom
AntoineRichard:antoiner/articulation_upgrade
Feb 3, 2026
Merged

[Newton] Articulation & Rigid Object Full Tests#4406
AntoineRichard merged 29 commits intoisaac-sim:dev/newtonfrom
AntoineRichard:antoiner/articulation_upgrade

Conversation

@AntoineRichard
Copy link
Copy Markdown
Collaborator

@AntoineRichard AntoineRichard commented Jan 16, 2026

Description

Brings back all of the original integration tests from the Articulation + the wrench composer.

Also provides UTs, ITs and micro benchmarks for the articulation with newton. Some integration tests are still failing / skipped as the feature set of newton is not complete yet.

Run a unit-test:

./isaaclab.sh -p -m pytest source/isaaclab_newton/test/assets/rigid_object/test_rigid_object.py
./isaaclab.sh -p -m pytest source/isaaclab_newton/test/assets/rigid_object/test_rigid_object_data.py
./isaaclab.sh -p -m pytest source/isaaclab_newton/test/assets/rigid_object/test_articulation.py
./isaaclab.sh -p -m pytest source/isaaclab_newton/test/assets/rigid_object/test_articulation_data.py

Run integration tests:

./isaaclab.sh -p -m pytest source/isaaclab_newton/test/assets/rigid_object/test_integration_rigid_object.py
./isaaclab.sh -p -m pytest source/isaaclab_newton/test/assets/rigid_object/test_integration_articulation.py

Run a micro-benchmark:

./isaaclab.sh -p source/isaaclab_newton/test/assets/rigid_object/benchmark_rigid_object.py
./isaaclab.sh -p source/isaaclab_newton/test/assets/rigid_object/benchmark_rigid_object_data.py
./isaaclab.sh -p source/isaaclab_newton/test/assets/rigid_object/benchmark_articulation.py
./isaaclab.sh -p source/isaaclab_newton/test/assets/rigid_object/benchmark_articulation_data.py

Known slow down:

  • The methods: make_complete_data_from_torch_dual_index, make_complete_data_from_torch_single_index, make_masks_from_torch_ids, are very slow, and they should be modified to include a out argument, that would allow to preallocate the tensors.
  • For now most of the warp code was written with modularity in mind, this means that sometimes we launch multiple kernels when we should really just be launching one. For performance optimization we should track these instances and write dedicated kernels.

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 documentation Improvements or additions to documentation asset New asset feature or request infrastructure labels Jan 16, 2026
@AntoineRichard AntoineRichard marked this pull request as ready for review January 20, 2026 12:47
@AntoineRichard AntoineRichard changed the title [Newton] Articulation Upgrade [Newton] Articulation & Rigid Object Full Tests Jan 21, 2026
@AntoineRichard AntoineRichard force-pushed the antoiner/articulation_upgrade branch from 2fc4559 to 1befd82 Compare January 21, 2026 10:36
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jan 21, 2026
@AntoineRichard
Copy link
Copy Markdown
Collaborator Author

@greptileai could you give it a review?

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jan 21, 2026

Greptile Summary

  • Restores comprehensive integration tests, unit tests, and micro-benchmarks for Articulation and RigidObject classes in the Newton physics backend, bringing back full test coverage that was previously missing
  • Introduces WrenchComposer utility class for managing external forces and torques on rigid bodies with support for both instantaneous and permanent force application patterns
  • Implements extensive performance optimizations including lazy buffer allocation, memory view optimizations, and pre-allocated temporary buffers for torch-to-warp array conversions

Important Files Changed

Filename Overview
source/isaaclab/utils/wrench_composer.py New WrenchComposer utility for external force management with critical initialization bug on line 37
source/isaaclab/utils/warp/kernels.py Added new Warp kernels for force composition with inconsistent torque calculation approach between functions
source/isaaclab_newton/isaaclab_newton/assets/rigid_object/rigid_object.py Major refactoring integrating WrenchComposer with complex lazy allocation and wrench application logic
source/isaaclab_newton/isaaclab_newton/assets/articulation/articulation.py Comprehensive refactor adding full wrench composer support and extensive state validation logic
source/isaaclab_newton/isaaclab_newton/assets/rigid_object/rigid_object_data.py Extensive performance optimizations with removed deprecated decorators and complex memory management changes

Confidence score: 3/5

  • This PR introduces significant architectural changes and new functionality but contains critical bugs and potential issues requiring careful review
  • Score lowered due to critical initialization bug in WrenchComposer (line 37), inconsistent torque calculation approaches, many skipped/failing tests indicating incomplete Newton feature set, and extensive API changes with deprecated methods becoming permanent
  • Pay close attention to source/isaaclab/utils/wrench_composer.py for the initialization bug, force/torque composition kernels for mathematical correctness, and integration test files for understanding Newton backend limitations

Copy link
Copy Markdown
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.

38 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

if hasattr(asset, "num_bodies"):
self.num_bodies = asset.num_bodies
else:
raise ValueError(f"Unsupported asset type: {self._asset.__class__.__name__}")
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.

logic: self._asset is referenced before being assigned (line 39)

Suggested change
raise ValueError(f"Unsupported asset type: {self._asset.__class__.__name__}")
raise ValueError(f"Unsupported asset type: {asset.__class__.__name__}")

@AntoineRichard
Copy link
Copy Markdown
Collaborator Author

AntoineRichard commented Jan 21, 2026

@greptileai let's do another round of review.

Copy link
Copy Markdown
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 (1)

  1. source/isaaclab/isaaclab/sensors/sensor_base.py, line 206 (link)

    logic: The env_mask parameter is defined but never used in the implementation. Should env_mask be implemented alongside env_ids, or is this parameter being added as a placeholder for future development?

39 files reviewed, 9 comments

Edit Code Review Agent Settings | Greptile

Comment thread source/isaaclab/isaaclab/assets/rigid_object/rigid_object.py
Comment thread source/isaaclab_newton/isaaclab_newton/assets/rigid_object/rigid_object.py Outdated
Comment thread source/isaaclab/isaaclab/utils/warp/kernels.py
Comment thread source/isaaclab_newton/test/assets/rigid_object/test_rigid_object.py Outdated
Comment thread source/isaaclab/isaaclab/assets/rigid_object/base_rigid_object.py Outdated
Comment thread source/isaaclab/isaaclab/assets/rigid_object/base_rigid_object.py Outdated
Comment thread source/isaaclab/isaaclab/sim/schemas/schemas.py
def test_reset(self):
"""Test that reset method works properly."""
articulation, _, _ = create_test_articulation()
articulation._create_buffers()
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.

logic: Duplicate _create_buffers() call - already called in factory function on line 125

Suggested change
articulation._create_buffers()
articulation, _, _ = create_test_articulation()

@ooctipus
Copy link
Copy Markdown
Collaborator

I gave a rough read and ran the tests myself, beyond making those failed one pass,

Our new tests are a lot more thorough than before, this is good, but it did took me a decent amount of effort to start make sense what is going on. I think some tests could be refactored further, and could potentially help a lot of new

for example:

    assert articulation.is_initialized
    # Check that floating base
    assert not articulation.is_fixed_base
    # Check buffers that exists and have correct shapes
    assert wp.to_torch(articulation.data.root_pos_w).shape == (num_articulations, 3)
    assert wp.to_torch(articulation.data.root_quat_w).shape == (num_articulations, 4)
    assert wp.to_torch(articulation.data.joint_pos).shape == (num_articulations, 12)
    assert wp.to_torch(articulation.data.body_mass).shape == (num_articulations, articulation.num_bodies)
    assert wp.to_torch(articulation.data.body_inertia).shape == (num_articulations, articulation.num_bodies, 3, 3)

    # Check some internal physx data for debugging
    # -- joint related
    assert articulation.num_joints == NewtonManager.get_model().joint_dof_count / num_articulations - 6
    # -- link related
    assert articulation.num_bodies == NewtonManager.get_model().body_count / num_articulations
    # -- link names (check within articulation ordering is correct)
    prim_path_body_names = articulation.root_view.body_names
    assert prim_path_body_names == articulation.body_names
    # -- actuator type
    for actuator_name, actuator in articulation.actuators.items():
        is_implicit_model_cfg = isinstance(articulation_cfg.actuators[actuator_name], ImplicitActuatorCfg)
        assert actuator.is_implicit_model == is_implicit_model_cfg

    # Simulate physics
    for _ in range(10):
        # perform rendering
        sim.step(render=False)
        # update articulation
        articulation.update(sim.cfg.dt)

this pattern repeated many time in articulation_integration_tests.py

all these instances could be replaced with something like

    _assert_initialized_common(articulation, num_articulations, expected_joint_count=12, expected_fixed_base=False, check_body_props=True,)
    _assert_model_counts(articulation, num_articulations, subtract_root_dofs=True)
    _assert_body_names_from_root_view(articulation)
    _assert_actuator_types(articulation, articulation_cfg)
    _step_sim(sim, articulation, steps=10, render=False)

Maybe after these tests passed, let cursor do some of these refactor for us?

@ooctipus
Copy link
Copy Markdown
Collaborator

some of the failure seems like requires newton or mujoco_warp to be fixed, is the goal to merge it with failed tests, or merge after those has been fixed?

cfg = cfg.to_dict()
# extract non-USD properties
fix_root_link = cfg.pop("fix_root_link", None)
print("fix_root_link", fix_root_link)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

logger x)

@AntoineRichard
Copy link
Copy Markdown
Collaborator Author

I gave a rough read and ran the tests myself, beyond making those failed one pass,

Our new tests are a lot more thorough than before, this is good, but it did took me a decent amount of effort to start make sense what is going on. I think some tests could be refactored further, and could potentially help a lot of new

for example:

    assert articulation.is_initialized
    # Check that floating base
    assert not articulation.is_fixed_base
    # Check buffers that exists and have correct shapes
    assert wp.to_torch(articulation.data.root_pos_w).shape == (num_articulations, 3)
    assert wp.to_torch(articulation.data.root_quat_w).shape == (num_articulations, 4)
    assert wp.to_torch(articulation.data.joint_pos).shape == (num_articulations, 12)
    assert wp.to_torch(articulation.data.body_mass).shape == (num_articulations, articulation.num_bodies)
    assert wp.to_torch(articulation.data.body_inertia).shape == (num_articulations, articulation.num_bodies, 3, 3)

    # Check some internal physx data for debugging
    # -- joint related
    assert articulation.num_joints == NewtonManager.get_model().joint_dof_count / num_articulations - 6
    # -- link related
    assert articulation.num_bodies == NewtonManager.get_model().body_count / num_articulations
    # -- link names (check within articulation ordering is correct)
    prim_path_body_names = articulation.root_view.body_names
    assert prim_path_body_names == articulation.body_names
    # -- actuator type
    for actuator_name, actuator in articulation.actuators.items():
        is_implicit_model_cfg = isinstance(articulation_cfg.actuators[actuator_name], ImplicitActuatorCfg)
        assert actuator.is_implicit_model == is_implicit_model_cfg

    # Simulate physics
    for _ in range(10):
        # perform rendering
        sim.step(render=False)
        # update articulation
        articulation.update(sim.cfg.dt)

this pattern repeated many time in articulation_integration_tests.py

all these instances could be replaced with something like

    _assert_initialized_common(articulation, num_articulations, expected_joint_count=12, expected_fixed_base=False, check_body_props=True,)
    _assert_model_counts(articulation, num_articulations, subtract_root_dofs=True)
    _assert_body_names_from_root_view(articulation)
    _assert_actuator_types(articulation, articulation_cfg)
    _step_sim(sim, articulation, steps=10, render=False)

Maybe after these tests passed, let cursor do some of these refactor for us?

Yeah these are the OG tests. I didn't want to alter them too much to see what kind of coverage we have in newton. I think they would need to be reworked in general to be more thorough.

@AntoineRichard AntoineRichard merged commit 48e23d2 into isaac-sim:dev/newton Feb 3, 2026
3 of 9 checks passed
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.

2 participants