Skip to content

Commit 249a5cb

Browse files
committed
Remove post-Hydra preset resolution (isaac-sim#7303)
## Summary - make resolve_task_config and parse_env_cfg the task configuration composition boundary, with explicit programmatic overrides - remove late preset fallback handling from environments, simulation, launch scanning, camera validation, benchmarks, and RL summaries - require runtime consumers to receive concrete physics, renderer, and camera configurations - route scripts, tools, integrations, and relevant tests through registered task composition This is a separate follow-up to isaac-sim#7301; it does not mix the earlier preset ownership cleanup into this PR. ## Validation - 129 Hydra and Shadow Hand camera tests passed - 31 benchmark capture and RL entrypoint tests passed - 23 experimental frontend tests passed, 1 skipped - 5 custom-coupling tests passed - representative composition audit confirmed six task trees contain no remaining PresetCfg nodes - Python compile checks passed for all changed runtime and script paths - ruff and ruff-format passed The full format command passes every hook except the changelog comparison, which uses the stale local origin/develop ref and flags six pre-existing upstream fragments that this branch does not modify. This PR includes all required package fragments. (cherry picked from commit 393fc37)
1 parent 9624ddb commit 249a5cb

54 files changed

Lines changed: 273 additions & 552 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

scripts/benchmarks/benchmark_cameras.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
)
272272
from isaaclab.utils.math import orthogonalize_perspective_depth, unproject_depth
273273

274-
from isaaclab_tasks.utils import load_cfg_from_registry
274+
from isaaclab_tasks.utils import parse_env_cfg
275275

