Skip to content

Add tracking cameras that follow a robot to the Newton GL visualizer - #8620

Closed
matthewtrepte wants to merge 23 commits into
isaac-sim:mainfrom
matthewtrepte:mtrepte/newton-gl-tracked-view
Closed

matthewtrepte wants to merge 23 commits into
isaac-sim:mainfrom
matthewtrepte:mtrepte/newton-gl-tracked-view

Conversation

@matthewtrepte

@matthewtrepte matthewtrepte commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Adds tracking cameras: a perspective camera that frames an environment or follows a robot, without creating anything in the scene. It replaces the interactive-camera tracking that @AntoineRichard started in #7760, so the interactive camera stays free and nothing grows with the number of environments.

  • New TrackingCameraCfg, a PerspectiveCameraCfg subclass with env_index (the middle environment by default), track_path (follow an asset or body), follow_heading, and heading_smoothing_time_constant. Its eye and lookat are offsets from the environment origin or the tracked asset; PerspectiveCameraCfg keeps its world-coordinate meaning. The first entry in cameras starts active, and a free view at the visualizer's own pose is added beside tracking cameras.
  • Newton GL renders a tracking camera from the viewer camera, with the viewport's markers and shadows. Camera View lists it as Tracking Camera beside the free Perspective view, and a Tracking Camera group edits it while it runs: environment, followed asset and body, eye, look-at, focal length, heading follow and smoothing, with Reset to Task Default. An unknown asset or ambiguous body is reported and the camera keeps its previous target. Record it with --video viz:newton_gl:tracking, whichever view the window shows. CameraFollower gains set_track_path, asset_names and body_names for this, matching the Tracking Camera in Prototype a unified Newton visualizer with RTX rendering, Policy Ghosts, recording and replay, and a Tracking Camera #8786.
  • Merged with current main, which split VisualizerCfg from KitBackendCfg: tasks declare views in sim.visualizer_cfgs, Newton RTX leaves tracking cameras out.
  • The 44 core tasks declare a tracking camera with the framings from Add task-owned recording cameras with heading tracking #7760: fixed environment views, and views that follow the robot for Ant, Humanoid and the velocity tasks. Each task keeps its viewport pose.

Verification

  • 11 representative tasks recorded with --video viz:newton_gl:tracking on Newton MJWarp with headless Newton GL: Cartpole, Ant, Humanoid, AnymalD, H1, Lift-Franka, Reach-UR10, Open-Drawer-Franka, Reorient-Cube-Shadow, Pendulum-MARL and Shadow-Handover. Framing and tracking match the Add task-owned recording cameras with heading tracking #7760 clips, now with markers.
  • New unit tests cover the follower (fixed, tracking, heading, smoothing, reset, environment switching, switching the followed asset), the recording source, Newton GL view capture and labels. After merging main, the visualizer, follower, adapter, recording and viewer-deprecation unit tests pass; the Newton scene-camera adapter test and the test/app Kit and standalone-script tests fail the same way on main in my environment (Kit EULA bootstrap, installed Newton version). A real Ant environment with Viser binds the view, starts off at environment 0, and computes the followed pose.
  • The 11 representative tasks were recorded again with --video viz:newton_gl:tracking on the merged branch (4 environments, 300 steps, same seed and policies); framing and following match the earlier clips. The floor shows a plain white grid instead of the grey checker pattern, which I have not traced and which is not a camera change.
  • A code review of the merge found issues in CameraFollower reset detection and the Tracking Camera reset; they are fixed and covered by new tests. The reorient tasks lost their task view in play mode in the merge; restored.
  • The Newton integration and golden image tests and the Newton RTX integration test ran before the merge with main and were not repeated.
  • Not run: PhysX, and Newton RTX tracking cameras.

Limits

Tracking cameras are Newton GL only; the Kit visualizer is not extended since it is being removed. Kit, Viser, Newton RTX and Rerun ignore tracking cameras, and a tracking camera shows one environment.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have run the pre-commit checks with ./isaaclab.sh --format (ruff only; the docs build was not run)
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature works
  • I have added changelog fragments

