Skip to main content

Connect to the Unitree Go2 and G1 with WebRTC

Project description

Unitree Go2 and G1 WebRTC Driver

This repository contains a Python implementation of the WebRTC driver to connect to the Unitree Go2 and G1 Robots. WebRTC is used by the Unitree Go/Unitree Explore APP and provides high-level control through it. Therefore, no jailbreak or firmware manipulation is required. It works out of the box for Go2 AIR/PRO/EDU models and G1 AIR/EDU.

Description of the image

Currently Supported Firmware Versions

Go2:

  • 1.1.x series: 1.1.1 – 1.1.11 (latest available)
  • 1.0.x series: 1.0.19 – 1.0.25

G1:

  • 1.4.0 (latest available)

Audio and Video Support (Go2 only)

There are video (recvonly) and audio (sendrecv) channels in WebRTC that you can connect to. Check out the examples in the /example folder.

Lidar support (Go2 only)

There is a lidar decoder built in, so you can handle decoded PoinClouds directly. Check out the examples in the /example folder.

Connection Methods

The driver supports three types of connection methods:

  1. AP Mode: Go2/G1 is in AP mode, and the WebRTC client is connected directly to it:

    UnitreeWebRTCConnection(WebRTCConnectionMethod.LocalAP)
    
  2. STA-L Mode: Go2/G1 and the WebRTC client are on the same local network. An IP or Serial number is required:

    UnitreeWebRTCConnection(WebRTCConnectionMethod.LocalSTA, ip="192.168.8.181")
    

    If the IP is unknown, you can specify only the serial number, and the driver will try to find the IP using the special Multicast discovery feature available on Go2:

    UnitreeWebRTCConnection(WebRTCConnectionMethod.LocalSTA, serialNumber="B42D2000XXXXXXXX")
    
  3. STA-T mode: Remote connection through remote Unitrees TURN server. Could control your Go2/G1 even being on the diffrent network. Requires username and pass from Unitree account

    UnitreeWebRTCConnection(WebRTCConnectionMethod.Remote, serialNumber="B42D2000XXXXXXXX", username="email@gmail.com", password="pass")
    

Multicast scanner (Go2 only)

The driver has a built-in Multicast scanner to find the Unitree Go2 on the local network and connect using only the serial number.

PIP installation (Recommended)

cd ~
sudo apt update
sudo apt install -y python3-pip portaudio19-dev
pip install unitree_webrtc_connect

Manual Installation

cd ~
sudo apt update
sudo apt install -y python3-pip portaudio19-dev
pip install --upgrade setuptools pip
git clone https://github.com/legion1581/unitree_webrtc_connect.git
cd unitree_webrtc_connect
pip install -e .

Usage

Example programs are located in the /example directory.

Thanks

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 providing a plot LiDAR example. Special thanks to Nico for the aiortc monkey patch.

Support

If you like this project, please consider buying me a coffee:

Buy 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

unitree_webrtc_connect-2.0.3.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unitree_webrtc_connect-2.0.3-py3-none-any.whl (39.7 kB view details)

Uploaded Python 3

File details

Details for the file unitree_webrtc_connect-2.0.3.tar.gz.

File metadata

  • Download URL: unitree_webrtc_connect-2.0.3.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","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

Hashes for unitree_webrtc_connect-2.0.3.tar.gz
Algorithm Hash digest
SHA256 b1e11333487bc6bbae19ecd58d896d03bef7ccf70c3b44c529b72c5516e76805
MD5 894220f6b8423c547b740f8f03b00133
BLAKE2b-256 8f490bf005d4d0e6c3fe10768fb5df980e81e14fcaa5e40dcf6c6468f0a4785b

See more details on using hashes here.

File details

Details for the file unitree_webrtc_connect-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: unitree_webrtc_connect-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 39.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","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

Hashes for unitree_webrtc_connect-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e1a43cd7daecce97fc7e4a1c6b6858759dacd8147f5402486ee6808da43a9256
MD5 92ba50b4d61da9b73c9b04b729414c2a
BLAKE2b-256 90a47bf3a2eed033f249f86e5b1546753d488be7db1a4865535d425b5866d056

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page