Skip to content

Add cross-backend repro for dropped camera pose writes - #4

Draft
alexmillane wants to merge 5 commits into
developfrom
alex/repro/camera_pose_write_takes_no_effect
Draft

alexmillane wants to merge 5 commits into
developfrom
alex/repro/camera_pose_write_takes_no_effect

Conversation

@alexmillane

@alexmillane alexmillane commented Sep 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

Repro-only PR: a failing test that pins down camera pose writes not reaching the renderer under the Newton backend.

Details

Camera.set_world_poses writes through the sensor's FrameView. Under PhysX that view is Fabric-backed (FabricFrameView), so the RTX renderer — which reads the USD/Fabric camera prim — follows the write. Under Newton the view is a NewtonSiteFrameView, which updates only in-memory Warp state; nothing mirrors the pose onto the camera prim, so the rendered image stays at the old pose.

What the test does

source/isaaclab/test/sensors/test_camera_pose_write_across_backends.py moves a downward-looking camera from 2 m to 8 m over a ground plane via the public set_world_poses, parametrized over PhysxCfg() and NewtonCfg(solver_cfg=MJWarpSolverCfg()), and checks the two observable consequences of the write:

  • test_camera_pose_write_moves_reported_pose — camera.data.pos_w follows the write. Passes on both backends.
  • test_camera_pose_write_moves_render — the rendered distance_to_camera must grow when the camera rises 4x.

Results

test_camera_pose_write_moves_reported_pose[physx]  PASSED
test_camera_pose_write_moves_reported_pose[newton] PASSED
test_camera_pose_write_moves_render[physx]         PASSED
test_camera_pose_write_moves_render[newton]        FAILED
  Far depth (2.08 m) should be > 1.5x close depth (2.08 m); got 1.00x.

Run

uv run python -m pytest source/isaaclab/test/sensors/test_camera_pose_write_across_backends.py -v -s

Camera.set_world_poses writes through the sensor's FrameView. Under PhysX that
view is Fabric-backed, so the RTX renderer -- which reads the USD/Fabric camera
prim -- follows the write. Under Newton the view is a NewtonSiteFrameView, which
updates only in-memory Warp state; nothing mirrors the pose onto the camera prim,
so the rendered image stays at the old pose.

Add a backend-parametrized test that moves a downward-looking camera from 2 m to
8 m over a ground plane and checks both observable consequences of the write:
camera.data.pos_w (passes on both backends, isolating the failure to the
renderer) and the rendered depth, which under Newton is unchanged at a 1.00x
far-to-close ratio instead of the expected ~4x.

Signed-off-by: Alex Millane <[email protected]>

@alexmillane alexmillane left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Self review.

Comment on lines +8 to +21
:meth:`Camera.set_world_poses` writes through the sensor's :class:`FrameView`. Under PhysX that view is
Fabric-backed (:class:`FabricFrameView`), so the RTX renderer -- which reads the USD/Fabric camera prim --
follows the write. Under Newton the view is a :class:`NewtonSiteFrameView`, which updates only in-memory
Warp state; nothing mirrors the pose back to the camera prim, so the rendered image keeps the old pose
even though ``camera.data.pos_w`` reports the new one.

Both tests move a downward-looking camera straight up over a ground plane, which multiplies the distance
to every visible surface, and check the two observable consequences of the write:

- ``_moves_reported_pose_*`` reads ``camera.data.pos_w`` (deterministic, no renderer involved).
- ``_moves_render_*`` compares the rendered depth before and after the move.

:func:`test_camera_pose_update_reflected_in_render` in ``test_camera.py`` covers the render half of this on
the default (PhysX) backend only; these tests parametrize the backend so the Newton regression is visible.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Remove

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Removed — the cross-reference to test_camera.py is gone from the module docstring.

# launch omniverse app
simulation_app = AppLauncher(headless=True, enable_cameras=True).app

"""Rest everything follows."""

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Remove

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Removed the ""Rest everything follows.""" marker.

Comment on lines +52 to +65
DEVICE = "cuda:0"
HEIGHT = 128
WIDTH = 256
# Camera heights [m] above the ground plane, looking straight down. Moving between them multiplies the
# distance to every visible surface, so both the reported pose and the rendered depth must change.
CAMERA_HEIGHT_CLOSE_M = 2.0
CAMERA_HEIGHT_FAR_M = 8.0
# Reported world-pose shift [m] below which the write is considered to have been dropped.
POSE_SHIFT_THRESHOLD_M = 0.5 * (CAMERA_HEIGHT_FAR_M - CAMERA_HEIGHT_CLOSE_M)
# Minimum ratio of far-to-close mean depth. The true ratio is ~4x; 1.5 leaves room for the ground plane
# filling different fractions of the frame while still failing hard if the render does not move at all.
DEPTH_RATIO_THRESHOLD = 1.5
# Physics steps taken after each pose write so the renderer produces a frame at the new pose.
STEPS_PER_POSE = 2

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Move all of this into the test.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Moved. The camera heights and thresholds now live in each test; the device, resolution, step count and clipping range moved into _capture_at_heights, which takes the heights as an argument and returns the mean visible depth so the tests no longer need the clipping range. Only BACKEND_CFGS/BACKEND_IDS stay at module scope, since parametrize needs them at decoration time.

- Drop the cross-reference to test_camera.py and the "Rest everything follows" marker.
- Move the tuning constants (camera heights, thresholds, resolution, device, step
  count) out of module scope: heights and thresholds now live in each test, the
  rest inside the capture helper, which takes the heights as an argument and
  returns the mean visible depth so the tests no longer need the clipping range.

Signed-off-by: Alex Millane <[email protected]>
Setting ISAACLAB_TEST_SAVE_IMAGES=1 writes one PNG per camera height under
<test dir>/output/<test name>/. Grey level maps depth against a fixed scale set
by the highest commanded pose rather than each frame's own range, so a camera
that never moved renders identically across heights instead of being
re-normalized back into looking correct.

Signed-off-by: Alex Millane <[email protected]>
The RGB view is the more legible of the two: pulling the camera back brings more
of the ground plane's grid into frame, so the stale Newton render is visible as
an unchanged number of grid cells rather than as a brightness difference.

Signed-off-by: Alex Millane <[email protected]>
Add three coloured marker cubes: one directly under the camera that shrinks as it
rises, and two that sit outside the frame at 2 m and only come into view at 8 m.
The PhysX frames go from one large cube to three small ones; the Newton frames
stay on the single large cube, which reads at a glance.

The markers are plain USD gprims at /World rather than scene entities because
geometry placed under /World/envs/env_* by InteractiveScene does not reach the
RTX renderer in a bare build_simulation_context -- the same prim spawned at
/World renders. The scene cube is therefore invisible and only exists to give
Newton a body to build its model from.

Signed-off-by: Alex Millane <[email protected]>

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant