Skip to content

GDK Python Usage Guide

GDK Python uses version 3.10 by default. If you need to use a different Python version, you can specify the Python version when compiling the pybind source code to generate a GDK Python package for that version.

Overview

GDK's Python module provides a Python interface to all of GDK's functionality.

Installation requirements (if you need a Python version other than 3.10)

System requirements

  • Linux (x86_64 or aarch64)
  • Python 3.8+

Dependencies

  • pybind11 >= 2.6.0
  • numpy >= 1.19.0
  • protobuf >= 5.28.3

Installing protobuf

sudo apt update && sudo apt install -y libprotobuf-dev protobuf-compiler

Installation

Installing from source

cd ~/.cache/agibot/app/gdk/build_dep/python/pybind/
pip install . --no-build-isolation

Building a wheel package

cd ~/.cache/agibot/app/gdk/build_dep/python/pybind/
python setup.py bdist_wheel --dist-dir dist

Checking whether the installation succeeded

Checking whether it's installed on the system

pip list  

Basic usage

Complete example

import agibot_gdk
import time

agibot_gdk.gdk_init()
robot = agibot_gdk.Robot()
time.sleep(1)

joint_states = robot.get_joint_states()
print(joint_states)

Code walkthrough

Import the agibot_gdk module

import agibot_gdk

Initialize the gdk module and the robot object

agibot_gdk.gdk_init()
robot = agibot_gdk.Robot()
time.sleep(1)

Get the robot's joint information

joint_states = robot.get_joint_states()
print(joint_states)

Declare the Python path

source ~/.cache/agibot/app/env.sh

Run the program

python3 <your_py>