Skip to main content

XGO 机器人控制库

Project description

xgolib — XGO 机器人控制库

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

  • 已支持设备:XGO-MINIXGO-LITEXGO-mini2SWXGO-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


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.2.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xgolib-1.1.2-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file xgolib-1.1.2.tar.gz.

File metadata

  • Download URL: xgolib-1.1.2.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for xgolib-1.1.2.tar.gz
Algorithm Hash digest
SHA256 b8d1ca30876eeb66ec9db5f947ba2f00218e49cc342de93cbcbd7395a163f92e
MD5 0c4df5d128984bb94325fab9ca986cec
BLAKE2b-256 86e0e687f0ab8221ac07b99b10eb5e606c954916f8cf0b47aa050980ed7f28f8

See more details on using hashes here.

File details

Details for the file xgolib-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: xgolib-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for xgolib-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4e594458810d71b0faa8f8b186b7bf308c9f2112b4fc2f668e89a366cfab319b
MD5 697f163dfac8b1446fd3031adf19ab94
BLAKE2b-256 941ec4890681b8d7b75a61d51c48ea7142980188bdb64bfd5200f71b073bc1ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page