Repository navigation
[PR8] Share scene bindings for sensors and cuRobo - #8765
Conversation
|
run-ci |
[Medium impact] The PR appears safe to merge; no actionable issue was found. SummaryMulti-mesh ray casters now bind each tracked mesh to an exact body in the shared scene-data provider.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Selected meshes] --> B[Exact owning body paths]
B --> C[Stored body indices]
D[Physics body poses] --> E[Shared scene-data provider]
E --> F[Warp gather kernel]
C --> F
F --> G[Mesh poses]
G --> H[Ray hits]
I[Initial static poses] --> G
Reviews (1) · Last reviewed commit: "Share multi-mesh ray-cast body poses thr..." · Reviewed by Greptile |
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Implementation (1), Style consistency (1), Test quality (1). Other reviewed categories look good.
- PR description: The description matches the diff; add reproducible baseline/candidate update-latency and allocation evidence with revisions, workload, hardware, backend, environment count, and warmup for the removed per-update staging path.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: No over-engineering issues.
- API: API changes look good.
- Compatibility and deprecation: No breaking changes identified.
- Implementation: Missing scene-data body mappings raise an unlabeled
KeyError, obscuring the invalid target; raiseRuntimeErrorwith the target expression and body path. - Style consistency: The new tracked-target paragraph contradicts the preceding static-mesh statement; qualify that statement as applying to single-mesh ray casters.
- Test quality: The OVPhysX integration case lacks the sibling
ovphysx.typesimport gate, so OVRTX-only collection can fail instead of skipping; add the module-level gate.
Minor fixes needed. Posted 3 inline findings.
Automated review; human maintainers own approval decisions.
| :class:`isaaclab_newton.sensors.NewtonRaycastSensorCfg` to make that behavior | ||
| explicit and to access Newton-specific options. | ||
|
|
||
| For explicitly selected moving geometry, :class:`~sensors.MultiMeshRayCaster` and |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Docs contradict static-mesh statement above
Lines 18-20 still state that PhysX and OVPhysX configured meshes must remain static, which this paragraph contradicts for tracked multi-mesh targets. Qualify the earlier sentence as applying to single-mesh ray casters.
| mesh_ids[env_id, target_slice] = np.asarray(record_mesh_ids, dtype=np.uint64) | ||
| mesh_positions[env_id, target_slice] = np.asarray(record_positions, dtype=np.float32) | ||
| mesh_orientations[env_id, target_slice] = np.asarray(record_orientations, dtype=np.float32) | ||
| body_indices[env_id, target_slice] = [ |
There was a problem hiding this comment.
🟡 Warning · Implementation — Unmapped tracked body raises bare KeyError
A tracked owner missing from the provider's transform paths now fails with an unlabeled KeyError; the removed backend hooks raised named errors. Raise a RuntimeError naming the target expression and body path.
| ray_alignment="world", | ||
| ) | ||
|
|
||
| cfg = sim_utils.SimulationCfg(physics=OvPhysxCfg(), gravity=(0.0, 0.0, 0.0)) |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Missing ovphysx wheel skip gate
This test builds a real OvPhysx simulation, but the file has no gate; sibling OVPhysX sensor tests call pytest.importorskip("ovphysx.types") so OVRTX-only jobs skip instead of erroring. Add it at module top.
|
run-ci |
|
run-ci |
| else: | ||
| body_paths = sim_utils.find_matching_prim_paths(body_expr) | ||
| self._view_count = len(body_paths) | ||
| self._sensor_mapping = self._scene_data_provider.create_mapping(body_paths) |
There was a problem hiding this comment.
Is there code sharing opportunity for this part in general?
|
@StafaH I expanded this PR in 3808d23 and updated the description with the scope and validation. Here is how the linked work maps to the current implementation. Fully covered in this PR
The fixes from #8678, #8676, and #8674 are fully implemented and tested in #8765. No additional implementation from those PRs is needed for main. Applying these fixes to release branches is a separate backport step after merge. Partly incorporated; remaining work still needed
Separate attention
Your inline comments are also addressed: the shared ray-caster initializer resolves the provider once for its consumers, and the body-index array always exists with Validation: 62 focused cases passed. Two failures in the broader Newton frame-transformer suite reproduce on the unchanged previous head and fail during MuJoCo Warp kernel compilation. The updated description records that limitation and the numerical/performance comparisons. |
|
run-ci |
Remove six one-use wrappers, bind Newton sensors to one owned site label, and use the context and provider supplied by the existing initialization root. Allocate PhysX pose buffers directly in Warp and remove redundant buffer fields. Keep regression coverage in existing suites, require exact SDF error counts, honor runtime GPU selection, and extend the ownership gate for retired helpers.
|
run-ci |
1 similar comment
|
run-ci |
|
run-test |
|
run-ci |
# Description Newton PVA and frame readers could return stale state after root/joint writes. The existing manager-owned lazy state accessor now resolves pending kinematics, including for frame reads through `SceneDataProvider`. Reset establishes valid cleared measurement outputs. Reading that cache leaves sampling clocks untouched; the first positive-time update requests a measurement, then normal cadence resumes. Pose, ray, and image queries explicitly invalidate their derived caches during initialization/reset. `SensorBase` owns this lifecycle without sensor-type policy flags, and native kernels consume its masks without repeating readiness checks. Native bindings validate environment coverage instead of resizing shared rows and clocks. PhysX-mounted camera views use the native scene publisher and derive newly initialized mount matrices from live parent poses before the first read. Fabric selections retain ownership of matrix initialization; unused writable-parent seeding support is removed. RTX marker and runtime mesh edits explicitly invalidate the source camera cache so zero-time renders can see the edit without advancing sampling clocks. All five linked bugs are fixed by this PR. This completes the remaining main-branch sensor work from #8663 and #8655 after #8765. Release-branch backports require separate coordination. Fixes #8662 Fixes #8654 Fixes #8652 Fixes #8643 Fixes #8664 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Validation - CI follow-up: 136 passed, 5 expected skips across the scheduler, renderer-context, visualizer-adapter, the full RTX integration file (7 passed), and both GPU-1 Fabric configurations. The existing RTX integration test covers marker visibility/prototype changes and runtime geometry/material/texture edits. - Multi-GPU CI explicitly sets `ISAACLAB_FABRIC_USE_GPU_INTEROP=0`. The native GPU Fabric test now declares that capability requirement: GPU 1 with interop enabled passes all 25 cases; disabled interop passes 24 and skips only the native GPU Fabric case. All pose assertions are retained. The other 4 skips are GPU-only adapter cases in the CPU-only run. - Updated-main validation (`41480b9fc`): 184 passed, 3 existing non-default-GPU skips, and 2 existing compiler failures described below. Includes full Fabric/Newton/OV frame-view suites, scheduler, renderer, camera, Newton PVA, and manager capture/reset checks. - The existing Fabric fixture checks a body, its mount, a mount created after motion, and same-step native writes without `forward()`. The mounted-camera tests check pose and depth after motion, state writes, and resets. Removing the native initialization projection makes the mount assertion fail on the first read. - The existing manager contract exercises pending FK/reset work during a real graph capture and verifies that subsequent fresh reads consume it once. Architecture gates reject reset-policy flags, duplicate scheduling, leaf `forward()` calls, and retired Fabric seeding paths. - Passed formatting, changelog validation, and a file-by-file ownership audit. Production changes: 166 additions / 280 deletions across 41 existing files, with no new production modules. - Known local limitation: the two Newton `test_frame_transformer_duplicate_body_names` cases hit `nvJitLink` / `nvvmAddNVVMContainerToProgram` compilation errors. Both failures also reproduce with all changed Python files restored to current `main` (`41480b9fc`). The changed frame-transformer freshness case passes. ## Checklist - [x] I have read and understood the contribution guidelines. - [x] I have run the pre-commit checks with `uv run isaaclab --format`. - [x] I have updated the relevant documentation and changelog fragments. - [x] My changes introduce no new production warnings. - [x] I have validated the changed behavior and applied the test-audit criteria. - [x] I have added a changelog fragment for every touched package. - [x] My name already exists in `CONTRIBUTORS.md`.
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.
int32index arrays use-1for 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.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
Fixes #8677.
Fixes #8675.
Fixes #8673.
Validation at
9db57d446GPU0 / RTX 5090, 62 focused tests passed:
The new pose-write, mount-count, tactile-write and hard-reset regressions fail on the previous head
338d3161and pass with this change. The consolidated PhysX scene also rejects a deliberate mutation that lets-1slots 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 against73f275291, andgit diff --checkpassed.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 (
nvJitLinkerror 6 / NVVM container error). The same two cases fail on unchanged338d3161, 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→9db57d446on 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.Earlier performance measurements, startup costs, and pinned methodology
Expansion performance check
Compared
338d3161→3808d2361on 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: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.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.
One-target and native ray-caster controls
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.
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.
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.Type of change
Checklist