Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
6821fe6
Add task views to PerspectiveCameraCfg
matthewtrepte Oct 15, 2026
17a6ab6
Render task views from the Newton GL viewer camera
matthewtrepte Oct 15, 2026
866763b
Declare task views for the core tasks
matthewtrepte Oct 15, 2026
91e6550
Document task views and the tracking recording source
matthewtrepte Oct 15, 2026
9b1b6ed
Merge remote-tracking branch 'origin/develop' into mtrepte/newton-gl-…
matthewtrepte Oct 15, 2026
c944f49
Validate task views at initialization and track follower time per view
matthewtrepte Oct 15, 2026
dfff486
Reseed the heading filter when an environment resets in place
matthewtrepte Oct 15, 2026
3f6b0bd
Name task views in the Camera View selector
matthewtrepte Oct 15, 2026
59c4b0c
Address task view review comments
matthewtrepte Oct 15, 2026
2d4fd34
Describe task views in the streaming view docs
matthewtrepte Oct 15, 2026
e4e0d87
Follow task views in Kit and Viser and pick the environment
matthewtrepte Oct 15, 2026
6aeaaf2
Merge remote-tracking branch 'origin/develop' into mtrepte/newton-gl-…
matthewtrepte Oct 15, 2026
287c4d4
Merge origin/main and port the Tracking Camera controls from #8786
matthewtrepte Oct 27, 2026
6d76a1a
Fix review findings in task view following
matthewtrepte Oct 27, 2026
434dd87
Keep the task view on the reorient tasks in play mode
matthewtrepte Oct 27, 2026
7141712
Keep declared scene cameras first and apply the task view lens in Kit
matthewtrepte Oct 27, 2026
9d47742
Tighten the task view documentation and drop outdated behavior
matthewtrepte Oct 27, 2026
f2b0beb
Remove Viser task view following and note the RTX-only filters
matthewtrepte Oct 27, 2026
dd676d6
Split tracking cameras from perspective cameras
matthewtrepte Oct 27, 2026
70e1a8c
Default the tracking camera to the middle environment
matthewtrepte Oct 27, 2026
a66e2f8
Remove tracking camera support from the Kit visualizer
matthewtrepte Oct 28, 2026
68fd75e
Document tracking cameras as Newton GL only in TrackingCameraCfg
matthewtrepte Oct 28, 2026
11417a1
Merge main into mtrepte/newton-gl-tracked-view
matthewtrepte Oct 28, 2026
63c51bd
Merge main into mtrepte/newton-gl-tracked-view
matthewtrepte Nov 11, 2026
418804c
Remove an unused import
matthewtrepte Nov 11, 2026
1151d52
Merge main into pr/1-tracking-camera
matthewtrepte Nov 12, 2026
7e907ae
Address review feedback on tracking cameras
matthewtrepte Nov 12, 2026
6ac4f43
Compare a tracking camera's raw heading when detecting a reset
matthewtrepte Nov 12, 2026
66862f6
Drop a camera follower test that asserts a true-by-construction type …
matthewtrepte Nov 16, 2026
60ab29a
Address review feedback on the tracking camera
matthewtrepte Nov 17, 2026
338d3d3
Validate the tracking view when the recorder binds and freeze the tra…
matthewtrepte Nov 18, 2026
0438b74
Add an RTX renderer toggle and rendering settings to the Newton visua…
matthewtrepte Nov 11, 2026
b0308a5
Place Lighting & Appearance under the renderer toggle, drop the solid…
matthewtrepte Nov 12, 2026
32611fb
Remove Impulse Drag and the Space pause bindings
matthewtrepte Nov 12, 2026
fd7bc96
Restore three files that formatting touched
matthewtrepte Nov 18, 2026
7ff049b
Update the paused OVRTX render changelog fragment
matthewtrepte Nov 12, 2026
7184ded
Keep OVRTX marker batches intact when environments are hidden and dim…
matthewtrepte Nov 12, 2026
b6e3568
Address review feedback on the RTX toggle
matthewtrepte Nov 12, 2026
9bec52e
Keep a sensor view's own environment selection
matthewtrepte Nov 12, 2026
2ff8ae6
Keep the Perspective pose when leaving RTX from a Tracking Camera
matthewtrepte Nov 13, 2026
76a890f
Move the window fit into WindowCfg and declare the viewer camera in a…
matthewtrepte Nov 16, 2026
a363cd2
Mark hiding OVRTX environments below the scene as a workaround
matthewtrepte Nov 16, 2026
19c8a3c
Drop redundant visualizer tests
matthewtrepte Nov 16, 2026
0cc9f88
Fix the RTX visualizer crash, the hover stub in the visualizer checks…
matthewtrepte Nov 17, 2026
3f0bea0
Refresh the RTX frame when markers change
matthewtrepte Nov 17, 2026
b3064cc
Start the window from the configured eye instead of the viewer's defa…
matthewtrepte Nov 17, 2026
80c32a7
Render the OVRTX camera again when visualization markers change
matthewtrepte Nov 17, 2026
5343fd3
Address review feedback on the RTX toggle: standalone RTX controls, s…
matthewtrepte Nov 18, 2026
9a60f0e
Correct the RTX overlay limitation in the visualization docs
matthewtrepte Nov 18, 2026
a3dabb8
Restore files that formatting touched
matthewtrepte Nov 18, 2026
36809df
Restore a file that formatting touched
matthewtrepte Nov 18, 2026
25d29f1
Fix the RTX viewer camera selection, visibility, and paused overlay r…
matthewtrepte Nov 18, 2026
45630b4
Merge remote-tracking branch 'origin/main' into pr/2-rtx-toggle
matthewtrepte Nov 18, 2026
f266e00
Merge remote-tracking branch 'origin/main' into pr/2-rtx-toggle
matthewtrepte Nov 18, 2026
7200706
Leave the shared OVRTX renderer alone in OpenGL, keep a dome light tu…
matthewtrepte Nov 19, 2026
ff23bad
Remove a duplicated class attribute
matthewtrepte Nov 19, 2026
c5d9813
Render the RTX viewer camera on demand, allow it with OVPhysX, hide o…
matthewtrepte Nov 19, 2026
c7265e4
Fix the render-on-demand check for mock sensors and the explicit stre…
matthewtrepte Nov 19, 2026
2721846
Merge main into pr/1-tracking-camera
matthewtrepte Nov 19, 2026
3ee43c2
Keep the tracking camera turning in one direction, hold the tracking …
matthewtrepte Nov 19, 2026
5bf8658
Merge pr/1-tracking-camera into pr/2-rtx-toggle
matthewtrepte Nov 19, 2026
6e1b1ed
Update the Newton visualizer docs and changelogs for the Camera Sourc…
matthewtrepte Nov 19, 2026
4d7541c
Restore shared scene state when leaving RTX, keep the viewer RTX came…
matthewtrepte Nov 19, 2026
8297fce
Say the first RTX switch can take a minute
matthewtrepte Nov 19, 2026
1a27ee1
Offset the tracking camera by the viewer's world offsets, skip live p…
matthewtrepte Nov 19, 2026
13aa091
Merge branch 'pr/1-tracking-camera' into pr/2-rtx-toggle
matthewtrepte Nov 19, 2026
825d053
Fix closing the Newton window while RTX limits environments, release …
matthewtrepte Nov 19, 2026
a530768
Split the tracking camera out of the RTX toggle
matthewtrepte Nov 20, 2026
bef13f6
Remove the Newton RTX visualizer in favor of the RTX toggle
matthewtrepte Nov 20, 2026
aeeabcc
Merge remote-tracking branch 'origin/main' into pr/2-rtx-toggle
matthewtrepte Nov 20, 2026
454b108
Fix imports and the changelog location after merging main
matthewtrepte Nov 20, 2026
ae949c5
Bind perspective image views to the Newton visualizer's capture
matthewtrepte Nov 20, 2026
78c9e78
Initialize the borrowed-view flag, unbind perspective captures on clo…
matthewtrepte Nov 20, 2026
98322a4
Make the OVRTX viewer camera opt-in and show a disabled Renderer togg…
matthewtrepte Nov 20, 2026
87966ff
Add a --rtx_viewer launcher flag and show how to enable RTX in the HUD
matthewtrepte Nov 20, 2026
c461d3d
Keep newton_rtx as the way to enable the RTX viewer camera
matthewtrepte Nov 20, 2026
72b35f5
Drop the newton_rtx deprecation from the changelog
matthewtrepte Nov 20, 2026
101395f
Merge main into the RTX toggle branch
matthewtrepte Nov 20, 2026
1a52a90
Note in the HUD that RTX visible envs and lighting also affect RTX se…
matthewtrepte Nov 20, 2026
0512889
Keep the newton_gl visualizer preset field and translate visualizer=n…
matthewtrepte Nov 20, 2026
f35d9ff
Show a wait message before the first RTX switch and keep each Perspec…
matthewtrepte Nov 20, 2026
fe32f05
Keep an RTX switch request until the next frame starts it
matthewtrepte Nov 20, 2026
9f97e77
Explain the opt-in RTX toggle in the HUD and place the lighting note …
matthewtrepte Nov 20, 2026
43e8845
Clear a failed RTX switch, reset the followed Perspective on leaving …
matthewtrepte Nov 20, 2026
fd9beee
Note in the HUD that RTX overlays and markers also reach RTX sensor c…
matthewtrepte Nov 20, 2026
01778d5
Use the newton_gl visualizer preset field in the MPM examples and tut…
matthewtrepte Nov 21, 2026
772740d
Let --viz newton select the newton_gl preset only when chosen explicitly
matthewtrepte Nov 21, 2026
136c3a9
Add a tracking camera to the Newton visualizer
matthewtrepte Nov 21, 2026
5ddd8ab
Allow one PerspectiveCameraCfg and keep a single Perspective pose in …
matthewtrepte Nov 21, 2026
4769d35
Merge the RTX toggle branch into the tracking camera branch
matthewtrepte Nov 21, 2026
58ac52a
Merge main into the tracking camera branch
matthewtrepte Nov 23, 2026
11a37c8
Describe the tracking camera changes in their own changelog fragment
matthewtrepte Nov 23, 2026
6c1b0b8
Keep the tracking camera's settings in the follower and always draw i…
matthewtrepte Nov 23, 2026
4635b52
Fix the tracking camera's focal length reset, paused edits, the expli…
matthewtrepte Nov 23, 2026
237f603
Re-render the paused RTX view reliably, keep an opted-out window off …
matthewtrepte Nov 24, 2026
5071909
Merge main into the tracking camera branch
matthewtrepte Nov 24, 2026
62a237f
Start the RTX HUD notes with Note
matthewtrepte Nov 24, 2026
915004b
Keep the RTX lighting note within the line length
matthewtrepte Nov 24, 2026
9eec5c0
Merge remote-tracking branch 'upstream/main' into local/viz1-review
matthewtrepte Nov 25, 2026
599ab6b
Address tracking camera review feedback
matthewtrepte Nov 25, 2026
5359358
Merge remote-tracking branch 'origin/main' into w/n50
matthewtrepte Nov 25, 2026
372fee4
Merge remote-tracking branch 'origin/main' into w/n50
matthewtrepte Dec 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/source/api/lab/isaaclab.visualizers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The following classes are part of the public :mod:`isaaclab.visualizers` API.
VisualizerBackendCfg
WindowCfg
PerspectiveCameraCfg
TrackingCameraCfg
SceneCameraCfg
ImageViewCfg
ImageView
Expand All @@ -51,6 +52,9 @@ The following classes are part of the public :mod:`isaaclab.visualizers` API.
.. autoclass:: PerspectiveCameraCfg
:show-inheritance:

.. autoclass:: TrackingCameraCfg
:show-inheritance:

.. autoclass:: SceneCameraCfg
:show-inheritance:

Expand Down
31 changes: 17 additions & 14 deletions docs/source/concepts/visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,14 @@ task's wrist-mounted and ego cameras. The view is supported in the Kit, Newton,
Rerun, and Viser visualizers. **Kit** opens it as a separate **Streaming View** viewport, which can
sit side by side with the default viewport for dual monitoring. **Newton**
provides a **Camera Source** selector in the sidebar for switching between perspective and scene-camera
views.
views. A perspective view can also be a *tracking camera* that follows a robot or frames an environment.
Selecting a scene sensor in **Camera Source** shows its channel: the **Channel** selector lists the
sensor's outputs (RGB, depth, normals, or segmentation), and depth, normals, and segmentation are
converted to colors for display. When the sensor is declared once per environment, **Tiled Envs**
sets how many of its feeds are tiled into the window.

See :doc:`/source/how-to/visualizer_streaming_camera_view` for the ``VisualizerCfg`` options, display
sources, troubleshooting, migration from generated cameras, and step-by-step examples.
sources, tracking cameras that follow a robot, troubleshooting, migration from generated cameras, and step-by-step examples.


Visualization Markers
Expand Down Expand Up @@ -778,22 +778,23 @@ Watch training live in Kit while recording from a separate headless Newton angle
``--viz kit --video viz:newton`` and giving each visualizer its own camera. See
:ref:`Recording from an independent camera angle <how_to_record_video_angle>` for the configuration.

