Skip to content

About

ROS 2 stack for SO-101 leader/follower: Feetech driver, bringup, teleop, MoveIt2, episode recording, Rerun, policy inference.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

SO-101 ROS Physical AI

ROS 2 Jazzy · ros2_control · MoveIt 2 · Rerun

ROS 2 Jazzy License: Apache 2.0 MoveIt 2 Rerun

Complete ROS 2 stack for the SO-101 robot arm in a leader/follower configuration. Feetech STS3215 servo driver via ros2_control, leader-to-follower teleoperation, MoveIt 2 motion planning, multi-camera support, episode recording for imitation learning, conversion to LeRobot datasets, policy training, policy inference, and live Rerun visualization — all on real hardware.

Sync inference supports ACT and SmolVLA on-device; async inference supports any LeRobot policy via policy_server. PRs and issues welcome.

SO-101 async inference demo

Main demo: run async policy inference on the real SO-101 arm with a ROS 2 client on the robot and the policy hosted on a remote GPU server via policy_server, including ACT and VLA-style LeRobot models trained on datasets collected with this repo's end-to-end pipeline. See so101_inference and policy_server for details.

What you can do with this repo

Teleoperate the robot Record imitation learning episodes IK kinematics control
SO-101 teleop demo SO-101 episode recorder demo
ros2_real_arm2_compressed.mp4
Teleop
Mirror the leader arm to the follower with the default and recommended forward_controller.
Episode recorder
Save synchronized robot + camera episodes with keyboard controls and optional live Rerun.
Kinematics
Interactive IK control with a 3D Viser gizmo — drag the end-effector and the arm follows in real time using robokin + Placo.

End-to-end workflow: teleoperate the robot → record episodes → convert rosbags to LeRobot datasets → train policies → run learned policies

Best first things to try

After the hardware setup guide and installation, these are the fastest ways to get a feel for the repo:

Important Before using the real arms with ROS 2, you must first complete the LeRobot motor setup and calibration steps for both arms. These steps write the required persistent values to the servo motors, including IDs and calibration-related settings stored in EEPROM.

Do not teleoperate, plan, or command the real arms from ROS until this is done. After calibration, joint_config_file is optional and mainly useful for explicit overrides or extra tuning.

→ See docs/hardware.md → 5. Calibration, EEPROM, and Optional Joint Config Overrides

  1. Teleoperate the robot

    ros2 launch so101_bringup teleop.launch.py
  2. Record a demonstration episode

    ros2 launch so101_bringup recording_session.launch.py \
      experiment_name:=pick_and_place \
      task:="Pick up the cube and place it in the container." \
      use_rerun:=true
  3. Convert recorded episodes into a LeRobot dataset

    pixi run -e lerobot convert -- \
      --input-dir ~/.ros/so101_episodes/pick_and_place \
      --config ~/ros2_ws/src/so101-ros-physical-ai/rosbag_to_lerobot/config/so101.yaml \
      --repo-id local/so101_test
  4. Then dive deeper


Features

Feature Description
Leader/Follower Teleop Real-time joint mirroring from leader arm to follower arm (forward or trajectory controller)
ros2_control + Feetech Driver Hardware interface for STS3215 servos with configurable joint limits and calibration
MoveIt 2 Integration OMPL-based motion planning, joint limits, kinematics (KDL) for the follower arm
Multi-Camera Pipeline USB cameras and RealSense D400 series with configurable TF placement
Episode Recording Record joint states + camera frames into timestamped episodes for imitation learning
Rerun Visualization Live visualization of observations, actions, and camera feeds via ROS-to-Rerun bridge (Pixi)
Policy Inference Sync: ACT & SmolVLA on-device. Async: any LeRobot policy (ACT, SmolVLA, π₀, …) offloaded to a remote GPU server via ZMQ/gRPC
URDF/Xacro Model Full SO-101 description with STL meshes, separate leader/follower end-effectors

Packages

