Skip to content

Accelerate and strengthen asset tests [2/13] - #8135

Closed
AntoineRichard wants to merge 3 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/asset-tests-p02-wrench-composer
Closed

AntoineRichard wants to merge 3 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/asset-tests-p02-wrench-composer

Conversation

@AntoineRichard

@AntoineRichard AntoineRichard commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Part 2/13 of the asset-test series (tracker: #7282). Scope: WrenchComposer tests. No dependencies.

This PR reduces the WrenchComposer tests to literal unit cases plus one real PhysX delivery test.

  • test_wrench_composer.py: 38 literal cases on small hand-written inputs replace the randomized matrix. They cover:
  • test_wrench_composer_integration.py: one real PhysX test, test_composed_wrenches_reach_physx_in_the_frame_they_are_delivered, runs on every test device (CPU and CUDA, as before). It covers both ways a rigid object hands a composed wrench to PhysX:
    • Body frame: a rotated world force at a world offset must match raw PhysX. The cubes sit off the world z axis, so the COM correction term is non-zero.
    • World frame: a world force and torque at the COM of a rotated cube at x = 2000 m must follow the world axes.
  • test_wrench_composer_vs_physx.py is removed. Two of its eight tests are genuine parity checks: the local force at a local offset, and the long-run world force at an offset. Their contracts are covered by the literal units and the delivery test, each proven by a mutation (table below). Four others make the identical PhysX call on both sides: local force, local torque, global torque and payload. The reset case re-applies the force to every environment, so it cannot detect a reset bug. The remaining case, the world force at an offset, is kept as the body-frame half of the delivery test.

Disposition of deleted and rewritten tests

Every mutation below is a one-line change to wrench_composer.py, its Warp kernels, or the PhysX RigidObject.write_data_to_sim. Each turned the named keeper red and was then reverted.

"Delivery test" means test_composed_wrenches_reach_physx_in_the_frame_they_are_delivered.

Deleted or rewritten test (develop) Keeper Proof
test_wrench_composer_uses_asset_frame_conventions same test verbatim
test_index_dtype_combinations_preserve_selected_wrench_cells same test verbatim
test_composed_wrench_emits_deprecation_warning same name, literal inputs; asserts the alias is the output proxy mutation: composed_force returns out_torque_b
test_output_property_triggers_lazy_composition same name, literal inputs mutation: out_force_b stops calling _ensure_composed
test_lazy_composition_reflects_later_adds same name, literal inputs mutation: add_forces_and_torques_index stops marking the composer dirty
test_add_forces_and_torques_at_position test_local_wrench_at_position_composes_without_pose_reads, test_add_accumulates_local_wrenches mutation: add-index kernel subtracts the local cross(p, F) torque
test_local_forces_at_local_position test_local_wrench_at_position_composes_without_pose_reads (all four entry points) mutation: set-index kernel subtracts the local cross(p, F) torque
test_global_forces_with_rotation test_global_wrench_at_com_uses_world_fast_path_or_rotates mutation: compose kernel rotates with quat_rotate instead of quat_rotate_inv
test_global_torques_with_rotation test_global_wrench_at_com_uses_world_fast_path_or_rotates mutation: torque-only input with positions sets the world-position flag
test_global_forces_at_global_position test_global_force_at_position_uses_live_com_and_rotation mutation: CoM correction sign flipped
test_global_force_with_com_offset test_global_force_at_position_uses_live_com_and_rotation mutation: CoM correction sign flipped
test_com_offset_with_rotation test_global_force_at_position_uses_live_com_and_rotation mutations: CoM correction sign flipped; forward rotation
test_90_degree_rotation_global_force test_global_force_at_position_uses_live_com_and_rotation (second read after a pose change) mutation: fallback returns the cached composition (_ensure_composed)
test_composition_mixed_local_and_global test_mixed_local_and_global_wrenches_compose_in_body_frame mutation: world fast path ignores local input
test_add_raw_buffers_from test_raw_buffer_merge_accumulates_all_five_buffers_and_ignores_inactive_sources mutation: merge kernel drops the global torque buffer
test_add_raw_buffers_from_inactive_is_noop test_raw_buffer_merge_accumulates_all_five_buffers_and_ignores_inactive_sources mutation: inactive-source guard removed
test_add_forces_mask test_index_and_mask_selection_change_only_selected_cells, plus sentinel-filled masked-out cells in every four-entry-point case mutation: add-mask kernel ignores the body mask
test_set_forces_overwrites_previous_add test_set_clears_every_buffer_of_targeted_environments_only mutations: set-index / set-mask skip their reset
test_set_forces_clears_targeted_envs_only test_set_clears_every_buffer_of_targeted_environments_only[index] mutation: set-index skips its reset
test_set_forces_mask_clears_targeted_envs_only test_set_clears_every_buffer_of_targeted_environments_only[mask] mutation: set-mask skips its reset
test_partial_reset_zeros_only_specified_envs test_partial_reset_zeros_only_selected_environments mutations: slice selectors resolve to all environments; partial reset clears the dirty flag
test_full_reset_clears_active_flag test_full_reset_clears_every_buffer_and_frame_flag mutations: full reset keeps the world-position flag; slice(None) treated as a partial reset
test_compose_is_idempotent test_lazy_composition_reflects_later_adds mutation: compose kernel accumulates into the outputs
test_deprecated_add_forces_and_torques_emits_warning test_deprecated_writers_warn_and_keep_add_and_set_behavior mutation: deprecated add drops the torques
test_deprecated_set_forces_and_torques_clears_previous test_deprecated_writers_warn_and_keep_add_and_set_behavior mutation: set-index skips its reset
test_global_force_invariant_under_rotation test_global_force_at_position_uses_live_com_and_rotation; delivery test (body frame) mutations: fallback returns the cached composition; forward rotation
test_local_force_follows_rotation test_local_wrench_at_position_composes_without_pose_reads; delivery test (body frame); contract test_external_wrench_frames mutation: PhysX write_data_to_sim passes is_global=True
test_global_torque_invariant_under_rotation delivery test (world-frame torque on a rotated cube) mutation: PhysX write_data_to_sim passes is_global=False
test_global_force_torque_after_translation test_global_force_at_position_uses_live_com_and_rotation (CoM moved between reads) mutation: fallback returns the cached composition
test_global_force_no_position_no_torque delivery test (world force at the CoM, angular velocity only from the world torque); test_global_wrench_at_com_uses_world_fast_path_or_rotates mutation: PhysX write_data_to_sim passes is_global=False
test_global_force_no_position_no_rotation_large_offset delivery test (world cube at x = 2000 m) mutation: PhysX write_data_to_sim passes is_global=False
test_multi_cube_different_torques_from_same_force test_global_force_at_position_uses_live_com_and_rotation (two environments with distinct CoMs) mutation: CoM correction sign flipped
test_global_force_torque_far_from_origin test_global_force_at_position_uses_live_com_and_rotation (cell at x = 2000 m); delivery test mutation: CoM correction sign flipped
test_composer_vs_physx_local_force contract test_external_wrench_frames; delivery test (body frame) identical PhysX call on both sides; mutation: is_global=True
test_composer_vs_physx_local_torque contract test_external_wrench_frames; delivery test (body frame) identical PhysX call on both sides; mutation: is_global=True
test_composer_vs_physx_global_torque delivery test (world frame) identical PhysX call on both sides; mutation: is_global=False
test_composer_vs_physx_payload_scenario delivery test (world frame) identical PhysX call on both sides; mutation: is_global=False
test_composer_vs_physx_global_force_with_reset test_partial_reset_zeros_only_selected_environments re-applies the force to every environment, so it cannot detect a reset bug; mutations as for the partial reset
test_composer_vs_physx_local_force_at_position (parity) test_local_wrench_at_position_composes_without_pose_reads; delivery test (body frame) mutations: set-index kernel subtracts the local cross(p, F) torque; PhysX is_global=True
test_composer_vs_physx_global_force_at_position (parity) delivery test (body frame) mutations: forward rotation; CoM correction sign flipped; is_global=False
test_composer_vs_physx_permanent_global_force_at_position_long_run (parity) test_global_force_at_position_uses_live_com_and_rotation; delivery test mutation: fallback returns the cached composition (red in both keepers)

Timing

Warm Warp cache, repository orchestrator, one process per file, RTX 5090.

Files Outcomes Wall
develop 3 106 pass 17.4 s
this PR 2 40 pass 5.2 s

Type of change

  • Test-suite redesign (no production change)

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Checklist

Docker and GPU tests run on demand. Push the commits you want tested, then
comment run-ci on the pull request.

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump package versions — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Replace the randomized and device-parametrized composer matrix with literal
two-environment, two-body cases that pin frames, fast paths, live CoM and
rotation reads, selection, set, reset, merge, lazy composition, and the
deprecated API.

Keep one real PhysX test: a world force at a world offset must match raw
PhysX delivery, and a world wrench at the CoM of a rotated body far from the
origin must follow the world axes. The composer-versus-PhysX matrix is
removed; its only non-trivial parity case is the retained offset force, and
its other cases issued the same PhysX call on both sides.
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Refactors wrench composer tests and removes one test file.

The PR appears safe to merge, though targeted CUDA mask-selection and buffer-merge coverage should be restored.

Findings

  1. P2 CUDA coverage is lost ▶

Summary

This PR replaces randomized wrench-composer tests with literal CPU cases, consolidates PhysX delivery checks into one CUDA integration test, and removes the separate PhysX comparison file.

  • The new assertions cover frames, selection, reset, merge, lazy composition, and deprecated APIs.
  • Targeted CUDA coverage for mask selection and buffer merging is lost.

Reviews (1) · Last reviewed commit: "Reduce WrenchComposer tests to literal u..."

Comment on lines +83 to +85
"""Create a two-environment, two-body CPU composer with literal body poses."""
asset = SimpleNamespace(num_instances=2, num_bodies=2, device="cpu", data=_AssetData(*_poses(com, quat)))
return WrenchComposer(asset, supports_world_at_com=supports_world_at_com)

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.

P2 CUDA coverage is lost The new composer fixture runs only on CPU, and the remaining CUDA integration test uses single-body index writes. Mask selection and buffer merging are therefore no longer tested on CUDA, so a GPU-specific regression in either path could pass the suite. A targeted CUDA case covering those paths, including a multi-cell mask, would restore that protection.

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!

@AntoineRichard
AntoineRichard marked this pull request as draft September 29, 2026 12:54
Type the literal cell tables, allocate uniform vectors directly instead of
scaling a ones tensor, drop redundant contiguous() calls, and build the raw
PhysX wrench arrays once before the step loop.
Run the PhysX delivery test on every test device, as before, and spawn its
cubes from the rigid-body, mass, and collision schema fragments instead of
the deprecated property configs. Assert that the deprecated composed
properties return the output proxies themselves.
@AntoineRichard AntoineRichard changed the title Accelerate and strengthen asset tests [2/24] Accelerate and strengthen asset tests [2/13] Sep 29, 2026
@StafaH

StafaH commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Closing because the combined PR #7282 has merged. This split PR is superseded by #7282 and is no longer needed.

@StafaH StafaH closed this Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants