Skip to content

Check the first reset camera observation before physics steps - #8427

Draft
Jean-Francois-Lafleche wants to merge 1 commit into
isaac-sim:mainfrom
Jean-Francois-Lafleche:test/first-reset-camera-observation
Draft

Jean-Francois-Lafleche wants to merge 1 commit into
isaac-sim:mainfrom
Jean-Francois-Lafleche:test/first-reset-camera-observation

Conversation

@Jean-Francois-Lafleche

@Jean-Francois-Lafleche Jean-Francois-Lafleche commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

The camera reset regression added in #7891 discards the first reset observation and checks only a later reset after ten physics steps. Its first reset also targets the USD spawn pose, making a stale spawn-pose image indistinguishable from the expected image.

Extend the same test with a deterministic reset event that moves the cube 15 cm from its spawn pose. Save the first reset depth observation before any public physics step, verify the reset state and zero step count, and compare its silhouette with a stabilized reference at the same physical pose. Retain the existing subsequent-reset pose, step-count, and silhouette assertions. The scene is reused; no additional scene build or production changes are introduced.

Related: #6394, #7891, #7138.

Validation on the latest release

Ran directly from this checkout on an A6000 with Isaac Sim 6.1.0.0, Torch 2.11.0+cu130, Warp 1.17.0, and NVIDIA driver 580.159.04. Runtime source paths were verified to resolve this checkout; no beta2 compatibility harness was used for these results.

Check Result
Original upstream reset test, copied from base commit 7cf8d41ed99eab9f8dc897f38639fed47635d997 into the same pytest context PASS — 1 passed
Improved reset test FAIL as expected — first-reset silhouette IoU 0.370, required >0.9
Entire modified camera test file 1 passed, 1 failed — texture coverage passes; the added first-reset assertion fails

The improved test verifies that the first-reset public physics count is zero and that the cube is already at the expected reset pose before comparing images. It verifies that the reference cube pose remains unchanged during stabilization.

Commands for the latest environment:

uv sync --frozen --extra isaacsim --extra test
HEADLESS=1 uv run --frozen --no-sync python -m pytest source/isaaclab/test/sensors/test_first_frame_textured_rendering.py::test_env_reset_restores_initial_pose_in_camera_observation -q -s
HEADLESS=1 uv run --frozen --no-sync python -m pytest source/isaaclab/test/sensors/test_first_frame_textured_rendering.py -q -s

Earlier A6000 validation on Isaac Sim 6.0.0.1 also reproduced the new assertion failure. A temporary explicit Fabric publication control made the test logic pass there; that control did not clear the failure on 6.1. No passing 6.1 runtime fix is claimed.

The full repository formatting/pre-commit checks, changelog gate, and git diff --check pass. The repository-wide GPU suite was not run.

This is a draft because the added regression exposes an unresolved first-reset synchronization failure on the latest supported runtime. A runtime fix that satisfies this coverage is needed before merging.

Type of change

  • Test coverage improvement

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Checklist

  • Read the contribution guidelines.
  • Run the repository formatting and pre-commit checks.
  • Validate the changed test logic and apply the test-audit criteria.
  • Add the test-only changelog skip fragment.
  • Add the contributor to CONTRIBUTORS.md.
  • Validate the new regression on Isaac Sim 6.1.

@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Oct 9, 2026
@pv-nvidia pv-nvidia mentioned this pull request Oct 9, 2026
6 of 8 tasks
ooctipus added a commit that referenced this pull request Oct 12, 2026
# Description

On GPU PhysX, the first camera observation from `env.reset()` showed
rigid bodies at their spawn pose. The state observations were correct. A
physics step made the image correct.

Fixes #8428. This PR includes the regression test from #8427 (commit by
@Jean-Francois-Lafleche).

## Root cause

The renderer is correct. Fabric is stale. After the first `env.reset()`
on `cuda:0`, the cube has these x positions:

| Source | x [m] |
| --- | --- |
| PhysX tensor view (`root_view.get_transforms()`) | -0.20 (reset pose)
|
| Fabric `omni:fabric:worldMatrix` | -0.35 (spawn pose) |
| Rendered silhouette | spawn pose |

The cause is the Fabric re-synchronization in `PhysxManager.play()`
(#5178, #5610). The sequence is:

1. `SimulationContext.reset()` calls `PhysxManager.play()` on the
initial stop-to-play transition.
2. `play()` calls `_sync_fabric_after_resume()`, which detaches and
re-attaches the `omni.physx.fabric` stage.
3. After the re-attach, `force_update()` ignores poses written through
the GPU tensor API until the next `simulate()`.
4. `ManagerBasedEnv.reset()` writes the reset pose through the GPU
tensor API. `forward()` calls `force_update()`, but Fabric keeps the
spawn pose.

These checks confirm the sequence:

* With `_re_sync_fabric()` disabled, the first reset frame shows the
reset pose at step 0.
* A raw `simulate()` before `env.reset()` also fixes the frame. The same
call at the end of `PhysxManager.reset()`, before `play()`, does not.
* `fabric.update()`, `fabricUseGPUInterop=false`, and an extra
detach/attach with `force_update()` do not fix the frame.
* The CPU pipeline is not affected.
* After the first physics step, later resets publish correctly without a
step. This is why the test from #7891 passes.

## Change

`PhysxManager.play()` now re-syncs Fabric only when the timeline resumes
from pause. A fresh stop-to-play transition does not need the #4279
workaround.

The #4279 workaround is still necessary on Isaac Sim 6.1. With the
re-sync removed completely, the Kit pause/resume test fails: the robot
stays frozen after resume (12 changed pixels, at least 100 required).

## Remaining PhysX defect

This PR avoids the defect at start-up only. The defect itself is in
`omni.physx.fabric` 110.3.2. After `detach_stage()` and
`attach_stage()`, `force_update()` does not publish GPU tensor API pose
writes until the next `simulate()`. The `force_update()` docstring says
that it updates Fabric "even if simulation did not run", so this
behavior is a PhysX defect. Thus, this sequence still returns a stale
first frame:

```python
sim.pause()
sim.play()      # re-attaches Fabric
env.reset()     # reset poses do not reach Fabric before a physics step
```

A PhysX ticket for this defect will be filed and linked in #8428. When
PhysX fixes it, Isaac Lab can remove the re-sync condition in `play()`.
If PhysX also fixes the #4279 resume freeze, Isaac Lab can remove the
detach/attach workaround.

## Validation

Isaac Sim 6.1.0.0, RTX A6000, driver 595.91.07:

| Test | Before | After |
| --- | --- | --- |
| `test_first_frame_textured_rendering.py` | first-reset test failed
(IoU 0.370) | 2 passed |
| `test_visualizer_integration_physx.py` (Kit pause/resume, #4279) | — |
passed |
| `test_simulation_context.py` | — | 26 passed |
| `test_simulation_context_kit.py` | — | 4 passed |

`test_visualizer_tiled_integration_physx.py` fails in my container with
`Canvas must be an instance of HeadlessCanvas` (pyglet). It fails the
same way without this change.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Release backport

- [ ] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Checklist

Docker and GPU tests run on demand. Push the commits you want tested,
then
comment `run-ci` on the pull request.

- [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

---------

Signed-off-by: JF Lafleche <[email protected]>
Co-authored-by: JF Lafleche <[email protected]>
Co-authored-by: pv-nvidia <[email protected]>
Co-authored-by: Octi Zhang <[email protected]>
pv-nvidia added a commit to pv-nvidia/pv-isaac-lab that referenced this pull request Oct 22, 2026
On GPU PhysX, the first camera observation from `env.reset()` showed
rigid bodies at their spawn pose. The state observations were correct. A
physics step made the image correct.

Fixes isaac-sim#8428. This PR includes the regression test from isaac-sim#8427 (commit by
@Jean-Francois-Lafleche).

The renderer is correct. Fabric is stale. After the first `env.reset()`
on `cuda:0`, the cube has these x positions:

| Source | x [m] |
| --- | --- |
| PhysX tensor view (`root_view.get_transforms()`) | -0.20 (reset pose)
|
| Fabric `omni:fabric:worldMatrix` | -0.35 (spawn pose) |
| Rendered silhouette | spawn pose |

The cause is the Fabric re-synchronization in `PhysxManager.play()`
(isaac-sim#5178, isaac-sim#5610). The sequence is:

1. `SimulationContext.reset()` calls `PhysxManager.play()` on the
initial stop-to-play transition.
2. `play()` calls `_sync_fabric_after_resume()`, which detaches and
re-attaches the `omni.physx.fabric` stage.
3. After the re-attach, `force_update()` ignores poses written through
the GPU tensor API until the next `simulate()`.
4. `ManagerBasedEnv.reset()` writes the reset pose through the GPU
tensor API. `forward()` calls `force_update()`, but Fabric keeps the
spawn pose.

These checks confirm the sequence:

* With `_re_sync_fabric()` disabled, the first reset frame shows the
reset pose at step 0.
* A raw `simulate()` before `env.reset()` also fixes the frame. The same
call at the end of `PhysxManager.reset()`, before `play()`, does not.
* `fabric.update()`, `fabricUseGPUInterop=false`, and an extra
detach/attach with `force_update()` do not fix the frame.
* The CPU pipeline is not affected.
* After the first physics step, later resets publish correctly without a
step. This is why the test from isaac-sim#7891 passes.

`PhysxManager.play()` now re-syncs Fabric only when the timeline resumes
from pause. A fresh stop-to-play transition does not need the isaac-sim#4279
workaround.

The isaac-sim#4279 workaround is still necessary on Isaac Sim 6.1. With the
re-sync removed completely, the Kit pause/resume test fails: the robot
stays frozen after resume (12 changed pixels, at least 100 required).

This PR avoids the defect at start-up only. The defect itself is in
`omni.physx.fabric` 110.3.2. After `detach_stage()` and
`attach_stage()`, `force_update()` does not publish GPU tensor API pose
writes until the next `simulate()`. The `force_update()` docstring says
that it updates Fabric "even if simulation did not run", so this
behavior is a PhysX defect. Thus, this sequence still returns a stale
first frame:

```python
sim.pause()
sim.play()      # re-attaches Fabric
env.reset()     # reset poses do not reach Fabric before a physics step
```

A PhysX ticket for this defect will be filed and linked in isaac-sim#8428. When
PhysX fixes it, Isaac Lab can remove the re-sync condition in `play()`.
If PhysX also fixes the isaac-sim#4279 resume freeze, Isaac Lab can remove the
detach/attach workaround.

Isaac Sim 6.1.0.0, RTX A6000, driver 595.91.07:

| Test | Before | After |
| --- | --- | --- |
| `test_first_frame_textured_rendering.py` | first-reset test failed
(IoU 0.370) | 2 passed |
| `test_visualizer_integration_physx.py` (Kit pause/resume, isaac-sim#4279) | — |
passed |
| `test_simulation_context.py` | — | 26 passed |
| `test_simulation_context_kit.py` | — | 4 passed |

`test_visualizer_tiled_integration_physx.py` fails in my container with
`Canvas must be an instance of HeadlessCanvas` (pyglet). It fails the
same way without this change.

- Bug fix (non-breaking change which fixes an issue)

- [ ] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

Docker and GPU tests run on demand. Push the commits you want tested,
then
comment `run-ci` on the pull request.

- [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

Conflict: source/isaaclab_visualizers/test/golden_images/anymal_d/physx-kit-tiled.png keeps the
release version. The release refreshed this golden for the published 6.2 checkerboard (isaac-sim#8685),
and the version from PR 8433 predates that refresh. The test
test_visualizer_golden[physx-anymal_d-kit-tiled] passes with the kept golden.

---------

Signed-off-by: JF Lafleche <[email protected]>
Co-authored-by: JF Lafleche <[email protected]>
Co-authored-by: pv-nvidia <[email protected]>
Co-authored-by: Octi Zhang <[email protected]>
(cherry picked from commit 4eccae0)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant