Commit d60ee5a
authored
Initialize visualizers before timeline play on reset (#6176)
## Summary
- Initializes first-time visualizers after `physics_manager.reset()` has
created PhysX tensor views, but before `physics_manager.play()` pumps
Kit timeline events.
- Prevents Newton visualizer initialization from seeing a PhysX
scene-data backend whose tensor view was invalidated by a STOP event
processed during the play event pump.
- Adds a focused unit test that locks the reset ordering to `reset ->
initialize_visualizers -> play` for first-time visualizers.
## Root cause
The reported command selects the Newton visualizer, but not Newton
physics, so the failing path is PhysX simulation feeding the Newton
visualizer through the scene-data provider.
`PhysxManager.reset()` creates the PhysX tensor simulation view and
stores it in the scene-data backend. `SimulationContext.reset()` then
called `physics_manager.play()` before creating visualizers.
`PhysxManager.play()` calls `omni.kit.app.get_app().update()`, which can
process timeline events. On the failing Windows/Kit path, a STOP event
is processed there, and `PhysxManager._on_stop()` invalidates the
freshly created tensor views. The Newton visualizer is then initialized
after that invalidation and asks scene data for `transform_paths`, which
reaches `RigidBodyView.prim_paths` on an invalid PhysX view and crashes
with `NoneType.prim_paths`.
The correct fix is to initialize visualizers before the play event pump,
not to make scene-data consumers tolerate already-invalid views.
## Validation
- `python3 -m py_compile
source/isaaclab/isaaclab/sim/simulation_context.py
source/isaaclab/test/sim/test_simulation_context_visualizers.py`
- `python3 tools/changelog/cli.py check develop`
- `git diff --cached --check`
- `pre-commit run --files
source/isaaclab/isaaclab/sim/simulation_context.py
source/isaaclab/test/sim/test_simulation_context_visualizers.py
source/isaaclab/changelog.d/zhengyuz-sim-reset-visualizer-before-play.rst`
Focused pytest was attempted locally, but this shell lacks runtime deps
(`lazy_loader`) needed to import the visualizer test module.1 parent 9103ad2 commit d60ee5a
3 files changed
Lines changed: 36 additions & 3 deletions
File tree
- source/isaaclab
- changelog.d
- isaaclab/sim
- test/sim
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
724 | 724 | | |
725 | 725 | | |
726 | 726 | | |
727 | | - | |
728 | | - | |
729 | 727 | | |
730 | | - | |
| 728 | + | |
731 | 729 | | |
| 730 | + | |
| 731 | + | |
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
| |||
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 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 | + | |
| 225 | + | |
197 | 226 | | |
198 | 227 | | |
199 | 228 | | |
| |||
0 commit comments