# unitreerobotics/unitree_lerobot architecture

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

- Interactive diagram: https://gitdiagram.com/unitreerobotics/unitree_lerobot
- Repository: https://github.com/unitreerobotics/unitree_lerobot

## Overview

unitree_lerobot supports Unitree data conversion and LeRobot training validation, plus policy evaluation on real robots and in simulation. Users convert recorded JSON episodes to LeRobot or HDF5, optionally clean episodes in the data editor, then evaluate a policy by supplying observations to a robot interface and applying its actions. The graph includes the documented replay and simulation branches and the sampled control, camera, and data-processing layers. Some subsystem implementations were not excerpted, so only documented or indexed relationships are shown; dashed links mark optional paths.

Main entry points: [`unitree_lerobot/eval_robot/make_robot.py`](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/make_robot.py) (Robot interface setup), [`unitree_lerobot/eval_robot/eval_g1_sim.py`](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/eval_g1_sim.py) (Simulation evaluation), [`unitree_lerobot/eval_robot/eval_g1.py`](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/eval_g1.py) (G1 policy evaluation), [`unitree_lerobot/eval_robot/utils/utils.py`](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/utils/utils.py) (Policy inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_json_data["Unitree JSON data"]
  node_folder_tools["Folder sorting"]
  node_json_lerobot["JSON to LeRobot"]
  node_json_h5["JSON to HDF5"]
  node_lerobot_h5["LeRobot to HDF5"]
  node_robot_config["Robot data configs<br/>[constants.py]"]
  node_editor["Episode editor<br/>[data_editor_EN.py]"]
end

subgraph group_evaluation["Policy evaluation"]
  node_lerobot["LeRobot training"]
  node_g1_eval["G1 policy evaluation<br/>[eval_g1.py]"]
  node_dataset_eval["Dataset evaluation<br/>[eval_g1_dataset.py]"]
  node_sim_eval["Simulation evaluation<br/>[eval_g1_sim.py]"]
  node_uniarm_eval["UniArm evaluation<br/>[eval_UniArmL1.py]"]
  node_replay["Robot replay<br/>[replay_robot.py]"]
  node_policy_runtime["Policy inference<br/>[utils.py]"]
end

subgraph group_control["Robot control"]
  node_robot_factory["Robot interface setup<br/>[make_robot.py]"]
  node_arm_control["Arm controllers<br/>[robot_arm.py]"]
  node_arm_ik["Arm inverse kinematics<br/>[robot_arm_ik.py]"]
  node_mobile["Mobile base control<br/>[mobile_control.py]"]
  node_hand_control["Dexterous hand control"]
  node_inspire_hand["Inspire hand control"]
  node_brainco_hand["BrainCo hand control"]
  node_uniarm["UniArm driver<br/>[uniarm_l1.py]"]
  node_uniarm_kinematics["UniArm kinematics<br/>[kinematics.py]"]
  node_uniarm_bus["UniArm motor bus<br/>[uniarm_l1_bus.py]"]
end

subgraph group_support["Runtime support"]
  node_camera_client["Camera image client<br/>[image_client.py]"]
  node_image_server["Image server<br/>[image_server.py]"]
  node_episode_writer["Episode writer<br/>[episode_writer.py]"]
  node_sim_state["Simulation state topics<br/>[sim_state_topic.py]"]
  node_sim_saving["Simulation data saving"]
  node_visualizer["Rerun visualization"]
end

node_user(("Robot developer"))

node_user -->|"records"| node_json_data
node_user -->|"sorts episodes"| node_folder_tools
node_folder_tools -->|"renames folders"| node_json_data
node_user -->|"converts data"| node_json_lerobot
node_json_lerobot -->|"uses mappings"| node_robot_config
node_json_h5 -->|"uses mappings"| node_robot_config
node_user -.->|"converts data"| node_json_h5
node_user -.->|"converts dataset"| node_lerobot_h5
node_user -->|"edits episodes"| node_editor
node_editor -->|"trims or deletes"| node_json_data
node_user -->|"trains policy"| node_lerobot
node_user -->|"runs policy"| node_g1_eval
node_g1_eval -->|"sets up robot"| node_robot_factory
node_g1_eval -->|"gets actions"| node_policy_runtime
node_dataset_eval -->|"sets up robot"| node_robot_factory
node_dataset_eval -->|"gets actions"| node_policy_runtime
node_sim_eval -->|"sets up robot"| node_robot_factory
node_sim_eval -->|"gets actions"| node_policy_runtime
node_sim_eval -->|"saves simulation"| node_sim_saving
node_uniarm_eval -->|"controls arm"| node_uniarm
node_uniarm_eval -.->|"gets actions"| node_policy_runtime
node_uniarm_eval -->|"reads images"| node_camera_client
node_user -->|"replays dataset"| node_replay
node_replay -->|"sets up robot"| node_robot_factory
node_robot_factory -->|"configures"| node_arm_control
node_robot_factory -->|"configures"| node_arm_ik
node_robot_factory -->|"configures"| node_hand_control
node_robot_factory -->|"configures"| node_inspire_hand
node_robot_factory -->|"configures"| node_brainco_hand
node_robot_factory -->|"optionally configures"| node_mobile
node_robot_factory -->|"configures"| node_camera_client
node_robot_factory -->|"optionally configures"| node_episode_writer
node_robot_factory -->|"optionally configures"| node_sim_state
node_uniarm -->|"uses bus"| node_uniarm_bus
node_uniarm -->|"uses kinematics"| node_uniarm_kinematics
node_image_server -->|"serves images"| node_camera_client
node_sim_eval -->|"visualizes run"| node_visualizer
node_g1_eval -->|"visualizes run"| node_visualizer
node_dataset_eval -->|"visualizes dataset"| node_visualizer

click node_folder_tools "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/utils/sort_and_rename_folders.py"
click node_json_lerobot "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/utils/convert_unitree_json_to_lerobot.py"
click node_json_h5 "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/utils/convert_unitree_json_to_h5.py"
click node_lerobot_h5 "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/utils/convert_lerobot_to_h5.py"
click node_robot_config "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/utils/constants.py"
click node_editor "https://github.com/unitreerobotics/unitree_lerobot/blob/main/data_editor/data_editor_EN.py"
click node_lerobot "https://github.com/unitreerobotics/unitree_lerobot/tree/main/unitree_lerobot/lerobot"
click node_g1_eval "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/eval_g1.py"
click node_dataset_eval "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/eval_g1_dataset.py"
click node_sim_eval "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/eval_g1_sim.py"
click node_uniarm_eval "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/eval_UniArmL1.py"
click node_replay "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/replay_robot.py"
click node_policy_runtime "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/utils/utils.py"
click node_robot_factory "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/make_robot.py"
click node_arm_control "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/robot_arm.py"
click node_arm_ik "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/robot_arm_ik.py"
click node_mobile "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/mobile_control.py"
click node_hand_control "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/robot_hand_unitree.py"
click node_inspire_hand "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/robot_hand_inspire.py"
click node_brainco_hand "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/robot_hand_brainco.py"
click node_uniarm "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/uniarml1/uniarm_l1.py"
click node_uniarm_kinematics "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/uniarml1/kinematics.py"
click node_uniarm_bus "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/uniarml1/uniarm_l1_bus.py"
click node_camera_client "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/image_server/image_client.py"
click node_image_server "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/image_server/image_server.py"
click node_episode_writer "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/utils/episode_writer.py"
click node_sim_state "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/utils/sim_state_topic.py"
click node_sim_saving "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/utils/sim_savedata_utils.py"
click node_visualizer "https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/utils/rerun_visualizer.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_json_data,node_folder_tools,node_json_lerobot,node_json_h5,node_lerobot_h5,node_robot_config,node_editor toneBlue
class node_lerobot,node_g1_eval,node_dataset_eval,node_sim_eval,node_uniarm_eval,node_replay,node_policy_runtime toneAmber
class node_robot_factory,node_arm_control,node_arm_ik,node_mobile,node_hand_control,node_inspire_hand,node_brainco_hand,node_uniarm,node_uniarm_kinematics,node_uniarm_bus toneMint
class node_camera_client,node_image_server,node_episode_writer,node_sim_state,node_sim_saving,node_visualizer toneRose
class node_user toneIndigo
```

## Components

### Data preparation

- **Unitree JSON data**
- [Folder sorting](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/utils/sort_and_rename_folders.py): `unitree_lerobot/utils/sort_and_rename_folders.py`
- [JSON to LeRobot](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/utils/convert_unitree_json_to_lerobot.py): `unitree_lerobot/utils/convert_unitree_json_to_lerobot.py`
- [JSON to HDF5](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/utils/convert_unitree_json_to_h5.py): `unitree_lerobot/utils/convert_unitree_json_to_h5.py`
- [LeRobot to HDF5](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/utils/convert_lerobot_to_h5.py): `unitree_lerobot/utils/convert_lerobot_to_h5.py`
- [Robot data configs](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/utils/constants.py): `unitree_lerobot/utils/constants.py`
- [Episode editor](https://github.com/unitreerobotics/unitree_lerobot/blob/main/data_editor/data_editor_EN.py): `data_editor/data_editor_EN.py`

### Policy evaluation

- [LeRobot training](https://github.com/unitreerobotics/unitree_lerobot/tree/main/unitree_lerobot/lerobot): `unitree_lerobot/lerobot`
- [G1 policy evaluation](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/eval_g1.py): `unitree_lerobot/eval_robot/eval_g1.py`
- [Dataset evaluation](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/eval_g1_dataset.py): `unitree_lerobot/eval_robot/eval_g1_dataset.py`
- [Simulation evaluation](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/eval_g1_sim.py): `unitree_lerobot/eval_robot/eval_g1_sim.py`
- [UniArm evaluation](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/eval_UniArmL1.py): `unitree_lerobot/eval_robot/eval_UniArmL1.py`
- [Robot replay](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/replay_robot.py): `unitree_lerobot/eval_robot/replay_robot.py`
- [Policy inference](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/utils/utils.py): `unitree_lerobot/eval_robot/utils/utils.py`

### Robot control

- [Robot interface setup](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/make_robot.py): `unitree_lerobot/eval_robot/make_robot.py`
- [Arm controllers](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/robot_arm.py): `unitree_lerobot/eval_robot/robot_control/robot_arm.py`
- [Arm inverse kinematics](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/robot_arm_ik.py): `unitree_lerobot/eval_robot/robot_control/robot_arm_ik.py`
- [Mobile base control](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/mobile_control.py): `unitree_lerobot/eval_robot/robot_control/mobile_control.py`
- [Dexterous hand control](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/robot_hand_unitree.py): `unitree_lerobot/eval_robot/robot_control/robot_hand_unitree.py`
- [Inspire hand control](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/robot_hand_inspire.py): `unitree_lerobot/eval_robot/robot_control/robot_hand_inspire.py`
- [BrainCo hand control](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/robot_hand_brainco.py): `unitree_lerobot/eval_robot/robot_control/robot_hand_brainco.py`
- [UniArm driver](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/uniarml1/uniarm_l1.py): `unitree_lerobot/eval_robot/robot_control/uniarml1/uniarm_l1.py`
- [UniArm kinematics](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/uniarml1/kinematics.py): `unitree_lerobot/eval_robot/robot_control/uniarml1/kinematics.py`
- [UniArm motor bus](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/robot_control/uniarml1/uniarm_l1_bus.py): `unitree_lerobot/eval_robot/robot_control/uniarml1/uniarm_l1_bus.py`

### Runtime support

- [Camera image client](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/image_server/image_client.py): `unitree_lerobot/eval_robot/image_server/image_client.py`
- [Image server](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/image_server/image_server.py): `unitree_lerobot/eval_robot/image_server/image_server.py`
- [Episode writer](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/utils/episode_writer.py): `unitree_lerobot/eval_robot/utils/episode_writer.py`
- [Simulation state topics](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/utils/sim_state_topic.py): `unitree_lerobot/eval_robot/utils/sim_state_topic.py`
- [Simulation data saving](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/utils/sim_savedata_utils.py): `unitree_lerobot/eval_robot/utils/sim_savedata_utils.py`
- [Rerun visualization](https://github.com/unitreerobotics/unitree_lerobot/blob/main/unitree_lerobot/eval_robot/utils/rerun_visualizer.py): `unitree_lerobot/eval_robot/utils/rerun_visualizer.py`

### Other components

- **Robot developer**

## Connections

- Robot developer → Unitree JSON data: records (evidence: `README.md`)
- Robot developer → Folder sorting: sorts episodes (evidence: `README.md`)
- Folder sorting → Unitree JSON data: renames folders (evidence: `README.md`)
- Robot developer → JSON to LeRobot: converts data (evidence: `README.md`)
- JSON to LeRobot → Robot data configs: uses mappings (evidence: `unitree_lerobot/utils/convert_unitree_json_to_lerobot.py`)
- JSON to HDF5 → Robot data configs: uses mappings (evidence: `unitree_lerobot/utils/convert_unitree_json_to_h5.py`)
- Robot developer → JSON to HDF5: converts data
- Robot developer → LeRobot to HDF5: converts dataset
- Robot developer → Episode editor: edits episodes (evidence: `README.md`)
- Episode editor → Unitree JSON data: trims or deletes (evidence: `README.md`)
- Robot developer → LeRobot training: trains policy (evidence: `README.md`)
- Robot developer → G1 policy evaluation: runs policy (evidence: `README.md`)
- G1 policy evaluation → Robot interface setup: sets up robot (evidence: `unitree_lerobot/eval_robot/eval_g1.py`)
- G1 policy evaluation → Policy inference: gets actions (evidence: `unitree_lerobot/eval_robot/eval_g1.py`)
- Dataset evaluation → Robot interface setup: sets up robot (evidence: `unitree_lerobot/eval_robot/eval_g1_dataset.py`)
- Dataset evaluation → Policy inference: gets actions (evidence: `unitree_lerobot/eval_robot/eval_g1_dataset.py`)
- Simulation evaluation → Robot interface setup: sets up robot (evidence: `unitree_lerobot/eval_robot/eval_g1_sim.py`)
- Simulation evaluation → Policy inference: gets actions (evidence: `unitree_lerobot/eval_robot/eval_g1_sim.py`)
- Simulation evaluation → Simulation data saving: saves simulation (evidence: `unitree_lerobot/eval_robot/eval_g1_sim.py`)
- UniArm evaluation → UniArm driver: controls arm (evidence: `unitree_lerobot/eval_robot/eval_UniArmL1.py`)
- UniArm evaluation → Policy inference: gets actions (evidence: `unitree_lerobot/eval_robot/eval_UniArmL1.py`)
- UniArm evaluation → Camera image client: reads images (evidence: `unitree_lerobot/eval_robot/eval_UniArmL1.py`)
- Robot developer → Robot replay: replays dataset (evidence: `README.md`)
- Robot replay → Robot interface setup: sets up robot (evidence: `unitree_lerobot/eval_robot/replay_robot.py`)
- Robot interface setup → Arm controllers: configures (evidence: `unitree_lerobot/eval_robot/make_robot.py`)
- Robot interface setup → Arm inverse kinematics: configures (evidence: `unitree_lerobot/eval_robot/make_robot.py`)
- Robot interface setup → Dexterous hand control: configures (evidence: `unitree_lerobot/eval_robot/make_robot.py`)
- Robot interface setup → Inspire hand control: configures (evidence: `unitree_lerobot/eval_robot/make_robot.py`)
- Robot interface setup → BrainCo hand control: configures (evidence: `unitree_lerobot/eval_robot/make_robot.py`)
- Robot interface setup → Mobile base control: optionally configures (evidence: `unitree_lerobot/eval_robot/make_robot.py`)
- Robot interface setup → Camera image client: configures (evidence: `unitree_lerobot/eval_robot/make_robot.py`)
- Robot interface setup → Episode writer: optionally configures (evidence: `unitree_lerobot/eval_robot/make_robot.py`)
- Robot interface setup → Simulation state topics: optionally configures (evidence: `unitree_lerobot/eval_robot/make_robot.py`)
- UniArm driver → UniArm motor bus: uses bus (evidence: `unitree_lerobot/eval_robot/robot_control/uniarml1/uniarm_l1.py`)
- UniArm driver → UniArm kinematics: uses kinematics (evidence: `unitree_lerobot/eval_robot/robot_control/uniarml1/uniarm_l1.py`)
- Image server → Camera image client: serves images (evidence: `unitree_lerobot/eval_robot/image_server/image_server.py`)
- Simulation evaluation → Rerun visualization: visualizes run (evidence: `unitree_lerobot/eval_robot/eval_g1_sim.py`)
- G1 policy evaluation → Rerun visualization: visualizes run (evidence: `unitree_lerobot/eval_robot/eval_g1.py`)
- Dataset evaluation → Rerun visualization: visualizes dataset (evidence: `unitree_lerobot/eval_robot/eval_g1_dataset.py`)
