Skip to main content

Connect to the Unitree Go2 with WebRTC

Project description

Full Unitree Go2 WebRTC Driver

This repository contains a Python implementation of the WebRTC driver to connect to the Unitree Go2 Robot.

  • High level control of the dog through WebRTC (like the Unitree Go app)
  • No jailbreak or firmware manipulation required.
  • Compatible with Go2 AIR/PRO/EDU models.

Description of the image

Installation

  1. Clone this repository.
git clone --recurse-submodules https://github.com/legion1581/go2_webrtc_connect.git
cd go2_webrtc_connect
  1. We use uv to manage python dependencies. Make sure it's installed.
# On macOS and Linux.
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Turn on the Go2. Get the IP of your Go2 using the Unitree Go2 app. Then, close the app and disconnect from your dog. Change the scripts to put your Go2 IP address.

Then, run scripts using uv.

uv run examples/data_channel/lowstate/lowstate.py

Supported Firmware Versions

The currently supported Go2 firmware packages are:

  • 1.1.1 - 1.1.4 (latest available)
  • 1.0.19 - 1.0.25

Use the Unitree Go2 app to check your firmware version.

Audio Support

There is an audio (sendrecv) channel in WebRTC that you can connect to.

This is supported only on Go2 Pro and Edu. Check out the examples in the /examples/audio folder.

  1. Install portaudio19-dev.
# On Linux
sudo apt update && sudo apt install portaudio19-dev
# On MacOS
brew update && brew install portaudio19-dev
  1. Use the audio optional dependencies
uv run --extra audio  examples/audio/mp3_player/play_mp3.py

Video Support

There is video (recvonly) channel in WebRTC. Use the video optional dependencies for this.

uv run --extra audio  examples/audio/mp3_player/play_mp3.py

Lidar support

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

Connection Methods

The driver supports three types of connection methods:

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

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

    Go2WebRTCConnection(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:

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

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

Multicast scanner

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

Usage

Example programs are located in the /examples 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 and MrRobotow for providing a plot LiDAR example.

Support

If you like this project, please consider buying the author 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

go2_webrtc_connect-0.1.0.tar.gz (42.5 kB view details)

Uploaded Source

Built Distribution

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

go2_webrtc_connect-0.1.0-py3-none-any.whl (57.9 kB view details)

Uploaded Python 3

File details

Details for the file go2_webrtc_connect-0.1.0.tar.gz.

File metadata

  • Download URL: go2_webrtc_connect-0.1.0.tar.gz
  • Upload date:
  • Size: 42.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.6

File hashes

Hashes for go2_webrtc_connect-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e0e6458f1f6ec04c94f29e1049821c325ffdfce96e23df32b388a617ac23ad6f
MD5 1d85db8d99347178af03141611bb75f8
BLAKE2b-256 80779e675d4303d19bf50f7c6c8e40a9fbd7c5bc3bd6eff8589069ecda16dda1

See more details on using hashes here.

File details

Details for the file go2_webrtc_connect-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for go2_webrtc_connect-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 221afecf71b0aca5f9619b767b05ed6431602c2aa2c5e5ec20896a79412c8de3
MD5 c8b652eebdda10cda6c5d26ca4c34991
BLAKE2b-256 56468a6c4cf81e921e6e526f15abe2c8a6733be787593d2feff99cef531ea78c

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