|
3 | 3 | # |
4 | 4 | # SPDX-License-Identifier: BSD-3-Clause |
5 | 5 |
|
6 | | -import logging |
7 | 6 | from dataclasses import MISSING |
8 | 7 |
|
9 | 8 | import numpy as np |
| 9 | +from isaaclab_teleop import IsaacTeleopCfg |
10 | 10 |
|
11 | 11 | from isaaclab.utils.configclass import configclass |
12 | 12 |
|
13 | 13 | from isaaclab_tasks.contrib.stack import mdp |
14 | 14 |
|
| 15 | +from . import stack_joint_pos_env_cfg |
15 | 16 | from .position_pitch_ik_action import SO101PositionPitchIKActionCfg |
16 | 17 | from .position_pitch_ik_controller import SO101PositionPitchIKControllerCfg |
17 | | - |
18 | | -try: |
19 | | - import isaacteleop # noqa: F401 -- pipeline builders need isaacteleop at runtime |
20 | | - from isaaclab_teleop import IsaacTeleopCfg |
21 | | - |
22 | | - _TELEOP_AVAILABLE = True |
23 | | -except ImportError: |
24 | | - _TELEOP_AVAILABLE = False |
25 | | - logging.getLogger(__name__).warning("isaaclab_teleop is not installed. XR teleoperation features will be disabled.") |
26 | | - |
27 | | -from . import stack_joint_pos_env_cfg |
28 | 18 | from .stack_joint_pos_env_cfg import _SO101_GRIPPER_CLOSE, _SO101_GRIPPER_OPEN |
29 | 19 |
|
30 | 20 | ## |
31 | 21 | # Pre-defined configs |
32 | 22 | ## |
33 | 23 | from isaaclab_assets.robots.so101 import SO101_HIGH_PD_CFG # isort: skip |
34 | 24 |
|
| 25 | +# ``isaaclab_teleop`` imports cleanly without the optional ``isaacteleop`` package (the heavy |
| 26 | +# import is deferred to session start), so no import guard is needed here. This lightweight |
| 27 | +# marker lets the env test suite categorize this as a teleop env (see |
| 28 | +# ``isaaclab_tasks/test/env_test_utils.py::_is_teleop_env``). |
| 29 | +_TELEOP_AVAILABLE = True |
| 30 | + |
35 | 31 | # Analog-gripper action affine: ``joint = offset + scale * closedness`` maps the retargeter's |
36 | 32 | # closedness ``c in [0, 1]`` to a ``gripper`` joint target [rad]. ``offset == OPEN`` (so ``c=0`` |
37 | 33 | # is fully open) and ``offset + scale == CLOSE`` (so ``c=1`` is fully closed). Tied to the |
@@ -274,17 +270,16 @@ def __post_init__(self): |
274 | 270 | ) |
275 | 271 |
|
276 | 272 | # IsaacTeleop-based teleoperation pipeline |
277 | | - if _TELEOP_AVAILABLE: |
278 | | - self.isaac_teleop = IsaacTeleopCfg( |
279 | | - pipeline_builder=_build_so101_stack_pipeline, |
280 | | - sim_device=self.sim.device, |
281 | | - xr_cfg=self.xr, |
282 | | - # Rebase all teleop output poses into the robot base frame: the device reads this |
283 | | - # prim's world transform each frame and left-multiplies its inverse onto the XR |
284 | | - # anchor (``base_T_world @ world_T_anchor``), so the clutch/roll retargeters work |
285 | | - # in the base frame -- the IK command's root frame (the FrameTransformer source |
286 | | - # also uses ``Robot/base``). The clutch's reset-origin home (_BASE_T_GRIPPER_HOME) |
287 | | - # provides the engage seed, so no live end-effector feed is needed. Teleop runs a |
288 | | - # single env (env_0). |
289 | | - target_frame_prim_path="/World/envs/env_0/Robot/base", |
290 | | - ) |
| 273 | + self.isaac_teleop = IsaacTeleopCfg( |
| 274 | + pipeline_builder=_build_so101_stack_pipeline, |
| 275 | + sim_device=self.sim.device, |
| 276 | + xr_cfg=self.xr, |
| 277 | + # Rebase all teleop output poses into the robot base frame: the device reads this |
| 278 | + # prim's world transform each frame and left-multiplies its inverse onto the XR |
| 279 | + # anchor (``base_T_world @ world_T_anchor``), so the clutch/roll retargeters work |
| 280 | + # in the base frame -- the IK command's root frame (the FrameTransformer source |
| 281 | + # also uses ``Robot/base``). The clutch's reset-origin home (_BASE_T_GRIPPER_HOME) |
| 282 | + # provides the engage seed, so no live end-effector feed is needed. Teleop runs a |
| 283 | + # single env (env_0). |
| 284 | + target_frame_prim_path="/World/envs/env_0/Robot/base", |
| 285 | + ) |
0 commit comments