diff --git a/source/isaaclab/changelog.d/fix-warp-env-cfg-forbidden-imports.skip b/source/isaaclab/changelog.d/fix-warp-env-cfg-forbidden-imports.skip new file mode 100644 index 000000000000..b2562fda8247 --- /dev/null +++ b/source/isaaclab/changelog.d/fix-warp-env-cfg-forbidden-imports.skip @@ -0,0 +1,3 @@ +Internal: hoisted module-local backend imports (``pxr``/``sim_utils``) to module top in +implementation files (``scene_data/scene_data_provider``, ``sim/schemas/schemas_actuators``, +``envs/utils/camera_view``, ``terrains/utils``). No user-facing change. diff --git a/source/isaaclab/isaaclab/envs/utils/camera_view.py b/source/isaaclab/isaaclab/envs/utils/camera_view.py index b89f42947a4d..2e2ea846a92f 100644 --- a/source/isaaclab/isaaclab/envs/utils/camera_view.py +++ b/source/isaaclab/isaaclab/envs/utils/camera_view.py @@ -14,10 +14,11 @@ import torch import warp as wp -from pxr import Sdf +from pxr import Sdf, UsdGeom import isaaclab.sim as sim_utils from isaaclab.sensors.camera import Camera, CameraCfg +from isaaclab.sim.views import FrameView _GENERATED_CAMERA_NAME = "VisualizerCamera" VISUALIZER_TILED_CAMERA_MAX_TILES = 100 @@ -225,10 +226,6 @@ def prim_world_positions( Uses ``FrameView`` first so PhysX/Fabric-backed transforms are current; falls back to USD only if the backend view cannot be constructed. """ - from pxr import UsdGeom - - from isaaclab.sim.views import FrameView - xform_cache = UsdGeom.XformCache() positions = [] try: diff --git a/source/isaaclab/isaaclab/scene_data/scene_data_provider.py b/source/isaaclab/isaaclab/scene_data/scene_data_provider.py index e31e9d9da282..9d888347e38e 100644 --- a/source/isaaclab/isaaclab/scene_data/scene_data_provider.py +++ b/source/isaaclab/isaaclab/scene_data/scene_data_provider.py @@ -13,6 +13,10 @@ import numpy as np import warp as wp +from pxr import UsdGeom + +import isaaclab.sim as sim_utils + from .scene_data_backend import SceneDataBackend, SceneDataFormat if TYPE_CHECKING: @@ -425,10 +429,6 @@ def _walk_camera_prims(stage: Usd.Stage | None) -> dict[str, Any] | None: if stage is None: return None - from pxr import UsdGeom - - import isaaclab.sim as isaaclab_sim - shared_paths: list[str] = [] instances: dict[str, list[tuple[int, str]]] = {} num_envs = -1 @@ -475,7 +475,7 @@ def _walk_camera_prims(stage: Usd.Stage | None) -> dict[str, Any] | None: prim = stage.GetPrimAtPath(prim_path) if not prim.IsValid(): continue - pos, ori = isaaclab_sim.resolve_prim_pose(prim) + pos, ori = sim_utils.resolve_prim_pose(prim) per_world_pos[world_id] = [float(pos[0]), float(pos[1]), float(pos[2])] per_world_ori[world_id] = [float(ori[0]), float(ori[1]), float(ori[2]), float(ori[3])] positions.append(per_world_pos) diff --git a/source/isaaclab/isaaclab/sim/schemas/schemas_actuators.py b/source/isaaclab/isaaclab/sim/schemas/schemas_actuators.py index 40456384e473..8f91689fa433 100644 --- a/source/isaaclab/isaaclab/sim/schemas/schemas_actuators.py +++ b/source/isaaclab/isaaclab/sim/schemas/schemas_actuators.py @@ -24,6 +24,11 @@ import re from typing import Any +from pxr import Sdf, Usd + +from isaaclab.actuators import ImplicitActuator +from isaaclab.utils.string import resolve_matching_names + logger = logging.getLogger(__name__) @@ -134,11 +139,6 @@ def _author_actuator_prims( actuator_cfgs: dict[str, Any], ) -> None: """Inner authoring routine; exposed separately for test fixtures.""" - from pxr import Sdf # noqa: PLC0415 - - from isaaclab.actuators import ImplicitActuator # noqa: PLC0415 - from isaaclab.utils.string import resolve_matching_names # noqa: PLC0415 - art_prim = stage.GetPrimAtPath(articulation_prim_path) if not art_prim.IsValid(): raise ValueError(f"Articulation prim not found: {articulation_prim_path}") @@ -300,8 +300,6 @@ def _collect_joint_prims(art_prim: Any) -> dict[str, str]: Returns: Ordered mapping of joint name to full prim path. """ - from pxr import Usd # noqa: PLC0415 - _JOINT_TYPES = {"PhysicsRevoluteJoint", "PhysicsPrismaticJoint"} joints: dict[str, str] = {} @@ -324,8 +322,6 @@ def _remove_actuator_prims_for_joints( Only prims under the *art_prim* subtree are considered. """ - from pxr import Usd # noqa: PLC0415 - to_deactivate: list = [] for prim in Usd.PrimRange(art_prim): if prim.GetTypeName() != "NewtonActuator": diff --git a/source/isaaclab/isaaclab/terrains/utils.py b/source/isaaclab/isaaclab/terrains/utils.py index 0feee6ca51f3..766fe13c6f9c 100644 --- a/source/isaaclab/isaaclab/terrains/utils.py +++ b/source/isaaclab/isaaclab/terrains/utils.py @@ -11,6 +11,9 @@ import trimesh import warp as wp +from pxr import UsdGeom + +import isaaclab.sim as sim_utils from isaaclab.utils.warp import raycast_mesh @@ -78,11 +81,6 @@ def create_prim_from_mesh(prim_path: str, mesh: trimesh.Trimesh, **kwargs): visual_material: The visual material to apply. Defaults to None. physics_material: The physics material to apply. Defaults to None. """ - # need to import these here to prevent isaacsim launching when importing this module - from pxr import UsdGeom - - import isaaclab.sim as sim_utils - # create parent prim sim_utils.create_prim(prim_path, "Xform") # create mesh prim diff --git a/source/isaaclab_experimental/changelog.d/fix-warp-env-cfg-forbidden-imports.rst b/source/isaaclab_experimental/changelog.d/fix-warp-env-cfg-forbidden-imports.rst new file mode 100644 index 000000000000..b6fbdfcfbca0 --- /dev/null +++ b/source/isaaclab_experimental/changelog.d/fix-warp-env-cfg-forbidden-imports.rst @@ -0,0 +1,10 @@ +Fixed +^^^^^ + +* Fixed the experimental packages eagerly importing backend modules (``pxr``, + ``omni``, ``carb``, ``isaacsim``, ``scipy``) at import time, which crashed when + a warp task's env config was loaded before ``SimulationApp`` was launched. The + ``managers``, ``envs``, ``envs.mdp`` and ``envs.mdp.actions`` packages now use + ``lazy_export`` with ``.pyi`` stubs, and the MDP term leaf modules guard runtime + types (``Articulation``, ``InteractiveScene``, ``ContactSensor``, action terms) + under ``TYPE_CHECKING`` with string ``class_type`` references. diff --git a/source/isaaclab_experimental/isaaclab_experimental/envs/__init__.py b/source/isaaclab_experimental/isaaclab_experimental/envs/__init__.py index fef4091748a9..7c4406231e4d 100644 --- a/source/isaaclab_experimental/isaaclab_experimental/envs/__init__.py +++ b/source/isaaclab_experimental/isaaclab_experimental/envs/__init__.py @@ -42,14 +42,6 @@ .. _`Task Design Workflows`: https://isaac-sim.github.io/IsaacLab/source/features/task_workflows.html """ -from .direct_rl_env_warp import DirectRLEnvWarp # noqa: F401 -from .interactive_scene_warp import InteractiveSceneWarp # noqa: F401 -from .manager_based_env_warp import ManagerBasedEnvWarp # noqa: F401 -from .manager_based_rl_env_warp import ManagerBasedRLEnvWarp # noqa: F401 - -__all__ = [ - "DirectRLEnvWarp", - "InteractiveSceneWarp", - "ManagerBasedEnvWarp", - "ManagerBasedRLEnvWarp", -] +from isaaclab.utils.module import lazy_export + +lazy_export() diff --git a/source/isaaclab_experimental/isaaclab_experimental/envs/__init__.pyi b/source/isaaclab_experimental/isaaclab_experimental/envs/__init__.pyi new file mode 100644 index 000000000000..ef3d01d6b4ec --- /dev/null +++ b/source/isaaclab_experimental/isaaclab_experimental/envs/__init__.pyi @@ -0,0 +1,18 @@ +# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +__all__ = [ + "mdp", + "DirectRLEnvWarp", + "InteractiveSceneWarp", + "ManagerBasedEnvWarp", + "ManagerBasedRLEnvWarp", +] + +from . import mdp +from .direct_rl_env_warp import DirectRLEnvWarp +from .interactive_scene_warp import InteractiveSceneWarp +from .manager_based_env_warp import ManagerBasedEnvWarp +from .manager_based_rl_env_warp import ManagerBasedRLEnvWarp diff --git a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/__init__.py b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/__init__.py index 1476dc828798..c90339869128 100644 --- a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/__init__.py +++ b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/__init__.py @@ -9,18 +9,6 @@ functions with Warp-first implementations from :mod:`isaaclab_experimental.envs.mdp.rewards`. """ -# Forward stable MDP terms (commands/observations/terminations/etc.) but *exclude* rewards and actions. -# Rewards and actions are provided by this experimental package to keep Warp-first execution. -from isaaclab.envs.mdp.commands import * # noqa: F401, F403 -from isaaclab.envs.mdp.curriculums import * # noqa: F401, F403 -from isaaclab.envs.mdp.events import * # noqa: F401, F403 -from isaaclab.envs.mdp.observations import * # noqa: F401, F403 -from isaaclab.envs.mdp.recorders import * # noqa: F401, F403 -from isaaclab.envs.mdp.terminations import * # noqa: F401, F403 +from isaaclab.utils.module import lazy_export -# Override terms with experimental implementations. -from .actions import * # noqa: F401, F403 -from .events import * # noqa: F401, F403 -from .observations import * # noqa: F401, F403 -from .rewards import * # noqa: F401, F403 -from .terminations import * # noqa: F401, F403 +lazy_export() diff --git a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/__init__.pyi b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/__init__.pyi new file mode 100644 index 000000000000..a6dadcfce5bc --- /dev/null +++ b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/__init__.pyi @@ -0,0 +1,29 @@ +# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +# Forward all stable MDP terms (commands/curriculums/events/observations/...) via a +# lazy fallback, so unresolved names defer to the stable package without eagerly +# importing its backend-dependent submodules. +from isaaclab.envs.mdp import * # noqa: F401, F403 + +# Experimental Warp-first action terms. Listed by name (not ``*``) so the runtime +# implementations in ``joint_actions`` stay lazy and only the pure-data config +# classes are imported when an env config is constructed. +from .actions import ( # noqa: F401 + JointAction, + JointActionCfg, + JointEffortAction, + JointEffortActionCfg, + JointPositionAction, + JointPositionActionCfg, +) + +# Override stable terms with experimental Warp-first implementations. These leaf +# modules are import-clean (no eager backend imports), so re-exporting them here +# is safe. +from .events import * # noqa: F401, F403 +from .observations import * # noqa: F401, F403 +from .rewards import * # noqa: F401, F403 +from .terminations import * # noqa: F401, F403 diff --git a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/actions/__init__.py b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/actions/__init__.py index d295384149d4..218284dc10f9 100644 --- a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/actions/__init__.py +++ b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/actions/__init__.py @@ -7,7 +7,12 @@ Provides Warp-first action term implementations overriding the stable :mod:`isaaclab.envs.mdp.actions` module. + +Symbols are lazily resolved from the ``__init__.pyi`` stub so that importing the +pure-data action config classes does not eagerly pull in the runtime action term +implementations (which depend on a running simulator). """ -from .actions_cfg import * # noqa: F401, F403 -from .joint_actions import * # noqa: F401, F403 +from isaaclab.utils.module import lazy_export + +lazy_export() diff --git a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/actions/__init__.pyi b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/actions/__init__.pyi new file mode 100644 index 000000000000..154f8cefe6a8 --- /dev/null +++ b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/actions/__init__.pyi @@ -0,0 +1,16 @@ +# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +__all__ = [ + "JointAction", + "JointActionCfg", + "JointEffortAction", + "JointEffortActionCfg", + "JointPositionAction", + "JointPositionActionCfg", +] + +from .actions_cfg import JointActionCfg, JointEffortActionCfg, JointPositionActionCfg +from .joint_actions import JointAction, JointEffortAction, JointPositionAction diff --git a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/actions/actions_cfg.py b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/actions/actions_cfg.py index f100b5235f00..1fc2566fd785 100644 --- a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/actions/actions_cfg.py +++ b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/actions/actions_cfg.py @@ -3,13 +3,17 @@ # # SPDX-License-Identifier: BSD-3-Clause +from __future__ import annotations + from dataclasses import MISSING +from typing import TYPE_CHECKING from isaaclab.utils.configclass import configclass -from isaaclab_experimental.managers.action_manager import ActionTerm, ActionTermCfg +from isaaclab_experimental.managers.manager_term_cfg import ActionTermCfg -from . import joint_actions +if TYPE_CHECKING: + from .joint_actions import JointEffortAction, JointPositionAction ## # Joint actions. @@ -40,7 +44,7 @@ class JointPositionActionCfg(JointActionCfg): See :class:`JointPositionAction` for more details. """ - class_type: type[ActionTerm] = joint_actions.JointPositionAction + class_type: type[JointPositionAction] | str = "{DIR}.joint_actions:JointPositionAction" use_default_offset: bool = True """Whether to use default joint positions configured in the articulation asset as offset. @@ -58,4 +62,4 @@ class JointEffortActionCfg(JointActionCfg): See :class:`JointEffortAction` for more details. """ - class_type: type[ActionTerm] = joint_actions.JointEffortAction + class_type: type[JointEffortAction] | str = "{DIR}.joint_actions:JointEffortAction" diff --git a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/events.py b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/events.py index e1732df0c026..d9e61041a7ad 100644 --- a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/events.py +++ b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/events.py @@ -24,13 +24,16 @@ from __future__ import annotations -import warp as wp +from typing import TYPE_CHECKING -from isaaclab.assets import Articulation +import warp as wp from isaaclab_experimental.managers import SceneEntityCfg from isaaclab_experimental.utils.warp import WarpCapturable +if TYPE_CHECKING: + from isaaclab.assets import Articulation + # --------------------------------------------------------------------------- # Randomize rigid body center of mass # --------------------------------------------------------------------------- diff --git a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/observations.py b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/observations.py index 39e4d0c54e48..808231c8faf6 100644 --- a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/observations.py +++ b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/observations.py @@ -27,8 +27,6 @@ rotate_vec_to_body_frame, ) -from isaaclab.assets import Articulation - from isaaclab_experimental.envs.utils.io_descriptors import ( generic_io_descriptor_warp, record_dtype, @@ -40,6 +38,7 @@ from isaaclab_experimental.managers import SceneEntityCfg if TYPE_CHECKING: + from isaaclab.assets import Articulation from isaaclab.envs import ManagerBasedEnv diff --git a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/rewards.py b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/rewards.py index 39776bb8c82f..338d27c99c5e 100644 --- a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/rewards.py +++ b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/rewards.py @@ -24,11 +24,10 @@ rotate_vec_to_body_frame, ) -from isaaclab.assets import Articulation - from isaaclab_experimental.managers import SceneEntityCfg if TYPE_CHECKING: + from isaaclab.assets import Articulation from isaaclab.envs import ManagerBasedRLEnv diff --git a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/terminations.py b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/terminations.py index 7721469e96a4..d309a70538bb 100644 --- a/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/terminations.py +++ b/source/isaaclab_experimental/isaaclab_experimental/envs/mdp/terminations.py @@ -19,11 +19,10 @@ import warp as wp -from isaaclab.assets import Articulation - from isaaclab_experimental.managers import SceneEntityCfg if TYPE_CHECKING: + from isaaclab.assets import Articulation from isaaclab.envs import ManagerBasedRLEnv diff --git a/source/isaaclab_experimental/isaaclab_experimental/managers/__init__.py b/source/isaaclab_experimental/isaaclab_experimental/managers/__init__.py index b4521b98434a..3dcec053e138 100644 --- a/source/isaaclab_experimental/isaaclab_experimental/managers/__init__.py +++ b/source/isaaclab_experimental/isaaclab_experimental/managers/__init__.py @@ -7,18 +7,14 @@ This package is intended for experimental forks of manager implementations while keeping stable task configs and the stable `isaaclab.managers` package intact. -""" -from isaaclab.managers import * # noqa: F401,F403 +Symbols are lazily resolved from the ``__init__.pyi`` stub so that importing this +package (e.g. to access pure-data cfg types like +:class:`~isaaclab_experimental.managers.ObservationTermCfg`) does not eagerly +pull in runtime managers that depend on a running simulator. This mirrors the +stable :mod:`isaaclab.managers` package. +""" -from .action_manager import ActionManager # noqa: F401 -from .command_manager import CommandManager # noqa: F401 -from .event_manager import EventManager # noqa: F401 +from isaaclab.utils.module import lazy_export -# Override the stable implementation with the experimental fork. -from .manager_base import ManagerTermBase # noqa: F401 -from .manager_term_cfg import ObservationTermCfg, RewardTermCfg, TerminationTermCfg # noqa: F401 -from .observation_manager import ObservationManager # noqa: F401 -from .reward_manager import RewardManager # noqa: F401 -from .scene_entity_cfg import SceneEntityCfg # noqa: F401 -from .termination_manager import TerminationManager # noqa: F401 +lazy_export() diff --git a/source/isaaclab_experimental/isaaclab_experimental/managers/__init__.pyi b/source/isaaclab_experimental/isaaclab_experimental/managers/__init__.pyi new file mode 100644 index 000000000000..18431a745b31 --- /dev/null +++ b/source/isaaclab_experimental/isaaclab_experimental/managers/__init__.pyi @@ -0,0 +1,51 @@ +# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +__all__ = [ + "ActionManager", + "ActionTerm", + "CommandManager", + "CommandTerm", + "EventManager", + "ManagerBase", + "ManagerTermBase", + "ActionTermCfg", + "CommandTermCfg", + "CurriculumTermCfg", + "EventTermCfg", + "ManagerTermBaseCfg", + "ObservationGroupCfg", + "ObservationTermCfg", + "RecorderTermCfg", + "RewardTermCfg", + "TerminationTermCfg", + "ObservationManager", + "RewardManager", + "SceneEntityCfg", + "TerminationManager", +] + +from isaaclab.managers import * # noqa: F401, F403 + +from .action_manager import ActionManager, ActionTerm +from .command_manager import CommandManager, CommandTerm +from .event_manager import EventManager +from .manager_base import ManagerBase, ManagerTermBase +from .manager_term_cfg import ( + ActionTermCfg, + CommandTermCfg, + CurriculumTermCfg, + EventTermCfg, + ManagerTermBaseCfg, + ObservationGroupCfg, + ObservationTermCfg, + RecorderTermCfg, + RewardTermCfg, + TerminationTermCfg, +) +from .observation_manager import ObservationManager +from .reward_manager import RewardManager +from .scene_entity_cfg import SceneEntityCfg +from .termination_manager import TerminationManager diff --git a/source/isaaclab_experimental/isaaclab_experimental/managers/scene_entity_cfg.py b/source/isaaclab_experimental/isaaclab_experimental/managers/scene_entity_cfg.py index 1930f6ce1cb7..ae97f7f526fb 100644 --- a/source/isaaclab_experimental/isaaclab_experimental/managers/scene_entity_cfg.py +++ b/source/isaaclab_experimental/isaaclab_experimental/managers/scene_entity_cfg.py @@ -11,11 +11,15 @@ from __future__ import annotations +from typing import TYPE_CHECKING + import warp as wp -from isaaclab.assets.articulation.base_articulation import BaseArticulation +from isaaclab.assets import ArticulationCfg from isaaclab.managers.scene_entity_cfg import SceneEntityCfg as _SceneEntityCfg -from isaaclab.scene import InteractiveScene + +if TYPE_CHECKING: + from isaaclab.scene import InteractiveScene class SceneEntityCfg(_SceneEntityCfg): @@ -41,7 +45,7 @@ def resolve(self, scene: InteractiveScene): entity = scene[self.name] # -- Warp joint mask / ids for articulations - if isinstance(entity, BaseArticulation): + if isinstance(entity.cfg, ArticulationCfg): if self.joint_ids == slice(None): joint_ids_list = list(range(entity.num_joints)) mask_list = [True] * entity.num_joints diff --git a/source/isaaclab_tasks/changelog.d/fix-warp-env-cfg-forbidden-imports.skip b/source/isaaclab_tasks/changelog.d/fix-warp-env-cfg-forbidden-imports.skip new file mode 100644 index 000000000000..da178983ff9d --- /dev/null +++ b/source/isaaclab_tasks/changelog.d/fix-warp-env-cfg-forbidden-imports.skip @@ -0,0 +1,2 @@ +Test-only: extend test_env_cfg_no_forbidden_imports to also scan +isaaclab_tasks_experimental tasks. No user-facing change. diff --git a/source/isaaclab_tasks/test/core/test_env_cfg_no_forbidden_imports.py b/source/isaaclab_tasks/test/core/test_env_cfg_no_forbidden_imports.py index c1ab6e78e7b4..febb89130a5e 100644 --- a/source/isaaclab_tasks/test/core/test_env_cfg_no_forbidden_imports.py +++ b/source/isaaclab_tasks/test/core/test_env_cfg_no_forbidden_imports.py @@ -43,6 +43,7 @@ import textwrap import gymnasium +import isaaclab_tasks_experimental # noqa: F401 -- triggers experimental task registration import pytest import isaaclab_tasks # noqa: F401 -- triggers task registration @@ -77,6 +78,7 @@ def _build_batch_script(task_names: list[str]) -> str: task_names = {task_names!r} import isaaclab_tasks # noqa: F401 + import isaaclab_tasks_experimental # noqa: F401 from isaaclab_tasks.utils.parse_cfg import load_cfg_from_registry results = {{}} diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/ant/__init__.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/ant/__init__.py index 6fcf15181c7e..0a573bd9ce56 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/ant/__init__.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/ant/__init__.py @@ -20,7 +20,7 @@ entry_point=f"{__name__}.ant_env_warp:AntWarpEnv", disable_env_checker=True, kwargs={ - "env_cfg_entry_point": f"{__name__}.ant_env_warp:AntWarpEnvCfg", + "env_cfg_entry_point": f"{__name__}.ant_env_warp_cfg:AntWarpEnvCfg", "rl_games_cfg_entry_point": f"{stable_agents}:rl_games_ppo_cfg.yaml", "rsl_rl_cfg_entry_point": f"{stable_agents}.rsl_rl_ppo_cfg:AntPPORunnerCfg", "skrl_cfg_entry_point": f"{stable_agents}:skrl_ppo_cfg.yaml", diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/ant/ant_env_warp.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/ant/ant_env_warp.py index 81df556a6a11..2bd7390039b7 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/ant/ant_env_warp.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/ant/ant_env_warp.py @@ -5,83 +5,9 @@ from __future__ import annotations -from isaaclab_newton.physics import MJWarpSolverCfg, NewtonCfg - -import isaaclab.sim as sim_utils -from isaaclab.assets import ArticulationCfg -from isaaclab.envs import DirectRLEnvCfg -from isaaclab.scene import InteractiveSceneCfg -from isaaclab.sim import SimulationCfg -from isaaclab.terrains import TerrainImporterCfg -from isaaclab.utils.configclass import configclass - -from isaaclab_assets import ANT_CFG - from isaaclab_tasks_experimental.direct.locomotion.locomotion_env_warp import LocomotionWarpEnv - -@configclass -class AntWarpEnvCfg(DirectRLEnvCfg): - # env - episode_length_s = 15.0 - decimation = 2 - action_scale = 0.5 - action_space = 8 - observation_space = 36 - state_space = 0 - - solver_cfg = MJWarpSolverCfg( - njmax=45, - nconmax=25, - cone="pyramidal", - integrator="implicitfast", - impratio=1, - ) - newton_cfg = NewtonCfg( - solver_cfg=solver_cfg, - num_substeps=1, - debug_mode=False, - use_cuda_graph=True, - ) - - # simulation - sim: SimulationCfg = SimulationCfg(dt=1 / 120, render_interval=decimation, physics=newton_cfg) - terrain = TerrainImporterCfg( - prim_path="/World/ground", - terrain_type="plane", - collision_group=-1, - physics_material=sim_utils.RigidBodyMaterialCfg( - friction_combine_mode="average", - restitution_combine_mode="average", - static_friction=1.0, - dynamic_friction=1.0, - restitution=0.0, - ), - debug_vis=False, - ) - - # scene - scene: InteractiveSceneCfg = InteractiveSceneCfg( - num_envs=4096, env_spacing=4.0, replicate_physics=True, clone_in_fabric=True - ) - - # robot - robot: ArticulationCfg = ANT_CFG.replace(prim_path="/World/envs/env_.*/Robot") - joint_gears: list = [15, 15, 15, 15, 15, 15, 15, 15] - - heading_weight: float = 0.5 - up_weight: float = 0.1 - - energy_cost_scale: float = 0.05 - actions_cost_scale: float = 0.005 - alive_reward_scale: float = 0.5 - dof_vel_scale: float = 0.2 - - death_cost: float = -2.0 - termination_height: float = 0.31 - - angular_velocity_scale: float = 1.0 - contact_force_scale: float = 0.1 +from .ant_env_warp_cfg import AntWarpEnvCfg class AntWarpEnv(LocomotionWarpEnv): diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/ant/ant_env_warp_cfg.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/ant/ant_env_warp_cfg.py new file mode 100644 index 000000000000..6e8b7fb81a95 --- /dev/null +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/ant/ant_env_warp_cfg.py @@ -0,0 +1,82 @@ +# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +from __future__ import annotations + +from isaaclab_newton.physics import MJWarpSolverCfg, NewtonCfg + +import isaaclab.sim as sim_utils +from isaaclab.assets import ArticulationCfg +from isaaclab.envs import DirectRLEnvCfg +from isaaclab.scene import InteractiveSceneCfg +from isaaclab.sim import SimulationCfg +from isaaclab.terrains import TerrainImporterCfg +from isaaclab.utils.configclass import configclass + +from isaaclab_assets import ANT_CFG + + +@configclass +class AntWarpEnvCfg(DirectRLEnvCfg): + # env + episode_length_s = 15.0 + decimation = 2 + action_scale = 0.5 + action_space = 8 + observation_space = 36 + state_space = 0 + + solver_cfg = MJWarpSolverCfg( + njmax=45, + nconmax=25, + cone="pyramidal", + integrator="implicitfast", + impratio=1, + ) + newton_cfg = NewtonCfg( + solver_cfg=solver_cfg, + num_substeps=1, + debug_mode=False, + use_cuda_graph=True, + ) + + # simulation + sim: SimulationCfg = SimulationCfg(dt=1 / 120, render_interval=decimation, physics=newton_cfg) + terrain = TerrainImporterCfg( + prim_path="/World/ground", + terrain_type="plane", + collision_group=-1, + physics_material=sim_utils.RigidBodyMaterialCfg( + friction_combine_mode="average", + restitution_combine_mode="average", + static_friction=1.0, + dynamic_friction=1.0, + restitution=0.0, + ), + debug_vis=False, + ) + + # scene + scene: InteractiveSceneCfg = InteractiveSceneCfg( + num_envs=4096, env_spacing=4.0, replicate_physics=True, clone_in_fabric=True + ) + + # robot + robot: ArticulationCfg = ANT_CFG.replace(prim_path="/World/envs/env_.*/Robot") + joint_gears: list = [15, 15, 15, 15, 15, 15, 15, 15] + + heading_weight: float = 0.5 + up_weight: float = 0.1 + + energy_cost_scale: float = 0.05 + actions_cost_scale: float = 0.005 + alive_reward_scale: float = 0.5 + dof_vel_scale: float = 0.2 + + death_cost: float = -2.0 + termination_height: float = 0.31 + + angular_velocity_scale: float = 1.0 + contact_force_scale: float = 0.1 diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/cartpole/__init__.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/cartpole/__init__.py index b167fbc59cd5..48021a84f4d5 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/cartpole/__init__.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/cartpole/__init__.py @@ -13,17 +13,17 @@ # Register Gym environments. ## -stable_agents = "isaaclab_tasks.core.direct_cartpole.agents" +stable_agents = "isaaclab_tasks.core.cartpole.agents" gym.register( id="Isaac-Cartpole-Direct-Warp-v0", entry_point=f"{__name__}.cartpole_warp_env:CartpoleWarpEnv", disable_env_checker=True, kwargs={ - "env_cfg_entry_point": f"{__name__}.cartpole_warp_env:CartpoleWarpEnvCfg", - "rl_games_cfg_entry_point": f"{stable_agents}:rl_games_ppo_cfg.yaml", - "rsl_rl_cfg_entry_point": f"{stable_agents}.rsl_rl_ppo_cfg:CartpolePPORunnerCfg", - "skrl_cfg_entry_point": f"{stable_agents}:skrl_ppo_cfg.yaml", - "sb3_cfg_entry_point": f"{stable_agents}:sb3_ppo_cfg.yaml", + "env_cfg_entry_point": f"{__name__}.cartpole_warp_env_cfg:CartpoleWarpEnvCfg", + "rl_games_cfg_entry_point": f"{stable_agents}:rl_games_direct_ppo_cfg.yaml", + "rsl_rl_cfg_entry_point": f"{stable_agents}.rsl_rl_direct_ppo_cfg:CartpolePPORunnerCfg", + "skrl_cfg_entry_point": f"{stable_agents}:skrl_direct_ppo_cfg.yaml", + "sb3_cfg_entry_point": f"{stable_agents}:sb3_direct_ppo_cfg.yaml", }, ) diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/cartpole/cartpole_warp_env.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/cartpole/cartpole_warp_env.py index 0826f6d98225..25e9aa4bfd7d 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/cartpole/cartpole_warp_env.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/cartpole/cartpole_warp_env.py @@ -6,70 +6,17 @@ from __future__ import annotations import math +from typing import TYPE_CHECKING import warp as wp from isaaclab_experimental.envs import DirectRLEnvWarp -from isaaclab_newton.physics import MJWarpSolverCfg, NewtonCfg import isaaclab.sim as sim_utils -from isaaclab.assets import Articulation, ArticulationCfg -from isaaclab.envs import DirectRLEnvCfg -from isaaclab.scene import InteractiveSceneCfg -from isaaclab.sim import SimulationCfg +from isaaclab.assets import Articulation from isaaclab.sim.spawners.from_files import GroundPlaneCfg, spawn_ground_plane -from isaaclab.utils.configclass import configclass - -from isaaclab_assets.robots.cartpole import CARTPOLE_CFG - - -@configclass -class CartpoleWarpEnvCfg(DirectRLEnvCfg): - # env - decimation = 2 - episode_length_s = 5.0 - action_scale = 100.0 # [N] - action_space = 1 - observation_space = 4 - state_space = 0 - - solver_cfg = MJWarpSolverCfg( - njmax=5, - nconmax=3, - cone="pyramidal", - integrator="implicitfast", - impratio=1, - ) - - newton_cfg = NewtonCfg( - solver_cfg=solver_cfg, - num_substeps=1, - debug_mode=False, - use_cuda_graph=True, - ) - - # simulation - sim: SimulationCfg = SimulationCfg(dt=1 / 120, render_interval=decimation, physics=newton_cfg) - - # robot - robot_cfg: ArticulationCfg = CARTPOLE_CFG.replace(prim_path="/World/envs/env_.*/Robot") - cart_dof_name = "slider_to_cart" - pole_dof_name = "cart_to_pole" - - # scene - scene: InteractiveSceneCfg = InteractiveSceneCfg( - num_envs=4096, env_spacing=4.0, replicate_physics=True, clone_in_fabric=True - ) - - # reset - max_cart_pos = 3.0 # the cart is reset if it exceeds that position [m] - initial_pole_angle_range = [-0.25, 0.25] # the range in which the pole angle is sampled from on reset [x pi rad] - # reward scales - rew_scale_alive = 1.0 - rew_scale_terminated = -2.0 - rew_scale_pole_pos = -1.0 - rew_scale_cart_vel = -0.01 - rew_scale_pole_vel = -0.005 +if TYPE_CHECKING: + from .cartpole_warp_env_cfg import CartpoleWarpEnvCfg @wp.kernel diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/cartpole/cartpole_warp_env_cfg.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/cartpole/cartpole_warp_env_cfg.py new file mode 100644 index 000000000000..2a99e1cff3e9 --- /dev/null +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/cartpole/cartpole_warp_env_cfg.py @@ -0,0 +1,66 @@ +# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +from __future__ import annotations + +from isaaclab_newton.physics import MJWarpSolverCfg, NewtonCfg + +from isaaclab.assets import ArticulationCfg +from isaaclab.envs import DirectRLEnvCfg +from isaaclab.scene import InteractiveSceneCfg +from isaaclab.sim import SimulationCfg +from isaaclab.utils.configclass import configclass + +from isaaclab_assets.robots.cartpole import CARTPOLE_CFG + + +@configclass +class CartpoleWarpEnvCfg(DirectRLEnvCfg): + # env + decimation = 2 + episode_length_s = 5.0 + action_scale = 100.0 # [N] + action_space = 1 + observation_space = 4 + state_space = 0 + + solver_cfg = MJWarpSolverCfg( + njmax=5, + nconmax=3, + cone="pyramidal", + integrator="implicitfast", + impratio=1, + ) + + newton_cfg = NewtonCfg( + solver_cfg=solver_cfg, + num_substeps=1, + debug_mode=False, + use_cuda_graph=True, + ) + + # simulation + sim: SimulationCfg = SimulationCfg(dt=1 / 120, render_interval=decimation, physics=newton_cfg) + + # robot + robot_cfg: ArticulationCfg = CARTPOLE_CFG.replace(prim_path="/World/envs/env_.*/Robot") + cart_dof_name = "slider_to_cart" + pole_dof_name = "cart_to_pole" + + # scene + scene: InteractiveSceneCfg = InteractiveSceneCfg( + num_envs=4096, env_spacing=4.0, replicate_physics=True, clone_in_fabric=True + ) + + # reset + max_cart_pos = 3.0 # the cart is reset if it exceeds that position [m] + initial_pole_angle_range = [-0.25, 0.25] # the range in which the pole angle is sampled from on reset [x pi rad] + + # reward scales + rew_scale_alive = 1.0 + rew_scale_terminated = -2.0 + rew_scale_pole_pos = -1.0 + rew_scale_cart_vel = -0.01 + rew_scale_pole_vel = -0.005 diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/humanoid/__init__.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/humanoid/__init__.py index 6025249267cb..70c6ec274d5f 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/humanoid/__init__.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/humanoid/__init__.py @@ -20,7 +20,7 @@ entry_point=f"{__name__}.humanoid_warp_env:HumanoidWarpEnv", disable_env_checker=True, kwargs={ - "env_cfg_entry_point": f"{__name__}.humanoid_warp_env:HumanoidWarpEnvCfg", + "env_cfg_entry_point": f"{__name__}.humanoid_warp_env_cfg:HumanoidWarpEnvCfg", "rl_games_cfg_entry_point": f"{stable_agents}:rl_games_ppo_cfg.yaml", "rsl_rl_cfg_entry_point": f"{stable_agents}.rsl_rl_ppo_cfg:HumanoidPPORunnerCfg", "skrl_cfg_entry_point": f"{stable_agents}:skrl_ppo_cfg.yaml", diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/humanoid/humanoid_warp_env.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/humanoid/humanoid_warp_env.py index e5921916af25..2fd0ac8433e2 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/humanoid/humanoid_warp_env.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/humanoid/humanoid_warp_env.py @@ -5,106 +5,9 @@ from __future__ import annotations -from isaaclab_newton.physics import MJWarpSolverCfg, NewtonCfg - -import isaaclab.sim as sim_utils -from isaaclab.assets import ArticulationCfg -from isaaclab.envs import DirectRLEnvCfg -from isaaclab.scene import InteractiveSceneCfg -from isaaclab.sim import SimulationCfg -from isaaclab.terrains import TerrainImporterCfg -from isaaclab.utils.configclass import configclass - -from isaaclab_assets import HUMANOID_CFG - from isaaclab_tasks_experimental.direct.locomotion.locomotion_env_warp import LocomotionWarpEnv - -@configclass -class HumanoidWarpEnvCfg(DirectRLEnvCfg): - # env - episode_length_s = 15.0 - decimation = 2 - action_scale = 1.0 - action_space = 21 - observation_space = 75 - state_space = 0 - - solver_cfg = MJWarpSolverCfg( - njmax=80, - nconmax=25, - cone="pyramidal", - integrator="implicitfast", - update_data_interval=2, - impratio=1, - ) - newton_cfg = NewtonCfg( - solver_cfg=solver_cfg, - num_substeps=2, - debug_mode=False, - use_cuda_graph=True, - ) - - # simulation - sim: SimulationCfg = SimulationCfg(dt=1 / 120, render_interval=decimation, physics=newton_cfg) - terrain = TerrainImporterCfg( - prim_path="/World/ground", - terrain_type="plane", - collision_group=-1, - physics_material=sim_utils.RigidBodyMaterialCfg( - friction_combine_mode="average", - restitution_combine_mode="average", - static_friction=1.0, - dynamic_friction=1.0, - restitution=0.0, - ), - debug_vis=False, - ) - - # scene - scene: InteractiveSceneCfg = InteractiveSceneCfg( - num_envs=4096, env_spacing=4.0, replicate_physics=True, clone_in_fabric=True - ) - - # robot - robot: ArticulationCfg = HUMANOID_CFG.replace(prim_path="/World/envs/env_.*/Robot") - joint_gears: list = [ - 67.5000, # left_upper_arm - 67.5000, # left_upper_arm - 45.0000, # left_lower_arm - 67.5000, # lower_waist - 67.5000, # lower_waist - 67.5000, # pelvis - 45.0000, # left_thigh: x - 135.0000, # left_thigh: y - 45.0000, # left_thigh: z - 90.0000, # left_knee - 22.5, # left_foot - 22.5, # left_foot - 45.0000, # right_thigh: x - 135.0000, # right_thigh: y - 45.0000, # right_thigh: z - 90.0000, # right_knee - 22.5, # right_foot - 22.5, # right_foot - 67.5000, # right_upper_arm - 67.5000, # right_upper_arm - 45.0000, # right_lower_arm - ] - - heading_weight: float = 0.5 - up_weight: float = 0.1 - - energy_cost_scale: float = 0.05 - actions_cost_scale: float = 0.01 - alive_reward_scale: float = 2.0 - dof_vel_scale: float = 0.1 - - death_cost: float = -1.0 - termination_height: float = 0.8 - - angular_velocity_scale: float = 0.25 - contact_force_scale: float = 0.01 +from .humanoid_warp_env_cfg import HumanoidWarpEnvCfg class HumanoidWarpEnv(LocomotionWarpEnv): diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/humanoid/humanoid_warp_env_cfg.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/humanoid/humanoid_warp_env_cfg.py new file mode 100644 index 000000000000..d7fa473eda38 --- /dev/null +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/direct/humanoid/humanoid_warp_env_cfg.py @@ -0,0 +1,105 @@ +# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +from __future__ import annotations + +from isaaclab_newton.physics import MJWarpSolverCfg, NewtonCfg + +import isaaclab.sim as sim_utils +from isaaclab.assets import ArticulationCfg +from isaaclab.envs import DirectRLEnvCfg +from isaaclab.scene import InteractiveSceneCfg +from isaaclab.sim import SimulationCfg +from isaaclab.terrains import TerrainImporterCfg +from isaaclab.utils.configclass import configclass + +from isaaclab_assets import HUMANOID_CFG + + +@configclass +class HumanoidWarpEnvCfg(DirectRLEnvCfg): + # env + episode_length_s = 15.0 + decimation = 2 + action_scale = 1.0 + action_space = 21 + observation_space = 75 + state_space = 0 + + solver_cfg = MJWarpSolverCfg( + njmax=80, + nconmax=25, + cone="pyramidal", + integrator="implicitfast", + update_data_interval=2, + impratio=1, + ) + newton_cfg = NewtonCfg( + solver_cfg=solver_cfg, + num_substeps=2, + debug_mode=False, + use_cuda_graph=True, + ) + + # simulation + sim: SimulationCfg = SimulationCfg(dt=1 / 120, render_interval=decimation, physics=newton_cfg) + terrain = TerrainImporterCfg( + prim_path="/World/ground", + terrain_type="plane", + collision_group=-1, + physics_material=sim_utils.RigidBodyMaterialCfg( + friction_combine_mode="average", + restitution_combine_mode="average", + static_friction=1.0, + dynamic_friction=1.0, + restitution=0.0, + ), + debug_vis=False, + ) + + # scene + scene: InteractiveSceneCfg = InteractiveSceneCfg( + num_envs=4096, env_spacing=4.0, replicate_physics=True, clone_in_fabric=True + ) + + # robot + robot: ArticulationCfg = HUMANOID_CFG.replace(prim_path="/World/envs/env_.*/Robot") + joint_gears: list = [ + 67.5000, # left_upper_arm + 67.5000, # left_upper_arm + 45.0000, # left_lower_arm + 67.5000, # lower_waist + 67.5000, # lower_waist + 67.5000, # pelvis + 45.0000, # left_thigh: x + 135.0000, # left_thigh: y + 45.0000, # left_thigh: z + 90.0000, # left_knee + 22.5, # left_foot + 22.5, # left_foot + 45.0000, # right_thigh: x + 135.0000, # right_thigh: y + 45.0000, # right_thigh: z + 90.0000, # right_knee + 22.5, # right_foot + 22.5, # right_foot + 67.5000, # right_upper_arm + 67.5000, # right_upper_arm + 45.0000, # right_lower_arm + ] + + heading_weight: float = 0.5 + up_weight: float = 0.1 + + energy_cost_scale: float = 0.05 + actions_cost_scale: float = 0.01 + alive_reward_scale: float = 2.0 + dof_vel_scale: float = 0.1 + + death_cost: float = -1.0 + termination_height: float = 0.8 + + angular_velocity_scale: float = 0.25 + contact_force_scale: float = 0.01 diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/__init__.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/__init__.py index af69710a9b15..9f46551de255 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/__init__.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/__init__.py @@ -10,7 +10,7 @@ import gymnasium as gym # Reuse agent configs from the stable task package. -from isaaclab_tasks.core.manager_cartpole import agents +from isaaclab_tasks.core.cartpole import agents ## # Register Gym environments. @@ -22,9 +22,9 @@ disable_env_checker=True, kwargs={ "env_cfg_entry_point": f"{__name__}.cartpole_env_cfg:CartpoleEnvCfg", - "rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml", - "rsl_rl_cfg_entry_point": f"{agents.__name__}.rsl_rl_ppo_cfg:CartpolePPORunnerCfg", - "skrl_cfg_entry_point": f"{agents.__name__}:skrl_ppo_cfg.yaml", - "sb3_cfg_entry_point": f"{agents.__name__}:sb3_ppo_cfg.yaml", + "rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_manager_ppo_cfg.yaml", + "rsl_rl_cfg_entry_point": f"{agents.__name__}.rsl_rl_manager_ppo_cfg:CartpolePPORunnerCfg", + "skrl_cfg_entry_point": f"{agents.__name__}:skrl_manager_ppo_cfg.yaml", + "sb3_cfg_entry_point": f"{agents.__name__}:sb3_manager_ppo_cfg.yaml", }, ) diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/mdp/__init__.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/mdp/__init__.py index 73b1cf4fb2c5..1ce92a1952e8 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/mdp/__init__.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/mdp/__init__.py @@ -5,6 +5,6 @@ """This sub-module contains the functions that are specific to the cartpole environments.""" -from isaaclab_experimental.envs.mdp import * # noqa: F401, F403 +from isaaclab.utils.module import lazy_export -from .rewards import * # noqa: F401, F403 +lazy_export() diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/mdp/__init__.pyi b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/mdp/__init__.pyi new file mode 100644 index 000000000000..377068405c79 --- /dev/null +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/mdp/__init__.pyi @@ -0,0 +1,14 @@ +# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +__all__ = [ + "joint_pos_target_l2", +] + +# Forward stable MDP terms and experimental Warp-first overrides lazily, then +# override with cartpole-specific terms below. +from isaaclab_experimental.envs.mdp import * # noqa: F401, F403 + +from .rewards import joint_pos_target_l2 diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/mdp/rewards.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/mdp/rewards.py index b83d2ea61706..2678ef03de65 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/mdp/rewards.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/cartpole/mdp/rewards.py @@ -11,9 +11,8 @@ from isaaclab_experimental.managers import SceneEntityCfg from isaaclab_experimental.utils.warp.utils import wrap_to_pi -from isaaclab.assets import Articulation - if TYPE_CHECKING: + from isaaclab.assets import Articulation from isaaclab.envs import ManagerBasedRLEnv diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/__init__.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/__init__.py index df0802edf058..6a039f247a4c 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/__init__.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/__init__.py @@ -5,7 +5,6 @@ """This sub-module contains the functions that are specific to the humanoid environments.""" -from isaaclab_experimental.envs.mdp import * # noqa: F401, F403 +from isaaclab.utils.module import lazy_export -from .observations import * # noqa: F401, F403 -from .rewards import * # noqa: F401, F403 +lazy_export() diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/__init__.pyi b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/__init__.pyi new file mode 100644 index 000000000000..f476fe7b000a --- /dev/null +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/__init__.pyi @@ -0,0 +1,29 @@ +# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +__all__ = [ + "base_yaw_roll", + "base_up_proj", + "base_heading_proj", + "base_angle_to_target", + "upright_posture_bonus", + "move_to_target_bonus", + "progress_reward", + "joint_pos_limits_penalty_ratio", + "power_consumption", +] + +# Forward stable MDP terms and experimental Warp-first overrides lazily, then +# override with humanoid-specific terms below. +from isaaclab_experimental.envs.mdp import * # noqa: F401, F403 + +from .observations import base_angle_to_target, base_heading_proj, base_up_proj, base_yaw_roll +from .rewards import ( + joint_pos_limits_penalty_ratio, + move_to_target_bonus, + power_consumption, + progress_reward, + upright_posture_bonus, +) diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/observations.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/observations.py index e6a256a4746c..4d9ab39b4ff7 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/observations.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/observations.py @@ -18,9 +18,8 @@ from isaaclab_experimental.managers import SceneEntityCfg from isaaclab_newton.kernels.state_kernels import rotate_vec_to_body_frame -from isaaclab.assets import Articulation - if TYPE_CHECKING: + from isaaclab.assets import Articulation from isaaclab.envs import ManagerBasedEnv diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/rewards.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/rewards.py index 2c69a4a2bc40..a090d3a16f69 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/rewards.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/classic/humanoid/mdp/rewards.py @@ -20,11 +20,11 @@ from isaaclab_newton.kernels.state_kernels import rotate_vec_to_body_frame import isaaclab.utils.string as string_utils -from isaaclab.assets import Articulation if TYPE_CHECKING: from isaaclab_experimental.managers.manager_term_cfg import RewardTermCfg + from isaaclab.assets import Articulation from isaaclab.envs import ManagerBasedRLEnv diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/__init__.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/__init__.py index cdc532db4255..8f9a146abdc8 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/__init__.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/__init__.py @@ -5,8 +5,6 @@ """This sub-module contains the functions that are specific to the locomotion environments.""" -from isaaclab_experimental.envs.mdp import * # noqa: F401, F403 +from isaaclab.utils.module import lazy_export -from .curriculums import * # noqa: F401, F403 -from .rewards import * # noqa: F401, F403 -from .terminations import * # noqa: F401, F403 +lazy_export() diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/__init__.pyi b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/__init__.pyi new file mode 100644 index 000000000000..ae4b6d7af547 --- /dev/null +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/__init__.pyi @@ -0,0 +1,30 @@ +# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +__all__ = [ + "terrain_levels_vel", + "feet_air_time", + "feet_air_time_positive_biped", + "feet_slide", + "stand_still_joint_deviation_l1", + "track_ang_vel_z_world_exp", + "track_lin_vel_xy_yaw_frame_exp", + "terrain_out_of_bounds", +] + +# Forward stable MDP terms and experimental Warp-first overrides (commands, actions, +# observations, ...) lazily, then override with locomotion-specific terms below. +from isaaclab_experimental.envs.mdp import * # noqa: F401, F403 + +from .curriculums import terrain_levels_vel +from .rewards import ( + feet_air_time, + feet_air_time_positive_biped, + feet_slide, + stand_still_joint_deviation_l1, + track_ang_vel_z_world_exp, + track_lin_vel_xy_yaw_frame_exp, +) +from .terminations import terrain_out_of_bounds diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/curriculums.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/curriculums.py index 01653af7d96b..c1aa55114ab7 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/curriculums.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/curriculums.py @@ -16,12 +16,12 @@ import torch -from isaaclab.assets import Articulation from isaaclab.managers import SceneEntityCfg -from isaaclab.terrains import TerrainImporter if TYPE_CHECKING: + from isaaclab.assets import Articulation from isaaclab.envs import ManagerBasedRLEnv + from isaaclab.terrains import TerrainImporter def terrain_levels_vel( diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/rewards.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/rewards.py index 6daea9d45499..d7e11c517c7d 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/rewards.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/rewards.py @@ -17,10 +17,10 @@ import warp as wp from isaaclab.managers import SceneEntityCfg -from isaaclab.sensors import ContactSensor if TYPE_CHECKING: from isaaclab.envs import ManagerBasedRLEnv + from isaaclab.sensors import ContactSensor # --------------------------------------------------------------------------- # feet_air_time diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/terminations.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/terminations.py index 4b3699e0e0bf..4e0c32c58e64 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/terminations.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/locomotion/velocity/mdp/terminations.py @@ -11,10 +11,10 @@ import warp as wp -from isaaclab.assets import Articulation from isaaclab.managers import SceneEntityCfg if TYPE_CHECKING: + from isaaclab.assets import Articulation from isaaclab.envs import ManagerBasedRLEnv diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/manipulation/reach/mdp/__init__.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/manipulation/reach/mdp/__init__.py index b0845d6735b6..9429bf3706cf 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/manipulation/reach/mdp/__init__.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/manipulation/reach/mdp/__init__.py @@ -5,6 +5,6 @@ """This sub-module contains the functions that are specific to the reach environments.""" -from isaaclab_experimental.envs.mdp import * # noqa: F401, F403 +from isaaclab.utils.module import lazy_export -from .rewards import * # noqa: F401, F403 +lazy_export() diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/manipulation/reach/mdp/__init__.pyi b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/manipulation/reach/mdp/__init__.pyi new file mode 100644 index 000000000000..c277ec98e076 --- /dev/null +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/manipulation/reach/mdp/__init__.pyi @@ -0,0 +1,16 @@ +# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +__all__ = [ + "position_command_error", + "position_command_error_tanh", + "orientation_command_error", +] + +# Forward stable MDP terms and experimental Warp-first overrides lazily, then +# override with reach-specific terms below. +from isaaclab_experimental.envs.mdp import * # noqa: F401, F403 + +from .rewards import orientation_command_error, position_command_error, position_command_error_tanh diff --git a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/manipulation/reach/mdp/rewards.py b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/manipulation/reach/mdp/rewards.py index e378bbfcee80..7435752528d6 100644 --- a/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/manipulation/reach/mdp/rewards.py +++ b/source/isaaclab_tasks_experimental/isaaclab_tasks_experimental/manager_based/manipulation/reach/mdp/rewards.py @@ -15,10 +15,10 @@ import warp as wp -from isaaclab.assets import Articulation from isaaclab.managers import SceneEntityCfg if TYPE_CHECKING: + from isaaclab.assets import Articulation from isaaclab.envs import ManagerBasedRLEnv