XGO 机器人控制库
Project description
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")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xgolib-1.1.3.tar.gz
(20.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
xgolib-1.1.3-py3-none-any.whl
(20.6 kB
view details)
File details
Details for the file xgolib-1.1.3.tar.gz.
File metadata
- Download URL: xgolib-1.1.3.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18b0b9a93d4ca0c7faffa2b0723368b9b97bc5aad106cfe42fec7b3d1e0d0aeb
|
|
| MD5 |
46b14de8fef4ef7e0baca3a0748ae5a3
|
|
| BLAKE2b-256 |
52463aa9d2b09e0212d810460a89bf55f48456cbc54b93eaa9915b8424559ec8
|
File details
Details for the file xgolib-1.1.3-py3-none-any.whl.
File metadata
- Download URL: xgolib-1.1.3-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bccd1eda56bd999d57327b99063050e91546a1cb95f1d17d6e6eac901db9ef1e
|
|
| MD5 |
2273b70c7d18acbeec1ed3537dfd3b4b
|
|
| BLAKE2b-256 |
f149f5126460747ab727ddb133d3ba50b964b4584e1d3cdd7bd4a5e17f18eb21
|