-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand Visualizer Tests and Patch Visualizer Bugs #5103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
f2c6ac1
39cedf8
7f23505
457f3d7
554e944
a6782f8
39d9a99
260ffcb
fdd4530
ce1bff9
a886aa9
9305232
14efc99
19e1022
5eca07a
0d08fea
6f01ce4
8d20245
0a98936
89ca77d
9e57174
0e7d0e2
38d93e0
1e9496b
fa49a5f
c8f6451
85b700b
7eb4a5b
c835728
d2d556e
f5ee0cb
bbb82ff
0ab9bca
c41a009
65e300d
e2ed226
48f5cf4
d645d15
3312472
b2ef7cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -305,6 +305,9 @@ def _install_extra_frameworks(framework_name: str = "all") -> None: | |
| "newton_actuators", | ||
| "warp", | ||
| "mujoco_warp", | ||
| "websockets", | ||
| "viser", | ||
| "imgui_bundle", | ||
| ] | ||
| """Package directory names in Isaac Sim prebundle directories to repoint. | ||
|
|
||
|
|
@@ -352,7 +355,25 @@ def _repoint_prebundle_packages() -> None: | |
| print_warning(f"site-packages directory not found: {site_packages} — skipping prebundle repoint.") | ||
| return | ||
|
|
||
| prebundle_dirs = list(isaacsim_path.rglob("pip_prebundle")) | ||
| # Discover pip_prebundle directories from both the Isaac Sim tree and | ||
| # Omniverse cache roots. Some Isaac Sim directories are symlinked into | ||
| # ~/.local/share/ov and may be missed by a plain rglob() on _isaac_sim. | ||
| candidate_roots: set[Path] = set() | ||
| for root in ( | ||
| isaacsim_path, | ||
| isaacsim_path.resolve(), | ||
| isaacsim_path / "extscache", | ||
| Path.home() / ".local" / "share" / "ov" / "data" / "exts", | ||
| Path.home() / ".local" / "share" / "ov" / "data" / "exts" / "v2", | ||
| ): | ||
| if root.exists(): | ||
| candidate_roots.add(root) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Warning: Consider adding a import time
t0 = time.monotonic()
for root in candidate_roots:
prebundle_dirs.update(root.rglob("pip_prebundle"))
print_debug(f"Discovered {len(prebundle_dirs)} pip_prebundle dirs in {time.monotonic() - t0:.1f}s") |
||
| candidate_roots.add(root.resolve()) | ||
|
|
||
| prebundle_dirs: set[Path] = set() | ||
| for root in candidate_roots: | ||
| prebundle_dirs.update(root.rglob("pip_prebundle")) | ||
|
|
||
| if not prebundle_dirs: | ||
| print_debug("No pip_prebundle directories found under Isaac Sim.") | ||
| return | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,8 @@ | |
|
|
||
| from __future__ import annotations | ||
|
|
||
| import warnings | ||
| from dataclasses import MISSING, fields | ||
| from typing import Dict, Literal, TypeVar # noqa: UP035 | ||
|
|
||
| import gymnasium as gym | ||
|
|
@@ -17,9 +19,28 @@ | |
| ## | ||
|
|
||
|
|
||
| def _viewer_cfg_value_matches_default(current: object, default: object) -> bool: | ||
| """Return True if ``current`` matches the dataclass field default (including list/tuple equivalence).""" | ||
| if current == default: | ||
| return True | ||
| if isinstance(current, (list, tuple)) and isinstance(default, (list, tuple)): | ||
| if len(current) != len(default): | ||
| return False | ||
| return all(a == b for a, b in zip(current, default, strict=True)) | ||
| return False | ||
|
|
||
|
|
||
| @configclass | ||
| class ViewerCfg: | ||
| """Configuration of the scene viewport camera.""" | ||
| """Configuration of the scene viewport camera. | ||
|
|
||
| Note: | ||
| Overriding non-default fields is deprecated. In a future release, Isaac Sim viewport camera | ||
| configuration will be expressed only through ``KitVisualizerCfg`` under | ||
| ``SimulationCfg.visualizer_cfgs``; use ``NewtonVisualizerCfg`` for the Newton viewer. | ||
| Those visualizer configs replace the viewport camera pose, resolution, prim path, and | ||
| frame-origin behavior that this class used to configure. | ||
| """ | ||
|
|
||
| eye: tuple[float, float, float] = (7.5, 7.5, 7.5) | ||
| """Initial camera position (in m). Default is (7.5, 7.5, 7.5).""" | ||
|
|
@@ -67,6 +88,35 @@ class ViewerCfg: | |
| This quantity is only effective if :attr:`origin` is set to "asset_body". | ||
| """ | ||
|
|
||
| def __post_init__(self) -> None: | ||
| # Dataclasses do not record which arguments were passed explicitly vs defaulted, and | ||
| # warning only on ``**kwargs`` would miss positional arguments. Comparing each field to | ||
| # its declared default catches any non-default effective configuration (including | ||
| # ``replace()`` and ``from_dict``), while keeping ``ViewerCfg()`` silent. | ||
| differing: list[str] = [] | ||
| for f in fields(self): | ||
| if not f.init: | ||
| continue | ||
| if f.default is not MISSING: | ||
| default_val = f.default | ||
| elif f.default_factory is not MISSING: | ||
| default_val = f.default_factory() | ||
| else: | ||
| continue | ||
| if not _viewer_cfg_value_matches_default(getattr(self, f.name), default_val): | ||
| differing.append(f.name) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Warning: The Consider:
|
||
| if differing: | ||
| warnings.warn( | ||
| "ViewerCfg is deprecated when overriding default viewport camera fields " | ||
| f"({', '.join(sorted(differing))}). In a future release, Isaac Sim viewport camera " | ||
| "settings will be configured only through ``SimulationCfg.visualizer_cfgs`` using " | ||
| "``KitVisualizerCfg`` (viewport camera pose, resolution, prim path, and " | ||
| "frame-origin options). For the Newton viewer, use ``NewtonVisualizerCfg``. " | ||
| "Migrate overrides out of ``ViewerCfg`` accordingly.", | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) | ||
|
|
||
|
|
||
| ## | ||
| # Types. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -218,8 +218,11 @@ def update_view_location(self, eye: Sequence[float] | None = None, lookat: Seque | |
| cam_eye = viewer_origin + self.default_cam_eye | ||
| cam_target = viewer_origin + self.default_cam_lookat | ||
|
|
||
| # set the camera view | ||
| self._env.sim.set_camera_view(eye=cam_eye, target=cam_target) | ||
| # set the renderer viewport camera view (does not broadcast to visualizers) | ||
|
matthewtrepte marked this conversation as resolved.
|
||
| # Kit-specific helper lives in isaaclab_physx | ||
| from isaaclab_physx.renderers.kit_viewport_utils import set_kit_renderer_camera_view | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Warning: This introduces a hard import from This is mitigated by the Consider wrapping with a fallback: try:
from isaaclab_physx.renderers.kit_viewport_utils import set_kit_renderer_camera_view
set_kit_renderer_camera_view(eye=cam_eye, target=cam_target, camera_prim_path=self.cfg.cam_prim_path)
except (ImportError, ModuleNotFoundError):
pass # Kit-only; Newton-only deployments skip viewport camera |
||
|
|
||
| set_kit_renderer_camera_view(eye=cam_eye, target=cam_target, camera_prim_path=self.cfg.cam_prim_path) | ||
|
|
||
| """ | ||
| Private Functions | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| """Hooks that run after visualizers during :meth:`~isaaclab.sim.SimulationContext.render`. | ||
|
|
||
| Lives alongside :mod:`video_recorder` / :mod:`video_recorder_cfg` because both tie into | ||
| ``--video`` / ``rgb_array`` recording. Keeps :class:`~isaaclab.sim.SimulationContext` free | ||
| of imports from ``isaaclab_physx``, ``isaaclab_newton``, and other recording backends. | ||
| Each integration is loaded lazily so optional extensions are not required at import time. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import Any | ||
|
|
||
|
|
||
| def run_recording_hooks_after_visualizers(sim: Any) -> None: | ||
| """Run recording-related work after :meth:`~isaaclab.sim.SimulationContext.render` steps visualizers. | ||
|
|
||
| Isaac Sim / RTX follow-up is loaded lazily so minimal installs still work. | ||
| Newton GL video is handled by :class:`~isaaclab.envs.utils.video_recorder.VideoRecorder` | ||
| (e.g. :class:`~isaaclab_newton.video_recording.newton_gl_perspective_video.NewtonGlPerspectiveVideo`), | ||
| not here. | ||
|
|
||
| Args: | ||
| sim: Active :class:`~isaaclab.sim.SimulationContext` instance. | ||
| """ | ||
| _recording_followup_isaac_sim(sim) | ||
|
|
||
|
|
||
| def _recording_followup_isaac_sim(sim: Any) -> None: | ||
| """Isaac Sim: keep RTX / Replicator outputs fresh when recording video without a Kit visualizer. | ||
|
|
||
| When ``--video`` uses ``rgb_array`` / :class:`~gymnasium.wrappers.RecordVideo`, Replicator | ||
| render products must see Kit's event loop pumped. :class:`~isaaclab_visualizers.kit.KitVisualizer` | ||
| already calls ``omni.kit.app.get_app().update()`` in its ``step()``; if no such visualizer | ||
| is active, we pump here (guarded by ``/isaaclab/video/enabled`` and ``is_rendering``). | ||
|
|
||
| Implemented by ``pump_kit_app_for_headless_video_render_if_needed`` in | ||
| :mod:`isaaclab_physx.renderers.isaac_rtx_renderer_utils`. | ||
| """ | ||
| try: | ||
| from isaaclab_physx.renderers.isaac_rtx_renderer_utils import ( | ||
| pump_kit_app_for_headless_video_render_if_needed, | ||
| ) | ||
| except ImportError: | ||
| return | ||
| pump_kit_app_for_headless_video_render_if_needed(sim) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this change needed? is there something else in the installation that's broken?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep the viser installation was broken due to a few shared and conflicting libraries with Isaac Sim