**Following a moving robot (Kit)**
**Following a moving robot**

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This recipe used to be Kit-specific (KitBackendCfg(origin_type="asset", origin_track_path="robot")), and that still works: origin_type/origin_track_path are still on KitBackendCfg, and migrating.rst (around line 2747) still points users to them.

The replacement uses TrackingCameraCfg, which Kit ignores without a warning, so a Kit user following this recipe gets a camera that never moves. The recipe also doesn't say it's Newton GL only.

Can we keep the Kit recipe next to this one, or label this one Newton GL only and link to the Kit option?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Labeled the recipe as Newton GL only and put the Kit option next to it.


Lock the Kit camera to a moving asset instead of updating ``eye``/``lookat`` yourself every
step, running with ``--viz kit``:
Declare a *tracking camera* instead of updating ``eye``/``lookat`` every step; see :ref:`how-to-visualizer-tracking-cameras`.
This is Newton GL only. Kit ignores a ``TrackingCameraCfg`` and follows an asset with
``KitBackendCfg(origin_type="asset", origin_track_path="robot")`` instead. For Newton GL:

.. code-block:: python

from isaaclab_visualizers.kit import KitBackendCfg

from isaaclab.visualizers import VisualizerCfg

from isaaclab_tasks.utils.presets import MultiBackendVisualizerCfg
from isaaclab.visualizers import TrackingCameraCfg, VisualizerCfg

