isaaclab.visualizers#

Visualizer configurations and implementations.

Custom visualizers implement initialize(sim, *, cameras) and reset(soft=False). Initialization receives the simulation owner explicitly. Call super().initialize(sim, cameras=cameras) to retain the simulation as self._sim and bind scene data. Resolve backend-specific resources in the implementation; core lifecycle dispatch does not import or construct them. Hard resets can reacquire resources through self._sim.get_or_create_backend(...) and access the stage through self._sim.stage. Rendering uses the resolved resources.

Additional Public Classes#

The following classes are part of the public isaaclab.visualizers API.

BaseVisualizer

Base class for all visualizer backends.

KeyEventSource

Keyboard input from a focused visualizer window.

KeyboardSubscription

A listener subscribed with KeyEventSource.add_key_listener().

VisualizerCfg

View, window, and scene settings independent of the selected visualizer backend.

VisualizerBackendCfg

Implementation and backend-specific options for a visualizer.

WindowCfg

Native window presentation, independent of the camera's image resolution.

PerspectiveCameraCfg

Initial pose and optics for an interactive perspective camera.

SceneCameraCfg

Select an existing scene camera's output as the visualizer's main view.

ImageViewCfg

A shared image selection consumed by windows and recorders.

ImageView

Own one composed GPU image shared by its display and recording consumers.

class isaaclab.visualizers.BaseVisualizer[source]#

Bases: ABC

Base class for all visualizer backends.

Lifecycle: __init__() -> initialize() -> step() (repeated) -> close()

Methods:

__init__(cfg)

Initialize visualizer with config.

__new__(*args, **kwargs)

__init__(cfg: VisualizerCfg)[source]#

Initialize visualizer with config.

Parameters:

cfg – Visualizer configuration.

classmethod __new__(*args, **kwargs)#
class isaaclab.visualizers.KeyEventSource[source]#

Keyboard input from a focused visualizer window.

Obtained from key_event_source. For every backend:

  • Subscribing, closing and every callback happen on the thread that steps the visualizer.

  • on_key receives the window’s presses and releases as W3C KeyboardEvent.code strings. Key repeat can arrive as further presses, and a release can arrive without its press (e.g. a key pressed in the visualizer’s UI), so a listener tracks the keys it holds.

  • on_focus_lost runs when the window stops delivering keys: it lost focus, the visualizer’s UI took the keyboard, or the source closed. The listener treats every held key as released.

  • A listener that raises is logged and does not affect other listeners.

  • Closing the source delivers a final focus loss to every listener; afterwards add_key_listener() raises RuntimeError.

The visualizer connects native events when its window initializes and closes the source before the window closes. Backend bridges report events through _emit_key() and _emit_focus_lost(); adding or removing a listener never changes native window resources.

Methods:

__init__()

add_key_listener(on_key, on_focus_lost)

Subscribe to key presses and releases from the initialized window.

close()

Close every subscription and deliver a final focus loss to its listener.

__new__(*args, **kwargs)

Attributes:

closed

Whether the source was closed.

__init__() → None[source]#
property closed: bool[source]#

Whether the source was closed.

add_key_listener(on_key: Callable[[str, bool], None], on_focus_lost: Callable[[], None]) → KeyboardSubscription[source]#

Subscribe to key presses and releases from the initialized window.

Parameters:
  • on_key – Called with the key’s W3C KeyboardEvent.code and whether it was pressed.

  • on_focus_lost – Called when the window stops delivering keys.

Returns:

The subscription. Close it to unsubscribe.

Raises:

RuntimeError – If the source is closed.

close() → None[source]#

Close every subscription and deliver a final focus loss to its listener.

classmethod __new__(*args, **kwargs)#
class isaaclab.visualizers.KeyboardSubscription[source]#

A listener subscribed with KeyEventSource.add_key_listener().

Close it (or use it as a context manager) to unsubscribe. Closing is idempotent and delivers no final focus loss: the listener chose to leave.

Methods:

__init__(source, on_key, on_focus_lost)

close()

Unsubscribe.

__new__(*args, **kwargs)

Attributes:

closed

Whether the subscription no longer receives callbacks.

__init__(source: KeyEventSource, on_key: Callable[[str, bool], None], on_focus_lost: Callable[[], None]) → None[source]#
property closed: bool[source]#

Whether the subscription no longer receives callbacks.

close() → None[source]#

Unsubscribe.

classmethod __new__(*args, **kwargs)#
isaaclab.visualizers.add_key_callbacks(visualizers: Sequence[BaseVisualizer], callbacks: Mapping[str, Callable[[], None]]) → Callable[[], None][source]#

Call callbacks[key] when key is pressed in a visualizer window, e.g. for a script’s hotkeys.

Keys are letters or digits ("N", "1") or W3C KeyboardEvent.code strings ("Escape"). Key repeat is not a press, and a press reported by several visualizers (Kit visualizers share the app window) fires once. The callbacks end when the visualizers close, or when the returned function is called.

Parameters:
  • visualizers – The windows to read, usually sim.visualizers.

  • callbacks – The function to call for each key. Takes no arguments.

Returns:

A function that removes the callbacks.

class isaaclab.visualizers.VisualizerCfg[source]#

Bases: object

View, window, and scene settings independent of the selected visualizer backend.

