Skip to main content

xgolib — XGO 机器人控制库

xgolib 提供了针对 XGO 系列设备的 Python 控制接口。通过统一入口 XGO(...) 可自动识别设备类型并返回对应的控制对象,亦可手动指定型号。

  • 已支持设备:XGO-MINI、XGO-LITE、XGO-mini2SW、XGO-RIDER

安装

  • Python 版本:建议 3.8+
  • 依赖:pyserial
pip install xgolib

快速开始

from xgolib import XGO

# 自动检测设备型号
dog = XGO()

# 或手动指定型号
dog = XGO("xgolite")

API

运动控制

dog.move("x", 18)      # 前进 18mm
dog.move("y", -5)      # 右移 5mm
dog.move("Y", 30)      # 左移 30mm
dog.turn(60)            # 以 60°/s 左转
dog.stop()              # 停止移动

变速

dog.pace("high")       # 高速步频
dog.mark_time(25)       # 抬腿 25mm 原地踏步
dog.mark_time(0)        # 停止原地踏步

设备信息

dog = XGO("xgolite")
version = dog.read_firmware()
print(version)  # e.g. M-4.3.3

if version[0] == "M":
    print("XGO-MINI")
else:
    print("XGO-LITE")

自动扫描

XGO() 未指定端口时自动扫描设备,默认顺序:/dev/ttyAMA5 → /dev/ttyAMA0。 也可手动指定:

dog = XGO("xgomini", port="/dev/ttyAMA2")

Metadata

Release files for xgolib 1.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xgolib 1.1.9
File Size Uploaded
xgolib-1.1.9.tar.gz 21.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xgolib 1.1.9
File Interpreter ABI Platform
xgolib-1.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 44.0 kB

Release files / xgolib-1.1.9.tar.gz

Download URL xgolib-1.1.9.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4c7841a45caf5a185e43fdf268cb78d1d63c74fae4e558de04531d38e10ff262
BLAKE2b-256 checksum
How to use checksums
97e4fb3e98894d52b721e9a7dcd211bd7470c065c3c05de3cf0a21cc8a35a48d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / xgolib-1.1.9-py3-none-any.whl

Download URL xgolib-1.1.9-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c59a37fb28bfb8dcdc38eb846e90aaf1488f5e771b99eb64e9b937ac19b0236d
BLAKE2b-256 checksum
How to use checksums
8cc79ef8aef3e18fab047d84ce2973b22c121b81d4452bcd33d542cb69233cda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

1.1.10

2 release files

This release

1.1.9 This release

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page