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.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xgolib-1.1.10.tar.gz | 22.1 kB | Without provenance | Details for xgolib-1.1.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xgolib-1.1.10-py3-none-any.whl | Python 3 | none | any | Details for xgolib-1.1.10-py3-none-any.whl |
Total release size: 44.5 kB
Release files / xgolib-1.1.10.tar.gz
| Download URL | xgolib-1.1.10.tar.gz |
|---|---|
| Size | 22.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9270bbb99567f78ad031a92a7aeabf68832379c6738b714062fd8f57961b3a8
|
|
BLAKE2b-256 checksum How to use checksums |
02b761713544af8b25b62614884fb41202c312fe05ddcb635da1986a386ac41d
|
| 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.10-py3-none-any.whl
| Download URL | xgolib-1.1.10-py3-none-any.whl |
|---|---|
| Size | 22.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c138844b5b235f502be210538dd358514827cd3124781a540764c24a951abe27
|
|
BLAKE2b-256 checksum How to use checksums |
d0fa02b63f33e5048790c0bb7b15fc5fcf8ab4d400a6e51fef1b74502833e0e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for xgolib 1.1.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.