Package Language Description
so101_bringup Python (launch) Top-level launch files, hardware configs, ros2_control, cameras, recording, TF layout
so101_description Xacro/URDF Robot model, STL meshes, RViz configs, ros2_control hardware interface macros
so101_teleop C++ Leader-to-follower teleoperation node (forward and trajectory controller modes)
so101_moveit_config YAML/Python MoveIt 2 config: SRDF, OMPL planning, joint limits, kinematics, controllers
episode_recorder C++ Minimalistic rosbag (MCAP) recorder with configurable topics and keyboard-driven episode control
rosbag_to_lerobot Python Convert rosbag episodes to LeRobot v3.0 datasets (local or Hub) — runs in Pixi lerobot env
so101_inference Python Policy inference — sync (ACT, SmolVLA on-device) and async (any LeRobot policy via remote GPU server). See so101_inference README
policy_server Python GPU-side inference server — loads any LeRobot policy and serves actions over ZMQ or gRPC. Runs on a remote machine (e.g. vast.ai). See policy_server README
so101_kinematics Python IK control nodes for the SO-101 arm using robokin (Placo) + Viser 3D UI — interactive gizmo servo and planned trajectories. See so101_kinematics README
feetech_ros2_driver C++ Submodule — Feetech STS3215 ros2_control hardware interface
scripts/ Python so101_ros2_to_rerun.py — ROS 2 to Rerun bridge (runs inside Pixi env)

Repository Structure

so101-ros-physical-ai/
├── so101_bringup/
│   ├── launch/              # teleop, recording_session, leader, follower, cameras ...
│   ├── config/
│   │   ├── hardware/        # leader/follower joint configs + LeRobot calibration refs
│   │   ├── ros2_control/    # controller YAML (forward, trajectory, joint_state)
│   │   ├── cameras/         # USB cam + RealSense configs
│   │   └── recording/       # episode recorder params
│   └── rviz/                # leader, follower, teleop RViz configs
├── so101_description/
│   ├── urdf/                # Xacro: arm, end-effectors (leader/follower), ros2_control
│   ├── meshes/              # STL meshes for all links
│   └── launch/
├── so101_teleop/
│   ├── src/                 # teleop.cpp, teleop_split.cpp
│   ├── config/              # teleop.yaml, teleop_split.yaml
│   └── launch/
├── so101_moveit_config/
│   └── config/              # SRDF, OMPL, joint_limits, kinematics, controllers
├── episode_recorder/
│   ├── src/                 # episode_recorder.cpp, teleop_episode_keyboard.cpp
│   ├── config/              # default_config.yaml
│   └── launch/
├── rosbag_to_lerobot/
│   ├── rosbag_to_lerobot/   # Python package (bag_reader, converter, decoders, cli)
│   ├── config/
│   │   └── so101.yaml       # Default conversion config (topics, features, sync)
│   └── test/
├── so101_inference/
│   └── so101_inference/     # LeRobot policy inference node + utils (runs in Pixi lerobot env)
├── so101_kinematics/
│   └── so101_kinematics/    # IK control nodes (Placo + Viser), motion planner, trajectory executor
├── feetech_ros2_driver/     # (submodule) Feetech ros2_control plugin
├── scripts/
│   └── so101_ros2_to_rerun.py
├── docs/
│   ├── hardware.md          # Full hardware setup guide (udev, calibration, cameras)
│   └── assets/
│       └── 99-so101.rules.example  # Example udev rules template
├── pixi.toml                # Pixi envs: default (Rerun bridge) + lerobot (dataset conversion + inference)
└── LICENSE

Requirements

  • Ubuntu 24.04 + ROS 2 Jazzy
  • Two SO-101 arms (leader + follower) with Feetech STS3215 servos, connected via USB
  • rosdep, colcon
  • (Optional) USB cameras / Intel RealSense for vision
  • (Optional) Pixi — required for Rerun visualization, dataset conversion, and policy inference

Hardware Setup & Calibration

Warning Before running on real hardware you must:

  1. Complete LeRobot motor setup + calibration for both arms so the required persistent values are written to the motors.
  2. Set up udev rules so your devices appear as /dev/so101_leader, /dev/so101_follower, /dev/cam_wrist, /dev/cam_overhead.

→ Full hardware setup guide (docs/hardware.md)

Follow the LeRobot SO-101 guide to assemble and configure the arms, then complete these steps before launching ROS:

Step Action Notes
1. Motor setup Run the LeRobot "setup motors" routine (writes servo IDs and baudrate to EEPROM) One-time per arm
2. Calibrate Run LeRobot calibration for both arms (calibrate command for follower and leader) Required per robot; stores calibration-related values
3. Udev rules Create stable device symlinks using the example template See docs/hardware.md
4. Optional ROS overrides Provide joint_config_file only if you want explicit per-robot overrides or extra tuning See precedence notes in docs/hardware.md
5. Launch ROS ros2 launch so101_bringup teleop.launch.py Only after steps 1-4

Config files the driver reads at launch:

