Skip to content

Cherry-picks pyglet and visualizer fixes from develop#6180

Merged
kellyguo11 merged 2 commits into
isaac-sim:release/3.0.0-beta2from
kellyguo11:cherry-pick-0613
Jun 13, 2026
Merged

Cherry-picks pyglet and visualizer fixes from develop#6180
kellyguo11 merged 2 commits into
isaac-sim:release/3.0.0-beta2from
kellyguo11:cherry-pick-0613

Conversation

@kellyguo11

Copy link
Copy Markdown
Contributor

ooctipus added 2 commits June 13, 2026 15:28
## 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.
- Add explicit `pyglet>=2.1.6,<3` dependencies for Newton GL
visualizer/video extras.
- Update the `newton` extra install message to include pyglet.
- Document the `glCreateShader` failure mode as an
OpenGL-context/session problem rather than a task or Newton physics
failure.

Newton ViewerGL requires pyglet/OpenGL, but Isaac Lab's Newton GL
packages did not declare pyglet directly. Separately, the reported
Windows stack means pyglet obtained an OpenGL context that does not
expose OpenGL 2.0 shader functions; an RTX PRO 6000 driver should expose
that, so the process is not receiving the NVIDIA OpenGL context in that
automation/display session.

- `pre-commit run --files
docs/source/overview/core-concepts/visualization.rst
source/isaaclab/isaaclab/cli/commands/install.py
source/isaaclab_newton/pyproject.toml
source/isaaclab_visualizers/pyproject.toml
source/isaaclab/changelog.d/zhengyuz-newton-pyglet-install-message.rst
source/isaaclab_newton/changelog.d/zhengyuz-newton-gl-pyglet-dependency.rst
source/isaaclab_visualizers/changelog.d/zhengyuz-newton-pyglet-dependency.rst`
- `python3 tools/changelog/cli.py check develop`
- `git diff --check`
@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Jun 13, 2026
@greptile-apps

greptile-apps Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This cherry-pick backports two fixes from develop to release/3.0.0-beta2: a SimulationContext.reset() ordering correction that ensures visualizers are initialised before play() pumps timeline events (preventing stale PhysX tensor views), and an explicit pyglet>=2.1.6,<3 dependency added to both isaaclab_newton and isaaclab_visualizers so the Newton GL viewer no longer relies on ambient transitive installs.

  • simulation_context.py: initialize_visualizers() is now called between physics_manager.reset() and physics_manager.play() instead of after play(), with a matching new unit test asserting the exact event order.
  • setup.py (both packages): pyglet>=2.1.6,<3 is added as an explicit dependency; the install-command print message and docs are updated to match.

Confidence Score: 5/5

Safe to merge — the reset ordering fix is narrowly scoped, well-tested, and the dependency additions are additive-only with a pinned lower-bound and a conservative upper bound that excludes the unreleased pyglet 3.x series.

Both changes are straightforward: a two-line reorder in reset() backed by a new event-log test that exercises the exact failure scenario, and two additive setup.py lines that make an already-required runtime package explicit. No logic is removed, no existing tests are modified, and the version constraint for pyglet is consistent across both packages.

No files require special attention. The only behavioural change is in simulation_context.py, and the new test covers the corrected ordering directly.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/sim/simulation_context.py Moves initialize_visualizers() before physics_manager.play() in reset(), ensuring visualizers can safely access PhysX tensor views before timeline events are pumped.
source/isaaclab/test/sim/test_simulation_context_visualizers.py Adds test_reset_initializes_visualizers_before_playing_timeline to verify the new reset ordering via event-log assertions; test construction is correct and consistent with existing test patterns.
source/isaaclab_newton/setup.py Adds explicit pyglet>=2.1.6,<3 dependency to the [all] extra, making the OpenGL viewer dependency explicit rather than relying on transitive installs.
source/isaaclab_visualizers/setup.py Adds matching pyglet>=2.1.6,<3 dependency to the [newton] extra; version range is consistent with isaaclab_newton/setup.py.
source/isaaclab/isaaclab/cli/commands/install.py Updates informational print message to list pyglet alongside the other newton extras; no functional change.
docs/source/overview/core-concepts/visualization.rst Adds troubleshooting section for Newton Visualizer OpenGL context failures (glCreateShader errors), explaining causes and workarounds.

Sequence Diagram

sequenceDiagram
    participant C as Caller
    participant SC as SimulationContext.reset()
    participant PM as PhysicsManager
    participant VI as initialize_visualizers()
    participant VZ as Visualizer.reset()

    C->>SC: "reset(soft=False)"
    SC->>PM: reset(soft)
    Note over PM: PhysX tensor views created/ready
    alt _visualizers not empty
        SC->>VZ: viz.reset(soft) for each viz
    else _visualizers empty (first call)
        SC->>VI: initialize_visualizers()
        Note over VI: Visualizers access PhysX views safely
        VI-->>SC: _visualizers populated
    end
    SC->>PM: play()
    Note over PM: Timeline events pumped
    SC-->>C: "_is_playing=True, _is_stopped=False"
Loading

Reviews (1): Last reviewed commit: "Declare pyglet for Newton GL features (#..." | Re-trigger Greptile

@kellyguo11
kellyguo11 merged commit a78f0ff into isaac-sim:release/3.0.0-beta2 Jun 13, 2026
37 checks passed
@ooctipus
ooctipus deleted the cherry-pick-0613 branch June 13, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants