Commit 2af0251
[Newton] Refresh FK before ray-cast sensor reads (#7523)
# Description
Fixes #7236.
Newton ray-cast tasks read `NewtonManager.get_state_0().body_q` inside
their graph-capturable query pipeline. After an in-step joint or
root-state write, the reset masks are current but the derived `body_q`
remains stale until forward kinematics runs. This made the first sensor
observation after a reset use the previous pose.
This fixes the stale read at its ownership boundary instead of adding
eager simulator synchronization to the RL environment loops:
- `NewtonManager._update_sensor_tasks()` obtains state through the
guarded `get_state()` accessor before BVH refit and sensor graph
capture/replay.
- The graph-captured raycast callback keeps using raw `get_state_0()`
state, so `forward()` is never captured.
- The ray-caster's direct `get_world_poses()` accessor applies the same
lazy-FK rule.
- The renderer's now-redundant state refresh is removed because the
sensor-task scheduler owns freshness for both renderer and raycast
consumers.
This is an alternative to the in-step synchronization part of #7516. Its
regex and legacy tracked-target fixes are independent of this PR.
## Architecture and performance
The state access boundary owns FK freshness; environment stepping
remains unaware of individual sensor requirements. The guard runs only
when a sensor or renderer update is requested. Rendering does not gain
an additional refresh because its existing call moved into the shared
scheduler, and Newton's device-resident reset masks limit the actual FK
work to invalidated worlds/articulations.
## Type of change
- Bug fix (non-breaking change which fixes an issue)
## Release backport
- [x] <!-- backport-active-release --> This PR already targets the
active release branch; do not backport it again.
## Screenshots
Not applicable.
## Validation
- Added observable regressions for sensor-data reads and direct
pose-getter reads immediately after a carrier root-pose write, with no
intervening simulation step or FK-sensitive asset getter. Both tests
failed before the fix by exactly the authored displacement in eager and
CUDA-graph modes.
- `uv run --frozen --extra test python -m pytest
source/isaaclab_newton/test/sensors/test_newton_raycast_sensor.py -vv`
(16 passed)
- `uv run --frozen --extra test python -m pytest
source/isaaclab_newton/test/physics/test_newton_manager_abstraction.py
source/isaaclab/test/sim/test_newton_manager_visualization_state.py -q`
(194 passed)
- `uv run --frozen isaaclab -f` (all checks passed)
## Checklist
- [x] I have read and understood the contribution guidelines
- [x] I have run the pre-commit checks
- [x] No standalone documentation change is required; the ownership rule
is documented at the access boundaries
- [x] My changes generate no new warnings
- [x] I have added tests that prove the fix is effective
- [x] I have added a changelog fragment for the touched package
- [x] My name already exists in `CONTRIBUTORS.md`
(cherry picked from commit 8365c57)1 parent d719f9f commit 2af0251
6 files changed
Lines changed: 56 additions & 10 deletions
File tree
- source/isaaclab_newton
- changelog.d
- isaaclab_newton
- physics
- renderers
- sensors/ray_caster
- test
- physics
- sensors
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2658 | 2658 | | |
2659 | 2659 | | |
2660 | 2660 | | |
2661 | | - | |
| 2661 | + | |
2662 | 2662 | | |
2663 | | - | |
2664 | | - | |
| 2663 | + | |
| 2664 | + | |
2665 | 2665 | | |
2666 | 2666 | | |
2667 | 2667 | | |
| |||
2708 | 2708 | | |
2709 | 2709 | | |
2710 | 2710 | | |
2711 | | - | |
| 2711 | + | |
2712 | 2712 | | |
2713 | 2713 | | |
2714 | 2714 | | |
2715 | 2715 | | |
2716 | | - | |
| 2716 | + | |
| 2717 | + | |
2717 | 2718 | | |
2718 | 2719 | | |
2719 | 2720 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
551 | 551 | | |
552 | 552 | | |
553 | 553 | | |
554 | | - | |
555 | | - | |
556 | 554 | | |
557 | 555 | | |
558 | 556 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
| 170 | + | |
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
| |||
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
195 | | - | |
| 196 | + | |
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
| 296 | + | |
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| 323 | + | |
323 | 324 | | |
324 | 325 | | |
325 | 326 | | |
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
329 | 334 | | |
330 | 335 | | |
| 336 | + | |
331 | 337 | | |
332 | 338 | | |
333 | 339 | | |
| |||
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
189 | 225 | | |
190 | 226 | | |
191 | 227 | | |
| |||
0 commit comments