so101_bringup/config/hardware/
├── leader_joints.yaml          # optional joint override example
├── follower_joints.yaml        # optional joint override example
├── lerobot_leader_arm.json     # reference: LeRobot calibration output example
└── lerobot_follower_arm.json   # reference: LeRobot calibration output example

The YAML files use a joints: top-level key with per-joint parameters such as id, homing_offset, range_min, range_max, return_delay_time, and acceleration (the follower also supports p_coefficient, i_coefficient, d_coefficient, and torque/protection values for the gripper). These files are optional override examples; the included lerobot_*.json files show raw LeRobot calibration output for reference.


Installation

# Clone (includes submodules)
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone --recurse-submodules https://github.com/legalaspro/so101-ros-physical-ai.git

# Install dependencies and build
cd ~/ros2_ws
sudo apt update
rosdep update
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
source install/setup.bash

Usage

Teleop (Leader to Follower)

source ~/ros2_ws/install/setup.bash
ros2 launch so101_bringup teleop.launch.py

Common overrides:

# Use trajectory controller instead of forward controller
ros2 launch so101_bringup teleop.launch.py arm_controller:=trajectory_controller

# Disable cameras
ros2 launch so101_bringup teleop.launch.py use_cameras:=false use_camera_tf:=false

# Disable RViz
ros2 launch so101_bringup teleop.launch.py use_teleop_rviz:=false

Episode Recording

Record teleoperation episodes for imitation learning. In one terminal, launch the recording session:

ros2 launch so101_bringup recording_session.launch.py experiment_name:=pick_and_place task:="Pick up the cube and place it in the container." use_rerun:=true

In a second terminal, run the interactive keyboard controller:

ros2 run episode_recorder teleop_episode_keyboard

Keys: r — start recording, s — save & stop, d / Backspace — discard episode, q — quit, h — help. Episodes are saved to ~/.ros/so101_episodes/ by default.

After recording, you can review your episodes with the built-in episode viewer powered by Gradio and gradio-rerun, which makes it easy to browse, select, and visualize episodes in the browser:

# pixi run python scripts/so101_episode_viewer_ros2.py --episodes_root ~/.ros/so101_episodes/pick_and_place
pixi run python scripts/so101_episode_viewer_mcap.py --episodes_root ~/.ros/so101_episodes/pick_and_place

Note: A ROS 2 variant (so101_episode_viewer_ros2.py) also exists — it replays bags through ROS 2 to correctly visualize Float64MultiArray action messages that the MCAP reader doesn't natively decode. In a future Rerun release, MCAP will be fully supported and the ROS 2 variant will no longer be needed.

LeRobot Dataset Conversion

The repo ships a second Pixi environment (lerobot) that bundles LeRobot, ffmpeg, and all dependencies needed to convert recorded rosbag episodes into LeRobot v3.0 datasets. See the full rosbag_to_lerobot README for details.

Local conversion (no Hugging Face account needed):

pixi run -e lerobot convert -- \
  --input-dir  ~/.ros/so101_episodes/pick_and_place \
  --config     ~/ros2_ws/src/so101-ros-physical-ai/rosbag_to_lerobot/config/so101.yaml \
  --repo-id    local/so101_test

Push to Hugging Face Hub:

# Authenticate (once)
pixi run -e lerobot -- hf auth login
# or: export HF_TOKEN="hf_..."

# Verify
pixi run -e lerobot -- hf auth whoami

# Convert & push
pixi run -e lerobot convert -- \
  --input-dir  ~/.ros/so101_episodes/pick_and_place \
  --config     ~/ros2_ws/src/so101-ros-physical-ai/rosbag_to_lerobot/config/so101.yaml \
  --repo-id    <hf-username>/so101-pick-and-place \
  --push-hub

Visualize the converted dataset:

# Local — enter the lerobot shell and use the built-in visualizer
pixi shell -e lerobot
lerobot-dataset-viz --repo-id local/so101_test --episode-index 0

# Online — after pushing to the Hub, open:
# https://huggingface.co/spaces/lerobot/visualize_dataset

Training (LeRobot)

Once you have a LeRobot dataset (local or on the Hub), train a policy using the LeRobot training CLI:

pixi shell -e lerobot

lerobot-train \
  --dataset.repo_id=<hf-username>/so101-pick-and-place \
  --policy.type=act \
  --output_dir=outputs/train/act_so101_pick_place \
  --job_name=act_so101_pick_place \
  --policy.device=cuda