276276
"""
277277
Camera Creation
@@ -527,9 +527,7 @@ def inject_cameras_into_task(
527527
num_cameras_per_env: int = 1,
528528
) -> gym.Env:
529529
"""Loads the task, sticks cameras into the config, and creates the environment."""
530-
cfg = load_cfg_from_registry(task, "env_cfg_entry_point")
531-
cfg.sim.device = args_cli.device
532-
cfg.sim.use_fabric = args_cli.use_fabric
530+
cfg = parse_env_cfg(task, device=args_cli.device, use_fabric=args_cli.use_fabric)
533531
scene_cfg = cfg.scene
534532

535533
num_envs = int(num_cams / num_cameras_per_env)

scripts/demos/h1_locomotion.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@
6565
get_published_pretrained_checkpoint,
6666
)
6767

68-
from isaaclab_tasks.core.velocity.config.h1.rough_env_cfg import H1RoughEnvCfg
69-
from isaaclab_tasks.utils import resolve_presets
68+
from isaaclab_tasks.utils import resolve_task_config
7069

7170
TASK = "Isaac-Velocity-Rough-H1"
7271
RL_LIBRARY = "rsl_rl"
@@ -93,8 +92,7 @@ def __init__(self):
9392
agent_cfg: RslRlOnPolicyRunnerCfg = cli_args.parse_rsl_rl_cfg(TASK, args_cli)
9493
agent_cfg = handle_deprecated_rsl_rl_cfg(agent_cfg, metadata.version("rsl-rl-lib"))
9594
# create envionrment
96-
env_cfg = resolve_presets(H1RoughEnvCfg(), selected=(args_cli.physics,))
97-
env_cfg.play_mode()
95+
env_cfg, _ = resolve_task_config(TASK, "", play_mode=True, overrides=(f"physics={args_cli.physics}",))
9896
env_cfg.scene.num_envs = 25
9997
env_cfg.episode_length_s = 1000000
10098
env_cfg.curriculum = None

scripts/demos/heterogeneous_scene.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@
5757
from isaaclab.scene import InteractiveSceneCfg
5858
from isaaclab.scene import add as scene_add
5959

60-
from isaaclab_tasks.utils.hydra import resolve_presets
61-
from isaaclab_tasks.utils.parse_cfg import load_cfg_from_registry
60+
from isaaclab_tasks.utils import resolve_task_config
6261

6362
# Tasks composed by default. The selection criterion is simple: every listed
6463
# scene is a PhysX task whose floor is a single flat plane at height zero, so
@@ -103,8 +102,7 @@ def _load_task_scenes() -> tuple[list[str], list[InteractiveSceneCfg]]:
103102
raise ValueError("Select at least two task scenes.")
104103
scene_cfgs = []
105104
for task_id in task_ids:
106-
# resolve preset placeholders (e.g. object-set choices) to their defaults
107-
env_cfg = resolve_presets(load_cfg_from_registry(task_id, "env_cfg_entry_point"))
105+
env_cfg, _ = resolve_task_config(task_id, "", overrides=hydra_args)
108106
scene_cfgs.append(env_cfg.scene)
109107
return task_ids, scene_cfgs
110108

scripts/tutorials/03_envs/policy_inference_in_usd.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
from isaaclab.terrains import TerrainImporterCfg
4646
from isaaclab.utils.assets import ISAAC_NUCLEUS_DIR, read_file
4747

48-
from isaaclab_tasks.core.velocity.config.h1.rough_env_cfg import H1RoughEnvCfg
48+
from isaaclab_tasks.utils import parse_env_cfg
4949

5050

5151
def main():
@@ -56,16 +56,14 @@ def main():
5656
policy = torch.jit.load(file, map_location=args_cli.device)
5757

5858
# setup environment
59-
env_cfg = H1RoughEnvCfg()
59+
env_cfg = parse_env_cfg("Isaac-Velocity-Rough-H1", device=args_cli.device, num_envs=1)
6060
env_cfg.play_mode()
61-
env_cfg.scene.num_envs = 1
6261
env_cfg.curriculum = None
6362
env_cfg.scene.terrain = TerrainImporterCfg(
6463
prim_path="/World/ground",
6564
terrain_type="usd",
6665
usd_path=f"{ISAAC_NUCLEUS_DIR}/Environments/Simple_Warehouse/warehouse.usd",
6766
)
68-
env_cfg.sim.device = args_cli.device
6967
if args_cli.device == "cpu":
7068
env_cfg.sim.use_fabric = False
7169

scripts/tutorials/03_envs/run_cartpole_rl_env.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@
3939

4040
from isaaclab.envs import ManagerBasedRLEnv
4141

42-
from isaaclab_tasks.core.cartpole.cartpole_manager_env_cfg import CartpoleEnvCfg
42+
from isaaclab_tasks.utils import parse_env_cfg
4343

4444

4545
def main():
4646
"""Main function."""
4747
# create environment configuration
48-
env_cfg = CartpoleEnvCfg()
49-
env_cfg.scene.num_envs = args_cli.num_envs
50-
env_cfg.sim.device = args_cli.device
48+
env_cfg = parse_env_cfg("Isaac-Cartpole", device=args_cli.device, num_envs=args_cli.num_envs)
5149
# setup RL environment
5250
env = ManagerBasedRLEnv(cfg=env_cfg)
5351

scripts/tutorials/07_visualizers/run_video_recording.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
from isaaclab.app import add_launcher_args, launch_simulation
5757
from isaaclab.envs.utils.video_recorder_cfg import VideoRecorderCfg
5858

59-
from isaaclab_tasks.utils import setup_preset_cli
59+
from isaaclab_tasks.utils import resolve_task_config, setup_preset_cli
6060

6161
# ---------------------------------------------------------------------------
6262
# Constants
@@ -87,11 +87,7 @@ def _output_dir(example: int) -> str:
8787

8888
def _shadow_env_cfg(num_envs: int, env_spacing: float = _SHADOW_ENV_SPACING):
8989
"""Build a base Shadow Hand camera env cfg shared by all examples."""
90-
from isaaclab_tasks.core.reorient.config.shadow_hand.shadow_hand_direct_camera_env_cfg import ShadowHandCameraEnvCfg
91-
92-
env_cfg = ShadowHandCameraEnvCfg()
93-
env_cfg.tiled_camera = env_cfg.tiled_camera.rgb
94-
env_cfg.tiled_camera.renderer_cfg = env_cfg.tiled_camera.renderer_cfg.default
90+
env_cfg, _ = resolve_task_config(_TASK_SHADOW, "", overrides=(*sys.argv[1:], "env.tiled_camera=rgb"))
9591
env_cfg.tiled_camera.height = 256
9692
env_cfg.tiled_camera.width = 256
9793
env_cfg.scene.num_envs = num_envs
@@ -109,8 +105,6 @@ def _build_env_cfg_example_1(num_envs: int):
109105
from isaaclab_visualizers.kit import KitVisualizerCfg
110106

111107
env_cfg = _shadow_env_cfg(num_envs)
112-
env_cfg.sim.physics = env_cfg.sim.physics.default
113-
114108
env_cfg.sim.visualizer_cfgs = [KitVisualizerCfg(eye=_SHADOW_EYE, lookat=_SHADOW_LOOKAT)]
115109

116110
out = _output_dir(1)
@@ -130,7 +124,6 @@ def _build_env_cfg_example_1(num_envs: int):
130124
def _build_env_cfg_example_2(num_envs: int):
131125
"""Shadow Hand + headless: scene tiled-camera sensor clip only."""
132126
env_cfg = _shadow_env_cfg(num_envs, env_spacing=2.0)
133-
env_cfg.sim.physics = env_cfg.sim.physics.default
134127
env_cfg.sim.visualizer_cfgs = [] # no interactive visualizer
135128

136129
out = _output_dir(2)
@@ -158,8 +151,6 @@ def _build_env_cfg_example_3(num_envs: int):
158151
from isaaclab_visualizers.newton import NewtonGLVisualizerCfg
159152

160153
env_cfg = _shadow_env_cfg(num_envs)
161-
env_cfg.sim.physics = env_cfg.sim.physics.default
162-
163154
kit_cfg = KitVisualizerCfg(
164155
eye=_SHADOW_EYE,
165156
lookat=_SHADOW_LOOKAT,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Removed
2+
^^^^^^^
3+
4+
* **Breaking:** Removed late task-preset resolution from environment construction and the
5+
:func:`isaaclab.utils.resolve_cfg_presets` helper. Compose registered tasks with
6+
:func:`isaaclab_tasks.utils.resolve_task_config` or :func:`isaaclab_tasks.utils.parse_env_cfg`
7+
before constructing an environment.
8+
* **Breaking:** Replaced ``run_config_from_presets`` with ``run_config_from_env_cfg`` in benchmark
9+
capture. Pass the concrete composed environment configuration instead of inferring backends from
10+
selector strings.

source/isaaclab/isaaclab/app/sim_launcher.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,11 @@ def _is_kit_camera(node) -> bool:
114114
# ``auto_rtx`` is resolved after the initial scan once physics and
115115
# visualizer intent are known; ie. it may become OVRTX for a kitless run.
116116
return False
117-
if isinstance(renderer_cfg, RendererCfg):
118-
return renderer_cfg.renderer_type in ("default", "isaac_rtx")
119-
# PresetCfg renderers (e.g. MultiBackendRendererCfg) are resolved during
120-
# environment construction once the physics backend is known; assume they
121-
# match the backend, so not necessarily Kit.
122-
from isaaclab_tasks.utils import PresetCfg
123-
124-
return not isinstance(renderer_cfg, PresetCfg)
117+
if not isinstance(renderer_cfg, RendererCfg):
118+
raise TypeError(
119+
f"CameraCfg.renderer_cfg must be a concrete RendererCfg or None, got {type(renderer_cfg).__name__}."
120+
)
121+
return renderer_cfg.renderer_type in ("default", "isaac_rtx")
125122

126123

127124
"""
@@ -218,7 +215,7 @@ class Scan:
218215
"""Signals gathered from one walk of the config tree (see :func:`scan`).
219216
220217
Every field starts as a plain snapshot computed during that single walk.
221-
Automatic PhysX preset selections and RTX placeholders are also recorded so
218+
Automatic PhysX configurations and RTX placeholders are also recorded so
222219
launch-time resolution can update the physics- and renderer-related fields
223220
without traversing the config tree again. ``needs_kit`` is the headline launch
224221
decision after automatic selections are resolved: a Kit-renderer camera or Isaac
@@ -424,11 +421,11 @@ def _validate_runtime(scan: Scan, kit_sources: tuple[str, ...]) -> None:
424421
"\n"
425422
"To fix this, pick one of the following supported combinations:\n"
426423
" * Keep OvPhysX physics and switch to a kitless renderer/visualizer:\n"
427-
" presets=ovphysx,ovrtx\n"
424+
" use `OvPhysxCfg` with `OVRTXRendererCfg`\n"
428425
" (and use `--visualizer newton`, `--visualizer rerun`, or `--visualizer viser`, or omit\n"
429426
" the visualizer argument for headless execution.)\n"
430427
" * Keep Isaac Sim / Kit and switch to a Kit-compatible physics backend:\n"
431-
" presets=isaacsim_physx,isaacsim_rtx\n"
428+
" use `PhysxCfg` with `IsaacRtxRendererCfg`\n"
432429
)
433430

434431
if not scan.has_ovrtx or not kit_sources:
@@ -441,11 +438,10 @@ def _validate_runtime(scan: Scan, kit_sources: tuple[str, ...]) -> None:
441438
"\n"
442439
"To fix this, pick one of the following supported combinations:\n"
443440
" * Keep Isaac Sim / Kit and switch the renderer:\n"
444-
" presets=isaacsim_rtx\n"
445-
" (uses `IsaacRtxRendererCfg`, the Kit-compatible renderer.)\n"
441+
" use `IsaacRtxRendererCfg`, the Kit-compatible renderer\n"
446442
" * Keep the OVRTX renderer and switch to a kitless physics backend\n"
447443
" (and avoid `--visualizer kit`):\n"
448-
" presets=newton_mjwarp,ovrtx\n"
444+
" use `NewtonCfg` or `OvPhysxCfg` with `OVRTXRendererCfg`\n"
449445
)
450446

451447

0 commit comments

Comments
 (0)