Spaces:
Running
Running
File size: 10,048 Bytes
ec936d5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
# Getting Started with SO-100 Robot Arms - lerobot.js (Node.js/TypeScript)
> **π Complete setup guide for SO-100 robot arms using lerobot.js**
> Zero Python dependencies - pure TypeScript/JavaScript implementation
## Prerequisites
- **Node.js 18+** (Windows, macOS, or Linux)
- **SO-100 robot arms** (follower + leader)
- **USB cables** for both arms
## π¨ Current Implementation Status
**β
Available Now:**
- `lerobot find-port` - USB port detection
- `lerobot calibrate` - Robot/teleoperator calibration
**π Coming Soon (Python equivalent shown for reference):**
- `lerobot check-motors` - Motor ID verification
- `lerobot setup-motors` - Motor ID configuration
- `lerobot teleoperate` - Real-time control
- `lerobot record` - Data collection
> For now, use Python lerobot for motor setup, then switch to lerobot.js for calibration!
## Install lerobot.js
### Option 1: Global Installation (Recommended)
```bash
# Install globally for easy access
npm install -g lerobot
# Verify installation
lerobot --help
```
### Option 2: Use without Installation
```bash
# Use directly with npx (no installation needed)
npx lerobot --help
```
### Option 3: Development Setup
```bash
# Clone and build from source
git clone https://github.com/timpietrusky/lerobot.js
cd lerobot.js
pnpm install
pnpm run install-global
```
## 1. Identify USB Ports
**What this does:** Identifies which USB port each robot arm is connected to. Essential for all subsequent commands.
### Connect and Test
1. **Connect both arms**: Plug in USB + power for both follower and leader arms
2. **Run port detection**:
```bash
lerobot find-port
```
**Example output:**
```
Finding all available ports for the MotorsBus.
Ports before disconnecting: ['COM3', 'COM4']
Remove the USB cable from your MotorsBus and press Enter when done.
The port of this MotorsBus is 'COM3'
Reconnect the USB cable.
```
3. **Repeat for second arm**: Run `lerobot find-port` again to identify the other arm
4. **Record the ports**: Note which port belongs to which arm (e.g., COM3=leader, COM4=follower)
## 2. Check Motor IDs
**Important: Always do this first!** This checks if your robot motors are already configured correctly.
**What are motor IDs?** Each motor needs a unique ID (1, 2, 3, 4, 5, 6) so the computer can talk to them individually. New motors often have the same default ID (1).
### Check Follower Arm
```bash
# π Coming soon - use Python lerobot for now:
python -m lerobot.check_motors --robot.port=COM4
```
### Check Leader Arm
```bash
# π Coming soon - use Python lerobot for now:
python -m lerobot.check_motors --teleop.port=COM3
```
**β
If you see this - you're ready for calibration:**
```
π PERFECT! This arm is correctly configured:
β
All 6 motors found: [1, 2, 3, 4, 5, 6]
β
Correct baudrate: 1000000
β
This arm is ready for calibration!
```
**β οΈ If you see this - continue to "Setup Motors" below:**
```
β οΈ This arm needs motor ID setup:
Expected IDs: [1, 2, 3, 4, 5, 6]
Found IDs: [1, 1, 1, 1, 1, 1]
Duplicate IDs: [1] (likely all motors have ID=1)
```
## 3. Setup Motors (If Needed)
**β οΈ Only do this if the motor check above showed your motors need setup!**
This assigns unique ID numbers to each motor. It's a one-time process.
**Safety notes:**
- Power down (unplug power + USB) when connecting/disconnecting motors
- Connect only ONE motor at a time during setup
- Remove gears from leader arm before this step
### Setup Follower Arm
```bash
# π Coming soon - use Python lerobot for now:
python -m lerobot.setup_motors --robot.type=so100_follower --robot.port=COM4
```
### Setup Leader Arm
```bash
# π Coming soon - use Python lerobot for now:
python -m lerobot.setup_motors --teleop.type=so100_leader --teleop.port=COM3
```
**After setup:** Run the motor check commands again to verify everything worked.
## 4. Calibrate Robot Arms
**What is calibration?** Teaches both arms to understand joint positions identically. Crucial for leader arm to control follower arm properly.
**Why needed?** Manufacturing differences mean position sensors might read different values for the same physical position.
### Calibrate Follower Arm
```bash
lerobot calibrate --robot.type=so100_follower --robot.port=COM4 --robot.id=my_follower_arm
```
**Example output:**
```
Calibrating device...
Device type: so100_follower
Port: COM4
ID: my_follower_arm
Connecting to so100_follower on port COM4...
Connected successfully.
Starting calibration procedure...
Initializing robot communication...
Robot communication initialized.
Reading motor positions...
Motor positions: [0.5, 45.2, 90.1, 0.0, 0.0, 0.0]
Setting motor limits...
Motor limits configured.
Calibrating motors...
Calibrating motor 1/6...
Motor 1 calibrated successfully.
[... continues for all 6 motors ...]
Verifying calibration...
Calibration verification passed.
Calibration completed successfully.
Configuration saved to: ~/.cache/huggingface/lerobot/calibration/robots/so100_follower/my_follower_arm.json
Disconnecting from robot...
```
**Calibration steps:**
1. **Move to neutral position**: Position arm in standard reference pose
2. **Move joints through range**: Gently move each joint to its limits
3. **Automatic save**: Calibration data saved automatically
### Calibrate Leader Arm
```bash
lerobot calibrate --teleop.type=so100_leader --teleop.port=COM3 --teleop.id=my_leader_arm
```
**Calibration steps:**
1. **Move to neutral position**: Same reference pose as follower
2. **Move through range**: Test all joint movements
3. **Button mapping**: Test all buttons and triggers
4. **Automatic save**: Configuration saved
**β
After both arms are calibrated, you're ready for teleoperation!**
## 5. Test Teleoperation
Test that your leader arm can control the follower arm:
```bash
# π Coming soon - use Python lerobot for now:
python -m lerobot.teleoperate \
--robot.type=so100_follower --robot.port=COM4 --robot.id=my_follower_arm \
--teleop.type=so100_leader --teleop.port=COM3 --teleop.id=my_leader_arm
```
**Expected behavior:**
- Both arms connect automatically
- Moving leader arm β follower arm copies movements
- Press `Ctrl+C` to stop teleoperation
## 6. Record Demonstrations (Optional)
Record demonstrations for training robot learning policies:
```bash
# π Coming soon - use Python lerobot for now:
python -m lerobot.record \
--robot.type=so100_follower --robot.port=COM4 --robot.id=my_follower_arm \
--teleop.type=so100_leader --teleop.port=COM3 --teleop.id=my_leader_arm \
--dataset-name=my_first_dataset \
--num-episodes=10 \
--task="Pick up the red block and place it in the box"
```
## CLI Command Reference
### Core Commands
```bash
# Show all available commands
lerobot --help
# Find USB ports
lerobot find-port
# Calibrate robot
lerobot calibrate --robot.type=so100_follower --robot.port=COM4 --robot.id=my_robot
# Calibrate teleoperator
lerobot calibrate --teleop.type=so100_leader --teleop.port=COM3 --teleop.id=my_teleop
# Show calibrate help
lerobot calibrate --help
```
### Alternative Usage Methods
```bash
# Method 1: Global installation (recommended)
lerobot calibrate --robot.type=so100_follower --robot.port=COM4 --robot.id=my_robot
# Method 2: Use with npx (no installation)
npx lerobot calibrate --robot.type=so100_follower --robot.port=COM4 --robot.id=my_robot
# Method 3: Development mode (if you cloned the repo)
pnpm run cli:calibrate -- --robot.type=so100_follower --robot.port=COM4 --robot.id=my_robot
# Method 4: Direct built CLI
node dist/cli/index.js calibrate --robot.type=so100_follower --robot.port=COM4 --robot.id=my_robot
```
## Configuration Files
Calibration data is stored in Hugging Face compatible directories:
```
~/.cache/huggingface/lerobot/calibration/
βββ robots/
β βββ so100_follower/
β βββ my_follower_arm.json
βββ teleoperators/
βββ so100_leader/
βββ my_leader_arm.json
```
**Environment variables:**
- `HF_HOME`: Override Hugging Face home directory
- `HF_LEROBOT_CALIBRATION`: Override calibration directory
## Troubleshooting
### Port Issues
```bash
# Error: Could not connect to robot on port COM99
lerobot find-port # Re-run to find correct ports
```
**Solutions:**
1. Verify robot is connected to specified port
2. Check no other application is using the port
3. Verify you have permission to access the port
4. Try different USB port or cable
### Motor Communication Issues
```bash
# Error: Robot initialization failed
```
**Solutions:**
1. Check power connection to robot
2. Verify USB cable is working
3. Ensure motors are properly daisy-chained
4. Check motor IDs are correctly configured
### Permission Issues
**Windows:**
```bash
# Run as administrator if needed
```
**Linux/macOS:**
```bash
# Add user to dialout group
sudo usermod -a -G dialout $USER
# Log out and back in
```
## Browser Usage (Alternative)
You can also use lerobot.js in the browser with Web Serial API:
1. **Build and serve**:
```bash
git clone https://github.com/timpietrusky/lerobot.js
cd lerobot.js
pnpm install
pnpm run build:web
pnpm run preview
```
2. **Visit**: `http://localhost:4173`
3. **Requirements**: Chrome/Edge 89+ with HTTPS or localhost
## Next Steps
β
**You now have working SO-100 robot arms with lerobot.js!**
**Continue with robot learning:**
- Add cameras for vision-based tasks
- Record more complex demonstrations
- Train neural network policies
- Run policies autonomously
**Resources:**
- [lerobot.js Documentation](https://github.com/timpietrusky/lerobot.js)
- [Original Python lerobot](https://github.com/huggingface/lerobot)
- [Hugging Face Robotics](https://huggingface.co/docs/lerobot)
**Community:**
- [Discord](https://discord.com/invite/s3KuuzsPFb) - Get help and discuss
- [GitHub Issues](https://github.com/timpietrusky/lerobot.js/issues) - Report bugs
---
**π Congratulations! You're now ready to use SO-100 robot arms with TypeScript/JavaScript!**
|