Repository navigation
Fix sensor freshness, reset cadence, and native coverage - #8780
Conversation
|
run-ci |
[Medium impact] The PR appears safe to merge; no actionable defects were found. SummaryThis PR fixes sensor freshness after state writes, keeps sensors due when a reset read skips capture, and rejects incomplete native bindings.
Acknowledged limitation: Review checks were static; no simulation tests were run. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Root or joint state write] --> B[Backend marks transforms dirty]
B --> C[Sensor or frame view reads]
C --> D[Backend resolves pending kinematics]
D --> E[Native buffers or Fabric transforms]
E --> F[Sensor measurement]
G[Sensor reset] --> H[Read reset values without capture]
H --> I[Keep environment due]
I --> J[First update after step captures]
J --> K[Restart update period]
Reviews (1) · Last reviewed commit: "Fix sensor observations after writes and..." · Reviewed by Greptile |
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Compatibility and deprecation (2), Implementation (1), Style consistency (2), Test quality (1). Other reviewed categories look good.
- PR description: The title and scope match the 39-file diff; replace vague validation claims with exact commands and provide baseline/head measurements for added per-capture kinematics calls, including hardware, backend, environment count, warmup, and step latency.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: No over-engineering issues.
- API: API changes look good.
- Compatibility and deprecation: Breaking changes: partial OVPhysX bindings now raise instead of adapting, without deprecation, and CPU PhysX overrides and retains an explicit Fabric publication setting; preserve old behavior with warnings and restore user state.
- Implementation: The optional hierarchy import silently skips world-transform propagation, leaving mounted-camera parent motion stale; import the capability directly or emit a clear runtime diagnostic when unavailable.
- Style consistency: Shared
_requires_physics_stepstate lacks the requiredClassVar[bool]annotation across its base definitions; add it and remove the newsim_ctxattribute alias. - Test quality: The AST scan asserts private assignment syntax and duplicates stronger backend coverage tests; delete it while retaining cadence, freshness, partial-coverage, and camera publication regressions.
Needs rework. Posted 6 inline findings.
Automated review; human maintainers own approval decisions.
| """Allocates the per-environment outdated flags, timestamps and elapsed times used to schedule updates. | ||
| def _check_env_count(self, count: int, prim_path: str, instances_per_env: int = 1) -> None: | ||
| """Reject native bindings that cannot be indexed with the scene's environment masks.""" | ||
| if count != self._num_envs * instances_per_env: |
There was a problem hiding this comment.
🔴 Critical · Compatibility — Partial native bindings now fail
OVPhysX contact, frame-transformer, and joint-wrench sensors previously sized themselves from the binding (clone_usd=False, partial clone combinations); this check now raises for those configurations. Keep the old behavior behind a deprecation cycle with warning and migration…
| coverage rather than resize those rows when some environments have no matching sensor body. | ||
| """ | ||
|
|
||
| _requires_physics_step = False |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Class variable missing ClassVar annotation
The coding style requires ClassVar[type] on class variables, and adjacent __backend_name__ follows it. Annotate _requires_physics_step: ClassVar[bool] here and in the four backend base sensors that override it.
| pytestmark = pytest.mark.unit | ||
|
|
||
|
|
||
| def test_native_sensors_preserve_shared_environment_count(): |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Remove AST source-grep test
This scans backend sensor modules for assignments to a private _num_envs name, asserting implementation syntax rather than behavior, and breaks under renames. The new per-backend coverage tests already own this contract; delete it.
| try: | ||
| from usdrt import hierarchy | ||
| except ImportError: | ||
| hierarchy = None |
There was a problem hiding this comment.
🟡 Warning · Implementation — Silent fallback disables hierarchy propagation
usdrt is imported unconditionally above, so this guard only creates a silent path where update_world_xforms() never runs and mounted-camera parent motion stays stale. Import it directly, or log when the capability is unavailable.
| is_gpu = "cuda" in self.get_device() | ||
| # CPU PhysX must publish Fabric transforms from startup; toggling it on demand only works on GPU. | ||
| if self._fabric is not None and not is_gpu: | ||
| sim.set_setting("/physics/fabricUpdateTransformations", True) |
There was a problem hiding this comment.
🟡 Warning · Compatibility — User Fabric setting overridden and never restored
An explicit /physics/fabricUpdateTransformations=False is discarded on CPU without notice and never restored on teardown, so later simulations inherit continuous publication. Warn per the ignored-setting rule and restore the prior value when the manager closes.
|
run-ci |
|
run-ci |
|
run-ci |
|
run-ci |
|
run-ci |
|
run-ci |
# Description USD polygon indices were passed directly to Warp as triangle indices, creating artificial interior faces. Triangulate them with the existing mesh utility before building the ray-caster mesh. A closed six-quad box now reports its outer surface correctly. Validate identical `(..., 3)` ray-start and direction shapes before flattening so mismatched arrays cannot reach the native query. This includes the remaining direction-shape validation from #7034; its output-reshape fix and #2416 are already covered on main. Fixes #3013 The shared distance-output proposal #2946 remains open. Existing `raycast_mesh(..., return_distance=True)` and Newton's `ray_distances` output remain available. This PR adds no sensor output or buffer and makes no drift-semantics changes (#4333). It is independent of #8780. ## Type of change - Bug fix ## Validation - The existing ray integration fixture checks the six-quad box's analytic outer-surface hits, misses, offsets, and maximum range. Removing the triangulation makes it fail on interior intersections. - Existing wrapper tests cover valid scalar/multidimensional ray layouts and output ordering, plus mismatched direction shapes. Removing the shape guard lets the surplus-direction case reach the native query and fail to reject invalid input. - 35 passed cases across the existing integration, wrapper, sensor, and Newton test files, including camera projection paths and Newton eager/captured distance queries. - Passed formatting, changelog validation, and a file-by-file ownership audit. Only the existing mesh loader and query wrapper change in production; no new modules, helpers, API fields, or buffers. ## 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 changelog fragment. - [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`.
|
run-ci |
|
run-ci |
1 similar comment
|
run-ci |
# Description On Newton, a hard `sim.reset()` closes the backend and rebuilds the model, but the sticky graph-replay flag `NewtonManager.transforms_may_change_on_graph_replay` carries over from the discarded graph. `forward()` then runs for the new model before `initialize_solver()` constructs its solver, so an asset pose read during the reset, such as one in a `PHYSICS_READY` callback, raises `RuntimeError: NewtonManager.initialize_solver() must run ...`. `_close_backend()` now clears the flag together with the graph it describes. `initialize_solver()` runs FK for the new model, so nothing pending is lost. The sensor-freshness part of the original PR (#8643) is covered on `main` by #8780 and #8782, and the pending-FK flag now lives on the backend that a hard reset recreates (#8733), so this PR is narrowed to the graph-replay flag. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `main` `release/3.0.0` predates #8733, so its backport clears `kinematics_dirty` and the graph-replay flag in `start_simulation()`. ## Tests `test_newton_manager_abstraction.py::test_reset_binds_consumers_before_constructing_the_solver` now sets the graph-replay flag before the hard reset and calls `forward()` in its `PHYSICS_READY` callback. On `main` (`9860e2bd86`) it fails with that `RuntimeError`; with this PR the file passes (106 passed). ## 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 `uv run isaaclab --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have validated the changed behavior with focused coverage and applied the [test-audit criteria](https://github.com/isaac-sim/IsaacLab/blob/develop/skills/developer/test-audit/SKILL.md) to any test changes - [x] 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) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
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.
SensorBaseowns 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
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_namescases hitnvJitLink/nvvmAddNVVMContainerToProgramcompilation errors. Both failures also reproduce with all changed Python files restored to currentmain(41480b9fc). The changed frame-transformer freshness case passes.Checklist
uv run isaaclab --format.CONTRIBUTORS.md.