The go2-webrtc
project provides a WebRTC API for Unitree GO2 Robots, enabling real-time communication and control over these robots through a web interface. This project simplifies the process of connecting to and controlling Unitree GO2 Robots by leveraging the WebRTC protocol for efficient, low-latency communication.
Go2's WebRTC API supports all models, including Go2 Air, Pro, and Edu versions.
To get started with go2-webrtc
, clone this repository and serve the index.html
file from a local web server to a modern web browser. Ensure that your Unitree GO2 Robot is powered on and connected to the same network as your computer.
git clone https://github.com/tfoldi/go2-webrtc
cd go2-webrtc/javascript
python3 -m http.server
The javascript folder contains a sample frontend application that demonstrates how to use the JS WebRTC API to connect to and control the Unitree GO2 Robots. Explore the javascript folder for more details and examples.
For backend or console applications, the python folder provides a Python API that interfaces with the Unitree GO2 Robots. This API is ideal for developers looking to integrate robot control into their Python applications or scripts. Check out the python folder for documentation and examples.
STA-L
) to the robotConnecting to your device without a security token is possible and might allow a connection to be established. However, this method limits you to a single active connection at any time. To simultaneously use multiple clients, such as a WebRTC-based application and a phone app, a valid security token is necessary. This ensures secure, multi-client access to your device.
One way is to sniff the traffic between the dog and your phone. Assuming that you have Linux or Mac:
tinyproxy
or any other HTTP proxy on your computerngrep
on your box sniffing port 8081 like ngrep port 8081
.The token looks like this in the request payload:
{
"token": "eyJ0eXAiOizI1NiJtlbiI[..]CI6MTcwODAxMzUwOX0.hiWOd9tNCIPzOOLNA",
"sdp": "v=0\r\no=- ",
"id": "STA_localNetwork",
"type": "offer"
}
Another option is to obtain token via the /login/email
endpoint.
curl -vX POST https://global-robot-api.unitree.com/login/email -d "email=<EMAIL>&password=<MD5 hash of your password>"
This project is structured around several key JavaScript files for the frontend and a Python package for backend or console applications. To contribute or modify the project, refer to these resources for implementing additional features or improving the existing codebase. PRs are welcome.
This project is licensed under the BSD 2-clause License - see the LICENSE file for details.