A perspective view can now frame an environment or follow an asset: env_index
places it relative to an environment origin, and track_path follows an asset's
position and, with follow_heading, its smoothed yaw. CameraFollower turns such
a view into world poses and reseeds the heading when an environment resets.
Visualizers that declare only task views get a free view beside them, and the
scene cameras they would find are kept. Add the viz:<type>:tracking video
source, which records the first task view whichever view the window shows.

Builds on the tracking views of isaac-sim#7760 by Antoine Richard.
Each perspective view renders itself, so a task view appears in Camera View
and the interactive view stays free. A recorder captures a task view by
borrowing the viewer camera for one frame and handing it back, so it does not
need the window to show that view. Nothing is created in the scene.
Fixed environment views and robot-following views for the locomotion tasks,
with the framings of isaac-sim#7760. Each task keeps its own viewport pose.
@matthewtrepte
matthewtrepte requested a review from a team October 15, 2026 20:46
@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Oct 15, 2026
@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect Newton GL viewing and recording across tasks that declare tracking cameras.

Fix the conflicting camera settings in reorient play mode before merging.

Findings

  1. P1 Shared views block play ▶
  2. P2 Task close-ups are lost ▶
  3. P2 Camera example cannot run ▶
  4. P2 Old heading survives resets ▶

Summary

Adds Newton GL tracking cameras, live camera controls, and a recording source independent of the selected window view.

  • Newton GL can show a camera that stays with an environment or follows an asset.
  • Core task windows start with views framed for their scenes or robots.
  • Video recording can capture the first tracking view even when another view is selected.

matthewtrepte explicitly limits tracking cameras to Newton GL because Kit is being removed; the earlier Kit lens finding is therefore no longer outstanding.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  C[TrackingCameraCfg] --> F[CameraFollower]
  S[Scene asset pose] --> F
  F --> V[Newton GL viewer camera]
  V --> W[Window]
  V --> R[Tracking recording]
  P[Saved viewer pose] --> B[Restore after recording]
  R --> B
Loading

Reviews (4) · Last reviewed commit: "Merge main into mtrepte/newton-gl-tracke..." · Reviewed by Greptile

Comment on lines +646 to +648
sim_time = self._sim.get_physics_step_count() * self._sim.get_physics_dt()
pose = follower.pose(max(sim_time - self._follow_time, 0.0))
self._follow_time = sim_time

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.

P1 Recorded heading stops following

When the window shows one smoothed task view and recording captures another, both followers share _follow_time. The first update consumes the elapsed time, so the second gets dt=0 when both render at the same physics step. Its heading stops updating on those frames and can remain frozen when this happens every frame. Store the previous update time per follower instead.

Comment on lines +471 to +476
# task views only add to the scene cameras the visualizer would find on its own
task_views_only = bool(visualizer.cfg.cameras) and all(
isinstance(camera, PerspectiveCameraCfg) and camera.is_task_view
for camera in visualizer.cfg.cameras
)
if visualizer.cfg.cameras is None or task_views_only:

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.

P1 Scene cameras disappear

Explicitly constructing NewtonGLVisualizerCfg(cameras=[PerspectiveCameraCfg(env_index=0)], streaming_view=True) disables scene-camera discovery. VisualizerCfg.__post_init__ overwrites streaming_view with False because the list contains no SceneCameraCfg, so execution never reaches this new task_views_only branch. Preserve the existing streaming setting for task-only camera lists so adding a task view does not remove scene cameras.

Comment on lines +92 to +96
last, self._last_position = self._last_position, position
reset = self._yaw is None or last is None or math.dist(position, last) > _RESET_JUMP
tau = self.cfg.heading_smoothing_time_constant
if tau > 0.0 and not reset:
yaw = self._yaw + -math.expm1(-dt / tau) * math.remainder(yaw - self._yaw, math.tau)

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.

P2 Old heading survives resets

A reset only clears heading smoothing when the robot moves more than one meter. The velocity tasks can reset near the same position while choosing a new heading, so this check misses those resets and carries the previous episode's camera heading into the next one. The camera then swings toward the new heading instead of starting there. Clear the follower's heading from an actual environment reset signal rather than relying only on distance.