sim_cfg.visualizer_cfgs = VisualizerCfg(
eye=(4.0, 4.0, 2.0),
backend=MultiBackendVisualizerCfg(kit=KitBackendCfg(origin_type="asset", origin_track_path="robot")),
cameras=[
TrackingCameraCfg(
track_path="robot", # or "robot/panda_hand" to track a specific body
eye=(4.0, 4.0, 2.0), # offset from the tracked asset
),
],
)

**Sharing a live view with a remote teammate**
Expand Down Expand Up @@ -821,7 +822,7 @@ share button in the native UI.
Every Newton viewer has a **Visible Envs** slider in its left panel that sets how many
environments are drawn. It changes only what is rendered, not the simulation. In the RTX view the OVRTX renderer is
shared with scene cameras, so the hidden environments also drop out of their images while the RTX view is shown;
the HUD notes this next to the slider.
the HUD notes this next to the slider. Deformable (soft) objects are not hidden in the RTX view.

Resolution Rules
~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1002,7 +1003,9 @@ authored scene through Isaac Lab's OVRTX renderer, shared with cameras using the
``OVRTXRendererCfg``. The Newton window displays the rendered GPU image and handles window controls;
Newton's ``ViewerRTX`` is not constructed. Scene transforms, deformable geometry, and material
updates follow the camera renderer's normal synchronization. Perspective resolution stays
fixed when the window is resized; the window scales the image for presentation.
fixed when the window is resized; the window scales the image for presentation. Use the RTX view in one Newton
window per run: windows with equal renderer settings share the renderer, the viewer camera and the viewer lights.
Visualization markers appear in the RTX view through the viewer camera, not through an ordinary scene camera.
Configure lights and environment placement in the scene. Viewer-only ``rtx_environment`` rigs
and ``world_spacing`` are no longer supported: declare scene lights for studio lighting, remove
scene lights for an unlit scene, and set ``InteractiveSceneCfg.env_spacing`` for world placement.
Expand Down
7 changes: 7 additions & 0 deletions docs/source/how-to/record_video.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ The ``source`` string selects what to capture:
- Newton visualizer viewport, in whichever renderer the window shows (OpenGL or RTX)
* - ``"viz:newton:streaming_view"``
- Newton streaming camera panel, requires ``streaming_view=True``
* - ``"viz:newton:tracking"``
- First ``TrackingCameraCfg`` of the visualizer, whichever view the window shows; see :ref:`how-to-visualizer-tracking-cameras`
* - ``"sensor:<name>"``
- ``env.scene.sensors[name]``, RGB (default)
* - ``"sensor:<name>:rgb"``
Expand All @@ -308,6 +310,11 @@ types are accepted here too, e.g. ``VideoRecorderCfg(source="newton")`` is equiv
headless runs. The recorder source remains ``"viz:newton"``; ``newton_rtx`` selects the
renderer when launching the visualizer.

