lerobot-find-port command helps you identify the USB serial port associated with your robot’s motor bus by detecting which port disappears when you disconnect the device.
Command
src/lerobot/scripts/lerobot_find_port.py
Overview
This interactive script:- Lists all available serial ports
- Prompts you to disconnect your robot’s USB cable
- Detects which port disappeared
- Reports the port name for use in configuration
How It Works
The script uses a simple detection method:- Scan: Lists all serial ports before disconnection
- Wait: Prompts you to unplug the USB cable
- Compare: Lists ports again and finds the difference
- Report: Shows the port that disappeared (your robot’s port)
Usage Example
Platform-Specific Behavior
Linux/macOS
Lists all/dev/tty* devices:
/dev/ttyUSB0,/dev/ttyUSB1(USB serial adapters)/dev/ttyACM0,/dev/ttyACM1(USB CDC devices)/dev/tty.usbserial-*,/dev/tty.usbmodem-*(macOS)
Windows
Lists COM ports:COM1,COM3,COM4, etc.
Using the Port in Configuration
Once you’ve identified the port, use it in your robot configuration:Recording
Calibration
Setup Motors
Multiple Devices
If you have multiple robot devices (e.g., leader and follower arms):-
Find the first device:
- Reconnect first device
- Connect second device
-
Find the second device:
Troubleshooting
No Port Difference Detected
Error message:- Ensure you actually unplugged the USB cable
- Wait a moment after unplugging before pressing Enter
- Try a different USB cable
- Check device is powered on when plugged in
- On Linux, ensure you have permission to access serial ports
Multiple Ports Disappeared
Error message:- Only one device should be connected initially
- Disconnect other USB serial devices
- Run the script with fewer devices connected
Permission Denied (Linux)
If you can’t see ports due to permissions:Port Names Change on Reboot (Linux)
Port assignments like/dev/ttyUSB0 can change. For stable port names:
-
Find device serial number:
-
Create udev rule in
/etc/udev/rules.d/99-robot.rules: -
Reload udev rules:
-
Use stable name:
Alternative Methods
Manual Port Listing (Linux)
Using dmesg (Linux)
Device Manager (Windows)
- Open Device Manager
- Expand “Ports (COM & LPT)”
- Unplug device and watch which port disappears
- Plug back in to confirm
Programmatic Usage
See Also
- lerobot-calibrate - Calibrate robot motors
- lerobot-setup-motors - Configure motor IDs and baudrate
- lerobot-record - Record robot demonstrations
- Robot API - Robot connection and control