ezgo 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ezgo-0.0.2.dist-info/METADATA +242 -0
- ezgo-0.0.2.dist-info/RECORD +5 -0
- ezgo-0.0.2.dist-info/top_level.txt +1 -0
- ezgo/__init__.py +0 -81
- ezgo/camera.py +0 -71
- ezgo/go2.py +0 -633
- ezgo/ui.py +0 -77
- ezgo-0.0.1.dist-info/METADATA +0 -295
- ezgo-0.0.1.dist-info/RECORD +0 -9
- ezgo-0.0.1.dist-info/top_level.txt +0 -1
- {ezgo-0.0.1.dist-info → ezgo-0.0.2.dist-info}/LICENSE +0 -0
- {ezgo-0.0.1.dist-info → ezgo-0.0.2.dist-info}/WHEEL +0 -0
ezgo-0.0.1.dist-info/METADATA
DELETED
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: ezgo
|
|
3
|
-
Version: 0.0.1
|
|
4
|
-
Summary: 宇树Go2机器狗Python控制库
|
|
5
|
-
Author-email: ezgo <noreply@example.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/your-username/ezgo
|
|
8
|
-
Project-URL: Repository, https://github.com/your-username/ezgo
|
|
9
|
-
Project-URL: Bug Reports, https://github.com/your-username/ezgo/issues
|
|
10
|
-
Keywords: robotics,unitree,go2,robot,control
|
|
11
|
-
Classifier: Development Status :: 3 - Alpha
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
-
Classifier: Operating System :: OS Independent
|
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
-
Requires-Python: >=3.7
|
|
23
|
-
Description-Content-Type: text/markdown
|
|
24
|
-
License-File: LICENSE
|
|
25
|
-
Provides-Extra: basic
|
|
26
|
-
Requires-Dist: opencv-python>=4.5.0; extra == "basic"
|
|
27
|
-
Requires-Dist: numpy>=1.19.0; extra == "basic"
|
|
28
|
-
Requires-Dist: Pillow>=8.0.0; extra == "basic"
|
|
29
|
-
Provides-Extra: full
|
|
30
|
-
Requires-Dist: opencv-python>=4.5.0; extra == "full"
|
|
31
|
-
Requires-Dist: numpy>=1.19.0; extra == "full"
|
|
32
|
-
Requires-Dist: Pillow>=8.0.0; extra == "full"
|
|
33
|
-
Requires-Dist: netifaces>=0.10.0; extra == "full"
|
|
34
|
-
Requires-Dist: unitree-sdk2py; extra == "full"
|
|
35
|
-
|
|
36
|
-
# ezgo - 宇树Go2机器狗Python控制库
|
|
37
|
-
|
|
38
|
-
[](https://badge.fury.io/py/ezgo)
|
|
39
|
-
[](https://pypi.org/project/ezgo/)
|
|
40
|
-
[](https://opensource.org/licenses/MIT)
|
|
41
|
-
|
|
42
|
-
ezgo 是一个用于控制宇树Go2机器狗的Python库,提供了简单易用的API接口,支持运动控制、视频流获取、UI界面等功能。
|
|
43
|
-
|
|
44
|
-
## 功能特性
|
|
45
|
-
|
|
46
|
-
- 🤖 **运动控制**: 支持前进、后退、转向、舞蹈等多种动作
|
|
47
|
-
- 📹 **视频流**: 实时获取机器狗摄像头画面
|
|
48
|
-
- 🎮 **状态管理**: 智能状态检测和动作切换
|
|
49
|
-
- 🖥️ **UI界面**: 提供简单的图形界面用于显示和控制
|
|
50
|
-
- 🔧 **易于集成**: 简洁的API设计,便于快速开发
|
|
51
|
-
|
|
52
|
-
## 安装
|
|
53
|
-
|
|
54
|
-
### 使用pip安装
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
pip install ezgo
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### 从源码安装
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
git clone https://github.com/your-username/ezgo.git
|
|
64
|
-
cd ezgo
|
|
65
|
-
pip install -e .
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## 系统要求
|
|
69
|
-
|
|
70
|
-
在安装 ezgo 之前,请确保您的系统已安装以下依赖:
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
# Ubuntu/Debian
|
|
74
|
-
sudo apt update
|
|
75
|
-
sudo apt install python3-opencv python3-numpy python3-pil
|
|
76
|
-
|
|
77
|
-
# CentOS/RHEL
|
|
78
|
-
sudo yum install opencv-python numpy Pillow
|
|
79
|
-
|
|
80
|
-
# macOS
|
|
81
|
-
brew install opencv
|
|
82
|
-
|
|
83
|
-
# Windows
|
|
84
|
-
# 请使用 pip 安装或下载预编译的二进制包
|
|
85
|
-
pip install opencv-python numpy Pillow
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
**注意**: ezgo 不会自动安装这些依赖,因为它们可能需要系统级安装或特定配置。
|
|
89
|
-
|
|
90
|
-
## 快速开始
|
|
91
|
-
|
|
92
|
-
### 基本使用
|
|
93
|
-
|
|
94
|
-
```python
|
|
95
|
-
from ezgo import Go2
|
|
96
|
-
|
|
97
|
-
# 初始化Go2控制器
|
|
98
|
-
go2 = Go2(interface="enx00e0986113a6") # 替换为你的网卡接口
|
|
99
|
-
|
|
100
|
-
# 初始化连接
|
|
101
|
-
if go2.init():
|
|
102
|
-
print("连接成功!")
|
|
103
|
-
|
|
104
|
-
# 基本动作
|
|
105
|
-
go2.StandUp() # 站立
|
|
106
|
-
go2.Forward(0.3, 2) # 向前移动2秒
|
|
107
|
-
go2.TurnLeft(0.5, 1) # 左转1秒
|
|
108
|
-
go2.Hello() # 打招呼
|
|
109
|
-
go2.Damp() # 进入阻尼状态
|
|
110
|
-
else:
|
|
111
|
-
print("连接失败!")
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### 视频流使用
|
|
115
|
-
|
|
116
|
-
```python
|
|
117
|
-
import cv2
|
|
118
|
-
from ezgo import Go2
|
|
119
|
-
|
|
120
|
-
# 初始化
|
|
121
|
-
go2 = Go2()
|
|
122
|
-
if go2.init():
|
|
123
|
-
print("开始获取视频流...")
|
|
124
|
-
|
|
125
|
-
while True:
|
|
126
|
-
frame = go2.read_image()
|
|
127
|
-
if frame is not None:
|
|
128
|
-
cv2.imshow('Go2 Camera', frame)
|
|
129
|
-
|
|
130
|
-
if cv2.waitKey(1) & 0xFF == ord('q'):
|
|
131
|
-
break
|
|
132
|
-
|
|
133
|
-
cv2.destroyAllWindows()
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### UI界面使用
|
|
137
|
-
|
|
138
|
-
```python
|
|
139
|
-
from ezgo.ui import APP
|
|
140
|
-
from ezgo.camera import Camera
|
|
141
|
-
import time
|
|
142
|
-
|
|
143
|
-
# 创建UI应用
|
|
144
|
-
app = APP(title="Go2控制面板", width=480, height=800)
|
|
145
|
-
|
|
146
|
-
# 创建摄像头
|
|
147
|
-
camera = Camera(index=0)
|
|
148
|
-
camera.open_camera()
|
|
149
|
-
|
|
150
|
-
# 更新界面
|
|
151
|
-
while app.is_running:
|
|
152
|
-
try:
|
|
153
|
-
# 获取摄像头图像
|
|
154
|
-
frame = camera.read_cv2_image()
|
|
155
|
-
image_tk = camera.cv2_to_tk(frame)
|
|
156
|
-
app.set_image(image_tk)
|
|
157
|
-
app.set_text("系统运行正常")
|
|
158
|
-
|
|
159
|
-
app.update()
|
|
160
|
-
time.sleep(0.03) # 约30FPS
|
|
161
|
-
except Exception as e:
|
|
162
|
-
print(f"更新界面出错: {e}")
|
|
163
|
-
break
|
|
164
|
-
|
|
165
|
-
app.mainloop()
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## API 文档
|
|
169
|
-
|
|
170
|
-
### Go2 类
|
|
171
|
-
|
|
172
|
-
主要的机器狗控制类,提供以下方法:
|
|
173
|
-
|
|
174
|
-
#### 运动控制
|
|
175
|
-
- `StandUp()` - 站立
|
|
176
|
-
- `StandDown()` - 蹲下
|
|
177
|
-
- `Sit()` - 坐下
|
|
178
|
-
- `Damp()` - 进入阻尼状态
|
|
179
|
-
- `BalanceStand()` - 平衡站立
|
|
180
|
-
- `StopMove()` - 停止移动
|
|
181
|
-
|
|
182
|
-
#### 移动控制
|
|
183
|
-
- `Move(vx, vy, vyaw)` - 移动控制
|
|
184
|
-
- `Forward(speed, duration)` - 向前移动
|
|
185
|
-
- `Backward(speed, duration)` - 向后移动
|
|
186
|
-
- `Left(speed, duration)` - 向左移动
|
|
187
|
-
- `Right(speed, duration)` - 向右移动
|
|
188
|
-
- `TurnLeft(speed, duration)` - 左转
|
|
189
|
-
- `TurnRight(speed, duration)` - 右转
|
|
190
|
-
|
|
191
|
-
#### 动作控制
|
|
192
|
-
- `Hello()` - 打招呼
|
|
193
|
-
- `Stretch()` - 伸懒腰
|
|
194
|
-
- `Content()` - 开心
|
|
195
|
-
- `Heart()` - 比心
|
|
196
|
-
- `Scrape()` - 拜年作揖
|
|
197
|
-
- `Dance1()` - 舞蹈1
|
|
198
|
-
- `Dance2()` - 舞蹈2
|
|
199
|
-
- `FrontJump()` - 前跳
|
|
200
|
-
- `FrontPounce()` - 向前扑人
|
|
201
|
-
|
|
202
|
-
#### 视频控制
|
|
203
|
-
- `read_image()` - 获取一帧图像
|
|
204
|
-
- `open_video(width, height)` - 打开视频流
|
|
205
|
-
|
|
206
|
-
### Camera 类
|
|
207
|
-
|
|
208
|
-
摄像头控制类,提供以下方法:
|
|
209
|
-
- `open_camera()` - 打开摄像头
|
|
210
|
-
- `read_cv2_image()` - 读取OpenCV格式图像
|
|
211
|
-
- `read_pil_image()` - 读取PIL格式图像
|
|
212
|
-
- `cv2_to_tk(frame)` - 转换为Tkinter格式
|
|
213
|
-
- `resize(frame, size)` - 调整图像尺寸
|
|
214
|
-
- `crop_to_square(frame)` - 裁剪为正方形
|
|
215
|
-
|
|
216
|
-
### APP 类
|
|
217
|
-
|
|
218
|
-
UI界面类,基于Tkinter:
|
|
219
|
-
- `set_image(image)` - 设置显示图像
|
|
220
|
-
- `set_text(text)` - 设置显示文字
|
|
221
|
-
|
|
222
|
-
## 项目结构
|
|
223
|
-
|
|
224
|
-
```
|
|
225
|
-
ezgo/
|
|
226
|
-
├── src/
|
|
227
|
-
│ ├── __init__.py # 包初始化文件
|
|
228
|
-
│ ├── go2.py # Go2机器狗控制类
|
|
229
|
-
│ ├── camera.py # 摄像头控制类
|
|
230
|
-
│ └── ui.py # UI界面类
|
|
231
|
-
├── pyproject.toml # 现代Python项目配置
|
|
232
|
-
├── README.md # 项目文档
|
|
233
|
-
├── LICENSE # 开源协议
|
|
234
|
-
├── quick_update.py # 快速更新脚本
|
|
235
|
-
└── .pypirc # PyPI配置文件
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## 开发指南
|
|
239
|
-
|
|
240
|
-
### 本地开发
|
|
241
|
-
|
|
242
|
-
```bash
|
|
243
|
-
# 克隆仓库
|
|
244
|
-
git clone https://github.com/your-username/ezgo.git
|
|
245
|
-
cd ezgo
|
|
246
|
-
|
|
247
|
-
# 安装开发依赖
|
|
248
|
-
pip install -e .
|
|
249
|
-
|
|
250
|
-
# 运行测试
|
|
251
|
-
python -m pytest tests/
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### 发布新版本
|
|
255
|
-
|
|
256
|
-
```bash
|
|
257
|
-
# 更新补丁版本
|
|
258
|
-
python quick_update.py patch
|
|
259
|
-
|
|
260
|
-
# 更新次版本
|
|
261
|
-
python quick_update.py minor
|
|
262
|
-
|
|
263
|
-
# 更新主版本
|
|
264
|
-
python quick_update.py major
|
|
265
|
-
|
|
266
|
-
# 发布到PyPI
|
|
267
|
-
python quick_update.py publish
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## 常见问题
|
|
271
|
-
|
|
272
|
-
### Q: 连接机器狗失败怎么办?
|
|
273
|
-
A: 请检查网络连接,确保机器狗IP (192.168.123.161) 可以ping通,并确认网卡接口名称正确。
|
|
274
|
-
|
|
275
|
-
### Q: 视频流无法打开?
|
|
276
|
-
A: 请检查GStreamer是否正确安装,以及网卡多播配置是否正确。
|
|
277
|
-
|
|
278
|
-
### Q: 某些动作无法执行?
|
|
279
|
-
A: 请检查机器狗当前状态,某些动作需要在特定状态下才能执行。
|
|
280
|
-
|
|
281
|
-
## 贡献
|
|
282
|
-
|
|
283
|
-
欢迎提交 Issue 和 Pull Request!
|
|
284
|
-
|
|
285
|
-
## 许可证
|
|
286
|
-
|
|
287
|
-
本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。
|
|
288
|
-
|
|
289
|
-
## 更新日志
|
|
290
|
-
|
|
291
|
-
### v0.0.1 (2024-01-01)
|
|
292
|
-
- 初始版本发布
|
|
293
|
-
- 基本运动控制功能
|
|
294
|
-
- 视频流获取功能
|
|
295
|
-
- UI界面功能
|
ezgo-0.0.1.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
ezgo/__init__.py,sha256=qDPgcBaUNokuBFBLW7DwmZ53sdZh-VTReHOab1a6yZw,1918
|
|
2
|
-
ezgo/camera.py,sha256=Vsr44vFtaop4LE0DlWyOHyvxF-jHnVO8iMPUwp5mbsE,2538
|
|
3
|
-
ezgo/go2.py,sha256=6-wjSGKfKfR1f9qfmhU9x8gwfeapei2Kx1CqUd9xAhE,20818
|
|
4
|
-
ezgo/ui.py,sha256=jUik6maaoemI2vsBM92OLZfJfskg54W7hwMls_gxppg,2777
|
|
5
|
-
ezgo-0.0.1.dist-info/LICENSE,sha256=Zk4eZBT3KaBhqM3LB_xN7QquwnoWsEHAoA6eLdE6W5M,1060
|
|
6
|
-
ezgo-0.0.1.dist-info/METADATA,sha256=ZzisKNb6JDsXTFT0H8zcWSCfYALHHQMnndwLrz7efbI,7765
|
|
7
|
-
ezgo-0.0.1.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
8
|
-
ezgo-0.0.1.dist-info/top_level.txt,sha256=BdCFEVD5V_4FxUtvH0BVlZKgxYnp7EKNsYs5OyFxj-g,5
|
|
9
|
-
ezgo-0.0.1.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ezgo
|
|
File without changes
|
|
File without changes
|