Skip to content

Fix sensor freshness, reset cadence, and native coverage - #8780

Merged
ooctipus merged 8 commits into
isaac-sim:mainfrom
ooctipus:fix/sensor-followups-pr8
Oct 23, 2026
Merged

ooctipus merged 8 commits into
isaac-sim:mainfrom
ooctipus:fix/sensor-followups-pr8

Conversation

@ooctipus

@ooctipus ooctipus commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • I have read and understood the contribution guidelines.
  • I have run the pre-commit checks with uv run isaaclab --format.
  • I have updated the relevant documentation and changelog fragments.
  • My changes introduce no new production warnings.
  • I have validated the changed behavior and applied the test-audit criteria.
  • I have added a changelog fragment for every touched package.
  • My name already exists in CONTRIBUTORS.md.

@ooctipus
ooctipus requested a review from a team October 22, 2026 06:22
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Oct 22, 2026
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable defects were found.

Summary

This PR fixes sensor freshness after state writes, keeps sensors due when a reset read skips capture, and rejects incomplete native bindings.

  • Physics-backed sensors keep their first post-reset capture due.
  • Native sensor bindings must cover the scene's environment rows.
  • Sensor and frame-view reads use the latest written body state.
  • PhysX-mounted Warp cameras follow current body and parent transforms.

Acknowledged limitation: ooctipus reports that two existing Newton duplicate-body-name tests fail with nvJitLink / nvvmAddNVVMContainerToProgram errors on both this branch and merged main.

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]
Loading

Reviews (1) · Last reviewed commit: "Fix sensor observations after writes and..." · Reviewed by Greptile

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_step state lacks the required ClassVar[bool] annotation across its base definitions; add it and remove the new sim_ctx attribute 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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 22, 2026
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added the ci:run-docker Trigger the on-demand Docker and GPU CI workflow label Oct 22, 2026
@isaaclab-bot isaaclab-bot Bot removed the ci:run-docker Trigger the on-demand Docker and GPU CI workflow label Oct 22, 2026
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

ooctipus added a commit that referenced this pull request Oct 22, 2026
# 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`.
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@ooctipus ooctipus added the ci:run-docker Trigger the on-demand Docker and GPU CI workflow label Oct 22, 2026
@ooctipus ooctipus self-assigned this Oct 22, 2026
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

1 similar comment
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Oct 22, 2026
@ooctipus
ooctipus merged commit 1d1a808 into isaac-sim:main Oct 23, 2026
59 checks passed
@ooctipus
ooctipus deleted the fix/sensor-followups-pr8 branch October 23, 2026 05:47
hujc7 pushed a commit that referenced this pull request Oct 29, 2026
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team

Projects

None yet

2 participants