lerobot_tutorial / 2. LeRobot Setting.md
aailabkaist's picture
Upload 4 files
1a59c60 verified
|
Raw
History Blame Contribute Delete
5.02 kB
# 2. LeRobot Setting
last updated Dec/26/2025
## 2-1. USB port μ°ΎκΈ°
1) Follower arm λ³΄λ“œμ™€ PCλ₯Ό USB둜 μ—°κ²°
2) μ•„λž˜ λͺ…λ Ή μ‹€ν–‰
```bash
lerobot-find-port
```
3) μ•ˆλ‚΄μ— 따라 **Follower arm λ³΄λ“œμ—μ„œ USB 케이블을 뽑고 Enter**λ₯Ό λˆ„λ₯΄λ©΄, μ•„λž˜μ™€ 같은 κ²°κ³Όκ°€ 좜λ ₯λ©λ‹ˆλ‹€.
```text
The port of this MotorsBus is '/dev/ttyACM0'
Reconnect the USB cable
```
β†’ 이 κ²½μš°μ— follower arm λ³΄λ“œμ˜ USB ν¬νŠΈλŠ” **`/dev/ttyACM0`** μž…λ‹ˆλ‹€.
4) Leader arm λ³΄λ“œλ„ λ§ˆμ°¬κ°€μ§€λ‘œ USB 포트λ₯Ό μ°Ύμ•„μ€λ‹ˆλ‹€.
5) 각 ν¬νŠΈκ°€ μ–΄λ–€ arm(Follower/Leader)에 ν•΄λ‹Ήν•˜λŠ”μ§€ **λ°˜λ“œμ‹œ ꡬ뢄**ν•΄ λ‘μ„Έμš”.
6) μ—°κ²°λœ USB ν¬νŠΈμ— Read/Write κΆŒν•œ λΆ€μ—¬
```bash
sudo chmod 666 /dev/ttyACM0
sudo chmod 666 /dev/ttyACM1
```
## (Optional) Serial numberλ₯Ό 기반으둜 USB port κ³ μ •ν•˜λŠ” 법
### 1. ttyACM0 serial 확인
```bash
udevadm info -a -n /dev/ttyACM0 | grep '{serial}' -m 1
```
```bash
# Example print
ATTRS{serial}=="5A7A057786"
```
### 2. ttyACM1 serial 확인
```bash
udevadm info -a -n /dev/ttyACM1 | grep '{serial}' -m 1
```
```bash
# Example print
ATTRS{serial}=="5A68011549"
```
### 3. udev rule 생성
```bash
# udev rule 생성/νŽΈμ§‘
sudo nano /etc/udev/rules.d/99-serial.rules
```
```bash
GNU nano 2.9.3 /etc/udev/rules.d/99-serial.rules
# μ•„λž˜μ˜ serial numberλŠ” μ˜ˆμ‹œμž…λ‹ˆλ‹€. μžμ‹ μ˜ ν™˜κ²½μ—μ„œ ν™•μΈν•œ κ°’μœΌλ‘œ λ°˜λ“œμ‹œ κ΅μ²΄ν•˜μ„Έμš”.
SUBSYSTEM=="tty", ATTRS{serial}=="5A7A057786", SYMLINK+="so101_follower"
SUBSYSTEM=="tty", ATTRS{serial}=="5A68011549", SYMLINK+="so101_leader"
```
### 4. rule reload / trigger
```bash
sudo udevadm control --reload-rules
sudo udevadm trigger
```
### 5. κ³ μ • 포트 확인
```bash
ls -l /dev/so101_*
```
```bash
# Example print
# USB 포트λ₯Ό κ½‚λŠ” μˆœμ„œκ°€ λ°”λ€Œμ–΄λ„ λ‹€μŒ 경둜둜 항상 λ™μΌν•˜κ²Œ 인식
lrwxrwxrwx 1 root root 7 11μ›” 24 21:46 /dev/so101_follower -> ttyACM0
lrwxrwxrwx 1 root root 7 11μ›” 24 21:46 /dev/so101_leader -> ttyACM1
```
---
## 2-2. λͺ¨ν„° ID μ„€μ •
- 각 λͺ¨ν„°μ˜ **고유 ID** 섀정을 μœ„ν•΄ μ•„λž˜ λͺ…λ Ήμ–΄ μ‹€ν–‰ ν›„, 터미널에 ν‘œμ‹œλ˜λŠ” κ°€μ΄λ“œμ— 따라 **λͺ¨ν„°λ₯Ό μˆœμ„œλŒ€λ‘œ μ—°κ²°**ν•˜λ©° μ§„ν–‰
- μ•„λž˜ 링크의 μ˜μƒμ„ λ³΄λ©΄μ„œ ν•˜λŠ” κ±Έ μΆ”μ²œν•©λ‹ˆλ‹€. \
https://huggingface.co/docs/lerobot/so101#2-set-the-motors-ids-and-baudrates
### Follower
```bash
lerobot-setup-motors \
--robot.type=so101_follower \
--robot.port=/dev/so101_follower # Follower λ³΄λ“œμ˜ USB port
```
### Leader
```bash
lerobot-setup-motors \
--teleop.type=so101_leader \
--teleop.port=/dev/so101_leader # Leader λ³΄λ“œμ˜ USB port
```
---
## 2-3. Calibration
- Calibration은 λ‘œλ΄‡ νŒ”μ˜ 각 κ΄€μ ˆ(joint)이 μ •ν™•ν•œ μœ„μΉ˜λ₯Ό μΈμ‹ν•˜κ³  λ§€ν•‘ν•  수 μžˆλ„λ‘ ν•˜λŠ” μ€‘μš”ν•œ κ³Όμ •μž…λ‹ˆλ‹€.
- μ•„λž˜ 링크의 μ˜μƒμ„ λ³΄λ©΄μ„œ ν•˜λŠ” κ±Έ μΆ”μ²œν•©λ‹ˆλ‹€. \
https://huggingface.co/docs/lerobot/so101#calibrate
### Follower
```bash
lerobot-calibrate \
--robot.type=so101_follower \
--robot.port=/dev/so101_follower \
--robot.id=follower
```
### Leader
```bash
lerobot-calibrate \
--teleop.type=so101_leader \
--teleop.port=/dev/so101_leader \
--teleop.id=leader
```
### Calibration κ³Όμ •
Command μ‹€ν–‰ ν›„ λ‹€μŒκ³Ό 같은 λ©”μ‹œμ§€κ°€ ν‘œμ‹œλ©λ‹ˆλ‹€.
```text
Move None SO101Leader to the middle of its range of motion and press ENTER....
Move all joints sequentially through their entire ranges of motion.
Recording positions. Press ENTER to stop...
```
μœ„ λ©”μ‹œμ§€λ₯Ό 따라 **쀑간 μœ„μΉ˜(middle position)** λ₯Ό μž‘μ•„μ£Όκ³  **Enter**λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš”.
#### Joint μ›€μ§μž„ 체크리슀트
- λ‘œλ΄‡ νŒ”μ„ **쀑간 μœ„μΉ˜(middle position)** 둜 이동
- λͺ¨λ“  κ΄€μ ˆ(joints)을 **순차적으둜** 전체 λ²”μœ„μ—μ„œ 움직여보기
- **ENTER** ν‚€λ₯Ό 눌러 기둝 쀑지
### Calibration κ²°κ³Ό
Calibration이 μ™„λ£Œλ˜λ©΄ λ‹€μŒκ³Ό 같은 κ΄€μ ˆ μœ„μΉ˜ 정보가 좜λ ₯λ©λ‹ˆλ‹€(μ˜ˆμ‹œ).
```bash
-------------------------------------------
-------------------------------------------
NAME | MIN | POS | MAX
shoulder_pan | 1955 | 2007 | 3132
shoulder_lift | 709 | 724 | 2057
elbow_flex | 1605 | 3036 | 3110
wrist_flex | 808 | 2797 | 2803
wrist_roll | 2037 | 2048 | 2055
gripper | 2019 | 2046 | 3383
```
### 파일 μ €μž₯ 확인
μ„±κ³΅μ μœΌλ‘œ μ™„λ£Œλ˜λ©΄ λ‹€μŒ λ©”μ‹œμ§€κ°€ ν‘œμ‹œλ©λ‹ˆλ‹€.
```bash
Calibration saved to ~/.cache/huggingface/lerobot/calibration/teleoperators/so101_leader/leader.json
```
### Calibration 파일
Calibration이 μ™„λ£Œλ˜λ©΄ λ‹€μŒ μœ„μΉ˜μ— 파일이 μ €μž₯λ©λ‹ˆλ‹€.
- 리더 μ•”:
`~/.cache/huggingface/lerobot/calibration/teleoperators/so101_leader/leader.json`
- νŒ”λ‘œμ›Œ μ•”:
`~/.cache/huggingface/lerobot/calibration/robots/so101_follower/follower.json`
각 Calibration νŒŒμΌμ—λŠ” λ‹€μŒ 정보가 ν¬ν•¨λ©λ‹ˆλ‹€.
- 각 κ΄€μ ˆμ˜ μ΅œμ†Œκ°’(MIN)
- ν˜„μž¬ μœ„μΉ˜(POS)
- μ΅œλŒ€κ°’(MAX)
---