lerobot-teleoperator-arx5 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ from .config_arx5_leader import ARX5LeaderConfig
2
+ from .arx5_leader import ARX5Leader
3
+
4
+ __all__ = [
5
+ "ARX5LeaderConfig",
6
+ "ARX5Leader",
7
+ ]
@@ -0,0 +1,183 @@
1
+ """
2
+ ARX5 Leader Teleoperator implementation.
3
+
4
+ This module provides the ARX5Leader class which implements the LeRobot Teleoperator
5
+ interface for ARX5 robot arms acting as leaders (producing actions from human input).
6
+ """
7
+
8
+ from functools import cached_property
9
+ import logging
10
+ import time
11
+
12
+ from lerobot.teleoperators.teleoperator import Teleoperator
13
+
14
+ from arx5_common import ARX5Arm, MOTOR_NAMES, EEF_ACTION_KEYS
15
+
16
+ from .config_arx5_leader import ARX5LeaderConfig
17
+
18
+ logger = logging.getLogger(__name__)
19
+
20
+
21
+ class ARX5Leader(Teleoperator):
22
+ """
23
+ ARX5 leader arm teleoperator for LeRobot.
24
+
25
+ This teleoperator reads the position of a physical ARX5 arm that a human
26
+ operator manipulates, producing actions that can be sent to a follower robot.
27
+ """
28
+
29
+ config_class = ARX5LeaderConfig
30
+ name = "arx5_leader"
31
+
32
+ def __init__(self, config: ARX5LeaderConfig):
33
+ super().__init__(config)
34
+ self.config = config
35
+
36
+ # Create the low-level arm controller
37
+ self.arm = ARX5Arm(
38
+ control_mode=config.control_mode,
39
+ config=config.arm_config,
40
+ is_leader=True,
41
+ )
42
+
43
+ @cached_property
44
+ def _motor_pos_ft(self) -> dict[str, type]:
45
+ """Motor position feature types."""
46
+ return {f"{name}.pos": float for name in MOTOR_NAMES}
47
+
48
+ @cached_property
49
+ def _motor_vel_ft(self) -> dict[str, type]:
50
+ """Motor velocity feature types."""
51
+ return {f"{name}.velocity": float for name in MOTOR_NAMES}
52
+
53
+ @cached_property
54
+ def _motor_eff_ft(self) -> dict[str, type]:
55
+ """Motor effort/torque feature types."""
56
+ return {f"{name}.effort": float for name in MOTOR_NAMES}
57
+
58
+ @cached_property
59
+ def _eef_ft(self) -> dict[str, type]:
60
+ """End-effector pose feature types."""
61
+ return {key: float for key in EEF_ACTION_KEYS}
62
+
63
+ @cached_property
64
+ def motor_names(self) -> dict[str, type]:
65
+ return MOTOR_NAMES
66
+
67
+ @cached_property
68
+ def action_features(self) -> dict[str, type]:
69
+ """
70
+ Features produced by this teleoperator (sent to follower robot).
71
+
72
+ Includes motor positions, velocities, efforts, and EEF pose.
73
+ """
74
+ return {
75
+ **self._motor_pos_ft,
76
+ **self._motor_vel_ft,
77
+ **self._motor_eff_ft,
78
+ **self._eef_ft,
79
+ }
80
+
81
+ @cached_property
82
+ def feedback_features(self) -> dict[str, type]:
83
+ """Features that can be sent back to this teleoperator as feedback."""
84
+ # ARX5 doesn't currently support force feedback
85
+ return {}
86
+
87
+ @property
88
+ def is_connected(self) -> bool:
89
+ """Whether the teleoperator hardware is connected."""
90
+ return self.arm.is_connected
91
+
92
+ def connect(self, calibrate: bool = True) -> None:
93
+ """
94
+ Connect to the teleoperator hardware.
95
+
96
+ Args:
97
+ calibrate: Whether to run calibration (ARX5 doesn't require manual calibration)
98
+ """
99
+ if self.is_connected:
100
+ raise RuntimeError(f"{self} is already connected")
101
+
102
+ logger.info(f"Connecting {self}...")
103
+ self.arm.connect()
104
+ time.sleep(0.2)
105
+
106
+ # Configure the arm for leader operation (low resistance for manual manipulation)
107
+ self.configure()
108
+ logger.info(f"{self} connected.")
109
+
110
+ @property
111
+ def is_calibrated(self) -> bool:
112
+ """ARX5 arms are factory calibrated."""
113
+ return True
114
+
115
+ def calibrate(self) -> None:
116
+ """ARX5 arms don't require manual calibration."""
117
+ pass
118
+
119
+ def configure(self) -> None:
120
+ """Configure the arm for leader/teleoperator operation."""
121
+ self.arm.configure()
122
+
123
+ def reset(self):
124
+ if not self.is_connected:
125
+ raise RuntimeError(f"{self} is not connected.")
126
+ self.arm.reset_to_home()
127
+
128
+ def get_action(self) -> dict[str, float]:
129
+ """
130
+ Read the current state of the leader arm as an action.
131
+
132
+ Returns:
133
+ Dictionary with motor positions, velocities, efforts, and EEF pose
134
+ that can be sent to a follower robot.
135
+ """
136
+ if not self.is_connected:
137
+ raise RuntimeError(f"{self} is not connected.")
138
+
139
+ start = time.perf_counter()
140
+ pos, vel, effort, eef_pose = self.arm.get_observation()
141
+ dt_ms = (time.perf_counter() - start) * 1e3
142
+ logger.debug(f"{self} read action: {dt_ms:.1f}ms")
143
+
144
+ action = {}
145
+
146
+ # Motor positions
147
+ for i, name in enumerate(MOTOR_NAMES):
148
+ action[f"{name}.pos"] = float(pos[i])
149
+
150
+ # Motor velocities
151
+ for i, name in enumerate(MOTOR_NAMES):
152
+ action[f"{name}.velocity"] = float(vel[i])
153
+
154
+ # Motor efforts (torques)
155
+ for i, name in enumerate(MOTOR_NAMES):
156
+ action[f"{name}.effort"] = float(effort[i])
157
+
158
+ # End-effector pose (x, y, z, roll, pitch, yaw, gripper)
159
+ action["eef.x"] = float(eef_pose[0])
160
+ action["eef.y"] = float(eef_pose[1])
161
+ action["eef.z"] = float(eef_pose[2])
162
+ action["eef.roll"] = float(eef_pose[3])
163
+ action["eef.pitch"] = float(eef_pose[4])
164
+ action["eef.yaw"] = float(eef_pose[5])
165
+ action["eef.gripper"] = float(pos[6]) # Gripper from joint state
166
+
167
+ return action
168
+
169
+ def send_feedback(self, feedback: dict[str, float]) -> None:
170
+ """
171
+ Send feedback to the teleoperator (e.g., force feedback).
172
+
173
+ ARX5 doesn't currently support force feedback.
174
+ """
175
+ raise NotImplementedError("ARX5 does not support force feedback")
176
+
177
+ def disconnect(self) -> None:
178
+ """Disconnect from the teleoperator hardware."""
179
+ if not self.is_connected:
180
+ raise RuntimeError(f"{self} is not connected.")
181
+
182
+ self.arm.disconnect()
183
+ logger.info(f"{self} disconnected.")
@@ -0,0 +1,32 @@
1
+ """
2
+ Configuration for ARX5 leader teleoperator.
3
+ """
4
+
5
+ from dataclasses import dataclass
6
+
7
+ from lerobot.teleoperators.config import TeleoperatorConfig
8
+
9
+ from arx5_common import ARXArmModel, ARXControlMode, ARX5ArmConfig
10
+
11
+
12
+ @TeleoperatorConfig.register_subclass("arx5_leader")
13
+ @dataclass
14
+ class ARX5LeaderConfig(TeleoperatorConfig):
15
+ """
16
+ Configuration for a single ARX5 leader arm teleoperator.
17
+
18
+ Usage:
19
+ lerobot-teleoperate --teleop.type=arx5_leader --teleop.interface_name=enx6c6e0711f4e2
20
+ """
21
+ # Arm hardware configuration
22
+ arm_model: ARXArmModel = ARXArmModel.L5
23
+ interface_name: str = "can0"
24
+ control_mode: ARXControlMode = ARXControlMode.JOINT_CONTROLLER
25
+
26
+ @property
27
+ def arm_config(self) -> ARX5ArmConfig:
28
+ """Generate ARX5ArmConfig from this teleoperator config."""
29
+ return ARX5ArmConfig(
30
+ model=self.arm_model,
31
+ interface_name=self.interface_name,
32
+ )
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.4
2
+ Name: lerobot_teleoperator_arx5
3
+ Version: 0.1.0
4
+ Summary: ARX5 robot arm leader/teleoperator plugin for LeRobot
5
+ Author-email: Ville Kuosmanen <ville@villekuosmanen.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Ville Kuosmanen
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Classifier: Programming Language :: Python :: 3
29
+ Classifier: License :: OSI Approved :: Apache Software License
30
+ Classifier: Operating System :: OS Independent
31
+ Requires-Python: >=3.10
32
+ License-File: LICENSE
33
+ Requires-Dist: arx5-common
34
+ Requires-Dist: lerobot>=0.4
35
+ Dynamic: license-file
@@ -0,0 +1,8 @@
1
+ lerobot_teleoperator_arx5/__init__.py,sha256=Fxb4A4ubFAp0F_4RBt82LeeJ0096Z8qH8g4CKiuv_Cg,142
2
+ lerobot_teleoperator_arx5/arx5_leader.py,sha256=66lX3RnlUxUlEgZCRA74AIGAuSKP876iHpkUgh5msbA,5912
3
+ lerobot_teleoperator_arx5/config_arx5_leader.py,sha256=UVguFxQbtMCxlrfB0wawekHzF44yK2jXvcmiIx-UYe8,938
4
+ lerobot_teleoperator_arx5-0.1.0.dist-info/licenses/LICENSE,sha256=h2OIPyHQwutQ7oGpGcEZ7uWUCmQIfCjf0hF9HKOM6NQ,1072
5
+ lerobot_teleoperator_arx5-0.1.0.dist-info/METADATA,sha256=FKsrAZjayd4EpxMMknLL8MsdOSmy8BaT6W7yirRDh4s,1720
6
+ lerobot_teleoperator_arx5-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ lerobot_teleoperator_arx5-0.1.0.dist-info/top_level.txt,sha256=voUvtvVwwfuPg57MfwGUJMyZp0YvA4MZydf0I7399Fo,26
8
+ lerobot_teleoperator_arx5-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ville Kuosmanen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ lerobot_teleoperator_arx5