.. note::

Recording a Tracking Camera with ``"viz:newton:tracking"`` while the window shows another source briefly draws the
tracking view in the window on each recorded frame.


Clip control
------------
Expand Down
50 changes: 48 additions & 2 deletions docs/source/how-to/visualizer_streaming_camera_view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ Streaming a camera view in a visualizer

.. currentmodule:: isaaclab

Display ground-truth camera frames from many environments in one live visualizer panel. For how the view works and which visualizers support it, see
:ref:`visualization-streaming-camera-view`.
This guide shows how to show ground-truth camera frames from many environments in one live
panel of a visualizer, and how to add a view that follows a robot (see :ref:`how-to-visualizer-tracking-cameras`).
For how the view works and which visualizers support it, see :ref:`visualization-streaming-camera-view`.


Sharing a view with recording
Expand Down Expand Up @@ -125,6 +126,7 @@ for dual monitoring.
The **Newton** visualizer has a **Camera Source** selector in the sidebar. Selecting a scene camera displays
its tiled output in the main viewport instead of rendering a perspective view behind it.
Selecting a perspective camera restores interactive scene rendering and picking.
A tracking camera is listed as **Tracking Camera**; see :ref:`how-to-visualizer-tracking-cameras`.

Without an explicit ``cameras`` list, Newton starts in perspective and offers scene cameras
that provide every requested ``streaming_gt_types`` channel. An explicit
Expand Down Expand Up @@ -244,6 +246,50 @@ Unselected cameras are still allocated and may render if another consumer reads
scene uses eager sensor updates. ``streaming_envs`` selects displayed tiles, not capture work.


.. _how-to-visualizer-tracking-cameras:

Tracking cameras that follow a robot
------------------------------------

A ``TrackingCameraCfg`` frames an environment or follows an asset in it. Its ``eye`` and ``lookat`` are
offsets [m] from the environment origin, or from the tracked asset, so it frames the robot wherever the scene puts
it. In the OpenGL renderer the visualizer renders it from its own camera, so nothing is added to the scene and the view
keeps the viewport's markers and shadows. In RTX the window follows it by moving the OVRTX viewer camera, which is a
camera in the scene, and OpenGL shadows do not apply.

.. code-block:: python

from isaaclab.visualizers import TrackingCameraCfg, VisualizerCfg

env_cfg.sim.visualizer_cfgs = VisualizerCfg(
cameras=[
TrackingCameraCfg(
eye=(1.8, -3.0, 1.1),
lookat=(0.15, 0.0, 0.0),
track_path="robot",
follow_heading=True,
heading_smoothing_time_constant=0.2,
)
],
)

