Skip to content

[6Biii] Select visualizer consumers before launching runtimes - #8126

Merged
ooctipus merged 6 commits into
isaac-sim:developfrom
ooctipus:refactor/pr6b-visualizer-launch
Oct 18, 2026
Merged

ooctipus merged 6 commits into
isaac-sim:developfrom
ooctipus:refactor/pr6b-visualizer-launch

Conversation

@ooctipus

@ooctipus ooctipus commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Launch decisions were split between a Scan result, global settings, and simulation construction. This makes the configuration passed to launch_simulation the source of truth: task selection resolves first, validate_launch prepares consumers and rejects incompatible runtimes, and each required runtime starts once. Recording selects or reuses its producer without opening a window.

Before and after:

  • uv run isaaclab train --task Isaac-Cartpole-Direct --rl_library rsl_rl visualizer=newton_gl now selects the viewer during task composition; --viz newton_gl is the equivalent spelling. Physics and renderer flags follow the same preset boundary.
  • A Python SimulationCfg(visualizer_cfgs=[NewtonGLVisualizerCfg(...)]) previously needed --viz newton_gl to run that declared viewer. It now runs as configured. --viz none disables windows; an empty config remains windowless by default.
  • --video viz:newton_gl:streaming_view retains headless, on-demand capture and enables the requested sensor view. Multiple recorders sharing a view reuse one producer.

Removed Scan, scan, duplicate selection helpers, and the settings-based viewer handoff. One traversal now collects and replaces runtime configs while preserving shared references; configuration tests call validation directly without mocking runtime startup. Standalone scripts pass the same simulation config to launch and construction. RTX perspective cameras remain ordinary scene cameras declared before construction.

Scope: 6Biii, 84 files, +1,125 / −1,369. The shared VisualizerCfg/backend API and its task/example migration are now in #8704 (6Biv). This PR retains the existing backend config API.

Validation: 308 focused tests passed across launch/runtime selection, device propagation, recording, simulation lifecycle, Kit arguments, task presets, and standalone configuration. An RTX particle-motion test passed on GPU0. uv run isaaclab -f passed.

  • Updated behavior documentation and migration guidance
  • Ran formatting/lint and focused tests
  • Added changelog fragments for every touched package

@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Sep 29, 2026
@ooctipus

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 Sep 29, 2026
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 2/5

[High impact] Restructures how visualizers are selected and initialized at runtime.

Fix shared-view recording startup, device propagation across simulation configs, and the outstanding XR update issue before merging.

Findings

  1. P1 Shared recordings fail to start ▶
  2. P1 Later simulations use wrong GPU ▶
  3. P1 XR viewer skips Kit updates ▶

Summary

Selects viewers before runtime launch and passes the same config into simulation construction.

  • Task commands can select visualizers before the simulation starts.
  • The launcher picks process runtimes from the configured simulation consumers.
  • Simulation examples and tools pass their config through launch and construction.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Task selectors or concrete configs] --> B[Resolve selected viewers]
  B --> C[Add recording producers]
  C --> D[Resolve required runtimes]
  D --> E[Launch runtimes]
  E --> F[Construct simulation from same config]
Loading

Reviews (2) · Last reviewed commit: "Select visualizers before runtime launch" · Reviewed by Greptile

if livestream and sim_cfg.visualizer_cfgs == []:
raise ValueError("Livestreaming requires the Kit visualizer; visualizer=none disables it.")
if not any(viewer.launcher_type == _KIT_LAUNCHER for viewer in viewers):
sim_cfg.visualizer_cfgs = [*viewers, KitVisualizerCfg(headless=bool(launcher_args.get("xr", False)))]

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 XR viewer skips Kit updates

When XR starts without a windowed Kit viewer, this code adds a headless Kit viewer. Its step() returns before calling app.update(), so it cannot provide the per-frame Kit updates needed for XR hand and joint transforms. Those transforms will not update as intended.

@ooctipus

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 Sep 29, 2026

@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

The pre-launch visualizer composition design is coherent, but three concrete issues remain: URDF/MJCF previews ignore the selected device, tuple traversal cannot support the documented in-place config replacement, and legacy preset aliases now have duplicated sources of truth.

  • Design and architecture: Moving visualizer selection into preset composition and attaching runtime requirements to concrete configs removes the settings round trip cleanly. However, legacy alias mappings are duplicated between the shared preset utility and PresetTarget, with stale ownership documentation and a maintenance risk if the tables diverge.
  • API: The refactor preserves launch_simulation's namespace/dict inputs and resolved-physics yield, but two observable contracts need correction: --device no longer affects URDF/MJCF previews on kitless paths, and scan claims tuple support even though tuple-held replaceable configs fail deterministically.
  • Implementation: The launch and device-resolution flow otherwise traces consistently, but convert_urdf.py and convert_mjcf.py must initialize SimulationCfg with args_cli.device. The scan replacement logic must either rebuild tuple containers through their parent or stop advertising tuple traversal. Preset alias ownership should also be consolidated into one maintained table.

Minor fixes needed. Posted 3 actionable findings inline.

Automated review; human maintainers own approval decisions.

@@ -173,7 +170,8 @@ def main():
print("-" * 80)
print("-" * 80)

with launch_simulation(cfg=PhysicsCfg(), launcher_args=args_cli) as physics_cfg:
sim_cfg = sim_utils.SimulationCfg()

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 — URDF/MJCF preview ignores --device