Create each task view's follower when the viewer initializes, so a bad env_index
or track_path fails there, and warn when the framed environment is not visible.
Keep the one-owner check on a perspective view's renderer, give each follower its
own clock, leave the streaming choice alone when a configuration only declares
task views, and drop a branch no caller reaches.
A velocity-task environment can reset near its old position with a new heading,
which the distance check misses. Also treat a yaw change no robot turns at
(over 10 rad/s) as a reset.
Say what a task view follows or frames instead of numbering it as another
perspective view.

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

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.

Isaac Lab Review Bot

Needs attention: Implementation (1), Style consistency (4), Test quality (2). Other reviewed categories look good.

  • PR description: Correct the body’s Newton-GL-only limit: RTX also applies task-view poses, while only tracking recording is GL-gated; the remaining scope and validation claims match the diff.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: No over-engineering issues.
  • API: API changes look good.
  • Compatibility and deprecation: No breaking changes identified.
  • Implementation: Task views without a registered interactive scene leave the follower map empty and fail during rendering; reject that configuration during initialization or handle the missing follower.
  • Style consistency: The documentation incorrectly excludes RTX task views; state that RTX displays them while tracking recording remains GL-only.
  • Test quality: The standalone Kit tracking failure duplicates the parametrized construction-error owner; merge it there, while retaining the distinct follower and camera hand-back coverage.

Minor fixes needed. Posted 7 inline findings.

Automated review; human maintainers own approval decisions.

The interactive view stays free: a free perspective view at the visualizer's own ``eye`` and ``lookat`` is
added before the task view, and the **Camera View** selector switches between them. While a task view is
selected the window follows the robot, and selecting the free view hands the camera back. Record a task view,
whichever view the window shows, with ``--video viz:newton_gl:tracking``. Newton GL supports task views; the

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 · Style Consistency — Doc contradicts RTX task-view support

NewtonVisualizerBase.initialize builds followers for RTX and NewtonRTXVisualizer._render_frame applies task-view poses, so "the other visualizers ignore them" is wrong; only viz:<type>:tracking recording is GL-gated. Correct this sentence.

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"])

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 · Style Consistency — Grammar error omits tracking form

tracking is now accepted, but the ValueError below still lists only 'viz:<type>:streaming_view', so a typo reports a grammar that contradicts the parser and the updated docstring. Add the new form.

raise ValueError("heading_smoothing_time_constant must be finite and non-negative.")


def with_free_view(cameras: list, eye: tuple, lookat: tuple, focal_length: float) -> list:

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 · Style Consistency — Bare collection annotations on new helper

with_free_view(cameras: list, eye: tuple, lookat: tuple) -> list drops the concrete types the guide requires; adjacent configs use tuple[float, float, float]. Also place it with the module's public functions, before the config classes.

assert viz.render_calls == 0


def test_a_visualizer_without_task_views_cannot_record_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.

🟡 Warning · Test Quality — Duplicates parametrized invalid-source owner

test_invalid_source_raises already owns construction-time source failures with the same (source, env, error, message) shape. Add a viz:kit:tracking row there instead of a standalone near-duplicate test.

raise ValueError("A perspective image view must have exactly one rendering owner.")
view.render = partial(self._capture_view, view)
source = view.cfg.source
if source.is_task_view and scene is not None:

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 — Follower guard not repeated by consumers

Followers are created only when an interactive scene exists, yet _apply_view_pose and both _render_frame overrides index self._followers[view] for every task view, so a scene-less run raises KeyError. Guard the consumers or reject earlier.