* ``env_index``: the environment to frame or follow; defaults to the middle one.
* ``track_path``: a scene asset (``"robot"``) or one of its bodies (``"robot/base"``). Without it, the view stays
fixed in the environment.
* ``follow_heading``: rotate the offsets with the asset's yaw, keeping the horizon level.
``heading_smoothing_time_constant`` [s] damps rapid turns.

A free view at the visualizer's own ``eye`` and ``lookat`` is added before the first tracking camera, so the
interactive camera stays free.

* **Newton:** **Camera Source** lists the tracking camera as **Tracking Camera** beside **Perspective**, and the
window follows it in both the OpenGL and RTX renderers. A **Tracking Camera** group edits its environment, asset,
body, eye, look-at, focal length and heading settings while it runs; **Reset to Task Default** restores the
declaration. Record it with ``--video viz:newton:tracking``, whichever view the window shows. Plain
``--video viz:newton`` records whichever renderer the window shows.
* **Kit**, **Viser** and **Rerun** ignore tracking cameras.


Examples
--------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* Added :class:`~isaaclab.visualizers.TrackingCameraCfg`, a perspective camera that frames an environment or follows
an asset with optional smoothed heading. Added the ``viz:<type>:tracking`` video source, which records the first
tracking camera whichever view the window shows. A visualizer opts in by overriding
:attr:`~isaaclab.visualizers.BaseVisualizer.has_tracking_view` and
:meth:`~isaaclab.visualizers.BaseVisualizer.render_tracking_rgb_array`, which Newton GL does.
Empty file.
10 changes: 9 additions & 1 deletion source/isaaclab/isaaclab/envs/utils/video_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,15 @@ def __init__(self, cfg: VideoRecorderCfg, env: object):
f"Enable streaming_view on {viz.cfg.backend.visualizer_type!r} to record its sensor view."
)
# Legacy recording follows camera selection in the window.
self._capture = viz.render_tiled_rgb_array if channel == "streaming_view" else viz.render_rgb_array
if channel == "tracking":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we not have hardcoded string checks in if statements? can we leverage the cfg for this?

@matthewtrepte matthewtrepte Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i kept channel == "tracking" since its the source name from --video viz:newton:tracking, same as the channel == "streaming_view" check next to it and in sim_launcher

we could use a cfg flag though that would duplicate the string we alredy have to parse. or i can move the source names into the visulizer and do the string check there

below, the visualizer type check is gone the recorder asks viz.has_tracking_view now

if not viz.has_tracking_view:
raise RuntimeError(
f"The {viz.cfg.backend.visualizer_type!r} visualizer has no tracking camera to record. Add a "
"TrackingCameraCfg to its cameras, on a visualizer that supports tracking cameras."
)
self._capture = viz.render_tracking_rgb_array

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Implementation — Validate tracking sources at binding

A Newton GL visualizer without a tracking camera binds successfully and raises only on the first captured frame. Resolve and validate the first tracking view when constructing the recorder.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already checked at construction: the recorder raises if the visualizer has no tracking view (has_tracking_view), so it no longer fails on the first frame.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Implementation — Validate tracking when binding

A Newton GL visualizer without a tracking camera binds successfully, then raises on the first recorded frame. Check that the view exists during recorder construction, like other invalid sources.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already checked at construction: the recorder raises if the visualizer has no tracking view (has_tracking_view), so it no longer fails on the first frame.

else:
self._capture = viz.render_tiled_rgb_array if channel == "streaming_view" else viz.render_rgb_array