Methods:

__new__(*args, **kwargs)

__init__([backend, view, window, headless, ...])

classmethod __new__(*args, **kwargs)#
__init__(backend: ~isaaclab.visualizers.visualizer_cfg.VisualizerBackendCfg | list[~isaaclab.visualizers.visualizer_cfg.VisualizerBackendCfg] = <factory>, view: ~isaaclab.visualizers.visualizer_cfg.ImageViewCfg | None = <factory>, window: ~isaaclab.visualizers.visualizer_cfg.WindowCfg = <factory>, headless: bool = <factory>, cameras: list[~isaaclab.visualizers.visualizer_cfg.PerspectiveCameraCfg | ~isaaclab.visualizers.visualizer_cfg.SceneCameraCfg] | None = <factory>, eye: tuple[float, float, float] = <factory>, lookat: tuple[float, float, float] = <factory>, focal_length: float = <factory>, background_color: tuple[float, float, float] | None = <factory>, streaming_view: bool = <factory>, streaming_sensor_prim_path: str | None = <factory>, streaming_envs: int | list[int] = <factory>, streaming_gt_types: tuple[str, ...] = <factory>, streaming_depth_min: float = <factory>, streaming_depth_max: float = <factory>, max_visible_envs: int | None = <factory>, visible_env_indices: list[int] | None = <factory>, randomly_sample_visible_envs: bool = <factory>, enable_markers: bool = <factory>, enable_live_plots: bool = <factory>, live_plots_update_interval: int = <factory>) → None#
class isaaclab.visualizers.VisualizerBackendCfg[source]#

Bases: object

Implementation and backend-specific options for a visualizer.

Methods:

__new__(*args, **kwargs)

__init__([class_type, visualizer_type])

classmethod __new__(*args, **kwargs)#
__init__(class_type: type[BaseVisualizer] | str | None = <factory>, visualizer_type: str | None = <factory>) → None#
class isaaclab.visualizers.PerspectiveCameraCfg[source]#

Bases: object

Initial pose and optics for an interactive perspective camera.

Newton RTX launch preparation expands this declaration into a scene CameraCfg. Newton GL uses its native viewer camera.

Methods:

__new__(*args, **kwargs)

__init__([eye, lookat, focal_length])

classmethod __new__(*args, **kwargs)#
__init__(eye: tuple[float, float, float] = <factory>, lookat: tuple[float, float, float] = <factory>, focal_length: float = <factory>) → None#
class isaaclab.visualizers.SceneCameraCfg[source]#

Bases: object

Select an existing scene camera’s output as the visualizer’s main view.

This does not create a sensor. Declare its pose, optics, and renderer in the scene’s CameraCfg.

Methods:

__new__(*args, **kwargs)

__init__([prim_path])

classmethod __new__(*args, **kwargs)#
__init__(prim_path: str = <factory>) → None#
class isaaclab.visualizers.ImageViewCfg[source]#

Bases: object

A shared image selection consumed by windows and recorders.

Reusing this declaration shares one runtime view within a simulation, including across copies of an environment configuration. Use isaaclab.utils.replace() to declare an independent view.

Methods:

__new__(*args, **kwargs)

__init__([class_type, source, envs, ...])

classmethod __new__(*args, **kwargs)#
__init__(class_type: str = <factory>, source: str | ~isaaclab.visualizers.visualizer_cfg.PerspectiveCameraCfg = <factory>, envs: tuple[int, ...] = <factory>, channels: tuple[str, ...] = <factory>, depth_range: tuple[float, float] = <factory>) → None#
class isaaclab.visualizers.ImageView[source]#

Own one composed GPU image shared by its display and recording consumers.

The scene retains ownership of sensors and their capture cadence. Perspective producers write device pixels through render. Reading twice for the same frame reuses the composed image; only read_rgb() transfers pixels to the host.

Methods:

__init__(cfg, *[, camera])

Bind a view declaration to a scene sensor or an initially unbound perspective producer.

read(frame_id)

Return native RGB/RGBA perspective pixels or composed uint8 [H, W, 4] sensor tiles; None for no rows.

read_rgb(frame_id)

Download the composed frame once for CPU encoders or network transports.

invalidate()

Invalidate cached pixels after camera movement, a source update, or a simulation reset.

__new__(*args, **kwargs)

__init__(cfg: ImageViewCfg, *, camera: Camera | BaseRayCasterCamera | None = None) → None[source]#

Bind a view declaration to a scene sensor or an initially unbound perspective producer.

read(frame_id: int | float) → array | None[source]#

Return native RGB/RGBA perspective pixels or composed uint8 [H, W, 4] sensor tiles; None for no rows.

read_rgb(frame_id: int | float) → ndarray | None[source]#

Download the composed frame once for CPU encoders or network transports.

invalidate() → None[source]#

Invalidate cached pixels after camera movement, a source update, or a simulation reset.

classmethod __new__(*args, **kwargs)#
class isaaclab.visualizers.WindowCfg[source]#

Bases: object

Native window presentation, independent of the camera’s image resolution.

Methods:

__new__(*args, **kwargs)

__init__([size, fps])

classmethod __new__(*args, **kwargs)#
__init__(size: tuple[int, int] = <factory>, fps: float = <factory>) → None#