Repository navigation
[Newton] Clear pending FK and graph-replay flags on hard reset - #8644
Conversation
Root and joint state writes on Newton only mark forward kinematics as pending (NewtonManager.invalidate_fk()). Resets inside ManagerBasedRLEnv.step() and DirectRLEnv.step() do not call sim.forward(), and interval events such as pushes write state right before the observations. Asset data and the scene data provider resolve pending FK at the read through NewtonManager.forward(), but the FrameTransformer, NewtonSiteFrameView and the PVA sensor read State.body_q and body_qd directly. They returned the state from before the write: frame views until something else resolved FK, frame transformers and PVA sensors until their next update. Cameras read their poses through the frame view, including Camera.get_world_poses() with update_latest_camera_pose=False. Call NewtonManager.forward() before these reads. It does nothing unless FK is pending or a graph replay may have changed transforms. The call runs on the host and is skipped while a graph is being captured: the frame transformer captures its own sampling graph, and recording FK into a caller's graph would clear the pending flag before FK runs. The frame view also resolves FK before it converts a world-pose write into the body frame. Pending FK and the graph-replay flag also carried over a hard sim.reset() to the rebuilt model. A transform read during the reset, before initialize_solver() binds the FK delegates of the new model, raised "Solver reset hook is not bound": a scene data read in a PHYSICS_READY callback, and with this change camera initialization. Graphs recorded before the reset reference the discarded buffers and initialize_solver() runs FK for the new model, so start_simulation() clears both flags together with the reset masks it reallocates.
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryResolves pending FK before Newton frame transformer, PVA, and frame-view reads. World-pose writes also resolve FK before computing the body-local offset.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Root or joint state write] --> B[FK marked pending]
B --> C[Frame transformer, PVA, or frame-view read]
C --> D{Graph capture active?}
D -->|No| E[NewtonManager.forward resolves pending FK]
E --> F[Sample body state]
D -->|Yes| G[Record sampling only; leave FK pending]
Reviews (1) · Last reviewed commit: "Resolve pending Newton FK before frame t..." · Reviewed by Greptile |
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Implementation (1). Other reviewed categories look good.
- PR description: The description matches the diff but should trim issue history, sensor asides, and ablation detail; for latency claims, provide benchmark commands, GPU model, warmup, and explicit baseline/candidate revisions.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: No over-engineering issues.
- API: API changes look good.
- Compatibility and deprecation: No breaking changes identified.
- Implementation: Partial NewtonSiteFrameView world-pose writes call forward() before invoking the getter, causing duplicate solver reset and FK under sticky graph replay; skip the first call for partial writes.
- Style consistency: Style consistency looks good.
- Test quality: Test quality looks good.
Minor fixes needed. Posted 1 inline finding.
Automated review; human maintainers own approval decisions.
| return | ||
|
|
||
| state = NewtonManager.get_state_0() | ||
| if not state.body_q.device.is_capturing: |
There was a problem hiding this comment.
🟡 Warning · Implementation — Partial pose write forwards FK twice
When only one of positions/orientations is given, _get_world_poses_impl forwards again, repeating a masked solver reset and FK while the sticky graph-replay flag is set. Gate this call on both inputs being supplied.
A world-pose write that leaves positions or orientations unset reads the current poses first, and that read already resolves pending FK. Resolve it separately only for full writes, so a partial write does not run a second masked solver reset and FK while the graph-replay flag is set.
…ransformer-stale-poses # Conflicts: # source/isaaclab_newton/isaaclab_newton/physics/newton_manager.py # source/isaaclab_newton/isaaclab_newton/sensors/pva/pva.py # source/isaaclab_newton/isaaclab_newton/sim/views/newton_site_frame_view.py # source/isaaclab_newton/test/sim/test_views_xform_prim_newton.py
…sformer-stale-poses # Conflicts: # source/isaaclab_newton/isaaclab_newton/sim/views/newton_site_frame_view.py
|
Merged #8780 covers the original #8643 sensor-freshness fix through the existing manager-owned lazy state accessor; Newton frame-transformer and PVA readers do not need explicit forward() calls. #8782 already covers the site/frame-view publication path, and #8643 is closed as completed. Keeping this PR open because its latest diff also fixes a separate hard-reset lifecycle boundary: clearing kinematics_dirty and transforms_may_change_on_graph_replay before PHYSICS_READY consumers read the rebuilt model. That change and its pending-write hard-reset regression are not in #8780. The remaining main-branch work should be narrowed to that reset fix. Requested release/3.0.0 backports also still need separate coordination. |
…sformer-stale-poses # Conflicts: # source/isaaclab_newton/isaaclab_newton/sensors/pva/pva.py # source/isaaclab_newton/test/sensors/test_frame_transformer.py
…sformer-stale-poses # Conflicts: # source/isaaclab_newton/isaaclab_newton/physics/newton_manager.py
…sformer-stale-poses # Conflicts: # source/isaaclab_newton/isaaclab_newton/physics/newton_manager.py # source/isaaclab_newton/test/physics/test_newton_manager_abstraction.py
|
run-ci |
Description
On Newton, a hard
sim.reset()closes the backend and rebuilds the model, but the sticky graph-replay flagNewtonManager.transforms_may_change_on_graph_replaycarries over from the discarded graph.forward()then runsfor the new model before
initialize_solver()constructs its solver, so an asset pose read during the reset, suchas one in a
PHYSICS_READYcallback, raisesRuntimeError: NewtonManager.initialize_solver() must run ...._close_backend()now clears the flag together with the graph it describes.initialize_solver()runs FK for thenew model, so nothing pending is lost.
The sensor-freshness part of the original PR (#8643) is covered on
mainby #8780 and #8782, and the pending-FKflag now lives on the backend that a hard reset recreates (#8733), so this PR is narrowed to the graph-replay flag.
Type of change
Release backport
mainrelease/3.0.0predates #8733, so its backport clearskinematics_dirtyand the graph-replay flag instart_simulation().Tests
test_newton_manager_abstraction.py::test_reset_binds_consumers_before_constructing_the_solvernow sets thegraph-replay flag before the hard reset and calls
forward()in itsPHYSICS_READYcallback. Onmain(
9860e2bd86) it fails with thatRuntimeError; with this PR the file passes (106 passed).Checklist
pre-commitchecks withuv run isaaclab --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bump package versions — CI handles that)CONTRIBUTORS.mdor my name already exists there