self.cfg = cfg
self._env = env
Expand Down
16 changes: 11 additions & 5 deletions source/isaaclab/isaaclab/envs/utils/video_recorder_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def parse_video_source(source: str) -> tuple[str, str, str]:
"""Split a string :attr:`VideoRecorderCfg.source` into ``(kind, name, sub)``.

``kind`` is ``"viz"`` or ``"sensor"``; ``name`` is the canonical visualizer type (``""`` for a bare
``"viz"``) or the sensor name; ``sub`` is ``"streaming_view"``, a sensor channel, or ``""``.
``"viz"``) or the sensor name; ``sub`` is ``"streaming_view"``, ``"tracking"``, a sensor channel, or ``""``.
The prefix ``visualizer`` is the long form of ``viz``, as ``--visualizer`` is of ``--viz``;
the ``newton_gl`` and ``newton_rtx`` aliases are mapped to ``newton``.
A bare visualizer type is shorthand for ``viz:<type>``.
Expand All @@ -36,14 +36,18 @@ def parse_video_source(source: str) -> tuple[str, str, str]:
name, sub = (*parts, "", "")[:2]
if kind == "viz" and not parts:
return kind, "", ""
if kind == "viz" and parts[1:] in ([], ["streaming_view"]) and name in (*VISUALIZER_TYPES, *VISUALIZER_ALIASES):
if (
kind == "viz"
and parts[1:] in ([], ["streaming_view"], ["tracking"])
and name in (*VISUALIZER_TYPES, *VISUALIZER_ALIASES)
):
return kind, VISUALIZER_ALIASES.get(name, name), sub
if kind == "sensor" and 1 <= len(parts) <= 2 and name and sub in ("", *SENSOR_CHANNELS):
return kind, name, sub
raise ValueError(
f"Invalid video source {source!r}: expected '<type>', 'viz', 'viz:<type>', 'viz:<type>:streaming_view' or "
f"'sensor:<name>[:<channel>]', with <type> one of {', '.join(VISUALIZER_TYPES)} and <channel> one of "
f"{', '.join(SENSOR_CHANNELS)}."
f"Invalid video source {source!r}: expected '<type>', 'viz', 'viz:<type>', 'viz:<type>:streaming_view', "
f"'viz:<type>:tracking' or 'sensor:<name>[:<channel>]', with <type> one of "
f"{', '.join(VISUALIZER_TYPES)} and <channel> one of {', '.join(SENSOR_CHANNELS)}."
)


Expand All @@ -66,6 +70,8 @@ class VideoRecorderCfg:
camera: the one ``--viz`` selected, else a headless one added for the recording.
* ``"viz:<type>:streaming_view"`` – the streaming camera panel of that visualizer (requires
``streaming_view=True`` on its :class:`~isaaclab.visualizers.VisualizerCfg`).
* ``"viz:<type>:tracking"`` – the first :class:`~isaaclab.visualizers.TrackingCameraCfg` of
that visualizer, whichever view its window shows. Only Newton GL supports it.
* ``"sensor:<name>"`` – scene sensor, RGB channel (default); no visualizer is added.
* ``"sensor:<name>:<channel>"`` – scene sensor channel: ``rgb``, ``depth`` (colorized via the turbo
colormap), ``segmentation`` or ``normals`` (colorized).
Expand Down
34 changes: 32 additions & 2 deletions source/isaaclab/isaaclab/sim/simulation_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@
from ..utils.version import has_kit
from ..visualizers.base_visualizer import BaseVisualizer
from ..visualizers.image_view import ImageView
from ..visualizers.visualizer_cfg import PerspectiveCameraCfg, SceneCameraCfg, VisualizerCfg, migrate_visualizer_cfgs
from ..visualizers.visualizer_cfg import (
PerspectiveCameraCfg,
SceneCameraCfg,
TrackingCameraCfg,
VisualizerCfg,
migrate_visualizer_cfgs,
)
from .utils import create_new_stage
from .utils import stage as stage_utils

Expand All @@ -51,6 +57,27 @@
logger = logging.getLogger(__name__)


def _with_free_view(
cameras: list[PerspectiveCameraCfg | SceneCameraCfg],
eye: tuple[float, float, float],
lookat: tuple[float, float, float],
focal_length: float,
) -> list[PerspectiveCameraCfg | SceneCameraCfg]:
"""Return *cameras* with a free perspective view added when it has tracking cameras but no free view of its own.

