Skip to content

[Newton] Clear pending FK and graph-replay flags on hard reset - #8644

Merged
hujc7 merged 7 commits into
isaac-sim:mainfrom
NeoZng:fix/newton-frame-transformer-stale-poses
Oct 29, 2026
Merged

hujc7 merged 7 commits into
isaac-sim:mainfrom
NeoZng:fix/newton-frame-transformer-stale-poses

Conversation

@NeoZng

@NeoZng NeoZng commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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

  • 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

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • 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)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

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.
@NeoZng
NeoZng requested a review from a team October 16, 2026 05:09
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Oct 16, 2026
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

Resolves pending FK before Newton frame transformer, PVA, and frame-view reads. World-pose writes also resolve FK before computing the body-local offset.

  • Newton frame and PVA reads use body state from the latest writes.
  • Hard resets clear pending FK flags when they rebuild the Newton model.

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

Reviews (1) · Last reviewed commit: "Resolve pending Newton FK before frame t..." · 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: 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:

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 — 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.
@maxkra15 maxkra15 self-assigned this Oct 16, 2026
…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
@ooctipus

Copy link
Copy Markdown
Collaborator

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
@NeoZng NeoZng changed the title [Newton] Resolve pending FK before frame transformer, frame view and PVA reads [Newton] Clear pending FK and graph-replay flags on hard reset Oct 23, 2026
@NeoZng

NeoZng commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

@ooctipus Thanks, narrowed to the hard-reset fix in 87353a4: only the start_simulation() flag reset and its regression remain, and the description and changelog are updated.

…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
@maxkra15
maxkra15 self-requested a review October 28, 2026 12:37
@maxkra15

Copy link
Copy Markdown
Contributor

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 28, 2026
@hujc7
hujc7 merged commit 8f5f782 into isaac-sim:main Oct 29, 2026
59 checks passed
@NeoZng
NeoZng deleted the fix/newton-frame-transformer-stale-poses branch November 3, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants