Skip to content

Commit b5fc0c7

Browse files
committed
Moving retargeter and device declariation out of factory and into the devices/retargeters themselves
1 parent 6f59b88 commit b5fc0c7

23 files changed

+244
-261
lines changed

docs/source/how-to/cloudxr_teleoperation.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -935,18 +935,15 @@ The retargeting system is designed to be extensible. You can create custom retar
935935
# Return control commands in appropriate format
936936
return torch.tensor([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]) # Example output
937937
938-
3. Register your retargeter with the factory by adding it to the ``RETARGETER_MAP``:
938+
3. Register your retargeter by setting ``retargeter_type`` on the config class:
939939

940940
.. code-block:: python
941941
942942
# Import your retargeter at the top of your module
943943
from my_package.retargeters import MyCustomRetargeter, MyCustomRetargeterCfg
944944
945-
# Add your retargeter to the factory
946-
from isaaclab.devices.teleop_device_factory import RETARGETER_MAP
947-
948-
# Register your retargeter type with its constructor
949-
RETARGETER_MAP[MyCustomRetargeterCfg] = MyCustomRetargeter
945+
# Link the config to the implementation for factory construction
946+
MyCustomRetargeterCfg.retargeter_type = MyCustomRetargeter
950947
951948
4. Now you can use your custom retargeter in teleop device configurations:
952949

source/isaaclab/config/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
# Note: Semantic Versioning is used: https://semver.org/
4-
version = "0.47.4"
4+
version = "0.47.5"
55

66
# Description
77
title = "Isaac Lab framework for Robot Learning"

source/isaaclab/docs/CHANGELOG.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Changelog
22
---------
33

4+
0.47.5 (2025-10-30)
5+
~~~~~~~~~~~~~~~~~~~
6+
7+
Changed
8+
^^^^^^^
9+
10+
* Moved retargeter and device declaration out of factory and into the devices/retargeters themselves.
11+
12+
413
0.47.4 (2025-10-30)
514
~~~~~~~~~~~~~~~~~~~
615

source/isaaclab/isaaclab/devices/device_base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@
1818
class DeviceCfg:
1919
"""Configuration for teleoperation devices."""
2020

21+
# Whether teleoperation should start active by default
22+
teleoperation_active_default: bool = True
23+
# Torch device string to place output tensors on
2124
sim_device: str = "cpu"
25+
# Retargeters that transform device data into robot commands
2226
retargeters: list[RetargeterCfg] = field(default_factory=list)
27+
# Concrete device class to construct for this config. Set by each device module.
28+
device_type: type["DeviceBase"] | None = None
2329

2430

2531
@dataclass

source/isaaclab/isaaclab/devices/gamepad/se2_gamepad.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
"""Gamepad controller for SE(2) control."""
77

8+
from __future__ import annotations
9+
810
import numpy as np
911
import torch
1012
import weakref
@@ -18,16 +20,6 @@
1820
from ..device_base import DeviceBase, DeviceCfg
1921

2022

21-
@dataclass
22-
class Se2GamepadCfg(DeviceCfg):
23-
"""Configuration for SE2 gamepad devices."""
24-
25-
v_x_sensitivity: float = 1.0
26-
v_y_sensitivity: float = 1.0
27-
omega_z_sensitivity: float = 1.0
28-
dead_zone: float = 0.01
29-
30-
3123
class Se2Gamepad(DeviceBase):
3224
r"""A gamepad controller for sending SE(2) commands as velocity commands.
3325
@@ -209,3 +201,14 @@ def _resolve_command_buffer(self, raw_command: np.ndarray) -> np.ndarray:
209201
command[command_sign] *= -1
210202

211203
return command
204+
205+
206+
@dataclass
207+
class Se2GamepadCfg(DeviceCfg):
208+
"""Configuration for SE2 gamepad devices."""
209+
210+
v_x_sensitivity: float = 1.0
211+
v_y_sensitivity: float = 1.0
212+
omega_z_sensitivity: float = 1.0
213+
dead_zone: float = 0.01
214+
device_type: type[DeviceBase] = Se2Gamepad

source/isaaclab/isaaclab/devices/gamepad/se3_gamepad.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,7 @@ def _resolve_command_buffer(self, raw_command: np.ndarray) -> np.ndarray:
264264
delta_command[delta_command_sign] *= -1
265265

266266
return delta_command
267+
268+
269+
# Link config to device for factory
270+
Se3GamepadCfg.device_type = Se3Gamepad

source/isaaclab/isaaclab/devices/keyboard/se2_keyboard.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
"""Keyboard controller for SE(2) control."""
77

8+
from __future__ import annotations
9+
810
import numpy as np
911
import torch
1012
import weakref
@@ -17,15 +19,6 @@
1719
from ..device_base import DeviceBase, DeviceCfg
1820

1921

20-
@dataclass
21-
class Se2KeyboardCfg(DeviceCfg):
22-
"""Configuration for SE2 keyboard devices."""
23-
24-
v_x_sensitivity: float = 0.8
25-
v_y_sensitivity: float = 0.4
26-
omega_z_sensitivity: float = 1.0
27-
28-
2922
class Se2Keyboard(DeviceBase):
3023
r"""A keyboard controller for sending SE(2) commands as velocity commands.
3124
@@ -178,3 +171,13 @@ def _create_key_bindings(self):
178171
"NUMPAD_9": np.asarray([0.0, 0.0, -1.0]) * self.omega_z_sensitivity,
179172
"X": np.asarray([0.0, 0.0, -1.0]) * self.omega_z_sensitivity,
180173
}
174+
175+
176+
@dataclass
177+
class Se2KeyboardCfg(DeviceCfg):
178+
"""Configuration for SE2 keyboard devices."""
179+
180+
v_x_sensitivity: float = 0.8
181+
v_y_sensitivity: float = 0.4
182+
omega_z_sensitivity: float = 1.0
183+
device_type: type[DeviceBase] = Se2Keyboard

