Connect to the Unitree Go2 and G1 with WebRTC
Project description
Unitree WebRTC Connect
Python WebRTC driver for Unitree Go2 and G1 robots. Provides high-level control through the same WebRTC protocol used by the Unitree Go/Unitree Explore mobile apps — no jailbreak or firmware modification required.
Supported Models
| Model | Variants |
|---|---|
| Go2 | AIR, PRO, EDU |
| G1 | AIR, EDU |
Supported Firmware
| Robot | Firmware Versions |
|---|---|
| Go2 | 1.1.1 – 1.1.14 (latest), 1.0.19 – 1.0.25 |
| G1 | 1.4.0 (latest) |
Features
| Feature | Go2 | G1 |
|---|---|---|
| Data channel (pub/sub, RPC) | yes | yes |
| Sport mode control | yes | yes |
| Video stream (receive) | yes | — |
| Audio stream (send/receive) | yes | — |
| LiDAR point cloud decoding | yes | — |
| VUI (LED, brightness, volume) | yes | — |
| AudioHub (audio file management) | yes | — |
| Obstacle avoidance API | yes | — |
| Multicast device discovery | yes | — |
Installation
PyPI (recommended)
sudo apt update
sudo apt install -y python3-pip portaudio19-dev
pip install unitree_webrtc_connect
From source
sudo apt update
sudo apt install -y python3-pip portaudio19-dev
git clone https://github.com/legion1581/unitree_webrtc_connect.git
cd unitree_webrtc_connect
pip install -e .
Quick Start
from unitree_webrtc_connect import UnitreeWebRTCConnection, WebRTCConnectionMethod
conn = UnitreeWebRTCConnection(WebRTCConnectionMethod.LocalSTA, ip="192.168.123.18")
await conn.connect()
Connection Methods
AP Mode
Robot is in Access Point mode, client connects directly to the robot's WiFi.
UnitreeWebRTCConnection(WebRTCConnectionMethod.LocalAP)
STA-L Mode (Local Network)
Robot and client are on the same local network. Requires IP or serial number.
# By IP
UnitreeWebRTCConnection(WebRTCConnectionMethod.LocalSTA, ip="192.168.8.181")
# By serial number (uses multicast discovery, Go2 only)
UnitreeWebRTCConnection(WebRTCConnectionMethod.LocalSTA, serialNumber="B42D2000XXXXXXXX")
STA-T Mode (Remote)
Remote connection through Unitree's TURN server. Control your robot from a different network. Requires Unitree account credentials.
UnitreeWebRTCConnection(
WebRTCConnectionMethod.Remote,
serialNumber="B42D2000XXXXXXXX",
username="email@gmail.com",
password="pass"
)
Examples
Examples are organized by robot model under the /examples directory:
Go2
| Category | Example | Description |
|---|---|---|
| Data Channel | data_channel/sportmode/ |
Sport mode movement commands |
data_channel/sportmodestate/ |
Subscribe to sport mode state | |
data_channel/lowstate/ |
Subscribe to low-level state (IMU, motors) | |
data_channel/multiplestate/ |
Subscribe to multiple state topics | |
data_channel/vui/ |
VUI control (LED, volume, brightness) | |
data_channel/lidar/lidar_stream.py |
LiDAR point cloud subscription | |
data_channel/lidar/plot_lidar_stream.py |
LiDAR 3D visualization (Three.js) | |
| Audio | audio/live_audio/ |
Live audio receive |
audio/save_audio/ |
Save audio to file | |
audio/mp3_player/ |
Play MP3 through robot speaker | |
audio/internet_radio/ |
Stream internet radio | |
| Video | video/camera_stream/ |
Display video stream |
G1
| Category | Example | Description |
|---|---|---|
| Data Channel | data_channel/sport_mode/ |
Sport mode movement commands |
Imports
All public classes and constants are exported from the package root:
from unitree_webrtc_connect import (
UnitreeWebRTCConnection,
WebRTCConnectionMethod,
WebRTCDataChannel,
WebRTCDataChannelPubSub,
DATA_CHANNEL_TYPE,
RTC_TOPIC,
SPORT_CMD,
)
Acknowledgements
A big thank you to TheRoboVerse community! Visit us at TheRoboVerse for more information and support.
Special thanks to the tfoldi WebRTC project and abizovnuralem for adding LiDAR support, MrRobotoW for the LiDAR visualization example, and Nico for the aiortc monkey patch.
Support
If you like this project, please consider buying me a coffee:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unitree_webrtc_connect-2.0.5.tar.gz.
File metadata
- Download URL: unitree_webrtc_connect-2.0.5.tar.gz
- Upload date:
- Size: 35.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e45004e013664227541583f251ef49849f7d68abe41813c8f0de389415be682c
|
|
| MD5 |
5e04ec429aabaee1ab75c257b4f5ca13
|
|
| BLAKE2b-256 |
36b204edca5f7ac7aba3c97ac9bd1b6e82f9968333678ce132ddd40e0ed43e16
|
File details
Details for the file unitree_webrtc_connect-2.0.5-py3-none-any.whl.
File metadata
- Download URL: unitree_webrtc_connect-2.0.5-py3-none-any.whl
- Upload date:
- Size: 40.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0c6ab2606072fc838c077e7bcbce0a1952ddd48387b8c5ca32c5a0ca299247f
|
|
| MD5 |
c273d64804f5ea0e16bb6ed20de87159
|
|
| BLAKE2b-256 |
37e98fa253ed4cd288dbc2c4a75e52d9487466981942162afdc286578b64e69f
|