ezgo 0.0.8__tar.gz → 0.0.10__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ezgo
3
- Version: 0.0.8
3
+ Version: 0.0.10
4
4
  Summary: 宇树Go2机器狗Python控制库
5
5
  Author-email: ezgo <noreply@example.com>
6
6
  License: MIT
@@ -83,7 +83,7 @@ pip install ezgo[basic]
83
83
  ```python
84
84
  import ezgo
85
85
 
86
- # 创建Go2控制对象
86
+ # 创建Go2控制对象(需要安装unitree-sdk2py)
87
87
  robot = ezgo.Go2()
88
88
 
89
89
  # 初始化连接
@@ -96,16 +96,16 @@ if robot.init():
96
96
  robot.StopMove() # 停止移动
97
97
  ```
98
98
 
99
- ### 摄像头控制
99
+ ### Go2摄像头控制
100
100
 
101
101
  ```python
102
102
  import ezgo
103
103
 
104
- # 方法1: 通过Go2对象获取摄像头
104
+ # 方法1: 通过Go2对象获取摄像头(需要unitree-sdk2py)
105
105
  robot = ezgo.Go2()
106
106
  camera = robot.get_camera()
107
107
 
108
- # 方法2: 直接使用摄像头类
108
+ # 方法2: 直接使用Go2摄像头类(需要unitree-sdk2py)
109
109
  camera = ezgo.Go2Camera()
110
110
 
111
111
  # 初始化摄像头
@@ -118,16 +118,16 @@ if camera.init():
118
118
  frame = camera.read_frame()
119
119
  ```
120
120
 
121
- ### 声光控制
121
+ ### Go2声光控制
122
122
 
123
123
  ```python
124
124
  import ezgo
125
125
 
126
- # 方法1: 通过Go2对象获取VUI控制
126
+ # 方法1: 通过Go2对象获取VUI控制(需要unitree-sdk2py)
127
127
  robot = ezgo.Go2()
128
128
  vui = robot.get_vui()
129
129
 
130
- # 方法2: 直接使用VUI
130
+ # 方法2: 直接使用VUI类(需要unitree-sdk2py)
131
131
  vui = ezgo.Go2VUI()
132
132
 
133
133
  # 初始化VUI
@@ -142,12 +142,70 @@ if vui.init():
142
142
  vui.set_volume(3)
143
143
  ```
144
144
 
145
+ ### EasyTk 简化界面开发
146
+
147
+ ```python
148
+ import ezgo
149
+
150
+ # 创建EasyTk窗口(自动适配灵芯派480x800分辨率)
151
+ app = ezgo.EasyTk(title="机器狗控制", size="480x800")
152
+
153
+ # 添加标签
154
+ label = app.add_label(text="欢迎使用ezgo", font=("SimHei", 24))
155
+
156
+ # 添加按钮
157
+ def on_click():
158
+ print("按钮被点击了!")
159
+
160
+ button = app.add_button(text="点击我", command=on_click)
161
+
162
+ # 添加图片显示(支持文件路径、OpenCV图像、PIL图像)
163
+ image_label = app.add_label(image="path/to/image.jpg")
164
+
165
+ # 运行主循环
166
+ app.root.mainloop()
167
+ ```
168
+
169
+ ### EzCamera 优化摄像头控制
170
+
171
+ ```python
172
+ import ezgo
173
+ import cv2
174
+
175
+ # 创建摄像头对象(自动适配平台)
176
+ camera = ezgo.EzCamera(index=0, width=640, height=480, fps=30)
177
+
178
+ # 打开摄像头
179
+ if camera.open():
180
+ print("摄像头打开成功!")
181
+
182
+ # 读取最新帧
183
+ frame = camera.read()
184
+ if frame is not None:
185
+ # 保存图片
186
+ camera.save_image(frame, "capture.jpg")
187
+
188
+ # 调整尺寸
189
+ resized = camera.resize(frame, (224, 224))
190
+
191
+ # 裁剪为正方形
192
+ square = camera.crop_to_square(frame)
193
+
194
+ # 显示图像
195
+ cv2.imshow("Camera", frame)
196
+ cv2.waitKey(0)
197
+ cv2.destroyAllWindows()
198
+
199
+ # 关闭摄像头
200
+ camera.close()
201
+ ```
202
+
145
203
  ### 高级运动模式
146
204
 
147
205
  ```python
148
206
  import ezgo
149
207
 
150
- robot = ezgo.Go2()
208
+ robot = ezgo.Go2() # 需要unitree-sdk2py
151
209
  if robot.init():
152
210
  # 步态模式切换
153
211
  robot.FreeWalk(True) # 开启灵动模式
@@ -173,7 +231,7 @@ if robot.init():
173
231
  ```python
174
232
  import ezgo
175
233
 
176
- robot = ezgo.Go2()
234
+ robot = ezgo.Go2() # 需要unitree-sdk2py
177
235
  if robot.init():
178
236
  # 表演动作
179
237
  robot.Hello() # 打招呼
@@ -197,7 +255,7 @@ if robot.init():
197
255
  ```python
198
256
  import ezgo
199
257
 
200
- robot = ezgo.Go2()
258
+ robot = ezgo.Go2() # 需要unitree-sdk2py
201
259
  if robot.init():
202
260
  # 设置自动翻身
203
261
  success = robot.AutoRecoverSet(True)
@@ -359,6 +417,29 @@ pip install opencv-python numpy Pillow netifaces
359
417
 
360
418
  ## 更新日志
361
419
 
420
+ ### v0.0.10 (2025-12-09)
421
+ **修复**:
422
+ - 🐛 修复懒加载模块导入错误,解决TypeError问题
423
+ - 🐛 修复使用importlib替代__import__,提高兼容性
424
+ - 🐛 修复Go2相关模块无法正确实例化的问题
425
+
426
+ **改进**:
427
+ - 🔧 更新README中的使用示例,明确标注依赖要求
428
+ - 🔧 为每个工具类添加独立的使用示例
429
+ - 🔧 优化文档结构,区分Go2相关和独立功能
430
+
431
+ ### v0.0.9 (2025-12-09)
432
+ **改进**:
433
+ - 🔧 实现懒加载机制,避免导入时的依赖检查
434
+ - 🔧 只在实际使用Go2相关功能时才检查依赖
435
+ - 🔧 eztk和ezcamera模块可直接使用,无任何依赖警告
436
+ - 🔧 优化模块导入结构,提升用户体验
437
+
438
+ **修复**:
439
+ - 🐛 修复导入ezgo时提示netifaces等依赖缺失的问题
440
+ - 🐛 修复使用eztk/ezcamera时的不必要警告
441
+ - 🐛 实现真正的按需依赖检查机制
442
+
362
443
  ### v0.0.8 (2025-12-09)
363
444
  **改进**:
364
445
  - 🔧 移除自动依赖检查逻辑,避免导入时的警告提示