Skip to content

MWS-Physical-AI/API-robot-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Unitree G1 Master API

FastAPI server for controlling the Unitree G1 humanoid robot. Provides a web interface and REST endpoints for movement, gestures, and live camera feeds.

Quick Start

Start the local API:

uvicorn api:app --host 0.0.0.0 --port 8000

Make it publicly accessible with ngrok:

ngrok http 8000

Use the ngrok URL to access the control panel and API from anywhere.


Requirements

  • Python 3.x
  • Unitree SDK2 (unitree_sdk2py)
  • FastAPI, uvicorn, opencv-python, numpy, pydantic
pip install fastapi uvicorn opencv-python numpy pydantic

API Endpoints

Method Endpoint Description
GET / Web control panel (index.html)
GET /actions List available standard actions
POST /action/{action_id} Trigger a standard action (3–11)
POST /move_timed Execute timed movement
GET /video_feed/{camera_id} MJPEG stream from camera 0 or 1

Standard Actions

ID Action
3 move forward
4 move lateral
5 move rotate
9 wave hand1
10 wave hand2
11 shake hand

Timed Move (POST /move_timed)

{
  "direction": "forward|backward|left|right|turn_left|turn_right|stop",
  "duration": 1.5,
  "speed": 0.3
}

Project Structure

File Description
api.py FastAPI app, robot control, video streams
index.html Web control panel UI
mock_api.py Mock API for testing without robot

About

In this repository is the code for controlling the G1 robot via the API, receiving the first and third view videos.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors