Repository navigation
Conversation
Newton 1.4 deprecated the `sensing_obj_*` spellings on SensorContact. Newton's deprecated properties return the new attributes unchanged, so this is a pure rename with no behavior change, and it keeps the sensor working when Newton removes the aliases.
There was a problem hiding this comment.
Isaac Lab Review Bot
The contact-selector regex migration is documented and the raycast BVH requirement is moved to model finalization, but the retained registration-time fallback can still build a visible-only BVH and omit collision-only geometry.
- Design and architecture: Selecting
COLLIDE_SHAPESbefore builder creation is a sound lifecycle simplification for the standard scene path. However,_register_sensor_taskremains a supported fallback owner for missing shape BVHs and does not apply the manager’s selected shape flags. - API: The breaking change from glob and bare-label rewriting to full-matched regular expressions is documented in the public configuration docstrings and changelog migration guidance. The Newton 1.4
sensing_*migration is internal to the backend integration. - Implementation: When raycast registration encounters a model with shapes but no existing shape BVH, line 2599 calls
bvh_build_shapes(state)with the default visible-only selection. It should passshape_flags=cls._sensor_bvh_shape_flagsso this fallback preserves the raycast requirement to include collision-only shapes.
Minor fixes needed. Posted 1 actionable finding inline.
Automated review; human maintainers own approval decisions.
| NewtonManager._sensor_bvh_has_collision_shapes = True | ||
| elif model.bvh_shapes is None: | ||
| model.bvh_build_shapes(state) | ||
| if model.shape_count > 0 and model.bvh_shapes is None: |
There was a problem hiding this comment.
🟡 Warning · Design Architecture — Fallback BVH build ignores sensor shape flags
_sensor_bvh_shape_flags now owns which shapes the shared BVH must cover, but this retained fallback still calls model.bvh_build_shapes(state) with Newton's default visible-only flags. Whenever the model reaches registration without a shape BVH (the exact case this branch exists for, e.g. a builder not produced by create_builder or the lazily built shadow model from get_model()), a ray-cast sensor silently queries a BVH lacking COLLIDE_SHAPES and misses collision-only geometry that the removed rebuild covered. Pass shape_flags=cls._sensor_bvh_shape_flags here.
Greptile SummaryThis PR moves Newton contact selection to compiled full-match regular expressions and configures collision-shape BVH construction before model finalization to avoid raycast-time rebuilding.
Confidence Score: 4/5The PR should not merge until selector lists preserve independently valid regular expressions instead of potentially failing contact-sensor initialization. Joining selector entries before compilation makes a valid later expression containing global inline flags syntactically invalid, causing scene startup to fail for that configuration. Files Needing Attention: source/isaaclab_newton/isaaclab_newton/physics/newton_manager.py Important Files Changed
Sequence DiagramsequenceDiagram
participant Scene as InteractiveScene
participant Ray as NewtonRaycastSensor
participant Manager as NewtonManager
participant Builder as ModelBuilder
participant Model as Newton Model
Scene->>Ray: construct configured sensor
Ray->>Manager: add COLLIDE_SHAPES flag
Manager->>Builder: create_builder(shape_flags)
Builder->>Model: finalize shared shape BVH
Ray->>Manager: register raycast task
Manager->>Model: reuse finalized BVH
Reviews (1): Last reviewed commit: "Build the raycast BVH once during model ..." | Re-trigger Greptile |
| """Compile selector expressions for Newton's full label matching.""" | ||
| if not expr: | ||
| return None | ||
| return re.compile("|".join((expr,) if isinstance(expr, str) else expr)) |
There was a problem hiding this comment.
Selector alternation breaks regex flags
When a selector list has a later entry containing a valid global inline flag, such as (?i)bar, joining the entries before compilation places that flag in the middle of one expression, causing re.compile to raise and preventing the contact sensor and scene from initializing.
## Summary This PR is now the contact/raycast part of the Newton startup work: - compile contact-sensor full-path expressions once and match them directly, without regex-to-glob conversion or stage globbing; - use Newton's current contact-sensing API names; - declare raycast collision-shape requirements before model finalization, so the model builds one correctly configured BVH instead of rebuilding it during sensor initialization. The contact-selector and sensing-API commits retain Chris's (`camevor`) original authorship. The BVH lifecycle change incorporates the review from #7296 while keeping this as Chris's PR. The related ownership work is intentionally split by component: #7292 handles explicit global ownership, and #7295 handles model/articulation startup. This PR contains no inactive-solver registration or articulation-view changes and supersedes #7296. Production code is `+29/-56` (net `-27`) against `909cc5decc5`. ## Startup benchmark RTX 5090, CUDA device 1, 4096 environments, three fresh processes per revision/task. Values are median end-to-end startup wall time. Base: `909cc5decc5`. PR: `5d0e1b1595e`. | Task | Base | PR | Change | |---|---:|---:|---:| | `Isaac-Cartpole` | 8.316 s | 8.410 s | +1.1% | | `Isaac-Velocity-Rough-UnitreeGo2` | 16.363 s | 15.682 s | -4.2% | | `Isaac-Lift-KukaAllegro-Camera` | 39.473 s | 37.605 s | -4.7% | Cartpole has no contact/raycast workload here and is neutral within process-startup noise. The sensor-heavy tasks show the intended gain: | Median phase | Go2 base | Go2 PR | Kuka base | Kuka PR | |---|---:|---:|---:|---:| | `newton_contact_sensor` | 0.10 s | 0.04 s | 1.32 s | 0.24 s | | `simulation_start` | 6.36 s | 5.91 s | 11.48 s | 10.39 s | Raw end-to-end totals: - Cartpole base: 9.368, 8.316, 8.195 s; PR: 8.410, 8.370, 8.476 s. - Go2 rough base: 19.900, 16.363, 16.091 s; PR: 15.669, 15.682, 15.984 s. - Kuka camera base: 41.328, 38.625, 39.473 s; PR: 37.580, 37.605, 38.785 s. ## Test plan - `261 passed, 8 xpassed` across the Newton manager abstraction, contact-sensor, and raycast-sensor suites. - Repository formatting and pre-commit checks pass. - Architecture checks reject the removed regex-to-glob path, deprecated sensing names, duplicate BVH state, and late BVH fallback. - The three 4096-environment benchmark tasks also provide end-to-end Newton MJWarp startup coverage. ## Type of change - Performance improvement - Bug fix --------- Co-authored-by: Octi Zhang <[email protected]>
## Summary This PR is now the contact/raycast part of the Newton startup work: - compile contact-sensor full-path expressions once and match them directly, without regex-to-glob conversion or stage globbing; - use Newton's current contact-sensing API names; - declare raycast collision-shape requirements before model finalization, so the model builds one correctly configured BVH instead of rebuilding it during sensor initialization. The contact-selector and sensing-API commits retain Chris's (`camevor`) original authorship. The BVH lifecycle change incorporates the review from isaac-sim#7296 while keeping this as Chris's PR. The related ownership work is intentionally split by component: isaac-sim#7292 handles explicit global ownership, and isaac-sim#7295 handles model/articulation startup. This PR contains no inactive-solver registration or articulation-view changes and supersedes isaac-sim#7296. Production code is `+29/-56` (net `-27`) against `909cc5decc5`. ## Startup benchmark RTX 5090, CUDA device 1, 4096 environments, three fresh processes per revision/task. Values are median end-to-end startup wall time. Base: `909cc5decc5`. PR: `5d0e1b1595e`. | Task | Base | PR | Change | |---|---:|---:|---:| | `Isaac-Cartpole` | 8.316 s | 8.410 s | +1.1% | | `Isaac-Velocity-Rough-UnitreeGo2` | 16.363 s | 15.682 s | -4.2% | | `Isaac-Lift-KukaAllegro-Camera` | 39.473 s | 37.605 s | -4.7% | Cartpole has no contact/raycast workload here and is neutral within process-startup noise. The sensor-heavy tasks show the intended gain: | Median phase | Go2 base | Go2 PR | Kuka base | Kuka PR | |---|---:|---:|---:|---:| | `newton_contact_sensor` | 0.10 s | 0.04 s | 1.32 s | 0.24 s | | `simulation_start` | 6.36 s | 5.91 s | 11.48 s | 10.39 s | Raw end-to-end totals: - Cartpole base: 9.368, 8.316, 8.195 s; PR: 8.410, 8.370, 8.476 s. - Go2 rough base: 19.900, 16.363, 16.091 s; PR: 15.669, 15.682, 15.984 s. - Kuka camera base: 41.328, 38.625, 39.473 s; PR: 37.580, 37.605, 38.785 s. ## Test plan - `261 passed, 8 xpassed` across the Newton manager abstraction, contact-sensor, and raycast-sensor suites. - Repository formatting and pre-commit checks pass. - Architecture checks reject the removed regex-to-glob path, deprecated sensing names, duplicate BVH state, and late BVH fallback. - The three 4096-environment benchmark tasks also provide end-to-end Newton MJWarp startup coverage. ## Type of change - Performance improvement - Bug fix --------- Co-authored-by: Octi Zhang <[email protected]> (cherry picked from commit 21bc111)
Summary
This is the third and final scoped startup PR. It keeps sensor selection and shared scene-query resources explicit:
sensing_*names;COLLIDE_SHAPESbefore clone builders are created, so model finalization builds the shared shape BVH once;The production diff against the pinned base is
+34/-56(net-22).This carries forward the contact-regex work from #7269 and replaces its BVH fallback path with the deterministic scene lifecycle above. The other two PRs in the series are #7292 and #7295.
Startup benchmark
RTX 5090, CUDA device 1, 4096 environments, three fresh processes per revision/task. Values are median end-to-end startup wall time; raw runs are included below. Base:
7666bd8369a. PR:2bb0293da19.Isaac-CartpoleIsaac-Velocity-Rough-UnitreeGo2Isaac-Lift-KukaAllegro-CameraRaw totals:
Phase medians explain the sensor-heavy gains:
Test plan
261 passed, 8 xpassedacross the full Newton manager, contact-sensor, and raycast-sensor modules (CPU/CUDA, eager/CUDA graph).7666bd8369a: the contact contract fails during collection and both BVH architecture gates fail; all pass on this branch.