# sgyliu8/lerobot architecture

> Architecture diagram of the GitHub repository sgyliu8/lerobot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sgyliu8/lerobot
- Repository: https://github.com/sgyliu8/lerobot

## Overview

PhysicalAI SO101 Lab is a local, upstream-first robot learning workbench. Its principal workflow is supervised Leader-to-Follower demonstration with two cameras, followed by recording review and audit, optional data preparation, local ACT training, checkpoint recovery, and offline output checks before any supervised physical trial. The README documents these capabilities, but most workbench, device, recording, and training implementation belongs to the LeLab/LeRobot dependency and is not present in the supplied tree; those links reflect documented behavior. Sampled project code supports the color-task evidence/split path and ROS 2 read-only replay.

Main entry points: [`so101_lab/training_split.py`](https://github.com/sgyliu8/lerobot/blob/main/so101_lab/training_split.py) (Split binding), [`so101_lab/color_sorting_cli.py`](https://github.com/sgyliu8/lerobot/blob/main/so101_lab/color_sorting_cli.py) (Evidence CLI), [`integrations/ros2/joint_state_replay.py`](https://github.com/sgyliu8/lerobot/blob/main/integrations/ros2/joint_state_replay.py) (ROS state replay), [`so101_lab/color_sorting.py`](https://github.com/sgyliu8/lerobot/blob/main/so101_lab/color_sorting.py) (Labels and splits)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and review"]
  node_workbench["LeLab workbench"]
  node_leader["Leader arm"]
  node_follower["Follower arm"]
  node_cameras["Dual cameras"]
  node_recording[("Episode recording")]
  node_browse["Browse and review"]
  node_audit["Dataset audit<br/>[audit_dataset.py]"]
end

subgraph group_learning["Learning workflow"]
  node_training["ACT training"]
  node_split_binding["Split binding<br/>[training_split.py]"]
  node_checkpoint[("Checkpoints")]
  node_offline_check["Offline output check"]
end

subgraph group_task["Color task evidence"]
  node_color_profile["Color task profile<br/>[color_sorting.py]"]
  node_color_cli["Evidence CLI"]
  node_labels_split[("Labels and splits<br/>[color_sorting.py]")]
end

subgraph group_integration["Optional integrations"]
  node_ros_replay["ROS state replay"]
  node_ros_description["ROS description prep"]
end

node_operator(("Operator"))
node_ros["ROS 2"]
node_local_dataset[("Local dataset")]

node_operator -->|"operates"| node_workbench
node_operator -->|"demonstrates"| node_leader
node_workbench -->|"reads motion"| node_leader
node_workbench -->|"dispatches control"| node_follower
node_workbench -->|"captures video"| node_cameras
node_workbench -->|"saves episodes"| node_recording
node_recording -->|"persists data"| node_local_dataset
node_operator -->|"reviews"| node_browse
node_browse -->|"reads episodes"| node_local_dataset
node_audit -->|"audits read-only"| node_local_dataset
node_operator -->|"configures"| node_training
node_training -.->|"binds color split"| node_split_binding
node_split_binding -->|"scopes episodes"| node_local_dataset
node_training -->|"reads training data"| node_local_dataset
node_training -->|"saves state"| node_checkpoint
node_checkpoint -->|"resumes in new job"| node_training
node_training -->|"produces policy"| node_offline_check
node_operator -->|"runs commands"| node_color_cli
node_color_cli -->|"validates profile"| node_color_profile
node_color_cli -->|"writes labels and splits"| node_labels_split
node_color_profile -->|"defines task contract"| node_labels_split
node_split_binding -->|"reads frozen manifest"| node_labels_split
node_operator -.->|"starts replay"| node_ros_replay
node_ros_replay -.->|"reads trajectory"| node_local_dataset
node_ros_replay -.->|"publishes state"| node_ros
node_ros_description -.->|"prepares description assets"| node_ros

click node_audit "https://github.com/sgyliu8/lerobot/blob/main/tools/audit_dataset.py"
click node_split_binding "https://github.com/sgyliu8/lerobot/blob/main/so101_lab/training_split.py"
click node_color_profile "https://github.com/sgyliu8/lerobot/blob/main/so101_lab/color_sorting.py"
click node_color_cli "https://github.com/sgyliu8/lerobot/blob/main/so101_lab/color_sorting_cli.py"
click node_labels_split "https://github.com/sgyliu8/lerobot/blob/main/so101_lab/color_sorting.py"
click node_ros_replay "https://github.com/sgyliu8/lerobot/blob/main/integrations/ros2/joint_state_replay.py"
click node_ros_description "https://github.com/sgyliu8/lerobot/blob/main/integrations/ros2/prepare_description.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_workbench,node_leader,node_follower,node_cameras,node_recording,node_browse,node_audit toneBlue
class node_training,node_split_binding,node_checkpoint,node_offline_check,node_local_dataset toneAmber
class node_color_profile,node_color_cli,node_labels_split toneMint
class node_ros_replay,node_ros_description toneRose
class node_operator,node_ros toneIndigo
```

## Components

### Capture and review

- **LeLab workbench**
- **Leader arm**
- **Follower arm**
- **Dual cameras**
- **Episode recording**
- **Browse and review**
- [Dataset audit](https://github.com/sgyliu8/lerobot/blob/main/tools/audit_dataset.py): `tools/audit_dataset.py`

### Learning workflow

- **ACT training**
- [Split binding](https://github.com/sgyliu8/lerobot/blob/main/so101_lab/training_split.py): `so101_lab/training_split.py`
- **Checkpoints**
- **Offline output check**

### Color task evidence

- [Color task profile](https://github.com/sgyliu8/lerobot/blob/main/so101_lab/color_sorting.py): `so101_lab/color_sorting.py`
- [Evidence CLI](https://github.com/sgyliu8/lerobot/blob/main/so101_lab/color_sorting_cli.py): `so101_lab/color_sorting_cli.py`
- [Labels and splits](https://github.com/sgyliu8/lerobot/blob/main/so101_lab/color_sorting.py): `so101_lab/color_sorting.py`

### Optional integrations

- [ROS state replay](https://github.com/sgyliu8/lerobot/blob/main/integrations/ros2/joint_state_replay.py): `integrations/ros2/joint_state_replay.py`
- [ROS description prep](https://github.com/sgyliu8/lerobot/blob/main/integrations/ros2/prepare_description.py): `integrations/ros2/prepare_description.py`

### Other components

- **Operator**
- **ROS 2**
- **Local dataset**

## Connections

- Operator → LeLab workbench: operates
- Operator → Leader arm: demonstrates
- LeLab workbench → Leader arm: reads motion
- LeLab workbench → Follower arm: dispatches control
- LeLab workbench → Dual cameras: captures video
- LeLab workbench → Episode recording: saves episodes
- Episode recording → Local dataset: persists data
- Operator → Browse and review: reviews
- Browse and review → Local dataset: reads episodes
- Dataset audit → Local dataset: audits read-only
- Operator → ACT training: configures
- ACT training → Split binding: binds color split
- Split binding → Local dataset: scopes episodes
- ACT training → Local dataset: reads training data
- ACT training → Checkpoints: saves state
- Checkpoints → ACT training: resumes in new job
- ACT training → Offline output check: produces policy
- Operator → Evidence CLI: runs commands
- Evidence CLI → Color task profile: validates profile
- Evidence CLI → Labels and splits: writes labels and splits
- Color task profile → Labels and splits: defines task contract
- Split binding → Labels and splits: reads frozen manifest
- Operator → ROS state replay: starts replay
- ROS state replay → Local dataset: reads trajectory
- ROS state replay → ROS 2: publishes state
- ROS description prep → ROS 2: prepares description assets
