You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

2.9 KiB

Unitree SDK2 Python

Source: https://github.com/unitreerobotics/unitree_sdk2_python Fetched: 2026-02-13 Type: GitHub Repository README


Unitree SDK2 Python Interface

Project Overview

This repository provides a Python interface for the Unitree SDK2, enabling developers to control and monitor Unitree quadruped robots through a Python API. The project maintains consistency with the C++ SDK2 implementation while offering Pythonic patterns for robot interaction.

Installation

Dependencies

The project requires:

  • Python >= 3.8
  • cyclonedds == 0.10.2
  • numpy
  • opencv-python

Installation from Source

Users should clone the repository and install via pip:

cd ~
sudo apt install python3-pip
git clone https://github.com/unitreerobotics/unitree_sdk2_python.git
cd unitree_sdk2_python
pip3 install -e .

Troubleshooting

Common installation errors involve missing CycloneDDS dependencies. Users must compile and install CycloneDDS separately before installing the SDK:

cd ~
git clone https://github.com/eclipse-cyclonedds/cyclonedds -b releases/0.10.x
cd cyclonedds && mkdir build install && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install
cmake --build . --target install

Then set environment variables before installation:

export CYCLONEDDS_HOME="~/cyclonedds/install"
pip3 install -e .

Core Features

DDS Communication

The SDK uses Data Distribution Service (DDS) for publish-subscribe messaging. Example programs demonstrate basic message exchange through publisher and subscriber patterns with customizable data structures.

Robot Control Levels

High-Level Interface: Provides sport-mode control including stand-up/sit-down, velocity-based movement, attitude control, trajectory following, and special motion sequences.

Low-Level Interface: Enables direct joint control with position, velocity, and torque parameters. Developers must disable sport-mode before using low-level control to prevent command conflicts.

Functionality Examples

  • Status Reading: Access high-level and low-level robot state data
  • Motion Control: Implement walking, balancing, and trajectory-based movements
  • Wireless Controller: Monitor gamepad input and button states
  • Camera Integration: Stream front-facing camera feeds using OpenCV
  • Obstacle Avoidance: Toggle autonomous obstacle detection features
  • Robot Customization: Control LED lights and speaker volume

Repository Statistics

  • 579 stars and 221 forks indicate active community adoption
  • BSD-3-Clause licensing permits broad commercial and research use
  • 45 commits demonstrate ongoing maintenance and development
  • 8 contributors spanning multiple development teams

Documentation

Complete technical specifications and API details are available through Unitree's official support documentation, including sports services, basic services, and remote control protocols.