Skip to content

Commit eec6796

Browse files
philfungPhilip Fungaliberts
authored
fixes to SO-100 readme (#600)
Co-authored-by: Philip Fung <no@one> Co-authored-by: Simon Alibert <[email protected]>
1 parent 25a8597 commit eec6796

File tree

1 file changed

+53
-32
lines changed

1 file changed

+53
-32
lines changed

examples/10_use_so100.md

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1-
This tutorial explains how to use [SO-100](https://github.com/TheRobotStudio/SO-ARM100) with LeRobot.
1+
# Using the [SO-100](https://github.com/TheRobotStudio/SO-ARM100) with LeRobot
22

3-
## Source the parts
3+
4+
## A. Source the parts
45

56
Follow this [README](https://github.com/TheRobotStudio/SO-ARM100). It contains the bill of materials, with link to source the parts, as well as the instructions to 3D print the parts, and advices if it's your first time printing or if you don't own a 3D printer already.
67

78
**Important**: Before assembling, you will first need to configure your motors. To this end, we provide a nice script, so let's first install LeRobot. After configuration, we will also guide you through assembly.
89

9-
## Install LeRobot
10+
## B. Install LeRobot
1011

1112
On your computer:
1213

1314
1. [Install Miniconda](https://docs.anaconda.com/miniconda/#quick-command-line-install):
1415
```bash
1516
mkdir -p ~/miniconda3
17+
# Linux:
1618
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
19+
# Mac M-series:
20+
# curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda3/miniconda.sh
21+
# Mac Intel:
22+
# curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o ~/miniconda3/miniconda.sh
1723
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
1824
rm ~/miniconda3/miniconda.sh
1925
~/miniconda3/bin/conda init bash
2026
```
2127

22-
2. Restart shell or `source ~/.bashrc`
28+
2. Restart shell or `source ~/.bashrc` (*Mac*: `source ~/.bash_profile`) or `source ~/.zshrc` if you're using zshell
2329

2430
3. Create and activate a fresh conda environment for lerobot
2531
```bash
@@ -36,23 +42,30 @@ git clone https://github.com/huggingface/lerobot.git ~/lerobot
3642
cd ~/lerobot && pip install -e ".[feetech]"
3743
```
3844

39-
For Linux only (not Mac), install extra dependencies for recording datasets:
45+
*For Linux only (not Mac)*: install extra dependencies for recording datasets:
4046
```bash
4147
conda install -y -c conda-forge ffmpeg
4248
pip uninstall -y opencv-python
4349
conda install -y -c conda-forge "opencv>=4.10.0"
4450
```
4551

46-
## Configure the motors
52+
## C. Configure the motors
53+
54+
### 1. Find the USB ports associated to each arm
55+
56+
Designate one bus servo adapter and 6 motors for your leader arm, and similarly the other bus servo adapter and 6 motors for the follower arm.
4757

48-
Follow steps 1 of the [assembly video](https://www.youtube.com/watch?v=FioA2oeFZ5I) which illustrates the use of our scripts below.
58+
#### a. Run the script to find ports
4959

50-
**Find USB ports associated to your arms**
51-
To find the correct ports for each arm, run the utility script twice:
60+
Follow Step 1 of the [assembly video](https://www.youtube.com/watch?v=FioA2oeFZ5I), which illustrates the use of our scripts below.
61+
62+
To find the port for each bus servo adapter, run the utility script:
5263
```bash
5364
python lerobot/scripts/find_motors_bus_port.py
5465
```
5566

67+
#### b. Example outputs
68+
5669
Example output when identifying the leader arm's port (e.g., `/dev/tty.usbmodem575E0031751` on Mac, or possibly `/dev/ttyACM0` on Linux):
5770
```
5871
Finding all available ports for the MotorBus.
@@ -64,7 +77,6 @@ Remove the usb cable from your DynamixelMotorsBus and press Enter when done.
6477
The port of this DynamixelMotorsBus is /dev/tty.usbmodem575E0031751
6578
Reconnect the usb cable.
6679
```
67-
6880
Example output when identifying the follower arm's port (e.g., `/dev/tty.usbmodem575E0032081`, or possibly `/dev/ttyACM1` on Linux):
6981
```
7082
Finding all available ports for the MotorBus.
@@ -77,13 +89,20 @@ The port of this DynamixelMotorsBus is /dev/tty.usbmodem575E0032081
7789
Reconnect the usb cable.
7890
```
7991

80-
Troubleshooting: On Linux, you might need to give access to the USB ports by running:
92+
#### c. Troubleshooting
93+
On Linux, you might need to give access to the USB ports by running:
8194
```bash
8295
sudo chmod 666 /dev/ttyACM0
8396
sudo chmod 666 /dev/ttyACM1
8497
```
8598

86-
**Configure your motors**
99+
#### d. Update YAML file
100+
101+
Now that you have the ports, modify the *port* sections in `so100.yaml`
102+
103+
### 2. Configure the motors
104+
105+
#### a. Set IDs for all 12 motors
87106
Plug your first motor and run this script to set its ID to 1. It will also set its present position to 2048, so expect your motor to rotate:
88107
```bash
89108
python lerobot/scripts/configure_motor.py \
@@ -94,7 +113,7 @@ python lerobot/scripts/configure_motor.py \
94113
--ID 1
95114
```
96115

97-
Note: These motors are currently limitated. They can take values between 0 and 4096 only, which corresponds to a full turn. They can't turn more than that. 2048 is at the middle of this range, so we can take -2048 steps (180 degrees anticlockwise) and reach the maximum range, or take +2048 steps (180 degrees clockwise) and reach the maximum range. The configuration step also sets the homing offset to 0, so that if you misassembled the arm, you can always update the homing offset to account for a shift up to ± 2048 steps (± 180 degrees).
116+
*Note: These motors are currently limitated. They can take values between 0 and 4096 only, which corresponds to a full turn. They can't turn more than that. 2048 is at the middle of this range, so we can take -2048 steps (180 degrees anticlockwise) and reach the maximum range, or take +2048 steps (180 degrees clockwise) and reach the maximum range. The configuration step also sets the homing offset to 0, so that if you misassembled the arm, you can always update the homing offset to account for a shift up to ± 2048 steps (± 180 degrees).*
98117

99118
Then unplug your motor and plug the second motor and set its ID to 2.
100119
```bash
@@ -108,23 +127,25 @@ python lerobot/scripts/configure_motor.py \
108127

109128
Redo the process for all your motors until ID 6. Do the same for the 6 motors of the leader arm.
110129

111-
**Remove the gears of the 6 leader motors**
112-
Follow step 2 of the [assembly video](https://www.youtube.com/watch?v=FioA2oeFZ5I). You need to remove the gear for the motors of the leader arm. As a result, you will only use the position encoding of the motor and reduce friction to more easily operate the leader arm.
113130

114-
**Add motor horn to the motors**
115-
Follow step 3 of the [assembly video](https://www.youtube.com/watch?v=FioA2oeFZ5I). For SO-100, you need to align the holes on the motor horn to the motor spline to be approximately 1:30, 4:30, 7:30 and 10:30.
131+
#### b. Remove the gears of the 6 leader motors
132+
133+
Follow step 2 of the [assembly video](https://youtu.be/FioA2oeFZ5I?t=248). You need to remove the gear for the motors of the leader arm. As a result, you will only use the position encoding of the motor and reduce friction to more easily operate the leader arm.
134+
135+
#### c. Add motor horn to all 12 motors
136+
Follow step 3 of the [assembly video](https://youtu.be/FioA2oeFZ5I?t=569). For SO-100, you need to align the holes on the motor horn to the motor spline to be approximately 1:30, 4:30, 7:30 and 10:30.
116137
Try to avoid rotating the motor while doing so to keep position 2048 set during configuration. It is especially tricky for the leader motors as it is more sensible without the gears, but it's ok if it's a bit rotated.
117138

118-
## Assemble the arms
139+
## D. Assemble the arms
119140

120-
Follow step 4 of the [assembly video](https://www.youtube.com/watch?v=FioA2oeFZ5I). The first arm should take a bit more than 1 hour to assemble, but once you get use to it, you can do it under 1 hour for the second arm.
141+
Follow step 4 of the [assembly video](https://youtu.be/FioA2oeFZ5I?t=610). The first arm should take a bit more than 1 hour to assemble, but once you get use to it, you can do it under 1 hour for the second arm.
121142

122-
## Calibrate
143+
## E. Calibrate
123144

124145
Next, you'll need to calibrate your SO-100 robot to ensure that the leader and follower arms have the same position values when they are in the same physical position. This calibration is essential because it allows a neural network trained on one SO-100 robot to work on another.
125146

126-
**Manual calibration of follower arm**
127-
/!\ Contrarily to step 6 of the [assembly video](https://www.youtube.com/watch?v=FioA2oeFZ5I) which illustrates the auto calibration, we will actually do manual calibration of follower for now.
147+
#### a. Manual calibration of follower arm
148+
/!\ Contrarily to step 6 of the [assembly video](https://youtu.be/FioA2oeFZ5I?t=724) which illustrates the auto calibration, we will actually do manual calibration of follower for now.
128149

129150
You will need to move the follower arm to these positions sequentially:
130151

@@ -139,8 +160,8 @@ python lerobot/scripts/control_robot.py calibrate \
139160
--robot-overrides '~cameras' --arms main_follower
140161
```
141162

142-
**Manual calibration of leader arm**
143-
Follow step 6 of the [assembly video](https://www.youtube.com/watch?v=FioA2oeFZ5I) which illustrates the manual calibration. You will need to move the leader arm to these positions sequentially:
163+
#### b. Manual calibration of leader arm
164+
Follow step 6 of the [assembly video](https://youtu.be/FioA2oeFZ5I?t=724) which illustrates the manual calibration. You will need to move the leader arm to these positions sequentially:
144165

145166
| 1. Zero position | 2. Rotated position | 3. Rest position |
146167
|---|---|---|
@@ -153,7 +174,7 @@ python lerobot/scripts/control_robot.py calibrate \
153174
--robot-overrides '~cameras' --arms main_leader
154175
```
155176

156-
## Teleoperate
177+
## F. Teleoperate
157178

158179
**Simple teleop**
159180
Then you are ready to teleoperate your robot! Run this simple script (it won't connect and display the cameras):
@@ -165,14 +186,14 @@ python lerobot/scripts/control_robot.py teleoperate \
165186
```
166187

167188

168-
**Teleop with displaying cameras**
189+
#### a. Teleop with displaying cameras
169190
Follow [this guide to setup your cameras](https://github.com/huggingface/lerobot/blob/main/examples/7_get_started_with_real_robot.md#c-add-your-cameras-with-opencvcamera). Then you will be able to display the cameras on your computer while you are teleoperating by running the following code. This is useful to prepare your setup before recording your first dataset.
170191
```bash
171192
python lerobot/scripts/control_robot.py teleoperate \
172193
--robot-path lerobot/configs/robot/so100.yaml
173194
```
174195

175-
## Record a dataset
196+
## G. Record a dataset
176197

177198
Once you're familiar with teleoperation, you can record your first dataset with SO-100.
178199

@@ -201,7 +222,7 @@ python lerobot/scripts/control_robot.py record \
201222
--push-to-hub 1
202223
```
203224

204-
## Visualize a dataset
225+
## H. Visualize a dataset
205226

206227
If you uploaded your dataset to the hub with `--push-to-hub 1`, you can [visualize your dataset online](https://huggingface.co/spaces/lerobot/visualize_dataset) by copy pasting your repo id given by:
207228
```bash
@@ -214,7 +235,7 @@ python lerobot/scripts/visualize_dataset_html.py \
214235
--repo-id ${HF_USER}/so100_test
215236
```
216237

217-
## Replay an episode
238+
## I. Replay an episode
218239

219240
Now try to replay the first episode on your robot:
220241
```bash
@@ -225,7 +246,7 @@ python lerobot/scripts/control_robot.py replay \
225246
--episode 0
226247
```
227248

228-
## Train a policy
249+
## J. Train a policy
229250

230251
To train a policy to control your robot, use the [`python lerobot/scripts/train.py`](../lerobot/scripts/train.py) script. A few arguments are required. Here is an example command:
231252
```bash
@@ -248,7 +269,7 @@ Let's explain it:
248269

249270
Training should take several hours. You will find checkpoints in `outputs/train/act_so100_test/checkpoints`.
250271

251-
## Evaluate your policy
272+
## K. Evaluate your policy
252273

253274
You can use the `record` function from [`lerobot/scripts/control_robot.py`](../lerobot/scripts/control_robot.py) but with a policy checkpoint as input. For instance, run this command to record 10 evaluation episodes:
254275
```bash
@@ -268,7 +289,7 @@ As you can see, it's almost the same command as previously used to record your t
268289
1. There is an additional `-p` argument which indicates the path to your policy checkpoint with (e.g. `-p outputs/train/eval_so100_test/checkpoints/last/pretrained_model`). You can also use the model repository if you uploaded a model checkpoint to the hub (e.g. `-p ${HF_USER}/act_so100_test`).
269290
2. The name of dataset begins by `eval` to reflect that you are running inference (e.g. `--repo-id ${HF_USER}/eval_act_so100_test`).
270291

271-
## More
292+
## L. More Information
272293

273294
Follow this [previous tutorial](https://github.com/huggingface/lerobot/blob/main/examples/7_get_started_with_real_robot.md#4-train-a-policy-on-your-data) for a more in-depth tutorial on controlling real robots with LeRobot.
274295

0 commit comments

Comments
 (0)