🐕 Go2Doggy
简单易用的Go2机器狗控制库,让小学生也能轻松控制机器人!
🌟 特点
- 🎯 简单易用: 专为初学者设计,API简洁明了
- 🔧 自动配置: 自动检测网络接口和IP地址
- 🎮 丰富功能: 支持运动控制、LED灯效等多种功能
- 📚 教育友好: 提供完整的教学示例和文档
- 🛠️ 易于扩展: 模块化设计,方便添加新功能
🚀 快速开始
安装
pip install go2doggy
基础使用
from go2doggy import Go2Dog, MovementCommands, LEDCommands
# 创建机器狗实例
dog = Go2Dog()
# 自动搜索并连接
if dog.connect():
# 创建控制命令
movement = MovementCommands(dog)
led = LEDCommands(dog)
# 控制机器狗前进
movement.forward(0.8, 2.0) # 速度0.8,持续2秒
# 设置LED颜色
led.set_color("red")
# 让机器狗跳舞
movement.dance()
# 断开连接
dog.disconnect()
📖 详细文档
核心功能
1. 自动连接
from go2doggy import Go2Dog
# 自动检测网络和IP
dog = Go2Dog()
dog.connect() # 自动搜索并连接
# 手动指定IP
dog = Go2Dog("192.168.1.100")
dog.connect()
2. 运动控制
from go2doggy import MovementCommands
movement = MovementCommands(dog)
# 基础运动
movement.forward(0.5, 1.0) # 前进1秒
movement.backward(0.5, 1.0) # 后退1秒
movement.turn_left(90) # 左转90度
movement.turn_right(90) # 右转90度
movement.stop() # 停止
# 特殊动作
movement.dance() # 跳舞
3. LED控制
from go2doggy import LEDCommands
led = LEDCommands(dog)
# 颜色控制
led.set_color("red") # 设置红色
led.set_color("blue") # 设置蓝色
# 灯效控制
led.blink(3, 0.5) # 闪烁3次,间隔0.5秒
led.rainbow() # 彩虹灯效
4. 动作序列
from go2doggy.utils import SequenceRunner
# 创建动作序列
runner = SequenceRunner()
runner.add_action("forward", 0.8, 1.0)
runner.add_action("turn_left", 90)
runner.add_action("forward", 0.8, 1.0)
# 执行序列
runner.run_sequence(dog)
🎓 教育示例
让机器狗画正方形
from go2doggy import Go2Dog, MovementCommands
dog = Go2Dog()
if dog.connect():
movement = MovementCommands(dog)
# 画正方形的4条边
for i in range(4):
movement.forward(1.0, 2.0) # 前进2秒
movement.turn_left(90) # 左转90度
dog.disconnect()
音乐舞蹈表演
from go2doggy import Go2Dog, MovementCommands, LEDCommands
import time
dog = Go2Dog()
if dog.connect():
movement = MovementCommands(dog)
led = LEDCommands(dog)
# 配合音乐的动作序列
led.rainbow() # 彩虹灯效
movement.dance() # 跳舞动作
dog.disconnect()
🛠️ 开发指南
本地开发
# 克隆仓库
git clone https://github.com/go2doggy/go2doggy.git
cd go2doggy
# 安装开发依赖
pip install -e .[dev]
# 运行测试
python -m pytest tests/
# 代码格式化
black go2doggy/
项目结构
go2doggy/
├── go2doggy/ # 主包目录
│ ├── __init__.py # 包初始化
│ ├── core.py # 核心连接功能
│ ├── commands.py # 控制命令
│ └── utils.py # 工具函数
├── tests/ # 测试文件
├── examples/ # 示例代码
├── setup.py # 安装配置
├── pyproject.toml # 项目配置
└── README.md # 项目说明
🤝 贡献
欢迎贡献代码!请查看 CONTRIBUTING.md 了解详细信息。
📄 许可证
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
🙏 致谢
感谢所有为这个项目做出贡献的开发者和用户!
📞 联系我们
- 📧 Email: contact@go2doggy.com
- 🐛 Issues: GitHub Issues
- 📖 文档: 在线文档
让每个孩子都能享受机器人编程的乐趣! 🚀
Metadata
Release files for go2doggy 0.1.0
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 |
|---|---|---|---|---|
| go2doggy-0.1.0.tar.gz | 14.4 kB | Without provenance | Details for go2doggy-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| go2doggy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for go2doggy-0.1.0-py3-none-any.whl |
Total release size: 25.7 kB
Release files / go2doggy-0.1.0.tar.gz
| Download URL | go2doggy-0.1.0.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b66881438316db79bd6b0af64a4a5f6b64cdc2e45c2342bb08d4cdbfdba6c2f
|
|
BLAKE2b-256 checksum How to use checksums |
d557d608d343346001c917f23d04617e76cc82424e15c9462a745190a0f783bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.6
|
Release files / go2doggy-0.1.0-py3-none-any.whl
| Download URL | go2doggy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4898845e0aad2247b399ee2c78436924e8be02dfcce2f22436e9125729f5d6d5
|
|
BLAKE2b-256 checksum How to use checksums |
57db34ac26a9f5e9d406f70b86d3801b00b01b1248044823a6580d91c3c645c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.6
|
Security for go2doggy 0.1.0
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.