# unitreerobotics/unitree_sdk2_python architecture

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

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

## Overview

unitree_sdk2py is a Python SDK for communicating with and controlling Unitree robots. The principal workflow is an application calling a robot-specific client, which encodes a service request and sends it through the RPC/DDS communication layer to the robot; responses return through that layer. The SDK also documents topic-based publishing/subscription and high-/low-level status and control, alongside sport, locomotion, camera, audio, obstacle-avoidance, and VUI services. The graph preserves these capabilities, but several links to unsampled modules are dashed because their wiring is not shown in the excerpts.

Main entry points: [`unitree_sdk2py/rpc/client.py`](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/client.py) (RPC client), [`unitree_sdk2py/core/channel.py`](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/core/channel.py) (Topic communication), [`unitree_sdk2py/rpc/client_base.py`](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/client_base.py) (Request handling), [`unitree_sdk2py/go2/sport/sport_client.py`](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/go2/sport/sport_client.py) (Sport control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Robot APIs"]
  node_sport["Sport control<br/>[sport_client.py]"]
  node_sport_variants["Other sport clients"]
  node_loco["Humanoid locomotion<br/>[g1_loco_client.py]"]
  node_h2loco["H2 locomotion<br/>[h2_loco_client.py]"]
  node_robot_state["Robot status"]
  node_lowlevel["Low-level control<br/>[_LowCmd_.py]"]
  node_wireless["Controller status"]
  node_obstacles["Obstacle avoidance"]
  node_video["Camera video"]
  node_audio["Audio services"]
  node_vui["Light and volume"]
  node_arm["Arm actions"]
  node_motion_switcher["Motion switching"]
end

subgraph group_rpc["RPC Transport"]
  node_rpc_client["RPC client<br/>[client.py]"]
  node_client_base["Request handling<br/>[client_base.py]"]
  node_client_stub["DDS client stub<br/>[client_stub.py]"]
  node_channel["DDS channels<br/>[channel.py]"]
  node_lease["Lease control<br/>[lease_client.py]"]
  node_server["RPC server<br/>[server.py]"]
end

subgraph group_dds["DDS Messages"]
  node_idl["RPC message types<br/>[_Request_.py]"]
  node_idl_robot["Robot data types"]
end

subgraph group_services["Robot Services"]
  node_topic_sdk["Topic communication<br/>[channel.py]"]
end

node_app(("SDK user"))
node_robot(("Unitree robot"))

node_app -.->|"calls"| node_sport
node_app -.->|"calls"| node_loco
node_sport -->|"calls"| node_rpc_client
node_sport_variants -->|"calls"| node_rpc_client
node_loco -->|"calls"| node_rpc_client
node_h2loco -->|"calls"| node_rpc_client
node_robot_state -->|"uses"| node_rpc_client
node_obstacles -->|"uses"| node_rpc_client
node_video -->|"uses"| node_rpc_client
node_audio -->|"uses"| node_rpc_client
node_vui -->|"uses"| node_rpc_client
node_arm -->|"uses"| node_rpc_client
node_motion_switcher -->|"uses"| node_rpc_client
node_rpc_client -->|"delegates"| node_client_base
node_rpc_client -->|"uses"| node_lease
node_client_base -->|"sends requests"| node_client_stub
node_client_base -->|"builds requests"| node_idl
node_client_stub -->|"uses"| node_channel
node_server -->|"handles messages"| node_idl
node_rpc_client -.->|"RPC requests"| node_robot
node_robot -.->|"RPC responses"| node_rpc_client
node_app -.->|"publishes or subscribes"| node_topic_sdk
node_topic_sdk -.->|"DDS topics"| node_robot
node_lowlevel -.->|"topic control"| node_topic_sdk
node_wireless -.->|"topic status"| node_topic_sdk
node_robot -.->|"robot data"| node_idl_robot

click node_sport "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/go2/sport/sport_client.py"
click node_sport_variants "https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/a2/sport"
click node_loco "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/g1/loco/g1_loco_client.py"
click node_h2loco "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/h2/loco/h2_loco_client.py"
click node_robot_state "https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/go2/robot_state"
click node_lowlevel "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/idl/unitree_go/msg/dds_/_LowCmd_.py"
click node_wireless "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/idl/unitree_go/msg/dds_/_WirelessController_.py"
click node_obstacles "https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/go2/obstacles_avoid"
click node_video "https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/go2/video"
click node_audio "https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/a2/audio"
click node_vui "https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/go2/vui"
click node_arm "https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/g1/arm"
click node_motion_switcher "https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/comm/motion_switcher"
click node_rpc_client "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/client.py"
click node_client_base "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/client_base.py"
click node_client_stub "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/client_stub.py"
click node_channel "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/core/channel.py"
click node_lease "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/lease_client.py"
click node_server "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/server.py"
click node_idl "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/idl/unitree_api/msg/dds_/_Request_.py"
click node_topic_sdk "https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/core/channel.py"
click node_idl_robot "https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/idl/unitree_go"

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_sport,node_sport_variants,node_loco,node_h2loco,node_robot_state,node_lowlevel,node_wireless,node_obstacles,node_video,node_audio,node_vui,node_arm,node_motion_switcher,node_app toneBlue
class node_rpc_client,node_client_base,node_client_stub,node_channel,node_lease,node_server toneAmber
class node_idl,node_idl_robot toneMint
class node_topic_sdk toneRose
class node_robot toneIndigo
```

## Components

### Robot APIs

- [Sport control](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/go2/sport/sport_client.py): `unitree_sdk2py/go2/sport/sport_client.py`
- [Other sport clients](https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/a2/sport): `unitree_sdk2py/a2/sport`
- [Humanoid locomotion](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/g1/loco/g1_loco_client.py): `unitree_sdk2py/g1/loco/g1_loco_client.py`
- [H2 locomotion](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/h2/loco/h2_loco_client.py): `unitree_sdk2py/h2/loco/h2_loco_client.py`
- [Robot status](https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/go2/robot_state): `unitree_sdk2py/go2/robot_state`
- [Low-level control](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/idl/unitree_go/msg/dds_/_LowCmd_.py): `unitree_sdk2py/idl/unitree_go/msg/dds_/_LowCmd_.py`
- [Controller status](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/idl/unitree_go/msg/dds_/_WirelessController_.py): `unitree_sdk2py/idl/unitree_go/msg/dds_/_WirelessController_.py`
- [Obstacle avoidance](https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/go2/obstacles_avoid): `unitree_sdk2py/go2/obstacles_avoid`
- [Camera video](https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/go2/video): `unitree_sdk2py/go2/video`
- [Audio services](https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/a2/audio): `unitree_sdk2py/a2/audio`
- [Light and volume](https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/go2/vui): `unitree_sdk2py/go2/vui`
- [Arm actions](https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/g1/arm): `unitree_sdk2py/g1/arm`
- [Motion switching](https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/comm/motion_switcher): `unitree_sdk2py/comm/motion_switcher`

### RPC Transport

- [RPC client](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/client.py): `unitree_sdk2py/rpc/client.py`
- [Request handling](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/client_base.py): `unitree_sdk2py/rpc/client_base.py`
- [DDS client stub](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/client_stub.py): `unitree_sdk2py/rpc/client_stub.py`
- [DDS channels](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/core/channel.py): `unitree_sdk2py/core/channel.py`
- [Lease control](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/lease_client.py): `unitree_sdk2py/rpc/lease_client.py`
- [RPC server](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/rpc/server.py): `unitree_sdk2py/rpc/server.py`

### DDS Messages

- [RPC message types](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/idl/unitree_api/msg/dds_/_Request_.py): `unitree_sdk2py/idl/unitree_api/msg/dds_/_Request_.py`
- [Robot data types](https://github.com/unitreerobotics/unitree_sdk2_python/tree/master/unitree_sdk2py/idl/unitree_go): `unitree_sdk2py/idl/unitree_go`

### Robot Services

- [Topic communication](https://github.com/unitreerobotics/unitree_sdk2_python/blob/master/unitree_sdk2py/core/channel.py): `unitree_sdk2py/core/channel.py`

### Other components

- **SDK user**
- **Unitree robot**

## Connections

- SDK user → Sport control: calls
- SDK user → Humanoid locomotion: calls
- Sport control → RPC client: calls (evidence: `unitree_sdk2py/go2/sport/sport_client.py`)
- Other sport clients → RPC client: calls (evidence: `unitree_sdk2py/a2/sport/sport_client.py`)
- Humanoid locomotion → RPC client: calls (evidence: `unitree_sdk2py/g1/loco/g1_loco_client.py`)
- H2 locomotion → RPC client: calls (evidence: `unitree_sdk2py/h2/loco/h2_loco_client.py`)
- Robot status → RPC client: uses (evidence: `unitree_sdk2py/go2/robot_state/robot_state_client.py`)
- Obstacle avoidance → RPC client: uses (evidence: `unitree_sdk2py/go2/obstacles_avoid/obstacles_avoid_client.py`)
- Camera video → RPC client: uses (evidence: `unitree_sdk2py/go2/video/video_client.py`)
- Audio services → RPC client: uses (evidence: `unitree_sdk2py/a2/audio/audio_client.py`)
- Light and volume → RPC client: uses (evidence: `unitree_sdk2py/go2/vui/vui_client.py`)
- Arm actions → RPC client: uses (evidence: `unitree_sdk2py/g1/arm/g1_arm_action_client.py`)
- Motion switching → RPC client: uses (evidence: `unitree_sdk2py/comm/motion_switcher/motion_switcher_client.py`)
- RPC client → Request handling: delegates (evidence: `unitree_sdk2py/rpc/client.py`)
- RPC client → Lease control: uses (evidence: `unitree_sdk2py/rpc/client.py`)
- Request handling → DDS client stub: sends requests (evidence: `unitree_sdk2py/rpc/client_base.py`)
- Request handling → RPC message types: builds requests (evidence: `unitree_sdk2py/rpc/client_base.py`)
- DDS client stub → DDS channels: uses (evidence: `unitree_sdk2py/rpc/client_stub.py`)
- RPC server → RPC message types: handles messages (evidence: `unitree_sdk2py/rpc/server.py`)
- RPC client → Unitree robot: RPC requests
- Unitree robot → RPC client: RPC responses
- SDK user → Topic communication: publishes or subscribes
- Topic communication → Unitree robot: DDS topics
- Low-level control → Topic communication: topic control
- Controller status → Topic communication: topic status
- Unitree robot → Robot data types: robot data