A tracking camera follows a robot or frames an environment, so the interactive view that a user moves stays
available beside it, at the visualizer's own ``eye``, ``lookat`` and ``focal_length``. The free view goes
right before the first tracking camera, so scene cameras declared ahead of it stay first. This camera policy is
temporary here: the visualizers should resolve their own camera lists from ``VisualizerCfg.cameras``.
"""
perspective = [camera for camera in cameras if isinstance(camera, PerspectiveCameraCfg)]
if perspective and all(isinstance(camera, TrackingCameraCfg) for camera in perspective):
free = PerspectiveCameraCfg(eye=eye, lookat=lookat, focal_length=focal_length)
first_tracking = next(i for i, camera in enumerate(cameras) if isinstance(camera, PerspectiveCameraCfg))
return [*cameras[:first_tracking], free, *cameras[first_tracking:]]
return cameras


class SimulationContext:
"""Controls simulation lifecycle including physics stepping and rendering.

Expand Down Expand Up @@ -426,12 +453,15 @@ def initialize_visualizers(self, config_filter: Callable[[Any], bool] | None = N
eye=visualizer.cfg.eye, lookat=visualizer.cfg.lookat, focal_length=visualizer.cfg.focal_length
)
]) # fmt: skip
cameras = _with_free_view(cameras, visualizer.cfg.eye, visualizer.cfg.lookat, visualizer.cfg.focal_length)
if visualizer.cfg.view is None and visualizer.cfg.streaming_view:
sensors = self._scene_data_provider.get_camera_sensors()
env_template = self._clone_plan.env_template if self._clone_plan is not None else DEFAULT_ENV_TEMPLATE
for gt_type in visualizer.cfg.streaming_gt_types:
sensor_key_for_gt_type(gt_type)
if visualizer.cfg.cameras is None:
# tracking cameras only add to the scene cameras the visualizer would find on its own
discovered = visualizer.cfg.cameras is None or visualizer.cfg.tracking_cameras_only()
if discovered:
if visualizer.cfg.streaming_sensor_prim_path is not None:
cameras.insert(0, SceneCameraCfg(prim_path=visualizer.cfg.streaming_sensor_prim_path))
else:
Expand Down
2 changes: 2 additions & 0 deletions source/isaaclab/isaaclab/visualizers/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ __all__ = [
"KeyEventSource",
"KeyboardSubscription",
"PerspectiveCameraCfg",
"TrackingCameraCfg",
"SceneCameraCfg",
"VisualizerCfg",
"VisualizerBackendCfg",
Expand All @@ -24,6 +25,7 @@ from .visualizer_cfg import (
ImageViewCfg,
PerspectiveCameraCfg,
SceneCameraCfg,
TrackingCameraCfg,
VisualizerBackendCfg,
VisualizerCfg,
WindowCfg,
Expand Down
21 changes: 20 additions & 1 deletion source/isaaclab/isaaclab/visualizers/base_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ def initialize(self, sim: SimulationContext, *, cameras: list[PerspectiveCameraC
pool = self._env_ids if self._env_ids is not None else range(num_envs)
num_tiles = min(int(self.cfg.streaming_envs), _VISUALIZER_MAX_TILES, len(pool))
env_ids = sorted(random.sample(pool, num_tiles))
automatic_sources = self.cfg.cameras is None and self.cfg.streaming_sensor_prim_path is None
automatic_sources = (
self.cfg.cameras is None or self.cfg.tracking_cameras_only()
) and self.cfg.streaming_sensor_prim_path is None
rtx_path = getattr(self.cfg.backend, "rtx_camera_path", None)
for camera in cameras:
if isinstance(camera, PerspectiveCameraCfg):
Expand Down Expand Up @@ -158,6 +160,23 @@ def render_tiled_rgb_array(self) -> np.ndarray | None:
return None
return self.current_image_view.read_rgb(self._sim.get_physics_step_count())

@property
def has_tracking_view(self) -> bool:
"""Whether this visualizer displays a Tracking Camera that a recording can read.

``False`` unless the visualizer supports tracking cameras and overrides this together with
:meth:`render_tracking_rgb_array`.
"""
return False

def render_tracking_rgb_array(self) -> np.ndarray:
"""Download the first Tracking Camera view for CPU consumers, whatever the window shows.

Raises:
NotImplementedError: If the visualizer does not support tracking cameras.
"""
raise NotImplementedError(f"{type(self).__name__} does not support tracking cameras.")

@abstractmethod
def step(self, dt: float) -> None:
"""Update visualization for one step.
Expand Down
Loading
Loading