The preview config previously used SimulationCfg(device=args_cli.device, physics=physics_cfg); it is now SimulationCfg(). In the preferred kit-less path (standalone importers present, newton_mjwarp) no launcher runs, so nothing overwrites sim_cfg.device and --device cpu silently previews on the default cuda:0. scripts/tools/convert_mjcf.py:162 has the same regression, while convert_mesh.py kept the argument. Pass device=args_cli.device.

setattr(parent, key, node)
else:
effective_cfg = node
owner[key] = node = _make_physics_cfg(physics_str)

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 — Tuple-held configs cannot be replaced

scan now documents and walks tuples, and owner may be a tuple, but the replacement paths assign owner[key] = ... for --physics overrides (line 264) and for auto-PhysX/auto-RTX resolution (lines 313, 330). A PhysicsCfg or auto-RTX placeholder stored in a tuple therefore raises TypeError deterministically. Rebuild and reattach the tuple through its parent when replacing an element, or restrict the documented traversal to mutable containers.


from .configclass import configclass

_LEGACY_PRESET_ALIASES = {

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.

🔵 Suggestion · Design Architecture — Legacy alias table duplicated from PresetTarget

_LEGACY_PRESET_ALIASES re-declares the mappings owned by PresetTarget.legacy_aliases, and the resolver no longer consults PresetTarget.all_legacy_aliases(). The two tables can now drift silently, and preset_target.py's docstrings still state that _normalize_preset_name consults them. Keep one source of truth: have the hydra path pass PresetTarget.all_legacy_aliases() through the existing aliases parameter, or drop the enum's alias data and its docs.

@ooctipus

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 Sep 29, 2026
@github-actions github-actions Bot added the isaac-mimic Related to Isaac Mimic team label Sep 29, 2026
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added the ci:run-docker Trigger the on-demand Docker and GPU CI workflow label Sep 29, 2026
@ooctipus
ooctipus force-pushed the refactor/pr6b-visualizer-launch branch from 4ed1834 to 23e1808 Compare October 14, 2026 18:50
@ooctipus

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 14, 2026
@ooctipus

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 14, 2026
@ooctipus

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 14, 2026
@ooctipus

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 14, 2026
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added the ci:run-docker Trigger the on-demand Docker and GPU CI workflow label Oct 14, 2026
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

2 similar comments
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@StafaH StafaH left a comment

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.

Found three selection issues and two test cleanups. The focused checks passed 62 tests; the five summary cases fail without CUDA.

viewers = env_cfg.sim.visualizer_cfgs
viewers = viewers if isinstance(viewers, list) else [viewers] if viewers else []
for viewer in viewers:
vars(choices)[viewer.visualizer_type] = viewer

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 keeps only the last viewer of each type. With two configured NewtonGLVisualizerCfg instances, --viz newton_gl silently drops the first, unlike the standalone launcher. Please preserve all matching instances in order and only create a default when none match.

if not value or value.startswith("-") or "=" in value:
parser.error(f"{key} requires a preset name.")
key = "visualizer" if key == "--viz" else key[2:]
token = f"{key}={value}"

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.

record_demos.py, replay_demos.py, and teleop_se3_agent.py still intersect these normalized tokens with the external callback's raw remainder. That drops --viz newton_gl, since it no longer matches visualizer=newton_gl; physics and renderer aliases have the same issue. Please normalize those callback remainders too, as the RSL-RL entrypoints now do.

f"'{task_name}'. Choose a declared preset, or remove the selector(s) to use its registered default "
"configuration."
)
if PresetTarget.VISUALIZER.matches in selectors.keys() - consumed_selectors:

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.

With a declared MultiBackendVisualizerCfg, visualizer=kit env.sim.visualizer_cfgs=newton_gl ends up selecting Kit. The explicit path resolves first, leaving the global selector unconsumed, so this fallback overwrites it. Please skip the fallback when an explicit path already selected the viewer.

scan(env_cfg, args_cli)
monkeypatch.setattr(physx_app, "KitLauncher", SimulationLauncher)
monkeypatch.setattr(ov_app, "OvrtxLauncher", SimulationLauncher)
with launch_simulation(env_cfg, args_cli):

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.

Could this just call validate_launch(env_cfg, args_cli)? The mocked launch still checks the task's default cuda:0 device, so all five cases fail with CUDA_VISIBLE_DEVICES="". Direct validation covers what the summary needs and removes the launcher mocks and imports.

"""Preset selection preserves declared settings; physics aliases do not also select a viewer."""
assert importlib.util.find_spec("isaaclab.utils.presets") is None
assert importlib.util.find_spec("isaaclab_visualizers.presets") is None
assert "resolve_simulation_cfg" not in vars(sim_launcher)

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.

nit: Please drop these three assertions and the unused importlib.util import. They constrain module layout rather than selection behavior; the assertions below already cover the behavior this test describes.

parse_visualizer_csv,
)
from ..visualizers import ImageViewCfg, PerspectiveCameraCfg, SceneCameraCfg, VisualizerCfg
from ..visualizers.visualizer_cfg import VISUALIZER_ALIASES, _apply_visualizer_defaults

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.

_ function is being imported, remove _ if it's used outside of file

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.

Agreed, the underscore is misleading since this is shared across modules. I left it unchanged here because #8704 removes this helper and the default-merging logic entirely. That follow-up replaces them with shared visualizer configuration, so there will be no cross-module helper to rename.

@@ -3,12 +3,7 @@
#

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.

Does the code get simpler if we just seperate the kit into kit_launcher() and then sim_launcher is just kit-less? Theres so much code that tries to determine if kit is needed, how would it look if there was just a clear seperation?

@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

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 infrastructure isaac-lab Related to Isaac Lab team isaac-mimic Related to Isaac Mimic team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants