Repository navigation
[Core] Let --visualizer and --video decide what runs and records - #8198
Conversation
|
run-ci |
|
| visualizer_types = args["visualizer"] if sim_cfg is None else [c.visualizer_type for c in sim_cfg.visualizer_cfgs] | ||
| max_visible_envs = args.get("max_visible_envs") | ||
| settings = get_settings_manager() | ||
| settings.set("/isaaclab/visualizer/types", ",".join(visualizer_types)) |
There was a problem hiding this comment.
Stale selection hides visualizers After a launch with no
--viz, this writes an empty selection to process-wide settings and never clears it. If a SimulationContext is later created directly without a launch, it treats that value as an explicit empty selection and drops the visualizers in its config. Restore or clear the setting when the launch ends.
Knowledge Base Used: Core simulation framework
There was a problem hiding this comment.
Fixed in 318e6543b: only a launch without a SimulationCfg hands its selection to the config built afterwards; any other launch clears the setting, and an empty value means no selection (d39a7691b). So a context built later keeps the visualizers it lists.
| cfg = configured.get(name) or _make_visualizer_cfg(name) | ||
| cfg.headless = True | ||
| visualizer_cfgs.append(cfg) |
There was a problem hiding this comment.
Recording changes shared visualizer settings When a recorder needs a visualizer that
--viz did not select, this reuses the configured object and sets headless=True on it. If the same object is later used for a run that selects that visualizer, it remains headless and does not open the requested view. Use a separate configuration object for the recording-only visualizer.
Knowledge Base Used: Core simulation framework
There was a problem hiding this comment.
Fixed in 318e6543b: the visualizer added only for the recording is now a headless copy of the configured one, so the configured object is left as it was.
| @@ -2551,8 +2552,8 @@ In Isaac Lab 3.0, ``--headless`` and ``--viz`` are independent: | |||
|
|
|||
| Passing ``--viz kit --headless`` now launches a Kit visualizer in headless mode using the | |||
| Replicator offscreen renderer (no display window required). Passing ``--viz newton_gl --headless`` | |||
| launches a Newton GL visualizer using pyglet's EGL headless backend. To disable all visualizers | |||
| explicitly, use ``--viz none``. | |||
| launches a Newton GL visualizer using pyglet's EGL headless backend. To run without visualizers, | |||
There was a problem hiding this comment.
Migration guide uses removed flag This section still tells users to pass
--headless, including in example commands, although the launcher no longer accepts it. Following those instructions produces an argument-parsing error instead of a headless run. Update the examples and explanation to use the new launch controls.
There was a problem hiding this comment.
Fixed in fa47fda6b: the section now says --headless is removed, that a run opens windows only for what --viz selects, and that HEADLESS=1 keeps a selected visualizer windowless.
There was a problem hiding this comment.
Isaac Lab Review Bot
The launcher rework establishes clearer ownership for visualizer selection and video-source resolution, but it is not ready to merge: process-global visualizer state leaks into later contexts, benchmark dispatch still emits the rejected none value, removed launcher arguments lack deprecation bridges, module-level Torch loading violates the pre-Kit startup constraint, and direct KitLauncher() construction is broken. Release notes and one parametrized test also need cleanup.
- Design and architecture: Resolving visualizers, video sources, and devices once into
SimulationCfgis a sound ownership direction. However,launch_simulationunconditionally publishes the resolved visualizer list through a process-global setting, and every laterSimulationContextreapplies that stale selection. The setting must be limited to launches without aSimulationCfg, so independently constructed contexts retain their own configured visualizers. - API: The new
parse_visualizer_csv,resolve_visualizer_cfgs,parse_video_source, optional--videosource grammar, and Hydra-override handling form a coherent API surface. DirectKitLauncherconstruction is broken, though: its documentedNoneor empty-dictionary arguments reach_config_resolution, which now requireslauncher_args["visualizer"]. Use a defensive default so callers outsidelaunch_simulationremain functional. - Compatibility and deprecation: Breaking changes: benchmark request dispatch still emits
--visualizer none, while the new parser rejects that value, causing existing benchmark requests to fail before launch. The establishedheadlessandvisualizer_intentlauncher arguments are also silently ignored without a functional deprecation bridge. Preserve old behavior during a transition with targeted warnings, migration guidance, removal guidance, and coverage rather than relying only on changelog text. - Implementation: The
scan→ video-source resolution → visualizer-config resolution → launcher/device path is generally coherent. Two concrete defects remain: the unconditional/isaaclab/visualizer/typeswrite leaks an empty selection into later contexts and can remove explicitly configured visualizers, and importing Torch atsim_launchermodule scope defeats the documented pre-Kit deferral needed to avoid NumPy/OpenBLAS at-fork startup failures. Restore the local import in the distributed-device path. - Style consistency: The
launch-decide-once.major.rstfragment contradicts the implementation and the companion changelog: it says visualizer settings are written only without aSimulationCfgand still documents--visualizer none. Consolidate the fragments so release notes describe one accurate final contract. - Test quality: The new tests cover distinct video grammar, Hydra optional-value parsing, launch-time source resolution, and visualizer-selection contracts. In
test_visualizer_failures_propagate_and_retain_constructed_instances, however, thecli_explicitparameter is no longer consumed after the settings rewrite, so it duplicates every construction/initialization failure case. Remove that axis while retaining thefail_constructrows.
Significant concerns. Posted 7 actionable findings inline.
Automated review; human maintainers own approval decisions.
| visualizer_types = args["visualizer"] if sim_cfg is None else [c.visualizer_type for c in sim_cfg.visualizer_cfgs] | ||
| max_visible_envs = args.get("max_visible_envs") | ||
| settings = get_settings_manager() | ||
| settings.set("/isaaclab/visualizer/types", ",".join(visualizer_types)) |
There was a problem hiding this comment.
🔴 Critical · Implementation — Launch selection leaks into later contexts
Every launch writes /isaaclab/visualizer/types, and SimulationContext.__init__ re-applies it to whatever config is built next. After a headless launch the value is "", so an independently built context silently drops its visualizers: test_newton_fabric_body_sync.py launches headless at module level, then builds SimulationCfg(visualizer_cfgs=[KitVisualizerCfg(...)]) and indexes sim.visualizers[0]. Write this setting only when sim_cfg is None.
There was a problem hiding this comment.
Fixed in 318e6543b: the setting is written only when there is no SimulationCfg and cleared otherwise. This was also the cause of the isaaclab_visualizers CI failures: launch_test_simulation launches with a default SimulationCfg, and recording its kit selection narrowed every later Newton-visualizer env to Kit.
| """ | ||
| names = value.split(",") if isinstance(value, str) else list(value) | ||
| invalid = [name for name in names if name not in (*VISUALIZER_TYPES, *VISUALIZER_ALIASES)] | ||
| if invalid: |
There was a problem hiding this comment.
🔴 Critical · Compatibility — Benchmark dispatch emits rejected visualizer none
parse_visualizer_csv now rejects none, but isaaclab.benchmark.entrypoints.dispatch._request_argv still emits --visualizer none for BenchmarkLauncherConfig(visualizers=()), which test/benchmark/test_api.py asserts verbatim. Those benchmark requests now fail in argparse before the run starts. Either keep accepting none as an empty selection with the established deprecation warning, or update the dispatcher to omit the flag.
There was a problem hiding this comment.
Fixed in 318e6543b: dispatch passes --visualizer only for a non-empty selection, so it no longer emits none.
| @@ -587,8 +570,6 @@ def launch_simulation( | |||
| a tool that reaches a Kit-only extension API. This is additive -- it can only turn a | |||
| kitless launch into a Kit one, never the reverse, so a config that already needs Kit | |||
| still launches it when the key is absent or ``False``. | |||
| * ``visualizer_intent``: Visualizer intent the config cannot express, e.g. | |||
There was a problem hiding this comment.
🟡 Warning · Compatibility — Removed launcher arguments lack deprecation
visualizer_intent (documented here) and headless (previously forwarded through _SIM_APP_CONFIG_KEYS) are now accepted and silently ignored, so an existing caller gets a different runtime with no diagnostic. A changelog and migration table are not a transition. Keep translating both keys to the new visualizer selection for the prescribed window, with the established targeted warning and removal guidance.
There was a problem hiding this comment.
Intentional. For this series, deprecation shims are kept only for public cfg and MDP APIs, and launcher-argument keys aren't one of those. The changelog lists both removals with their replacements: visualizer="kit" in place of visualizer_intent, and HEADLESS=1 or the --viz selection in place of headless.
| from collections.abc import Generator | ||
| from contextlib import contextmanager | ||
| from dataclasses import dataclass, field | ||
| from typing import Any | ||
|
|
||
| import torch |
There was a problem hiding this comment.
🟡 Warning · Implementation — Restore deferred torch import
torch was imported inside _resolve_distributed_device; at module scope every script now loads it before SimulationApp starts. KitLauncher._resolve_device_settings documents the constraint ("Importing torch can import NumPy/OpenBLAS, whose at-fork handlers can crash Kit's platform-info fork during startup"), and _initialize_preloaded_torch_cuda exists only for that already-loaded fallback. Keep the import local to the distributed path.
There was a problem hiding this comment.
Fixed in 27e56239d, and it pointed at a real startup crash. Measuring showed that torch alone was already loaded by other imports before launch. The same import hoist in #8125 also moved multi_agent_to_single_agent to the top of the RL entry points, which loads moviepy, SciPy, OpenCV and matplotlib before Kit starts. With moviepy installed, Kit then crashed at startup in OpenBLAS's at-fork handler in 3/3 runs, against 0/3 before #8125. Both imports are local again; the same trigger now passes 3/3, and the entry points load none of those modules before launch.
There was a problem hiding this comment.
Since develop has this crash now, the same fix is also up as a standalone PR: #8231. This PR keeps the identical change, so the two merge cleanly in either order.
| def _config_resolution(self, launcher_args: dict): | ||
| """Resolve the input arguments and environment variables. | ||
|
|
||
| Args: | ||
| launcher_args: A dictionary of all input arguments passed to the class object. | ||
| """ | ||
| self._kit_visualizer = bool(launcher_args.get("kit_visualizer", False)) | ||
| self._kit_visualizer = "kit" in launcher_args["visualizer"] |
There was a problem hiding this comment.
🟡 Warning · Api — KitLauncher rejects documented default arguments
_config_resolution indexes launcher_args["visualizer"], but the constructor still documents launcher_args=None as equivalent to an empty dictionary and normalizes it to {}. KitLauncher() and any caller not routed through launch_simulation now raise KeyError, and an un-normalized namespace (parser default None) raises TypeError. Read the key defensively, for example launcher_args.get("visualizer") or ().
There was a problem hiding this comment.
Fixed in 318e6543b: it reads launcher_args.get("visualizer") or ().
|
|
||
| * **Breaking:** Removed the ``/isaaclab/visualizer/explicit`` and ``/isaaclab/visualizer/disable_all`` settings, | ||
| and ``/isaaclab/visualizer/types`` and ``/isaaclab/visualizer/max_visible_envs`` are only set when the launched | ||
| config holds no :class:`~isaaclab.sim.SimulationCfg` (``types`` is then a comma-separated selection, ``none`` |
There was a problem hiding this comment.
🔵 Suggestion · Style Consistency — Changelog fragment documents removed behavior
This fragment states that /isaaclab/visualizer/types is set only when the launched config holds no SimulationCfg, and still describes --visualizer none. The shipped launcher writes the setting on every launch, and launch-cli-convention.major.rst removes none. Fold the superseded text into the final description so the release notes do not publish two contradictory contracts.
There was a problem hiding this comment.
#8125's fragments are merged, and the fragment check doesn't allow changing a pending fragment. After 318e6543b the launch again writes the setting only when there's no SimulationCfg, which matches that note. This PR's own fragments describe only what it changes, and I removed the bullet that described the old behavior.
| "/isaaclab/visualizer/disable_all": False, | ||
| "/isaaclab/visualizer/max_visible_envs": None, | ||
| } | ||
| settings = {} |
There was a problem hiding this comment.
🔵 Suggestion · Test Quality — Unused parametrize axis doubles cases
Replacing the settings dictionary with {} removes the only consumer of cli_explicit, so both parametrized values now execute identical construction and initialization failure paths. The axis doubles the case count without reaching a distinct branch. Drop the cli_explicit parametrization and keep the fail_construct rows.
There was a problem hiding this comment.
Removed in 318e6543b.
|
run-ci |
00cea29 to
0b05f57
Compare
|
run-ci |
0b05f57 to
76b3ffb
Compare
| invalid = [name for name in names if name not in (*VISUALIZER_TYPES, *VISUALIZER_ALIASES, "none")] | ||
| names = value.split(",") if isinstance(value, str) else list(value) | ||
| # an undocumented alias of omitting --visualizer, kept so older commands keep running | ||
| if names == ["none"]: |
There was a problem hiding this comment.
we can add a deprecation msg for the --viz none usage and also mention deprecation in the visualization.rst docs (resolution rules section)
There was a problem hiding this comment.
hm also, if its not covered yet, i can see a common user mistake being--video kit, or --video newton_gl, which fails without the "viz:" prefix. so perhaps we can add a handy ValueError msg for this case.
There was a problem hiding this comment.
My feeling is that there is nothing run with being none, but we should just not recommend or use it anywhere. it might prevent one more breaking changes
| @@ -28,25 +28,52 @@ Add a ``VideoRecorderCfg`` to ``env_cfg.video_recorders``: | |||
| from isaaclab.envs.utils.video_recorder_cfg import VideoRecorderCfg | |||
|
|
|||
| env_cfg.video_recorders = [ | |||
| VideoRecorderCfg(source="visualizer:kit", output_dir="videos/") | |||
| VideoRecorderCfg(source="viz:kit", output_dir="videos/") | |||
There was a problem hiding this comment.
it'd be good to include one explicit sentence in this doc that explains if you'd like to run multiple video recordings, you need to define custom VideoRecordingConfigs in the code, since the command line args only define the first video recording config
There was a problem hiding this comment.
Makes sense, added that to the quick start. --video only sets up a single recorder, so for multiple sources you list one VideoRecorderCfg per source in env_cfg.video_recorders. Those win over --video, and --video_length / --video_interval still apply to all of them.
|
run-ci |
|
run-ci |
- --visualizer selects which visualizers run; without it none run, and a config's visualizer_cfgs only supply the settings of the selected types. --visualizer none is removed and names are lower-case only. Tasks and tools open no visualizer by default; demos, examples and visualizer tutorials keep theirs through parser.set_defaults(visualizer=[...]). - --video [SOURCE] records from a visualizer (viz, viz:<type>) or a scene sensor (sensor:<name>); VideoRecorderCfg.source uses the same grammar with default "viz" and launch_simulation resolves it once, adding a headless visualizer only for the recording when --visualizer does not select that type. - Kit is windowed only when --visualizer selects kit (HEADLESS=1 and livestreaming still force headless), which removes the internal headless launcher argument. - setup_preset_cli never lets an optional-value option take a Hydra override as its value, so --video presets=... applies the preset.
…ualizer, and fix the --video docs reference
The Newton GL viewer cannot build its model from the PhysX scenes of h1_locomotion, visual_color_randomization and multi_mesh_raycaster, so they default to the Kit viewer with --physics isaacsim_physx and keep newton_gl on Newton; --visualizer still overrides it. The pretrained-checkpoint lookup skips visualizer configs when looking for the task's renderer, so selecting a visualizer no longer asks for a render-backend checkpoint that is not published.
…thout a SimulationCfg - A launch with a SimulationCfg resolved the selection into it and now clears the hand-off setting instead of recording its types, so a config built later keeps the visualizers it lists (the Newton visualizer golden and integration tests). - A visualizer added only for a recording is a headless copy, leaving the configured one as configured. - KitLauncher can be built without launcher arguments again. - Benchmark dispatch passes --visualizer only for a non-empty selection. - Drop the test parameter the settings rewrite left unused.
- An invalid --video source that names a visualizer type suggests its viz: form. - Doc commands no longer pass the --viz their script already defaults to. - record_video.rst says how to record several sources at once; the migration guide no longer documents the removed --headless flag; the deprecated newton source type is noted in prose, fixing the docs build.
f0ace7e to
ae8dbf1
Compare
|
run-ci |
matthewtrepte
left a comment
There was a problem hiding this comment.
approved, with "viz:" prefix adding followup
|
run-ci |
Develop's SimulationContext.can_render_rgb_array() now returns True whenever SimulationCfg.visualizer_cfgs lists a visualizer (isaac-sim#8198), so Newton cloning loads visual shapes for a headless visualizer without the explicit require_visual_shapes() call. The Warp video test records non-flat frames without it, and records flat frames once that develop clause is removed.
Develop moved the Warp rejection into pre_launch_video_config when isaac-sim#8198 made --video take a source that launch_simulation resolves. Remove it there: the default source already records from a headless newton_gl when --viz selects no capture-capable visualizer, which is what Part 5 injected for the Warp frontend by hand. The source-resolution test now pins that --frontend warp resolves like the torch frontend, the Warp test uses the canonical viz:newton_gl source, and the docs and fragment drop the Kit-vs-Newton GL frontend split that no longer exists.
Description
Follows #8125.
--visualizerdecides which visualizers run; the config only holds their settings.--videosays what to record.--visualizer--viz kitzero_agent,random_agent,run_cartpole_rl_env, ...) no longer open a viewer by default. Demos, examples and visualizer tutorials keep theirs viaparser.set_defaults(visualizer=[...]).--viz kitis selected (HEADLESS=1still forces headless). The internalheadlessandvisualizer_intentlauncher arguments are removed.--video [SOURCE]--video--vizwindow, else a headless newton_gl--video viz:newton_rtx--vizopened it)--video sensor:wrist_cameraVideoRecorderCfg.sourceuses the same format;visualizer:kitandviz:kitare equivalent.--video presets=newton_mjwarpstill applies the preset:--videonever takes a Hydra override as its value.Migration
--viz <type>zero_agent.py --task Xto watch--viz newton_gl--videorecording from headless Kit--video viz:kitType of change
Validation
--viz: headless, no Kit on Newton.--videoon Newton and PhysX,--video viz:kit, and--video presets=newton_mjwarp: each writes clips.Release backport
developChecklist