def render_task_view_rgb_array(self) -> np.ndarray:
"""Download the first perspective view that is tied to an environment or an asset, whatever the window shows."""
view = next(
(v for v in self._image_views if v.camera is None and getattr(v.cfg.source, "is_task_view", False)), None

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 · Style Consistency — getattr hides known is_task_view attribute

A view with camera is None always carries a PerspectiveCameraCfg, and initialize reads is_task_view directly. The guide forbids getattr defaults for known attributes; use direct access here and at lines 962 and 1313.

assert viz.current_image_view is free and viz._last_render_step == -1


def test_the_task_view_recording_picks_the_first_tied_view_and_reports_none():

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 · Test Quality — Name promises unexercised selection behavior

The name claims it picks the first tied view and reports none, but the fixture holds a single tied view and the second case asserts a RuntimeError. Rename and add a second distinguishable task view.

Report the tracking form in the invalid video source error, correct the docs on
which visualizers show task views, type and place the free-view helper, give a
task view no pose instead of an error when no follower exists, and read the
task-view flag directly. Merge the Kit tracking case into the parametrized
invalid-source test and cover each recording case separately.
Kit follows a task view with its viewport, replacing the origin_type,
origin_env_index and origin_track_path fields of KitVisualizerCfg: the viewport
starts on the first declared view, and follow(), unfollow(), set_follow_env()
and set_view_offsets() switch it, from the environment window or code. The
deprecated viewer bridge and ViewportCameraController map onto them.

Viser gets a Follow task view checkbox, off by default, and an Environment
field. Newton GL gets an Environment field beside Camera View. A follower can
change its environment at runtime.
@matthewtrepte matthewtrepte changed the title Add task views that follow a robot to the Newton GL visualizer Add task views that follow a robot to the Newton GL, Kit and Viser visualizers Oct 15, 2026
…m#8786

Resolve the merge with the visualizer config split: task views are
declared in VisualizerCfg.cameras and the Kit origin_* options stay
removed from KitBackendCfg. Task declarations use
SimulationCfg.visualizer_cfgs, the deprecated viewer bridge builds task
views on the new config, and Newton RTX leaves task views out.

Bring the follower and Newton GL behavior from isaac-sim#8786: set_track_path,
asset_names and body_names on CameraFollower, editable Tracking Camera
fields with a reset to the task default, and the Tracking Camera and
Perspective view names.
Comment on lines +41 to +43
perspective = [camera for camera in cameras if isinstance(camera, PerspectiveCameraCfg)]
if perspective and all(camera.is_task_view for camera in perspective):
return [PerspectiveCameraCfg(eye=eye, lookat=lookat, focal_length=focal_length), *cameras]

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.

P2 Wrong view opens first

When cameras starts with a SceneCameraCfg followed by a task view, with_free_view() inserts a free perspective view before both. Newton GL then selects that new view with _select_camera(0). The window and default recording start on the free view instead of the scene camera the user declared first.

Keep the first declared scene camera first when adding the free view.

Comment on lines +998 to +1001
if views and views[0].is_task_view:
first = views[0]
self.cfg.eye, self.cfg.lookat, self.cfg.focal_length = first.eye, first.lookat, first.focal_length
self.follow(first.track_path, env_index=first.env_index or 0)

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.

P2 Kit ignores task lens

Kit copies the first task view's focal_length into cfg, but never applies it to the viewport camera. The follow path only writes the camera position and target. Task views declaring values such as 26.0 or 35.0 therefore keep Kit's existing lens and show a different view width from Newton GL.

Apply the task view's lens settings when activating it so Kit uses the declared framing.

Insert the free view right before the first task view so scene cameras
declared ahead of it still open first, and set the viewport camera's focal
length when Kit starts following a task view.
@matthewtrepte

Copy link
Copy Markdown
Collaborator Author

@greptileai review

@matthewtrepte

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Oct 27, 2026
Move the task view section after the Newton RTX description, remove the
untested-RTX note, the Kit control details and the duplicated migration
paragraph, and shorten the visualization concept text.
Viser keeps its main behavior and ignores task views. Mark the two Newton RTX
filters as removable together with the RTX visualizer.
@matthewtrepte matthewtrepte changed the title Add task views that follow a robot to the Newton GL, Kit and Viser visualizers Add task views that follow a robot to the Newton GL and Kit visualizers Oct 27, 2026
Add TrackingCameraCfg, a PerspectiveCameraCfg subclass that frames an
environment or follows an asset, and give PerspectiveCameraCfg back its
world-coordinate meaning. Rename task views to tracking cameras in the
code, tests, docs and changelog fragments.
@matthewtrepte matthewtrepte changed the title Add task views that follow a robot to the Newton GL and Kit visualizers Add tracking cameras that follow a robot to the Newton GL and Kit visualizers Oct 27, 2026
env_index is now optional. None picks the middle of the visible environments,
so the view has neighbors on every side, and the tasks no longer repeat env 0.
@matthewtrepte matthewtrepte changed the title Add tracking cameras that follow a robot to the Newton GL and Kit visualizers Add tracking cameras that follow a robot to the Newton GL visualizer Oct 28, 2026
@matthewtrepte

Copy link
Copy Markdown
Collaborator Author

run-ci

@matthewtrepte

Copy link
Copy Markdown
Collaborator Author

@greptileai review

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Oct 28, 2026
viewer.eye = VISUALIZER_CFG.eye
viewer.lookat = VISUALIZER_CFG.lookat
viewer.focal_length = VISUALIZER_CFG.focal_length
viewer.cameras = [camera.replace() for camera in VISUALIZER_CFG.cameras]

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.

P1 Shared views block play

play_mode() now sets viewer.cameras even when the viewer already uses view=ImageViewCfg(...). VisualizerCfg.validate_config() rejects that combination, so reorient tasks with a shared display and recording view fail before launch. Leave cameras unset when viewer.view is set. The other reorient play-mode overrides have the same issue.

Comment on lines 534 to +535
visualizer_cfgs=VisualizerCfg(
eye=(1.4, 1.4, 0.9),
lookat=(0.5, 0.0, 0.1),
backend=MultiBackendVisualizerCfg(kit=KitBackendCfg(origin_type="env", origin_env_index=0)),
cameras=[TrackingCameraCfg(eye=(1.4, 1.4, 0.9), lookat=(0.5, 0.0, 0.1))],

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.

P2 Task close-ups are lost

The pour task moves its existing eye and lookat into TrackingCameraCfg without keeping the viewport settings. Kit, Viser and Rerun skip tracking cameras, and Newton GL adds a free view at the default pose. The task therefore opens at the generic pose instead of its previous close-up. Keep the existing viewport pose alongside the new tracking camera. The particle-push task has the same issue.

.. code-block:: python

from isaaclab.visualizers import PerspectiveCameraCfg, VisualizerCfg
from isaaclab.visualizers import TrackingCameraCfg, VisualizerCfg

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.

P2 Camera example cannot run

This example still constructs PerspectiveCameraCfg, but the changed import imports TrackingCameraCfg instead. Running it, including after the preceding imports, raises NameError. Keep PerspectiveCameraCfg in this import.

@maxkra15 maxkra15 left a comment

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.

reorient_manager_env_cfg.py:244: keep cameras unset when viewer.view is set; play_mode currently makes the config invalid. Same fix in the four reorient overrides.
pour_env_cfg.py:535: keep viewport eye/lookat too; Kit and the added free view otherwise lose the close-up. Same for particle push.
camera_follower.py:158-164: reset heading from the environment reset, not motion thresholds. A45deg in-place reset still carries old heading.
visualizer_streaming_camera_view.rst:58: import PerspectiveCameraCfg used below.

viewer.eye = VISUALIZER_CFG.eye
viewer.lookat = VISUALIZER_CFG.lookat
viewer.focal_length = VISUALIZER_CFG.focal_length
viewer.cameras = [camera.replace() for camera in VISUALIZER_CFG.cameras]

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.

P1: Do not populate cameras when viewer.view is already set. A valid shared ImageViewCfg becomes invalid after play_mode: VisualizerCfg.validate_config raises "Choose view or legacy cameras/streaming_sensor_prim_path, not both." The same assignment is added in the four reorient play-mode overrides.


scene: PourSceneCfg = PourSceneCfg(num_envs=2, env_spacing=2.5)
sim: sim_utils.SimulationCfg = sim_utils.SimulationCfg(
# the viewport starts on the first view, framing environment 0; a free view follows it

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.

P2: Keep the previous eye/lookat on VisualizerCfg. Moving them only into TrackingCameraCfg makes Kit/Viser/Rerun use the generic pose because they ignore tracking cameras; Newton GL also inserts its free view at that generic pose before the tracking view. UR10 particle push has the same regression.

x, y, z, w = quat
yaw = math.atan2(2.0 * (w * z + x * y), 1.0 - 2.0 * (y * y + z * z))
last, self._last_position = self._last_position, position
reset = self._yaw is None or last is None or math.dist(position, last) > _RESET_JUMP

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.

P2: Distance/yaw thresholds cannot identify resets. A robot reset in place by45degrees keeps the previous episode’s filtered heading: at dt0.02,tau0.5 the camera yaw is0.0308rad instead of0.7854rad. Clear the relevant follower when its environment resets and cover a small in-place reset.

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.

5 participants