source/isaaclab/isaaclab/devices/keyboard/se3_keyboard.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
"""Keyboard controller for SE(3) control."""
77

8+
from __future__ import annotations
9+
810
import numpy as np
911
import torch
1012
import weakref
@@ -18,16 +20,6 @@
1820
from ..device_base import DeviceBase, DeviceCfg
1921

2022

21-
@dataclass
22-
class Se3KeyboardCfg(DeviceCfg):
23-
"""Configuration for SE3 keyboard devices."""
24-
25-
gripper_term: bool = True
26-
pos_sensitivity: float = 0.4
27-
rot_sensitivity: float = 0.8
28-
retargeters: None = None
29-
30-
3123
class Se3Keyboard(DeviceBase):
3224
"""A keyboard controller for sending SE(3) commands as delta poses and binary command (open/close).
3325
@@ -206,3 +198,14 @@ def _create_key_bindings(self):
206198
"C": np.asarray([0.0, 0.0, 1.0]) * self.rot_sensitivity,
207199
"V": np.asarray([0.0, 0.0, -1.0]) * self.rot_sensitivity,
208200
}
201+
202+
203+
@dataclass
204+
class Se3KeyboardCfg(DeviceCfg):
205+
"""Configuration for SE3 keyboard devices."""
206+
207+
gripper_term: bool = True
208+
pos_sensitivity: float = 0.4
209+
rot_sensitivity: float = 0.8
210+
retargeters: None = None
211+
device_type: type[DeviceBase] = Se3Keyboard

source/isaaclab/isaaclab/devices/openxr/manus_vive.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
Manus and Vive for teleoperation and interaction.
88
"""
99

10+
from __future__ import annotations
11+
1012
import contextlib
1113
import numpy as np
1214
from collections.abc import Callable
@@ -34,13 +36,6 @@
3436
from .manus_vive_utils import HAND_JOINT_MAP, ManusViveIntegration
3537

3638

37-
@dataclass
38-
class ManusViveCfg(DeviceCfg):
39-
"""Configuration for Manus and Vive."""
40-
41-
xr_cfg: XrCfg | None = None
42-
43-
4439
class ManusVive(DeviceBase):
4540
"""Manus gloves and Vive trackers for teleoperation and interaction.
4641
@@ -246,3 +241,11 @@ def _on_teleop_command(self, event: carb.events.IEvent):
246241
elif "reset" in msg:
247242
if "RESET" in self._additional_callbacks:
248243
self._additional_callbacks["RESET"]()
244+
245+
246+
@dataclass
247+
class ManusViveCfg(DeviceCfg):
248+
"""Configuration for Manus and Vive."""
249+
250+
xr_cfg: XrCfg | None = None
251+
device_type: type[DeviceBase] = ManusVive

source/isaaclab/isaaclab/devices/openxr/openxr_device.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
"""OpenXR-powered device for teleoperation and interaction."""
77

8+
from __future__ import annotations
9+
810
import contextlib
911
import numpy as np
1012
from collections.abc import Callable
@@ -26,14 +28,8 @@
2628

2729
with contextlib.suppress(ModuleNotFoundError):
2830
from omni.kit.xr.core import XRCore, XRPoseValidityFlags
29-
from isaacsim.core.prims import SingleXFormPrim
30-
31-
32-
@dataclass
33-
class OpenXRDeviceCfg(DeviceCfg):
34-
"""Configuration for OpenXR devices."""
3531

36-
xr_cfg: XrCfg | None = None
32+
from isaacsim.core.prims import SingleXFormPrim
3733

3834

3935
class OpenXRDevice(DeviceBase):
@@ -303,3 +299,11 @@ def _on_teleop_command(self, event: carb.events.IEvent):
303299
elif "reset" in msg:
304300
if "RESET" in self._additional_callbacks:
305301
self._additional_callbacks["RESET"]()
302+
303+
304+
@dataclass
305+
class OpenXRDeviceCfg(DeviceCfg):
306+
"""Configuration for OpenXR devices."""
307+
308+
xr_cfg: XrCfg | None = None
309+
device_type: type[DeviceBase] = OpenXRDevice

0 commit comments

Comments
 (0)