Repository navigation
Conversation
A hard reset (a further sim.reset()) dispatches STOP, keeps the builder and its site map, and finalizes a new model from them. On STOP, the Newton IMU, PVA and frame transformer registered their sites again under fresh labels, and start_simulation injected these into the kept, already replicated builder. With several environments the reset then failed: an asset view on the body saw an inconsistent shape layout, or the frame transformer's site-map check failed. With one environment, a sensor that registers its site only once, such as the ray caster, could find its label pointing at another sensor's new site and report that body's pose. The kept builder still holds the sites after a hard reset, and close() clears the site registry after STOP, so the sensors now keep the labels from __init__. The hard reset also clears the registries of native IMU and frame transform sensors, which gained one stale entry per reset; stale IMU entries were still updated on every step. On initialization, the frame transformer replaced its configured target names with one name per matched body, and the next initialization read the configured names from that list by target index. After a hard reset, a target that follows a wildcard target took the name of a body that the wildcard matched. The configured names are now kept separately.
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryFixes Newton sensor behavior across hard resets.
No actionable issues were found. Tests were not run during this review. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Hard sim.reset()"] --> B["STOP invalidates sensor handles"]
B --> C["Clear native sensor lists"]
C --> D["Close old model; retain builder and site map"]
D --> E["Finalize new model"]
E --> F["PHYSICS_READY recreates native sensors"]
F --> G["Resolve retained site labels and configured target names"]
Reviews (1) · Last reviewed commit: "Keep Newton sensor sites and target name..." · Reviewed by Greptile |
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Scope and over-engineering (1). Other reviewed categories look good.
- PR description: The body matches the diff, but validation labeled “before the target-name change” is stale; rerun those tests on the final revision or remove that claim.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: Minimal implementation: extend NewtonManager.reset and existing IMU, PVA, and frame-transformer callbacks; delete _target_frame_cfg_names and derive configured names from cfg at use; keep the changelog and hard-reset regression test. No added source modules require disposition. Replace with one smaller PR: these six files, validated by test_site_injection.py.
- API: API changes look good.
- Compatibility and deprecation: No breaking changes identified.
- Implementation: Implementation looks good.
- Style consistency: Style consistency looks good.
- Test quality: Test quality looks good.
Minor fixes needed. Posted 1 inline finding.
Automated review; human maintainers own approval decisions.
| self._num_targets += 1 | ||
|
|
||
| # Configured names: initialization replaces the body names with one entry per matched body. | ||
| self._target_frame_cfg_names = list(self._target_frame_body_names) |
There was a problem hiding this comment.
🟡 Warning · Scope Complexity — Third copy of configured target names
This duplicates the list built at line 89 and recomputed verbatim at line 96, adding long-lived state that must stay in sync for one read. Delete it and compute the configured names from self.cfg.target_frames in…
Initialization replaces the target name lists with the expanded names, so the configured names are now built from the cfg where they are used instead of being kept as a third copy.
|
Thanks for the review! The sites are added to the prototype builders before replication, so the builder that the hard reset keeps already holds them in every world, with per-world indices from replication. Since the hard reset does not replicate again, a site registered again on |
…fix/newton-hard-reset-sites # Conflicts: # source/isaaclab_newton/isaaclab_newton/physics/newton_manager.py # source/isaaclab_newton/isaaclab_newton/sensors/frame_transformer/frame_transformer.py # source/isaaclab_newton/isaaclab_newton/sensors/imu/imu.py # source/isaaclab_newton/isaaclab_newton/sensors/pva/pva.py # source/isaaclab_newton/test/sensors/test_site_injection.py
## Description Specialized consumers rediscovered scene bodies or assumed every cloned environment had USD geometry. Sensor reads could also retain articulation poses from before a state write, or bind different sites after a Newton hard reset. This change uses existing scene ownership and repairs those lifecycle boundaries. - **Ray casters:** bind tracked meshes and OVPhysX sensor frames to exact native body paths. The shared ray-caster initializer resolves the scene-data provider once; leaf consumers use that bound dependency. Persistent `int32` index arrays use `-1` for static and padded slots, with one per-slot check in Warp and a separate all-static fast path. Missing native target bodies produce an error naming the target and body. - **Pose writes and environment coverage:** refresh pending articulation kinematics before PhysX ray-caster frame reads and TacSL force-field reads. Require one ray-caster mount per environment before allocating ray output buffers; preserve heterogeneous target counts and padded target slots. - **Newton hard resets:** retain builder-owned sites, replace native IMU/frame-transform sensor objects with the model, and expand frame names from configuration on each initialization. Remove the duplicated target-name field. - **TacSL:** resolve the authored contact mesh and destination expression from clone sources, including custom namespaces, and require exactly one SDF mesh. - **cuRobo:** import the selected world's source geometry when its native copy has no USD prims. A temporary USD projection feeds the existing importer and is discarded after initialization; asset data supplies dynamic poses. Remove six private wrappers and duplicate pose-buffer fields. Newton keeps one sensor-site label, and PhysX allocates pose buffers directly in Warp. No new public configuration fields, production modules, or runtime resource owners. **Size:** production **+244 / −737** (net **−493**); whole PR **+801 / −910** (net **−109**), including regression coverage, documentation, and changelogs. No new test files. ## Related fixes and scope - Covers the exact body/environment mapping problems in #8678 and #8676 through the shared provider, with consolidated heterogeneous-link and native-clone regression scenes. - Incorporates the site/reset lifecycle fixes from #8674. - Includes the ray-caster and TacSL read paths from #8663, and the ray-caster mount validation from #8655. Their changes to other sensor families remain separate. Missing target meshes remain supported by padded slots. - The output reshapes proposed by #7034 are already corrected in this base. Its remaining stricter input-layout policy stays in that utility PR. - No unmerged PR dependency is required. Fixes #8677. Fixes #8675. Fixes #8673. ## Validation at `9db57d446` GPU0 / RTX 5090, **62 focused tests passed**: - PhysX ray-caster integration: 9; standard ray-caster graph tests: 5. - OVPhysX ray casters: 2, including 16 interleaved articulation environments and rejection of partial native mounts. - Newton ray casters: 8; site/index/lifecycle tests: 12, including three hard resets at both one and two environments with ray caster, IMU, PVA and frame transformer. - TacSL: 10, including custom clone namespaces and tactile points immediately after an articulation root write. - Ray-caster kernel and ownership gates: 16. The new pose-write, mount-count, tactile-write and hard-reset regressions fail on the previous head `338d3161` and pass with this change. The consolidated PhysX scene also rejects a deliberate mutation that lets `-1` slots consume a body transform: its missing-target ray incorrectly hits at 1 m instead of the static ground. A central existence/ownership audit checked all 13 changed production modules: the existing file tree is retained, old target-view hooks remain absent, leaf consumers do not rediscover the provider, and Newton STOP callbacks do not register sites again. `uv run isaaclab -f`, the changelog gate against `73f275291`, and `git diff --check` passed. Tests stay in the existing suites. Exact SDF-count assertions reject a broken-discovery mutation that passed the former loose assertion. The Newton reset and OV ray-caster cases honor the runtime GPU mask and passed on `cuda:1`. **Broader suite limitation from the expansion validation:** the broader Newton frame-transformer file has 1 passing case and 2 failures compiling MuJoCo Warp's tiled Cholesky kernel (`nvJitLink` error 6 / NVVM container error). The same two cases fail on unchanged `338d3161`, before this expansion; the focused hard-reset/name regression passes. These compiler failures remain visible rather than being skipped. The unchanged cuRobo implementation retains the previously recorded five native-Newton obstacle-planning cases and PhysX pick-and-stack validation. ## Simplification performance check Compared `3808d2361` → `9db57d446` on GPU0 / RTX 5090 at 1,024 environments and 441 rays per environment, with the same workload and sampling method recorded below. Three alternating fresh-process pairs measured median paired refresh / full-step changes of **−7.3% / −3.0% for PhysX** and **−3.2% / +0.2% for Newton**. PhysX varied between processes: refresh changes ranged from −17.8% to +17.4%, and full-step changes from −12.3% to +5.4%. One additional native-Newton control pair measured +0.6% / +0.3%. **All seven paired hit buffers matched bit-for-bit.** Training FPS was not measured. <details> <summary>Earlier performance measurements, startup costs, and pinned methodology</summary> ## Expansion performance check Compared `338d3161` → `3808d2361` on GPU0 / RTX 5090, using the same four-cube, 441-ray workload as below at 1,024 environments. Three fresh process pairs alternated revision order; each used 30 warm-up steps, 100 synchronized refresh samples, and five batches of 100 complete steps. These are **median paired changes**: - Newton, four targets: refresh **+0.6%**, full step **0.0%**. - OVPhysX, four targets: refresh **−2.6%**, full step **−2.8%**. - PhysX, four targets: refresh **−1.6%**, full step **+8.4%** in the short runs. - PhysX, one tracked target: refresh **−5.7%**, full step **+1.5%**. The short PhysX full-step increase did not persist at that size in a longer confirmation: three new alternating pairs, 200 warm-up steps, 500 refresh samples, and 20 batches of 500 complete steps measured median paired changes of **+0.5% refresh and +1.6% full step**. Full-step changes ranged from **−5.2% to +2.9%**. All 12 initial paired hit buffers and all three confirmation pairs matched bit-for-bit. These checks do not establish a new training/FPS claim. ## Original scene-binding performance **Four-target sensor refresh took 18–52% less time.** The full physics-and-sensor loop ranged from 16.5% less time to 0.7% more time. Startup did not uniformly improve: Newton at 1,024 environments added 0.26 s, and OVPhysX added 0.10–0.45 s. Before (`73f275291`) → PR (`c893dd599`), on GPU0 / RTX 5090. Lower is better. This is a synthetic ray-caster workload with four rigid cubes and one 441-ray grid per environment; task/training FPS was not measured. | Physics | Environments | Initialization (s) | Sensor refresh (ms) | Physics + sensor step (ms) | |---|---:|---:|---:|---:| | Newton MJWarp | 1,024 | 3.31 → 3.57 | 0.359 → 0.172 | 0.356 → 0.320 | | Newton MJWarp | 4,096 | 4.03 → 4.02 | 0.543 → 0.391 | 0.714 → 0.719 | | OVPhysX | 1,024 | 2.48 → 2.58 | 0.372 → 0.284 | 1.392 → 1.394 | | OVPhysX | 4,096 | 6.28 → 6.73 | 0.623 → 0.513 | 1.776 → 1.590 | | PhysX (Kit) | 1,024 | 1.75 → 1.72 | 0.471 → 0.328 | 1.186 → 0.990 | | PhysX (Kit) | 4,096 | 3.29 → 3.25 | 0.721 → 0.572 | 1.462 → 1.379 | The multi-target gain comes from replacing separate target views/updates with one gather. OVPhysX now initializes its shared body table when the ray caster first requests it, which adds startup work when no earlier consumer has created that table. The benefit depends on target count: the longer one-target PhysX / 4,096 check measured median paired changes of **+5.4% for refresh (about 0.020 ms) and +1.2% for the full loop**. <details> <summary>One-target and native ray-caster controls</summary> The one-target cases retain all four bodies in the scene but track only one. Native cases use Newton’s BVH ray caster, with and without its query CUDA graph. | Control | Environments | Sensor refresh (ms) | Physics + sensor step (ms) | |---|---:|---:|---:| | Newton native / query graph | 1,024 | 0.082 → 0.082 | 0.282 → 0.280 | | Newton native / query graph | 4,096 | 0.241 → 0.238 | 0.551 → 0.553 | | Newton MJWarp / one target | 1,024 | 0.157 → 0.123 | 0.272 → 0.266 | | Newton MJWarp / one target | 4,096 | 0.211 → 0.210 | 0.480 → 0.482 | | OVPhysX / one target | 1,024 | 0.219 → 0.226 | 1.323 → 1.343 | | OVPhysX / one target | 4,096 | 0.320 → 0.322 | 1.540 → 1.518 | | PhysX (Kit) / one target | 1,024 | 0.266 → 0.275 | 1.024 → 1.009 | | PhysX (Kit) / one target | 4,096 | 0.365 → 0.368 | 1.152 → 1.239 | | Newton native / eager query | 1,024 | 2.884 → 2.874 | 3.008 → 3.065 | | Newton native / eager query | 4,096 | 2.945 → 2.910 | 3.024 → 3.001 | The initial one-target PhysX / 4,096 loop median was 1.152 → 1.239 ms (+7.6%). A longer confirmation used three fresh pairs, 200 warm-up steps, 500 refresh samples, and 20 batches of 500 steps. Paired refresh changes ranged from −3.6% to +8.0% (median +5.4%); paired loop changes ranged from −5.4% to +1.6% (median +1.2%). The initial 7.6% full-loop slowdown did not persist. </details> **Method:** Median of three fresh processes per revision, alternating base/head order, with the same locked dependencies and warm caches. Each process used 30 warm-up steps, 100 GPU-synchronized sensor-refresh samples, and five batches of 100 physics + scene-update + sensor-read steps (dt=0.01 s, zero gravity, no rendering). Newton physics used CUDA graphs; multi-mesh reads were eager. Initialization covers simulation/scene construction, reset, and the first sensor read; launcher startup and deferred first-physics-step graph capture are excluded. All 48 measured before/after hit-buffer pairs, plus the three longer confirmation pairs, matched bit-for-bit. **Additional consumer initialization:** in the existing PhysX cube-stack fixture, cuRobo collision-world import took **4.94 → 42.67 ms** (median of five alternating warm samples, GPU-synchronized). All three obstacle geometries and poses matched. The temporary source projection adds about **38 ms once per planner**; it adds no per-step work. This is import time, not full planner startup or training FPS. The original ray-caster measurements above are pinned to `c893dd599`. </details> ## Type of change - Bug fixes and internal refactoring; existing supported configurations retain their fields and construction API. ## Checklist - [x] Read the contribution guidelines. - [x] Ran formatting and changelog checks. - [x] Extended or consolidated existing regressions using the test-audit criteria. - [x] Audited the production file tree and ownership boundaries. - [x] Recorded numerical/performance evidence and the pre-existing compiler limitation.
|
Superseded by #8765, which includes this fix and its hard-reset test; the test passes on main, so I'm closing this. |
Description
On Newton, a hard reset (a further
sim.reset()) dispatchesSTOP, keeps the builder and its site map, andfinalizes a new model from the builder. On
STOP, the NewtonImu,PvaandFrameTransformerregistered theirsites again, and
start_simulationinjected them a second time into the kept, already replicated builder, underfresh labels. With several environments the second
sim.reset()failed. With one environment, a sensor thatregisters its site only once, such as the ray caster, could end up on another sensor's body (#8673).
STOPand keep the labels from__init__. On Newton,STOPcomes either from a hard reset, which keeps the builder and the site map, or from
NewtonManager.close(), whichclears the site registry right after
STOPand tears the sensors down. The re-registration therefore did nothingon teardown and duplicated the sites on a hard reset. The
body_qddrequests are unchanged.per reset, which kept the previous model alive; stale IMU entries were still updated on every step.
with one name per matched body and the next one looked them up by target index, so after a hard reset a target
that follows a wildcard target took another body's name.
Fixes #8673
Type of change
Release backport
developThe commit cherry-picks onto
release/3.0.0without conflicts. There, the new test fails without the fix and passeswith it.
Screenshots
Cases from the issue, Newton (MJWarp).
CubeAis at x = -0.5 m with one environment and at +0.5 m in environment 0with two:
CubeB)CubeA)sim.reset()ValueError: Articulation SHAPE layout is unavailableCubeA)Cube.*, thenCubeAnamedcube_a)['CubeA', 'CubeB', 'CubeB']['CubeA', 'CubeB', 'cube_a']Tests
isaaclab_newton/test/sensors/test_site_injection.py::test_hard_resets_keep_sensor_sites(new, one and twoenvironments): a ray caster on one cube registers its site before an IMU, a PVA and a frame transformer on another
cube, whose first target is a wildcard matching both cubes, followed by three
sim.reset()calls. The frametransformer must keep its target names, the ray caster must stay on its cube, the IMU, PVA and frame transformer
must read as in the first pass, and one native IMU and one frame transform sensor must remain.
develop, the one-environment case fails at the first hard reset with the target names['CubeA', 'CubeB', 'CubeB'](without that check, on the ray caster, which reports the other cube 1.0 m off),and the two-environment case fails at the second
sim.reset()with the SHAPE layout error.release/3.0.0(Newton 1.6.1), it fails as well; the two-environment case raises anIndexErrorin the raycaster's site lookup instead.
test_site_injection.pyhas 12 passed ondevelop9b6d2d8 (Newton 1.8.0.dev0, MuJoCo Warp3.15.0) and on
release/3.0.0b63cbde (Newton 1.6.1). Ondevelop,test_frame_transformer.py3 passed;before the target-name change also
test_imu.py2 passed,test_pva.py3 passed andtest_newton_raycast_sensor.py7 passed.pre-commit run --files), as dotools/changelog/cli.py checkandgit diff --check.Related
cl_register_sitecalls; whichever merges secondadapts.
order without conflicts, also with the release resolution described there.
Checklist
Docker and GPU tests run on demand. Push the commits you want tested, then
comment
run-cion the pull request.pre-commitchecks withuv run isaaclab --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bump package versions — CI handles that)CONTRIBUTORS.mdor my name already exists there