Spaces:
Running
lerobot
Python lerobot compatible CLI for Node.js. Provides the same command-line interface as Python lerobot with identical behavior and syntax.
Installation
# Use directly with npx (recommended)
npx lerobot find-port
# Or install globally
npm install -g lerobot
lerobot find-port
Commands
Find Port
Discover robot port with interactive cable detection. Matches Python lerobot's find_port.py
exactly.
# Interactive cable detection (always enabled, like Python lerobot)
lerobot find-port
This command follows Python lerobot's behavior exactly:
- Lists initial ports
- Prompts to unplug USB cable
- Detects which port disappeared
- Prompts to reconnect cable
- Verifies port is restored
Calibrate
Calibrate robot motors and save calibration data to Hugging Face cache.
lerobot calibrate \
--robot.type=so100_follower \
--robot.port=/dev/ttyUSB0 \
--robot.id=my_follower_arm
Options:
--robot.type
- Robot type (e.g.,so100_follower
)--robot.port
- Serial port (e.g.,/dev/ttyUSB0
,COM4
)--robot.id
- Robot identifier (default:default
)--output
- Custom output path for calibration file
Compatible with: python -m lerobot calibrate
Teleoperate
Control robot through keyboard teleoperation.
lerobot teleoperate \
--robot.type=so100_follower \
--robot.port=/dev/ttyUSB0 \
--robot.id=my_follower_arm
Options:
--robot.type
- Robot type (e.g.,so100_follower
)--robot.port
- Serial port (e.g.,/dev/ttyUSB0
,COM4
)--robot.id
- Robot identifier (default:default
)--teleop.type
- Teleoperator type (default:keyboard
)--teleop.stepSize
- Step size for keyboard control (default:25
)--duration
- Duration in seconds, 0 = unlimited (default:0
)
Controls:
w/s
- Motor 1 up/downa/d
- Motor 2 left/rightq/e
- Motor 3 up/downr/f
- Motor 4 forward/backt/g
- Motor 5 up/downy/h
- Motor 6 open/closeCtrl+C
- Stop and exit
Compatible with: python -m lerobot teleoperate
Release Motors
Release robot motors for manual movement.
lerobot release-motors \
--robot.type=so100_follower \
--robot.port=/dev/ttyUSB0
Options:
--robot.type
- Robot type (e.g.,so100_follower
)--robot.port
- Serial port (e.g.,/dev/ttyUSB0
,COM4
)--robot.id
- Robot identifier (default:default
)--motors
- Specific motor IDs to release (comma-separated)
Compatible with: python -m lerobot release-motors
Python lerobot Compatibility
This CLI provides 100% compatible commands with Python lerobot:
Python lerobot | Node.js lerobot | Status |
---|---|---|
python -m lerobot find_port |
npx lerobot find-port |
β Compatible |
python -m lerobot calibrate |
npx lerobot calibrate |
β Compatible |
python -m lerobot teleoperate |
npx lerobot teleoperate |
β Compatible |
python -m lerobot release-motors |
npx lerobot release-motors |
β Compatible |
Calibration Data Compatibility
Calibration files are saved to the same location as Python lerobot:
~/.cache/huggingface/lerobot/calibration/robots/{robot_type}/{robot_id}.json
This ensures calibration data is shared between Python and Node.js implementations.
Examples
Complete Workflow
# 1. Find your robot (interactive mode)
npx lerobot find-port --interactive
# Output: Detected port: /dev/ttyUSB0
# 2. Calibrate the robot
npx lerobot calibrate \
--robot.type=so100_follower \
--robot.port=/dev/ttyUSB0 \
--robot.id=my_arm
# 3. Control the robot
npx lerobot teleoperate \
--robot.type=so100_follower \
--robot.port=/dev/ttyUSB0 \
--robot.id=my_arm
# 4. Release motors when done
npx lerobot release-motors \
--robot.type=so100_follower \
--robot.port=/dev/ttyUSB0
Automation Scripts
#!/bin/bash
# Automated calibration script
ROBOT_TYPE="so100_follower"
ROBOT_PORT="/dev/ttyUSB0"
ROBOT_ID="production_arm_1"
echo "Starting automated calibration..."
npx lerobot calibrate \
--robot.type=$ROBOT_TYPE \
--robot.port=$ROBOT_PORT \
--robot.id=$ROBOT_ID
echo "Calibration complete. Starting teleoperation..."
npx lerobot teleoperate \
--robot.type=$ROBOT_TYPE \
--robot.port=$ROBOT_PORT \
--robot.id=$ROBOT_ID \
--duration=60 # Run for 60 seconds
Requirements
- Node.js 18+
- Compatible with Windows, macOS, and Linux
- Same hardware requirements as Python lerobot
Related Packages
- @lerobot/node - Node.js library for programmatic control
- @lerobot/web - Browser library for web applications
License
Apache-2.0