Repository navigation
[Tests] Consolidate overlapping isaaclab_newton tests - #7603
Conversation
Merge the dynamics accessor shape and FK-refresh checks into one sim per asset, fold paired sensor and schema checks that rebuilt the same scene, remove permanently skipped tests, and skip the non-strict xfail contact sensor cases that ran to completion without producing a verdict.
Greptile SummaryThis PR reduces the Newton test-suite runtime by removing permanently skipped cases and consolidating tests that previously created duplicate simulation scenes.
Confidence Score: 4/5The PR appears safe to merge, with a non-blocking test-quality issue in the consolidated articulation refresh test. The runtime optimizations generally preserve the tested behavior, but the first Jacobian read refreshes shared FK state and prevents later assertions from detecting accessor-specific refresh regressions. Files Needing Attention: source/isaaclab_newton/test/assets/test_articulation.py Important Files Changed
Reviews (1): Last reviewed commit: "Consolidate overlapping isaaclab_newton ..." | Re-trigger Greptile |
| assert not torch.allclose(J_link_0, articulation.data.body_link_jacobian_w.torch, atol=1e-3), ( | ||
| "body_link_jacobian_w did not change after manual joint write; FK trigger likely missing" | ||
| ) | ||
| assert not torch.allclose(J_com_0, J_com_1, atol=1e-3), ( | ||
| "body_com_jacobian_w did not change after manual joint write — FK trigger likely missing before eval_jacobian." | ||
| assert not torch.allclose(J_com_0, articulation.data.body_com_jacobian_w.torch, atol=1e-3), ( | ||
| "body_com_jacobian_w did not change after manual joint write; FK trigger likely missing" | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("num_articulations", [1]) | ||
| @pytest.mark.parametrize("device", test_devices(DeviceScope.CUDA)) | ||
| @pytest.mark.parametrize("articulation_type", ["panda", "anymal"]) | ||
| @pytest.mark.parametrize("gravity_enabled", [False]) | ||
| @pytest.mark.isaacsim_ci | ||
| def test_mass_matrix_refreshes_after_manual_joint_write( | ||
| sim, num_articulations, device, articulation_type, gravity_enabled | ||
| ): | ||
| """After ``write_joint_position_to_sim_index`` (no sim step), the mass matrix read | ||
| must reflect the new joint state. | ||
|
|
||
| The mass matrix depends on ``q`` (joint positions) through the body-spatial-inertia | ||
| transformation in eval_mass_matrix's ``compute_body_spatial_inertia`` step, which | ||
| reads ``state.body_q``. Same FK-staleness pattern as the Jacobian. | ||
| """ | ||
| articulation_cfg = generate_articulation_cfg(articulation_type=articulation_type) | ||
| articulation, _ = generate_articulation(articulation_cfg, num_articulations, device=device) | ||
| sim.reset() | ||
| sim.step() | ||
| articulation.update(sim.cfg.dt) | ||
|
|
||
| M_0 = articulation.data.mass_matrix.torch.clone() | ||
| q_target = articulation.data.joint_pos.torch.clone() + 0.5 | ||
| env_ids = wp.array([0], dtype=wp.int32, device=device) | ||
| articulation.write_joint_position_to_sim_index(position=q_target, env_ids=env_ids) | ||
| M_1 = articulation.data.mass_matrix.torch.clone() | ||
|
|
||
| assert not torch.allclose(M_0, M_1, atol=1e-3), ( | ||
| "mass_matrix did not change after manual joint write — " | ||
| "FK trigger likely missing before eval_mass_matrix (compute_body_spatial_inertia " | ||
| "reads stale state.body_q)." | ||
| assert not torch.allclose(M_0, articulation.data.mass_matrix.torch, atol=1e-3), ( | ||
| "mass_matrix did not change after manual joint write; FK trigger likely missing" | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("num_articulations", [1]) | ||
| @pytest.mark.parametrize("device", test_devices(DeviceScope.CUDA)) | ||
| @pytest.mark.parametrize("articulation_type", ["panda"]) | ||
| @pytest.mark.isaacsim_ci | ||
| def test_gravity_compensation_refreshes_after_manual_joint_write(sim, num_articulations, device, articulation_type): | ||
| """After ``write_joint_position_to_sim_index`` (no sim step), the gravity | ||
| compensation read must reflect the new joint state. | ||
|
|
||
| ``g(q)`` depends on ``q`` through the RNEA pass in ``eval_inverse_dynamics_passive``, | ||
| which reads ``state.body_q``. Same FK-staleness pattern as the Jacobian and | ||
| the mass matrix. Gravity stays enabled (the default) — with gravity off, | ||
| ``g(q)`` is identically zero and the assert would be vacuous. | ||
| """ | ||
| articulation_cfg = generate_articulation_cfg(articulation_type=articulation_type) | ||
| articulation, _ = generate_articulation(articulation_cfg, num_articulations, device=device) | ||
| sim.reset() | ||
| sim.step() | ||
| articulation.update(sim.cfg.dt) | ||
|
|
||
| g_0 = articulation.data.gravity_compensation_forces.torch.clone() | ||
| q_target = articulation.data.joint_pos.torch.clone() + 0.5 | ||
| env_ids = wp.array([0], dtype=wp.int32, device=device) | ||
| articulation.write_joint_position_to_sim_index(position=q_target, env_ids=env_ids) | ||
| g_1 = articulation.data.gravity_compensation_forces.torch.clone() | ||
|
|
||
| assert not torch.allclose(g_0, g_1, atol=1e-3), ( | ||
| "gravity_compensation_forces did not change after manual joint write — " | ||
| "FK trigger likely missing before eval_inverse_dynamics_passive." | ||
| assert not torch.allclose(g_0, articulation.data.gravity_compensation_forces.torch, atol=1e-3), ( | ||
| "gravity_compensation_forces did not change after manual joint write; FK trigger likely missing" |
There was a problem hiding this comment.
Shared refresh weakens coverage
The test reads body_link_jacobian_w first, which refreshes the FK state shared by all four accessors. The later body_com_jacobian_w, mass_matrix, and gravity_compensation_forces checks therefore run with FK already refreshed and would still pass if their own refresh calls were removed. Re-invalidate FK before each check or parameterize the test so each accessor is the first read after a joint write.
There was a problem hiding this comment.
Isaac Lab Review Bot
The test-only consolidation largely preserves existing coverage and reduces repeated simulation setup, but the merged dynamics-accessor refresh test no longer independently verifies FK invalidation for three accessors.
- Design and architecture: Grouping related checks into shared scenes is appropriate for reducing Newton test runtime. However, FK-refresh behavior is stateful, so sharing one stale-to-fresh transition across multiple accessor assertions weakens the intended regression coverage.
- API: No production or public API is changed. The test helper cleanup is internally consistent, and the
.skipchangelog fragment appropriately records a non-user-visible test-only change. - Implementation: In
test_dynamics_accessors_refresh_after_manual_joint_write, one joint write marks FK stale, but the firstbody_link_jacobian_wread refreshes the shared FK state. Subsequent reads ofbody_com_jacobian_w,mass_matrix, andgravity_compensation_forcestherefore cannot detect removal of their own FK-refresh triggers. Re-mark FK stale, such as by repeating the joint write, before each accessor assertion.
Minor fixes needed. Posted 1 actionable finding inline.
Automated review; human maintainers own approval decisions.
| "mass_matrix did not change after manual joint write — " | ||
| "FK trigger likely missing before eval_mass_matrix (compute_body_spatial_inertia " | ||
| "reads stale state.body_q)." | ||
| assert not torch.allclose(M_0, articulation.data.mass_matrix.torch, atol=1e-3), ( |
There was a problem hiding this comment.
🟡 Warning · Implementation — Chained reads void three FK-refresh assertions
All four accessors are read after one joint write. As the test's own comment states, the write marks FK stale via a single _fk_timestamp, so the first read (body_link_jacobian_w) runs forward() and refreshes body_q. The later COM-Jacobian, mass-matrix and gravity reads then see fresh poses even if their own FK trigger were removed — the exact regressions the docstring claims to catch. Re-write the joint state before each accessor read.
…aaclab-newton-tests-2 # Conflicts: # source/isaaclab_newton/test/assets/test_articulation.py
|
run-ci |
|
run-ci |
|
run-ci |
# Description Second pass over the `isaaclab_newton` test suite after isaac-sim#7306. The goal is the same: cut CI runtime by removing tests that produce no verdict and by collapsing groups of tests that rebuild the same simulation to check one accessor each, while keeping every distinct behavioral check. **Removed (no verdict produced)** - `test_articulation.py`: `test_initialization_hand_with_tendons` and `test_spatial_tendons` always skipped (shadow hand / spatial tendons are unsupported on Newton); the `shadow_hand` fixture branch and its sim config go with them. `test_setting_gains_from_cfg_dict` was byte-for-byte the same check as `test_setting_gains_from_cfg`. - `test_rigid_object.py`: four permanently skipped tests (kinematic bodies, no-friction, static friction, restitution) and the material helper only they used. `test_rigid_object_collection.py`: the permanently skipped kinematic test. - `test_contact_sensor.py`: the `newton_contacts` cases of the force-matrix, contact-point and finger-isolation tests were non-strict `xfail`s. They ran the full 240-step settle (and the Allegro drop with `flaky` reruns) and could neither fail nor pass the build. They are now `skip` with the same reason, so the known gap stays visible in the report. **Consolidated (same assertions, fewer simulations)** - Dynamics accessor shape contracts: six tests (`J`/`M`/`g` × fixed/floating base) each spun up their own sim per batch size. One `test_dynamics_accessor_shapes` reads all three accessors per (asset, batch) and keeps the positive-diagonal mass-matrix check. 12 sims → 4. - FK-refresh after a manual joint write: three tests → one `test_dynamics_accessors_refresh_after_manual_joint_write` that checks `J`, `M` and `g` on both assets. Gravity stays on so the `g(q)` assertion is not vacuous. - Config-validation failures (out-of-range default joint pos/vel, valid/invalid explicit articulation root) are device independent; each pair is now one parametrized CPU test. - External-force tests reran an identical reset+force cycle five times; two cycles still cover the alternating local/global variants and the re-application after reset. - PVA/IMU: initialization + shape checks merged; the at-rest gravity and velocity checks shared the same 200/500-step settle and are now read from one scene. Free-fall acceleration and growing-speed checks share one scene. - Joint wrench: partial and full reset checks run on the same 4-env scene. - Frame view (`test_views_xform_prim_newton.py`): body/shape-path rejection, world-attached read/write, and clone-plan vs post-reset resolution each collapsed into one scene. - Newton schemas: each authored/unset pair now authors both prims in one stage instead of two `SimulationContext`s. - Ray-cast sensor: the two FK-refresh-after-carrier-write checks run on one scene. - Frame transformer: 100 steps with a reset every 25 → 50 steps (two reset cycles); the per-step assertions are unchanged. - `test_site_injection.py`: two tests made the identical call and split the assertions. ## Before and after measurement Per-file wall time from the CI-style per-file runner on the same workstation (RTX PRO 6000), warm Warp cache, changed files only: | File | Cases before | Cases after | Before | After | |---|---:|---:|---:|---:| | `assets/test_articulation.py` | 194 + 4 skipped | 177 | 298.6 s | 232.8 s | | `sensors/test_contact_sensor.py` | 67 + 8 xpassed | 67 + 8 skipped | 87.8 s | 64.9 s | | `assets/test_rigid_object_collection.py` | 54 + 8 skipped | 53 | 52.4 s | 48.8 s | | `assets/test_rigid_object.py` | 58 + 16 skipped | 52 | 48.8 s | 47.1 s | | `sim/test_views_xform_prim_newton.py` | 60 | 54 | 44.6 s | 42.2 s | | `sensors/test_frame_transformer.py` | 9 | 9 | 23.5 s | 21.3 s | | `sensors/test_newton_raycast_sensor.py` | 18 | 16 | 20.6 s | 18.9 s | | `sensors/test_joint_wrench_sensor.py` | 10 | 9 | 19.1 s | 16.9 s | | `sensors/test_pva.py` | 10 | 6 | 17.0 s | 14.1 s | | `sensors/test_imu.py` | 7 | 5 | 14.7 s | 13.1 s | | `sim/test_newton_schemas.py` | 20 | 14 | 7.7 s | 6.7 s | | `sensors/test_site_injection.py` | 27 | 26 | 5.3 s | 5.4 s | | **Total (changed files)** | | | **640 s** | **532 s** | The whole `isaaclab_newton` suite measured 16 min 20 s before the change on this machine; the changed files account for the full 108 s saved (about 11%). The largest single win is `test_articulation.py`, which is 30% of the suite. ## Type of change - Test and CI performance improvement (non-breaking) ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump `extension.toml` — CI handles that) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there (cherry picked from commit d0864da)
…#7610, #7603) (#7907) ## Description Backports #7610 and #7603 to `release/3.0.0` to reduce repeated installation and Newton simulation setup in CI while retaining the distinct behavioral checks. | Source | Change | | --- | --- | | #7610 (`f0a7a94d276c8eb8eb74c8bdbb51a03696f76480`) | Consolidate installer environment builds and import checks; use `core` for the system-Python smoke; run camera probes once on the wheel path. | | #7603 (`d0864daafb15cf18d663e63cdd99185e9a156e89`) | Consolidate Newton accessor, schema, sensor, and reset checks; remove duplicate or permanently unsupported tests; skip the known nondeterministic Newton contact cases. | Both source patches applied onto release commit `ff22c52891` without conflicts or changes. Includes the original changelog fragments and author attribution. ## Validation - Installer and wheel metadata tests: **72 passed**. - Installation-CI runner tests: **3 passed**. - Installation suite collection with Docker selection and the timeout plugin: **60 tests collected**. - All 12 changed Newton test files, run in separate processes: **502 passed, 10 skipped**. Eight skips cover the known Newton contact limitations from #7603; two skip the Newton-actuator path unavailable in the local runtime. - `uv run --no-sync isaaclab -f`: all checks passed with changelog validation against the release base. - File-by-file source audit, release-metadata preservation checks, and `git diff --check`: passed. Local Newton validation used RTX 5090, PyTorch 2.12, Newton 1.6.0rc1, MuJoCo Warp 3.12, and Isaac Sim 6.0.1. Release CI uses the pinned Newton 1.6.0 and Isaac Sim 6.1 versions. The full fresh-environment installation matrix was not rerun locally. The source installation PR passed both [ARM](https://github.com/isaac-sim/IsaacLab/actions/runs/35478221079/job/105991131510) and [x86](https://github.com/isaac-sim/IsaacLab/actions/runs/35478221079/job/105991131535) installation CI. ## Release backport Targets `release/3.0.0` directly; no further backport requested. --------- Co-authored-by: Mustafa H <[email protected]>
…7530, #7899) (#7926) ## Description Backports the two changes merged into `develop` since September 19 that are still missing from `release/3.0.0`: | Source PR | Change | Source commit | | --- | --- | --- | | #7530 | Validate camera outputs against renderer capabilities before simulator startup | `31d1c53510490c76841e9c35a329574b357d9900` | | #7899 | Share native resources by construction cfg and centralize ownership and teardown | `c90c3a1097a0a669a823b880b1c8d0654d7fd267` | Includes the original regression tests, API documentation, and changelog fragments. #7530 applied without changes. #7899 required two conflict resolutions to retain the release branch's OVRTX mapping API, documentation, and tests. Of its 62 files, 59 match the merged source exactly; the other three retain those existing release additions. Release versions, lockfile entries, compiled changelogs, and documentation routing are preserved. ## Audit Checked all **33 PRs** merged from September 19, 2026 00:00 America/Los_Angeles through `develop` commit `c90c3a1097` (September 20, 21:29 Pacific), against release base `75e9c8ce12`. **31 are already backported; the remaining two are included here.** Git first-parent history and GitHub's merged PR list agree. Automatic changelog/version compilation remains branch-specific. <details> <summary>31 PRs already recorded in release</summary> | Source PRs | Existing release commit | | --- | --- | | #7777, #7608, #7895, #7872, #7831, #7834, #7838, #7840, #7903, #7674 | [`ff22c52891`](ff22c52) | | #7886 | [`41bfaee5f0`](41bfaee) | | #7042 | [`970d21ef48`](970d21e) | | #7905 | [`f0563d1f9e`](f0563d1) | | #7604 | [`dca7cfe984`](dca7cfe) | | #7610, #7603 | [`5dd2220243`](5dd2220) | | #7839 | [`b8b93bb96e`](b8b93bb) | | #6851 | [`baa025ad90`](baa025a) | | #7250 | [`f86b33e6b1`](f86b33e) | | #7910 | [`24f7b4842b`](24f7b48) | | #7810 | [`9738e096c8`](9738e09) | | #7832 | [`be270ed88b`](be270ed) | | #4679 | [`80157aa22d`](80157aa) | | #7914 | [`01b59b5a22`](01b59b5) | | #7502 | [`db7db61f60`](db7db61) | | #7918 | [`bca9dba8bb`](bca9dba) | | #7919 | [`ef1514c97c`](ef1514c) | | #7922 | [`7d6979a19e`](7d6979a) | | #7923 | [`a1dd560b98`](a1dd560) | | #7924 | [`892e51dc1d`](892e51d) | | #7925 | [`75e9c8ce12`](75e9c8c) | </details> ## Validation **745 tests passed** on the combined backport: - Core registry, configclass, replication, camera contracts, and task presets: 158 passed. - Newton manager/model/reset and coupling suites: 299 passed. - OVPhysX/OVRTX lifecycle, scene data, bindings, and material contracts: 141 passed on CPU. - Clone-plan algebra: 83 passed. - All 8 OV CUDA cases skipped in the CPU run: 8 passed on GPU. - OVPhysX ray-caster regression: 1 passed. - Kit simulation-context and PhysX scene-data tests: 54 passed. - Newton solver reset integration: 1 passed. The registry-identity and borrowed-config-field regressions both fail with the pre-backport implementations and pass with this change. Backport file-scope validation, source-file comparison, `git diff --check`, and `uv run isaaclab -f` passed. Local validation used PyTorch 2.12.0/CUDA 13.0, Isaac Sim 6.0.1.0, Newton 1.6.0rc1, and an RTX 5090. Existing deprecation/runtime warnings occurred. Full Docker CI is requested separately against the pinned environment; local checks do not claim a startup or runtime speedup. ## Checklist - [x] Read the contribution guidelines and ran formatting/changelog checks. - [x] Included source tests, documentation, and changelog fragments. - [x] Verified regression behavior and preserved release-specific changes. - [x] Recorded source commit hashes and audited the requested merge window. --------- Co-authored-by: Antoine RICHARD <[email protected]> Co-authored-by: ooctipus <[email protected]>
Description
Second pass over the
isaaclab_newtontest suite after #7306. The goal is the same: cut CI runtime by removing tests that produce no verdict and by collapsing groups of tests that rebuild the same simulation to check one accessor each, while keeping every distinct behavioral check.Removed (no verdict produced)
test_articulation.py:test_initialization_hand_with_tendonsandtest_spatial_tendonsalways skipped (shadow hand / spatial tendons are unsupported on Newton); theshadow_handfixture branch and its sim config go with them.test_setting_gains_from_cfg_dictwas byte-for-byte the same check astest_setting_gains_from_cfg.test_rigid_object.py: four permanently skipped tests (kinematic bodies, no-friction, static friction, restitution) and the material helper only they used.test_rigid_object_collection.py: the permanently skipped kinematic test.test_contact_sensor.py: thenewton_contactscases of the force-matrix, contact-point and finger-isolation tests were non-strictxfails. They ran the full 240-step settle (and the Allegro drop withflakyreruns) and could neither fail nor pass the build. They are nowskipwith the same reason, so the known gap stays visible in the report.Consolidated (same assertions, fewer simulations)
J/M/g× fixed/floating base) each spun up their own sim per batch size. Onetest_dynamics_accessor_shapesreads all three accessors per (asset, batch) and keeps the positive-diagonal mass-matrix check. 12 sims → 4.test_dynamics_accessors_refresh_after_manual_joint_writethat checksJ,Mandgon both assets. Gravity stays on so theg(q)assertion is not vacuous.test_views_xform_prim_newton.py): body/shape-path rejection, world-attached read/write, and clone-plan vs post-reset resolution each collapsed into one scene.SimulationContexts.test_site_injection.py: two tests made the identical call and split the assertions.Before and after measurement
Per-file wall time from the CI-style per-file runner on the same workstation (RTX PRO 6000), warm Warp cache, changed files only:
assets/test_articulation.pysensors/test_contact_sensor.pyassets/test_rigid_object_collection.pyassets/test_rigid_object.pysim/test_views_xform_prim_newton.pysensors/test_frame_transformer.pysensors/test_newton_raycast_sensor.pysensors/test_joint_wrench_sensor.pysensors/test_pva.pysensors/test_imu.pysim/test_newton_schemas.pysensors/test_site_injection.pyThe whole
isaaclab_newtonsuite measured 16 min 20 s before the change on this machine; the changed files account for the full 108 s saved (about 11%). The largest single win istest_articulation.py, which is 30% of the suite.Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bumpextension.toml— CI handles that)CONTRIBUTORS.mdor my name already exists there