Optional flags: --wandb.enable=true, --policy.repo_id=<hf-username>/<policy-name> (auto-push checkpoint to Hub). See the LeRobot training docs for the full list of options.

Policy Inference (LeRobot)

Deploy trained LeRobot policies on the real SO-101 follower arm. Two inference modes are available — synchronous (ACT, SmolVLA on-device) and asynchronous (any LeRobot policy — ACT, SmolVLA, π₀, and others — offloaded to a remote GPU server via ZMQ/gRPC). See the full so101_inference README for all parameters and details.

Terminal 1 — bring up the follower arm + cameras (+ optional Rerun):

source ~/ros2_ws/install/setup.bash
ros2 launch so101_bringup inference.launch.py

Terminal 2 — run the policy (Pixi lerobot env):

cd ~/ros2_ws/src/so101-ros-physical-ai

# Synchronous — ACT policy on-device
pixi run -e lerobot infer -- --ros-args \
    -p repo_id:="legalaspro/act_so101_pnp_crosslane_showcase_60_50hz_v0"

# Synchronous — SmolVLA on-device
pixi run -e lerobot infer -- --ros-args \
    -p repo_id:="legalaspro/smolvla_so101_pnp_crosslane_showcase_60_50hz_v0" \
    -p policy_type:=smolvla \
    -p camera_top_name:=camera1 -p camera_wrist_name:=camera2

# Asynchronous — SmolVLA offloaded to a remote GPU server
pixi run -e lerobot async_infer -- --ros-args \
    -p repo_id:="legalaspro/smolvla_so101_pnp_crosslane_showcase_60_50hz_v0" \
    -p policy_type:=smolvla \
    -p server_address:=192.168.1.100:8090 \
    -p fps:=50.0 -p actions_per_chunk:=50 -p chunk_size_threshold:=0.6 \
    -p camera_top_name:=camera1 -p camera_wrist_name:=camera2

Common overrides:

# Disable Rerun in the launch file
ros2 launch so101_bringup inference.launch.py use_rerun:=false

Rerun (Live Visualization)

The repo ships a Pixi environment with bridge and viewer tasks. Rerun can be added to both teleop and recording sessions:

# Set once
export SO101_RERUN_ENV_DIR=~/ros2_ws/src/so101-ros-physical-ai

# Teleop with Rerun instead of RViz
ros2 launch so101_bringup teleop.launch.py use_rerun:=true use_teleop_rviz:=false

# Recording session with Rerun
ros2 launch so101_bringup recording_session.launch.py experiment_name:=pick_and_place use_rerun:=true

Or run the bridge standalone:

cd ~/ros2_ws/src/so101-ros-physical-ai
pixi run viewer   # in one terminal
pixi run bridge   # in another (after sourcing ROS)

MoveIt 2 (Follower)

MoveIt 2 is configured with dedicated ros2_control controllers for the follower arm: a FollowJointTrajectory controller for the 5-DOF arm and a ParallelGripperCommand controller for the gripper, enabling OMPL-based motion planning with independent gripper control.

ros2 launch so101_bringup follower_moveit_demo.launch.py

Configuration

Launch Arguments (teleop.launch.py)

Argument Default Description
hardware_type real real or mock (mujoco planned, not yet supported)
arm_controller forward_controller forward_controller or trajectory_controller
use_cameras true Enable USB / RealSense cameras
use_camera_tf true Publish camera TF frames
use_teleop_rviz true Launch RViz with teleop config
use_rerun false Launch Rerun bridge
leader_usb_port /dev/so101_leader Leader arm USB device
follower_usb_port /dev/so101_follower Follower arm USB device

Launch Arguments (inference.launch.py)

Argument Default Description
hardware_type real real or mock
arm_controller forward_controller forward_controller or trajectory_controller
follower_usb_port /dev/so101_follower Follower arm USB device
use_rerun true Launch Rerun bridge alongside hardware
rerun_env_dir $SO101_RERUN_ENV_DIR Path to repo root (for Pixi Rerun env)

Hardware Configs

  • so101_bringup/config/hardware/ — joint names, IDs, limits, calibration
  • so101_bringup/config/ros2_control/ — controller parameters (forward, trajectory, joint_state_broadcaster)
  • so101_bringup/config/cameras/ — camera topics, resolution, frame rates

Author

Dmitri Manajev

License

This project is licensed under the Apache License 2.0 — see LICENSE for details.

About

ROS 2 stack for SO-101 leader/follower: Feetech driver, bringup, teleop, MoveIt2, episode recording, Rerun, policy inference.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages