Skip to content

Commit ac7e150

Browse files
philfungPhilip Fungaliberts
authored andcommitted
fixes to SO-100 readme (huggingface#600)
Co-authored-by: Philip Fung <no@one> Co-authored-by: Simon Alibert <75076266+aliberts@users.noreply.github.com>
1 parent dd4d83f commit ac7e150

File tree

1 file changed

+57
-31
lines changed

1 file changed

+57
-31
lines changed

examples/10_use_so100.md

+57-31
Original file line numberDiff line numberDiff line change
@@ -1,26 +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+
## A. Source the parts
44

55
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.
66

77
**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.
88

9-
## Install LeRobot
9+
## B. Install LeRobot
1010

1111
On your computer:
1212

1313
1. [Install Miniconda](https://docs.anaconda.com/miniconda/#quick-command-line-install):
1414

1515
```bash
1616
mkdir -p ~/miniconda3
17+
# Linux:
1718
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
1823
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
1924
rm ~/miniconda3/miniconda.sh
2025
~/miniconda3/bin/conda init bash
2126
```
2227

23-
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
2429

2530
3. Create and activate a fresh conda environment for lerobot
2631

@@ -40,25 +45,32 @@ git clone https://github.com/huggingface/lerobot.git ~/lerobot
4045
cd ~/lerobot && pip install -e ".[feetech]"
4146
```
4247

43-
For Linux only (not Mac), install extra dependencies for recording datasets:
48+
_For Linux only (not Mac)_: install extra dependencies for recording datasets:
4449

4550
```bash
4651
conda install -y -c conda-forge ffmpeg
4752
pip uninstall -y opencv-python
4853
conda install -y -c conda-forge "opencv>=4.10.0"
4954
```
5055

51-
## Configure the motors
56+
## C. Configure the motors
5257

53-
Follow steps 1 of the [assembly video](https://www.youtube.com/watch?v=FioA2oeFZ5I) which illustrates the use of our scripts below.
58+
### 1. Find the USB ports associated to each arm
5459

55-
**Find USB ports associated to your arms**
56-
To find the correct ports for each arm, run the utility script twice:
60+
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.
61+
62+
#### a. Run the script to find ports
63+
64+
Follow Step 1 of the [assembly video](https://www.youtube.com/watch?v=FioA2oeFZ5I), which illustrates the use of our scripts below.
65+
66+
To find the port for each bus servo adapter, run the utility script:
5767

5868
```bash
5969
python lerobot/scripts/find_motors_bus_port.py
6070
```
6171

72+
#### b. Example outputs
73+
6274
Example output when identifying the leader arm's port (e.g., `/dev/tty.usbmodem575E0031751` on Mac, or possibly `/dev/ttyACM0` on Linux):
6375

6476
```
@@ -85,14 +97,23 @@ The port of this DynamixelMotorsBus is /dev/tty.usbmodem575E0032081
8597
Reconnect the usb cable.
8698
```
8799

88-
Troubleshooting: On Linux, you might need to give access to the USB ports by running:
100+
#### c. Troubleshooting
101+
102+
On Linux, you might need to give access to the USB ports by running:
89103

90104
```bash
91105
sudo chmod 666 /dev/ttyACM0
92106
sudo chmod 666 /dev/ttyACM1
93107
```
94108

95-
**Configure your motors**
109+
#### d. Update YAML file
110+
111+
Now that you have the ports, modify the _port_ sections in `so100.yaml`
112+
113+
### 2. Configure the motors
114+
115+
#### a. Set IDs for all 12 motors
116+
96117
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:
97118

98119
```bash
@@ -104,7 +125,7 @@ python lerobot/scripts/configure_motor.py \
104125
--ID 1
105126
```
106127

107-
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).
128+
_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)._
108129

109130
Then unplug your motor and plug the second motor and set its ID to 2.
110131

@@ -119,23 +140,26 @@ python lerobot/scripts/configure_motor.py \
119140

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

122-
**Remove the gears of the 6 leader motors**
123-
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.
143+
#### b. Remove the gears of the 6 leader motors
144+
145+
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.
146+
147+
#### c. Add motor horn to all 12 motors
124148

125-
**Add motor horn to the motors**
126-
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.
149+
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.
127150
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.
128151

129-
## Assemble the arms
152+
## D. Assemble the arms
130153

131-
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.
154+
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.
132155

133-
## Calibrate
156+
## E. Calibrate
134157

135158
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.
136159

137-
**Manual calibration of follower arm**
138-
/!\ 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.
160+
#### a. Manual calibration of follower arm
161+
162+
/!\ 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.
139163

140164
You will need to move the follower arm to these positions sequentially:
141165

@@ -151,8 +175,9 @@ python lerobot/scripts/control_robot.py calibrate \
151175
--robot-overrides '~cameras' --arms main_follower
152176
```
153177

154-
**Manual calibration of leader arm**
155-
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:
178+
#### b. Manual calibration of leader arm
179+
180+
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:
156181

157182
| 1. Zero position | 2. Rotated position | 3. Rest position |
158183
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
@@ -166,7 +191,7 @@ python lerobot/scripts/control_robot.py calibrate \
166191
--robot-overrides '~cameras' --arms main_leader
167192
```
168193

169-
## Teleoperate
194+
## F. Teleoperate
170195

171196
**Simple teleop**
172197
Then you are ready to teleoperate your robot! Run this simple script (it won't connect and display the cameras):
@@ -178,15 +203,16 @@ python lerobot/scripts/control_robot.py teleoperate \
178203
--display-cameras 0
179204
```
180205

181-
**Teleop with displaying cameras**
206+
#### a. Teleop with displaying cameras
207+
182208
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.
183209

184210
```bash
185211
python lerobot/scripts/control_robot.py teleoperate \
186212
--robot-path lerobot/configs/robot/so100.yaml
187213
```
188214

189-
## Record a dataset
215+
## G. Record a dataset
190216

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

@@ -218,7 +244,7 @@ python lerobot/scripts/control_robot.py record \
218244
--push-to-hub 1
219245
```
220246

221-
## Visualize a dataset
247+
## H. Visualize a dataset
222248

223249
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:
224250

@@ -233,7 +259,7 @@ python lerobot/scripts/visualize_dataset_html.py \
233259
--repo-id ${HF_USER}/so100_test
234260
```
235261

236-
## Replay an episode
262+
## I. Replay an episode
237263

238264
Now try to replay the first episode on your robot:
239265

@@ -245,7 +271,7 @@ python lerobot/scripts/control_robot.py replay \
245271
--episode 0
246272
```
247273

248-
## Train a policy
274+
## J. Train a policy
249275

250276
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:
251277

@@ -269,7 +295,7 @@ Let's explain it:
269295

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

272-
## Evaluate your policy
298+
## K. Evaluate your policy
273299

274300
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:
275301

@@ -291,7 +317,7 @@ As you can see, it's almost the same command as previously used to record your t
291317
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`).
292318
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`).
293319

294-
## More
320+
## L. More Information
295321

296322
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.
297323

0 commit comments

Comments
 (0)