IsaacLab 中通过 Hydra 覆盖与预设管理机器人任务配置
介绍 IsaacLab 使用 Hydra 命令行覆盖环境与训练参数的方式,包括可调用对象选择、依赖参数同步更新、validate_config 校验钩子以及整段替换配置的预设系统。
## Hydra 配置系统[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#hydra-configuration-system>) 使用( U) [海德拉语Name](<https://hydra.cc/docs/intro/>) 从命令行中更改任务和代理设置的覆盖,而不编辑 Python 。 附录 `env.<path>=<value>` 环境设置,例如 `env.actions.joint_effort.scale=10.0`。使用 `agent` 培训设置的前缀,例如 `agent.seed=2024`. 路径遵循每个 RL 库的配置结构。 例如, RL- Games 使用 `agent.params.seed`; RSL - RL , skrl, 和 SB3 使用 `agent.seed`. 例如: rsl_rl uv(建议) ``` uv run isaaclab train --rl_library rsl_rl --task=Isaac-Cartpole env.actions.joint_effort.scale=10.0 agent.seed=2024 ``` rl_games uv(建议) ``` uv run --extra rl-games isaaclab train --rl_library rl_games --task=Isaac-Cartpole env.actions.joint_effort.scale=10.0 agent.params.seed=2024 ``` 缩写 : uv(建议) ``` uv run --extra skrl isaaclab train --rl_library skrl --task=Isaac-Cartpole env.actions.joint_effort.scale=10.0 agent.seed=2024 ``` 编号b3 uv(建议) ``` uv run --extra sb3 isaaclab train --rl_library sb3 --task=Isaac-Cartpole env.actions.joint_effort.scale=10.0 agent.seed=2024 ``` 以上指挥将随任务进行训练 `Isaac-Cartpole` 不选择可视化器,并设置 `env.actions.joint_effort.scale` 参数到 10.0 和 `agent.seed` 参数为 2024 。 说明 为了保持反向兼容性,并提供一个更方便用户的经验,我们保留了表格中的旧cli参数。 `--param`,例如, `--num_envs`, `--seed`, `--max_iterations`。这些参数优先于海德拉参数,将覆盖海德拉参数设定的值。 ## 修改高级参数[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#modifying-advanced-parameters>) ### 可调用[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#callables>) 使用( U) `module:attribute_name` 来选择一个函数或类。例如,在 Cartpole 中: ``` class ObservationsCfg: """Observation specifications for the MDP.""" @configclass class PolicyCfg(ObsGroup): """Observations for policy group.""" # observation terms (order preserved) joint_pos_rel = ObsTerm(func=mdp.joint_pos_rel) joint_vel_rel = ObsTerm(func=mdp.joint_vel_rel) def __post_init__(self): self.enable_corruption = False self.concatenate_terms = True # observation groups policy: PolicyCfg = PolicyCfg() ``` 我们可以修改 `joint_pos_rel` 计算绝对位置,而不是相对位置 `env.observations.policy.joint_pos_rel.func=isaaclab.envs.mdp:joint_pos`. ### 设置参数为无[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#setting-parameters-to-none>) 要设置参数为无,请使用 `null` 关键字,是 Hydra 中一个自动转换为 None 的特殊关键字。 在上述例子中, 我们还可以禁用 `joint_pos_rel` 通过设置为无 `env.observations.policy.joint_pos_rel=null`. ### 词典[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#dictionaries>) 词典中的元素作为参数在等级中处理。例如,在Cartpole环境中: ``` reset_cart_position = EventTerm( func=mdp.reset_joints_by_offset, mode="reset", params={ "asset_cfg": SceneEntityCfg("robot", joint_names=["slider_to_cart"]), "position_range": (-1.0, 1.0), "velocity_range": (-0.5, 0.5), }, ) ``` 编号 `position_range` 参数可修改为 `env.events.reset_cart_position.params.position_range="[-2.0, 2.0]"`。这个例子显示了两个值得注意的要点: - 值包含一个空格,所以它必须被附在外壳的引文中. - 参数是列表, 而它是配置中的 tuple 。 这是因为 Hydra 不支持 tuples 。 ## 修改相互依存的参数[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#modifying-inter-dependent-parameters>) 覆盖不重算早先从其他设置中得出的值。 也更新这些依赖值, 除非环境在运行时重算它们 。 例如,对于Cartpole相机环境的配置: ``` class CartpoleCameraEnvCfg(PresetCfg): """Cartpole camera environment with a selectable camera data type. The selector also picks the matching tiled camera preset and its rendering backend through :attr:`CartpoleCameraSceneCfg.tiled_camera`. """ @configclass class BaseCartpoleCameraEnvCfg(CartpoleEnvCfg): """Camera variant of :class:`CartpoleEnvCfg`; only the fields that differ are overridden.""" write_image_to_file = False frame_stack: int = 2 """Number of frames to stack along the channel dimension. Values less than two disable stacking. """ # spaces: single-frame channels + default spatial size. At env init, height/width # are replaced with the tiled camera size and channels are expanded by frame_stack. # Only the channel count must stay in sync with the camera data type (presets set this). observation_space = [3, 96, 96] ``` 配置宣告单帧通道计数和默认空间大小。在环境初始化时, `CartpoleCameraEnv` 重建( E) `observation_space` 从已解析的相机:默认 `frame_stack=2` 扩展频道,高/宽取自 `scene.tiled_camera`。所以 `env.scene.tiled_camera.width=128 env.scene.tiled_camera.height=128` 单产生有效堆叠形状 `[6,128,128]` 而不同时压倒性 `env.observation_space`。频道条目输入 `observation_space` 必须仍然匹配相机数据类型(例如) `[1, ...]` 与 `presets=depth`; 预设已设置此选项。 类机构任务在导入时评估一次并完成 **没有** 跟踪后海德拉,除非运行时代码像这个相机环境那样明确重建依赖值。 同样, `__post_init__` 方法不随命令行输入而更新。 `LocomotionVelocityRoughEnvCfg`例如,该员额的更新如下: ``` class LocomotionVelocityRoughEnvCfg(ManagerBasedRLEnvCfg): """Configuration for the locomotion velocity-tracking environment.""" # Simulation settings sim: SimulationCfg = VELOCITY_SIM_CFG decimation: int = 4 episode_length_s: float = 20.0 # Scene settings scene: MySceneCfg = MySceneCfg(num_envs=4096, env_spacing=2.5) # Basic settings observations: ObservationsCfg = ObservationsCfg() actions: ActionsCfg = ActionsCfg() commands: CommandsCfg = CommandsCfg() # MDP settings rewards: RewardsCfg = RewardsCfg() terminations: TerminationsCfg = TerminationsCfg() events: EventsCfg = EventsCfg() curriculum: CurriculumCfg = CurriculumCfg() def __post_init__(self): """Post initialization.""" self.sim.physics_material = self.scene.terrain.physics_material # check if terrain levels curriculum is enabled - if so, enable curriculum for terrain generator # this generates terrains with increasing difficulty and is useful for training if getattr(self.curriculum, "terrain_levels", None) is not None: if self.scene.terrain.terrain_generator is not None: self.scene.terrain.terrain_generator.curriculum = True else: if self.scene.terrain.terrain_generator is not None: self.scene.terrain.terrain_generator.curriculum = False def play_mode(self): """Play-mode overrides shared by the velocity-tracking environments.""" super().play_mode() # spawn the robot randomly in the grid (instead of their terrain levels) self.scene.terrain.max_init_terrain_level = None # reduce the number of terrains to save memory if self.scene.terrain.terrain_generator is not None: self.scene.terrain.terrain_generator.num_rows = 5 self.scene.terrain.terrain_generator.num_cols = 5 self.scene.terrain.terrain_generator.curriculum = False # remove random pushing events self.events.base_external_force_torque = None self.events.push_robot = None ``` 在这里,当修改时 `env.decimation` 或 时 间 `env.sim.dt`,用户需要给出更新的 `env.sim.render_interval`, `env.scene.height_scanner.update_period`,以及 `env.scene.contact_forces.update_period` 作为投入。 ## 自定义配置验证[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#custom-configuration-validation>) 配置类对象可以定义一个 `validate_config()` 用于在所有字段解析后进行域特定验证的方法。在预设解析度和MISSING-field检查成功后,此勾钩会自动被调用,这样您就可以及早用清晰的错误消息捕捉无效参数组合。 例如,Franka到达配置验证其牛顿IK动作预设与牛顿物理配置配对: ``` def validate_config(self) -> None: """Validate the selected controller and physics backend.""" if self.observations.policy.ee_target_error is not None and not isinstance( self.actions.arm_action, mdp.JointPositionActionCfg ): raise ValueError("The 'hold' preset requires the Franka joint-position action.") if isinstance(self.actions.arm_action, NewtonInverseKinematicsActionCfg) and not isinstance( self.sim.physics, NewtonCfg ): raise ValueError("The 'newton_ik' action preset requires a Newton physics preset.") ``` **当它运行时 :** 1. 全部人员 `MISSING` 字段将先检查,如果尚存, `TypeError` 被提高。 2. 只有这样 `validate_config()` 调用每个嵌入式配置类和顶级配置对象(在拥有这些配置的配置之前验证已忘的配置). 3. 钩子应该抬起来的 `ValueError` 有明确的信息和移民指导。 **通用验证模式 :** - 独立可选控制器、物理配置和渲染器之间的兼容性 - 渲染器、相机数据类型和特性提取器兼容性 - 无法单独用字段类型表示的数字关系或限制 ## 预设系统[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#preset-system>) 选择物理、渲染和任务变体的面向用户的介绍,从 [后端和预设](<https://isaac-sim.github.io/IsaacLab/main/source/concepts/backends_and_presets.html>)。本节涵盖完整的预设定义和解析行为。 预设系统允许您用单个命令行参数来交换整个配置区段 — — 或单个scalar值。您选择一个命名的预设,而不是凌驾于单个字段之上 **完全替换** 配置区域(没有字段合并)。 预设通过子分类来宣告 [`PresetCfg`](<https://isaac-sim.github.io/IsaacLab/main/source/api/lab_tasks/isaaclab_tasks.utils.html#isaaclab_tasks.utils.PresetCfg>) 或通过使用 `preset()` 便利工厂. 系统递归性地从嵌套配置中自动发现所有预设,包括预设在dict值字段内(例如. `actuators`). ### 覆盖顺序[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#override-order>) 从最低到最高的有效优先是: 1. **默认**: 每一个未解决 `PresetCfg` 回到它身边 `default` 字段键入。 2. **输入和域选择**: `physics=newton_mjwarp` 选择物理时 `presets=rgb` 向每个匹配的配置播放特定任务名称。 3. **路径选择**: `env.sim.physics=newton_kamino` 具体目标 `PresetCfg` 在这条道路上居于优先位置。 4. **播放模式更改**: 当播放命令要求时, 环境 `play_mode()` 对解析后的配置应用了更改。 5. **scalar 覆盖**: `env.sim.dt=0.001` 对单个领域有最后发言权。 如果多个广播名称在同一活动路径上选择不同的替代品,解析失败而不是默默地选择一个. ### 用 PresetCfg 定义预设[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#defining-presets-with-presetcfg>) 创建一个 [`PresetCfg`](<https://isaac-sim.github.io/IsaacLab/main/source/api/lab_tasks/isaaclab_tasks.utils.html#isaaclab_tasks.utils.PresetCfg>) 子类,每个字段都是命名的选项。 `default` 字段是当未给出 CLI 覆盖时使用的配置 : ``` from isaaclab.sim import SimulationCfg from isaaclab.utils import configclass from isaaclab_newton.physics import NewtonCfg from isaaclab_isaacsim.physics import PhysxCfg from isaaclab_tasks.utils import PresetCfg @configclass class PhysicsPresetsCfg(PresetCfg): isaacsim_physx: PhysxCfg = PhysxCfg() default: PhysxCfg = isaacsim_physx newton_mjwarp: NewtonCfg = NewtonCfg() @configclass class MyEnvCfg: sim: SimulationCfg = SimulationCfg(physics=PhysicsPresetsCfg()) ``` 物理属于 [`SimulationCfg`](<https://isaac-sim.github.io/IsaacLab/main/source/api/lab/isaaclab.sim.html#isaaclab.sim.SimulationCfg>),所以预设的配置路径是 `env.sim.physics`。对于后端选择,选择键入选择器。 ``` uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Cartpole physics=newton_mjwarp ``` 使用路径表单 `env.sim.physics=newton_mjwarp` 仅当您有意想要替换一个预设的节点而不选择其他匹配的任务预设时。 那个... `default` 字段可以设置为 `None` 使一个可选功能被禁用,除非明确选择: ``` @configclass class CameraSettingsCfg: width: int = 64 height: int = 64 @configclass class CameraPresetCfg(PresetCfg): default = None small: CameraSettingsCfg = CameraSettingsCfg() large: CameraSettingsCfg = CameraSettingsCfg(width=256, height=256) @configclass class SceneCfg: camera: CameraPresetCfg = CameraPresetCfg() ``` 在这里, `env.scene.camera` 决定: `None` 默认情况下。使用此配置的注册任务可以使用路径选择器激活大相机 `env.scene.camera=large`. ### 后端和溶解预设[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#backend-and-solver-presets>) 物理后端选择使用相同的预设系统。任务可以定义一个 `PresetCfg` 其条目取代完整的物理配置 : Cartpole任务的定义是一个持续的例子: ``` class CartpolePhysicsCfg(PresetCfg): """Physics backend presets for the cartpole environments.""" isaacsim_physx: PhysxCfg = PhysxCfg() ovphysx: OvPhysxCfg = OvPhysxCfg() physx: PhysxAutoCfg = PhysxAutoCfg(isaacsim_physx=isaacsim_physx, ovphysx=ovphysx) newton_mjwarp: NewtonCfg = NewtonCfg( solver_cfg=MJWarpSolverCfg( njmax=5, nconmax=3, cone="pyramidal", impratio=1, integrator="implicitfast", ), num_substeps=1, debug_mode=False, use_cuda_graph=True, ) newton_steel: NewtonCfg = NewtonCfg( solver_cfg=SteelSolverCfg( enable_joint_limits=True, iterations=4, articulation_constraint_max=8, free_body_constraint_max=64 ), ) newton_kamino: NewtonCfg = NewtonCfg( solver_cfg=KaminoPADMMSolverCfg(sparse_jacobian=True), debug_mode=False, use_cuda_graph=True, ) default: NewtonCfg = newton_mjwarp ``` 那个... `newton_mjwarp` 财务报告和财务报告 `newton_kamino` 条目均选择牛顿物理后端,因为两个条目都是 [`NewtonCfg`](<https://isaac-sim.github.io/IsaacLab/main/source/api/lab_newton/isaaclab_newton.physics.html#isaaclab_newton.physics.NewtonCfg>) 对象。差异是解析器配置 : `newton_mjwarp` 用途 [`MJWarpSolverCfg`](<https://isaac-sim.github.io/IsaacLab/main/source/api/lab_newton/isaaclab_newton.physics.html#isaaclab_newton.physics.MJWarpSolverCfg>)时 `newton_kamino` 用途 [`KaminoPADMMSolverCfg`](<https://isaac-sim.github.io/IsaacLab/main/source/api/lab_newton/isaaclab_newton.physics.html#isaaclab_newton.physics.KaminoPADMMSolverCfg>). 因此,卡米诺是一个解析器预设,而不是单独的艾萨克实验室后端. 预设解决后使用相同的牛顿资产,传感器,渲染器,和可视化器,它是基于受限刚性多体动力学的近代取代方向法(P-ADMM). 说明 卡米诺需要具备兼容模型结构的资产. MujoCo-Warp 或 PhysX 预设公司在与它们合作前可能需要模型结构的更新. `physics=newton_kamino`. ``` # Preferred: select and validate a physics preset by type uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Cartpole physics=newton_kamino # Advanced: replace only the physics config at this path uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Cartpole env.sim.physics=newton_kamino ``` 后端支持是针对特定任务的, 并随着任务验证而更改。 请使用任务 `--help` 输出为真理的来源。通过 `physics=newton_kamino` 用于不发布失败广告的任务;它不会为这项任务添加卡米诺配置。 ### 带有预设的内置预设( )[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#inline-presets-with-preset>) 对于不需要完整子类的简单值(scalars, lists),请使用 `preset()` 它能动态地创造出一种 `PresetCfg` 关键词参数中的实例 : ``` from isaaclab_tasks.utils.hydra import preset # Scalar preset -- no boilerplate subclass self.scene.robot.actuators["legs"].armature = preset( default=0.0, isaacsim_physx=0.0, newton_mjwarp=0.01, physx=0.0 ) ``` 创建与 a 相同的字段 `PresetCfg` 子类。 `default` 需要论证。 `preset()` 用于任意类型的数值 - scalars, lists,甚至配置实例 : ``` # Resolution preset on a camera config field width = preset(default=64, res128=128, res256=256) # List preset for camera data types @configclass class DataTypeCfg(PresetCfg): default: list = ["rgb"] depth: list = ["depth"] albedo: list = ["albedo"] ``` 使用( U) `preset()` 当定义适合单行时。使用 `PresetCfg` 当选项的动词足以从类型说明和多行格式化中受益时,子类。 预设系统发现 `preset()` 配置树中任意位置的值, 包括 dict- valued 字段, 如 `actuators`: ``` # Select MJWarp physics and all matching dependent alternatives uv run isaaclab train --rl_library rsl_rl \ --task IsaacContrib-Velocity-Rough-AnymalC physics=newton_mjwarp ``` 键入 `physics=` 选择器对所选名称使用广播分辨率, 因此匹配任务特定选项, 如此挂载值也会更新 。 它还验证名称是否解决了物理配置; 自由形式 `presets=` 选择器不提供该类型检查。 ### 键入的预设选择器[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#typed-preset-selectors>) 预设的 CLI 层识别 4 `key=value` 可附加到任何训练或播放脚本命令的符号( 无前缀) : | 托肯语 | 效果 | | --- | --- | | `physics=NAME` | 已键入选择器 [`PhysicsCfg`](<https://isaac-sim.github.io/IsaacLab/main/source/api/lab/isaaclab.physics.html#isaaclab.physics.PhysicsCfg>) 变体 | | `renderer=NAME` | 已键入选择器 [`RendererCfg`](<https://isaac-sim.github.io/IsaacLab/main/source/api/lab/isaaclab.renderers.html#isaaclab.renderers.RendererCfg>) 变体 | | `visualizer=NAME[,NAME,...]` | 选择 [`VisualizerBackendCfg`](<https://isaac-sim.github.io/IsaacLab/main/source/api/lab/isaaclab.visualizers.html#isaaclab.visualizers.VisualizerBackendCfg>) 每个已配置的查看器的后端( E)`none` 禁用查看器) | | `presets=NAME[,NAME,...]` | 广播: 应用到每个匹配中 [`PresetCfg`](<https://isaac-sim.github.io/IsaacLab/main/source/api/lab_tasks/isaaclab_tasks.utils.html#isaaclab_tasks.utils.PresetCfg>) 在配置树上 | 输入选择器使用相同的广播分辨率 。 `presets=`。这意味着 `physics=newton_mjwarp` 也可以更新使用相同名称的依赖性任务预设,例如激活器或事件设置。这些预设不能互换,但是:一个被键入的选择器必须至少解决其声明类型的一个配置,否则会产生错误。使用 `physics=` 财务报告和财务报告 `renderer=` 用于后端选择,并保留 `presets=` 用于特定任务模式。 **常见物理预设名称** (仅在任务公布时): | 名称 | 后端 | | --- | --- | | `isaacsim_physx` | 混凝土 Isaac Sim PhysX 配置 | | `physx` | 在配置的选项中自动选择 PhysX 家族 | | `newton_mjwarp` | 使用 MujoCo- Warp 解析器的牛顿物理 | | `newton_kamino` | 牛顿物理学与卡米诺解析器(选定任务——参见 [后端和溶解预设](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#hydra-backend-solver-presets>)) | | `ovphysx` | 用于支持的无工具包任务的具体 OvPhysX 配置 | **常见的渲染器预设名称** (当提供时) `MultiBackendRendererCfg`): | 名称 | 渲染器 | | --- | --- | | `isaacsim_rtx` | 混凝土 Isaac Sim RTX 渲染器 | | `rtx` | 在配置的选项中自动选择 RTX 家族 | | `newton_warp` | 牛顿曲速渲染器 | | `newton_optix` | 用于 RTX GPU的牛顿 OptiX 渲染器; 要求 `optix` 额外 | | `ovrtx` | 用于支持的无工具包任务的具体 OVRTX 渲染器 | 隐含的 `default` 字段是针对特定任务的,有意省略 `--help`。不要从这些常规名称中推断任务默认的后端;检查它的帮助输出或配置。自动选择如 `physics=physx` 财务报告和财务报告 `renderer=rtx` 是选入的,而不是通用的默认值。 域预设(观察模式,相机配置等)是特定任务. Pass. `--task=<task-name> --help` 到培训命令,以查看用于该任务的所有预设,按选择器类型分组。 对于强化学习任务,预先设定的解析度将注册环境和代理配置作为兄弟般的根基。 `<library>_cfg_entry_point` 因此,可能返回根级 `PresetCfg` 使用与环境相同的替代名称。 `presets=resnet18` 选择 `resnet18` 在一个决议通过时, uv(建议) ``` uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Cartpole-Camera presets=resnet18 ``` 这是保持一个与环境相关的政策形状的首选方式,例如特性提取器或动作空间头,与选定的环境保持一致。它不需要预设特定的登记册条目或重写 `--agent`. 独立训练配方仍然是明确的代理选择。任务可以选择一个替代代理,用于对称性、重现性、蒸馏或另一种算法,而不改变其环境预设。 预设的代理切入点和注册侧的preset-to-agent地图不属于此模型。使用犬形切入点并选择其变体。 `presets=`。对于更古老的 SKRL 运行,其显示或目录编码了一个配置键后缀,而不是 `agent.class` 作为算法,通过检查点路径,而不是使用自动 `latest` 或 时 间 `best` 发现。 说明 遗产别名 `newton` → `newton_mjwarp` 财务报告和财务报告 `kamino` → `newton_kamino` 仍被接受,但发出 [`FutureWarning`](<https://docs.python.org/3/builtins/exceptions.html#FutureWarning>)。渲染器的别名 `isaacsim_rtx_renderer` → `isaacsim_rtx` 财务报告和财务报告 `ovrtx_renderer` → `ovrtx` 做同样的事情 更喜欢那些神话的名字 ### 使用预设[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#using-presets>) **输入选择器** - 物理和渲染器后端的首选形式: ``` # Switch to Newton MuJoCo-Warp physics uv run isaaclab train --rl_library rsl_rl \ --task IsaacContrib-Velocity-Rough-AnymalC physics=newton_mjwarp # Switch to Newton renderer for camera environments uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Cartpole-Camera-Direct renderer=newton_warp # Combine typed selectors with a task-specific observation preset uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Cartpole-Camera-Direct \ physics=newton_mjwarp renderer=newton_warp presets=rgb ``` **路径预设** - 选择一个配置路径的特定预设 : ``` # Replace only this task's physics preset node uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Cartpole env.sim.physics=newton_kamino ``` **域预设** - 在任何地方广播特定任务的名称: ``` # Keep the observation pipeline and camera data type in sync uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Cartpole-Camera presets=depth ``` **多个域预设** - 采用若干非冲突性的任务选择: ``` uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Lift-KukaAllegro-Camera presets=duo_camera,rgb128 ``` KukaAllegro号卫星 `-Camera` 任务默认为单相机和匹配的RSL - RL CNN 演员. `presets=duo_camera` 开关摄像机和演员输入;评论员继续使用状态观察. **合并** - 键入选择器、域预设器和scalar 覆盖器: ``` uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Cartpole-Camera \ physics=newton_mjwarp renderer=newton_warp presets=rgb \ env.sim.dt=0.002 ``` ### 全球预设冲突探测[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#global-preset-conflict-detection>) 如果两个全局预设都匹配相同的配置路径,就会出现错误,因此模糊性会及早被捕获: ``` ValueError: Conflicting global presets: 'foo' and 'bar' both define preset for 'env.events' ``` ### 现实世界实例[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#real-world-example>) Nahmal-C运动环境继承了基础速度配置的物理预设: ``` class RoughPhysicsCfg(PresetCfg): """Shared backend presets for locomotion velocity environments.""" isaacsim_physx = PhysxCfg(gpu_max_rigid_patch_count=10 * 2**15) ovphysx = OvPhysxCfg(gpu_max_rigid_patch_count=10 * 2**15) physx = PhysxAutoCfg(isaacsim_physx=isaacsim_physx, ovphysx=ovphysx) newton_mjwarp = NewtonCfg( solver_cfg=MJWarpSolverCfg( njmax=1000, nconmax=300, cone="pyramidal", impratio=1.0, integrator="implicitfast", use_mujoco_contacts=False, ), collision_cfg=NewtonCollisionPipelineCfg(max_triangle_pairs=2_500_000), num_substeps=2, debug_mode=False, default_shape_cfg=NewtonShapeCfg(margin=0.0, ke=160000.0, kd=1100.0), ) newton_nerd = replace(newton_mjwarp, solver_cfg=NeRDSolverCfg(articulation="{ENV_REGEX_NS}/Robot"), num_substeps=1) newton_steel = NewtonCfg( solver_cfg=SteelSolverCfg( update_mass_matrix_interval=2, enable_joint_limits=True, contact_friction_gap_max=0.02, articulation_constraint_max=192, free_body_constraint_max=32, ), collision_cfg=NewtonCollisionPipelineCfg(max_triangle_pairs=12_000_000), num_substeps=2, default_shape_cfg=NewtonShapeCfg(margin=0.01, ke=160000.0, kd=1100.0), ) newton_kamino = NewtonCfg( solver_cfg=KaminoSCCSolverCfg( max_contacts_per_world=64, sparse_jacobian=True, sparse_dynamics=True, dynamics_solver_cfg=KaminoSCCCfg(bilateral_solver_type="LLTBRCM"), ) ) default = newton_mjwarp ``` 明确 `physics=newton_mjwarp` 解析物理配置和每个使用此名称的动态依赖选项。输入的选择器还验证物理预设是否被实际选中。 ``` uv run isaaclab train --rl_library rsl_rl \ --task IsaacContrib-Velocity-Rough-AnymalC physics=newton_mjwarp ``` 没有选择器,每个 `PresetCfg` 独立使用自己的 `default`;默认选项的名称不广播到其他预设节点. ### 内容提要[#](<https://isaac-sim.github.io/IsaacLab/main/source/features/hydra.html#summary>) | 覆盖类型 | 语法 | 效果 | | --- | --- | --- | | 斯卡拉尔 | `env.sim.dt=0.001` | 修改单字段 | | 路径预设 | `env.sim.physics=newton_kamino` | 替换整节 | | 域预设 | `presets=rgb` | 在所有匹配的地方应用特定任务名称 | | 键入物理选择器 | `physics=newton_mjwarp` | 选择物理变体, 更新相匹配的依赖预设, 并需要输入匹配 | | 已键入的渲染器选择器 | `renderer=newton_warp` | 选择一个渲染器变体, 并需要输入匹配 | | 合并 | `physics=newton_mjwarp renderer=newton_warp presets=rgb env.sim.dt=0.001` | 键入选择器 + 域预设 + 悬浮 |
查看原始来源