Skip to content

Commit 1bf9b6f

Browse files
imstevenpmworksandhya-cb
authored andcommitted
fix(robots): add reachy2 fixes (huggingface#2783)
* fix(robots): add reachy2 fixes * tests(robots): remove reachy sdk stub
1 parent 43e04cf commit 1bf9b6f

File tree

15 files changed

+169
-250
lines changed

15 files changed

+169
-250
lines changed

docs/source/reachy2.mdx

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ docker run --rm -it \
3838
start_rviz:=true start_sdk_server:=true mujoco:=true
3939
```
4040

41+
> [!NOTE]
4142
> If MuJoCo runs slowly (low simulation frequency), append `-e LD_LIBRARY_PATH="/opt/host-libs:$LD_LIBRARY_PATH" \` to the previous command to improve performance:
4243
>
4344
> ```
@@ -141,7 +142,7 @@ If you choose this option but still want to use the VR teleoperation application
141142
First add reachy2 and reachy2_teleoperator to the imports of the record script. Then you can use the following command:
142143

143144
```bash
144-
python -m lerobot.record \
145+
lerobot-record \
145146
--robot.type=reachy2 \
146147
--robot.ip_address=192.168.0.200 \
147148
--robot.id=r2-0000 \
@@ -150,6 +151,7 @@ python -m lerobot.record \
150151
--teleop.type=reachy2_teleoperator \
151152
--teleop.ip_address=192.168.0.200 \
152153
--teleop.with_mobile_base=false \
154+
--robot.with_torso_camera=true \
153155
--dataset.repo_id=pollen_robotics/record_test \
154156
--dataset.single_task="Reachy 2 recording test" \
155157
--dataset.num_episodes=1 \
@@ -165,7 +167,7 @@ python -m lerobot.record \
165167
**Extended setup overview (all options included):**
166168

167169
```bash
168-
python -m lerobot.record \
170+
lerobot-record \
169171
--robot.type=reachy2 \
170172
--robot.ip_address=192.168.0.200 \
171173
--robot.use_external_commands=true \
@@ -177,6 +179,8 @@ python -m lerobot.record \
177179
--robot.with_left_teleop_camera=true \
178180
--robot.with_right_teleop_camera=true \
179181
--robot.with_torso_camera=false \
182+
--robot.camera_width=640 \
183+
--robot.camera_height=480 \
180184
--robot.disable_torque_on_disconnect=false \
181185
--robot.max_relative_target=5.0 \
182186
--teleop.type=reachy2_teleoperator \
@@ -212,59 +216,71 @@ Must be set to true if a compliant Reachy 2 is used to control another one.
212216
From our initial tests, recording **all** joints when only some are moving can reduce model quality with certain policies.
213217
To avoid this, you can exclude specific parts from recording and replay using:
214218

215-
````
219+
```bash
216220
--robot.with_<part>=false
217-
```,
221+
```
222+
218223
with `<part>` being one of : `mobile_base`, `l_arm`, `r_arm", `neck`, `antennas`.
219224
It determine whether the corresponding part is recorded in the observations. True if not set.
220225

221226
By default, **all parts are recorded**.
222227

223228
The same per-part mechanism is available in `reachy2_teleoperator` as well.
224229

225-
````
226-
230+
```bash
227231
--teleop.with\_<part>
228-
229232
```
233+
230234
with `<part>` being one of : `mobile_base`, `l_arm`, `r_arm", `neck`, `antennas`.
231235
Determine whether the corresponding part is recorded in the actions. True if not set.
232236

233237
> **Important:** In a given session, the **enabled parts must match** on both the robot and the teleoperator.
234-
For example, if the robot runs with `--robot.with_mobile_base=false`, the teleoperator must disable the same part `--teleoperator.with_mobile_base=false`.
238+
> For example, if the robot runs with `--robot.with_mobile_base=false`, the teleoperator must disable the same part `--teleoperator.with_mobile_base=false`.
235239
236240
##### Use the relevant cameras
237241

238-
You can do the same for **cameras**. By default, only the **teleoperation cameras** are recorded (both `left_teleop_camera` and `right_teleop_camera`). Enable or disable each camera with:
242+
You can do the same for **cameras**. Enable or disable each camera with default parameters using:
243+
244+
```bash
245+
--robot.with_left_teleop_camera=<true|false> \
246+
--robot.with_right_teleop_camera=<true|false> \
247+
--robot.with_torso_camera=<true|false>
248+
```
249+
250+
By default, no camera is recorded, all camera arguments are set to `false`.
251+
If you want to, you can use custom `width` and `height` parameters for Reachy 2's cameras using the `--robot.camera_width` & `--robot.camera_height` argument:
239252

253+
```bash
254+
--robot.camera_width=1920 \
255+
--robot.camera_height=1080
240256
```
241257

242-
--robot.with_left_teleop_camera=<true|false>
243-
--robot.with_right_teleop_camera=<true|false>
244-
--robot.with_torso_camera=<true|false>
258+
This will change the resolution of all 3 default robot cameras (enabled by the above bool arguments).
245259

246-
````
260+
If you want, you can add additional cameras other than the ones in the robot as usual with:
247261

262+
```bash
263+
--robot.cameras="{ extra: {type: opencv, index_or_path: 42, width: 640, height: 480, fps: 30}}" \
264+
```
248265

249266
## Step 2: Replay
250267

251268
Make sure the robot is configured with the same parts as the dataset:
252269

253270
```bash
254-
python -m lerobot.replay \
271+
lerobot-replay \
255272
--robot.type=reachy2 \
256273
--robot.ip_address=192.168.0.200 \
257274
--robot.use_external_commands=false \
258275
--robot.with_mobile_base=false \
259276
--dataset.repo_id=pollen_robotics/record_test \
260277
--dataset.episode=0
261-
--display_data=true
262-
````
278+
```
263279

264280
## Step 3: Train
265281

266282
```bash
267-
python -m lerobot.scripts.train \
283+
lerobot-train \
268284
--dataset.repo_id=pollen_robotics/record_test \
269285
--policy.type=act \
270286
--output_dir=outputs/train/reachy2_test \
@@ -277,10 +293,9 @@ python -m lerobot.scripts.train \
277293
## Step 4: Evaluate
278294

279295
```bash
280-
python -m lerobot.record \
296+
lerobot-eval \
281297
--robot.type=reachy2 \
282298
--robot.ip_address=192.168.0.200 \
283-
--display_data=false \
284299
--dataset.repo_id=pollen_robotics/eval_record_test \
285300
--dataset.single_task="Evaluate reachy2 policy" \
286301
--dataset.num_episodes=10 \

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ unitree_g1 = [
111111
"pyzmq>=26.2.1,<28.0.0",
112112
"onnxruntime>=1.16.0,<2.0.0"
113113
]
114-
reachy2 = ["reachy2_sdk>=1.0.14,<1.1.0"]
114+
reachy2 = ["reachy2_sdk>=1.0.15,<1.1.0"]
115115
kinematics = ["lerobot[placo-dep]"]
116116
intelrealsense = [
117117
"pyrealsense2>=2.55.1.6486,<2.57.0 ; sys_platform != 'darwin'",

src/lerobot/cameras/reachy2_camera/configuration_reachy2_camera.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@ class Reachy2CameraConfig(CameraConfig):
3535
name="teleop",
3636
image_type="left",
3737
ip_address="192.168.0.200", # IP address of the robot
38-
fps=15,
38+
port=50065, # Port of the camera server
3939
width=640,
4040
height=480,
41+
fps=30, # Not configurable for Reachy 2 cameras
4142
color_mode=ColorMode.RGB,
42-
) # Left teleop camera, 640x480 @ 15FPS
43+
) # Left teleop camera, 640x480 @ 30FPS
4344
```
4445
4546
Attributes:
4647
name: Name of the camera device. Can be "teleop" or "depth".
4748
image_type: Type of image stream. For "teleop" camera, can be "left" or "right".
4849
For "depth" camera, can be "rgb" or "depth". (depth is not supported yet)
49-
fps: Requested frames per second for the color stream.
50+
fps: Requested frames per second for the color stream. Not configurable for Reachy 2 cameras.
5051
width: Requested frame width in pixels for the color stream.
5152
height: Requested frame height in pixels for the color stream.
5253
color_mode: Color mode for image output (RGB or BGR). Defaults to RGB.
@@ -62,7 +63,6 @@ class Reachy2CameraConfig(CameraConfig):
6263
color_mode: ColorMode = ColorMode.RGB
6364
ip_address: str | None = "localhost"
6465
port: int = 50065
65-
# use_depth: bool = False
6666

6767
def __post_init__(self) -> None:
6868
if self.name not in ["teleop", "depth"]:

0 commit comments

Comments
 (0)