Skip to content

Commit a78f0ff

Browse files
kellyguo11ooctipus
andauthored
Cherry-picks pyglet and visualizer fixes from develop (#6180)
# Description Cherry pick visualizer fixes from develop: - #6176 - #6179 --------- Co-authored-by: ooctipus <zhengyuz@nvidia.com>
1 parent 7632d16 commit a78f0ff

10 files changed

Lines changed: 68 additions & 4 deletions

File tree

docs/source/overview/core-concepts/visualization.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,18 @@ The visualizer will still function correctly but may experience reduced performa
646646
CPU copy operations instead of direct GPU memory sharing.
647647

648648

649+
**Newton Visualizer OpenGL Context Failures**
650+
651+
The Newton visualizer is an OpenGL window. If pyglet reports that
652+
``glCreateShader`` is not exported or that OpenGL 2.0 is required, the Python
653+
process did not receive a usable OpenGL 2.0+ context from the active Windows or
654+
Linux display session. This usually means the process is running in a
655+
non-interactive/service session, through a remote desktop path without GPU
656+
OpenGL acceleration, or with a software/basic OpenGL provider instead of the
657+
NVIDIA driver. Run from a GPU-backed interactive display session, or omit
658+
``--visualizer newton`` for headless inference.
659+
660+
649661
**Newton Visualizer on Spark with Conda**
650662

651663
When running the Newton visualizer on Spark inside a conda environment, conda-installed X11 libraries
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Changed
2+
^^^^^^^
3+
4+
* Updated the ``newton`` extra installation message to list the Newton GL
5+
viewer's ``pyglet`` dependency.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Fixed
2+
^^^^^
3+
4+
* Fixed SimulationContext reset ordering so initial visualizers are created before the timeline play event pump can invalidate freshly created PhysX tensor views.

source/isaaclab/isaaclab/cli/commands/install.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,9 @@ def _install_extra_feature(feature_name: str, selector: str = "") -> None:
652652
elif feature_name == "newton":
653653
if selector:
654654
print_warning(f"'newton' does not support selectors (got '{selector}'). Installing all newton extras.")
655-
print_info("Installing newton extras (newton[sim], PyOpenGL-accelerate, imgui-bundle, typing-extensions)...")
655+
print_info(
656+
"Installing newton extras (newton[sim], pyglet, PyOpenGL-accelerate, imgui-bundle, typing-extensions)..."
657+
)
656658
run_command(pip_cmd + ["install", "--editable", f"{source_dir}/isaaclab_newton[all]"])
657659
run_command(pip_cmd + ["install", "--editable", f"{source_dir}/isaaclab_physx[newton]"])
658660
run_command(pip_cmd + ["install", "--editable", f"{source_dir}/isaaclab_visualizers[newton]"])

source/isaaclab/isaaclab/sim/simulation_context.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,11 @@ def reset(self, soft: bool = False) -> None:
720720
self.physics_manager.reset(soft)
721721
for viz in self._visualizers:
722722
viz.reset(soft)
723-
# Start the timeline so the play button is pressed
724-
self.physics_manager.play()
725723
if not self._visualizers:
726-
# Initialize visualizers after PhysX sim view is ready.
724+
# Initialize visualizers after PhysX sim views are ready, but before play() pumps timeline events.
727725
self.initialize_visualizers()
726+
# Start the timeline so the play button is pressed
727+
self.physics_manager.play()
728728
self._is_playing = True
729729
self._is_stopped = False
730730

source/isaaclab/test/sim/test_simulation_context_visualizers.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,35 @@ def test_update_visualizers_handles_training_pause_loop():
194194
assert viz.step_calls == [0.0, 0.2]
195195

196196

197+
def test_reset_initializes_visualizers_before_playing_timeline():
198+
"""Initial visualizers must see the PhysX views created by reset before play() pumps timeline events."""
199+
events: list[str] = []
200+
ctx = object.__new__(SimulationContext)
201+
ctx._visualizers = []
202+
203+
class _PhysicsManager:
204+
@staticmethod
205+
def reset(soft=False):
206+
events.append(f"reset:{soft}")
207+
208+
@staticmethod
209+
def play():
210+
events.append("play")
211+
212+
def _initialize_visualizers():
213+
events.append("initialize_visualizers")
214+
ctx._visualizers = [_FakeVisualizer()]
215+
216+
ctx.physics_manager = _PhysicsManager()
217+
ctx.initialize_visualizers = _initialize_visualizers
218+
219+
ctx.reset()
220+
221+
assert events == ["reset:False", "initialize_visualizers", "play"]
222+
assert ctx.is_playing()
223+
assert not ctx.is_stopped()
224+
225+
197226
class _DummyViserSceneDataProvider:
198227
@property
199228
def num_envs(self) -> int:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Fixed
2+
^^^^^
3+
4+
* Added an explicit ``pyglet>=2.1.6,<3`` dependency for Newton GL video
5+
recording support.

source/isaaclab_newton/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def run(self):
3939
"all": [
4040
"prettytable==3.3.0",
4141
"PyOpenGL-accelerate==3.1.10",
42+
"pyglet>=2.1.6,<3",
4243
"newton[sim]==1.2.1",
4344
],
4445
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Fixed
2+
^^^^^
3+
4+
* Added an explicit ``pyglet>=2.1.6,<3`` dependency for the Newton visualizer
5+
extra so the OpenGL viewer does not rely on ambient transitive installs.

source/isaaclab_visualizers/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"warp-lang",
2727
"newton[sim]==1.2.1",
2828
"PyOpenGL-accelerate",
29+
"pyglet>=2.1.6,<3",
2930
"imgui-bundle>=1.92.601",
3031
"typing-extensions==4.12.2",
3132
"pydantic>=2.7,<2.12",

0 commit comments

Comments
 (0)