ezgo 0.0.14__py3-none-any.whl → 0.0.16__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/__init__.py +1 -1
- ezgo/go2.py +19 -47
- {ezgo-0.0.14.dist-info → ezgo-0.0.16.dist-info}/METADATA +23 -1
- {ezgo-0.0.14.dist-info → ezgo-0.0.16.dist-info}/RECORD +7 -7
- {ezgo-0.0.14.dist-info → ezgo-0.0.16.dist-info}/WHEEL +1 -1
- {ezgo-0.0.14.dist-info → ezgo-0.0.16.dist-info}/LICENSE +0 -0
- {ezgo-0.0.14.dist-info → ezgo-0.0.16.dist-info}/top_level.txt +0 -0
ezgo/__init__.py
CHANGED
ezgo/go2.py
CHANGED
|
@@ -292,7 +292,7 @@ class Go2:
|
|
|
292
292
|
def move_thread():
|
|
293
293
|
ret = self.sport_client.Move(vx, vy, vyaw)
|
|
294
294
|
success = ret == 0
|
|
295
|
-
print(f"Move 执行结果: {ret}, 成功: {success}")
|
|
295
|
+
# print(f"Move 执行结果: {ret}, 成功: {success}")
|
|
296
296
|
return success
|
|
297
297
|
|
|
298
298
|
t = threading.Thread(target=move_thread)
|
|
@@ -303,30 +303,33 @@ class Go2:
|
|
|
303
303
|
def MoveForDuration(self, vx, vy, vyaw, duration):
|
|
304
304
|
"""
|
|
305
305
|
持续移动指定时间
|
|
306
|
-
|
|
306
|
+
|
|
307
307
|
Args:
|
|
308
308
|
vx (float): 前后速度 (-1.0 到 1.0)
|
|
309
|
-
vy (float): 左右速度 (-1.0 到 1.0)
|
|
309
|
+
vy (float): 左右速度 (-1.0 到 1.0)
|
|
310
310
|
vyaw (float): 转动速度 (-2.0 到 2.0)
|
|
311
311
|
duration (float): 移动时间(秒)
|
|
312
|
-
|
|
312
|
+
|
|
313
313
|
Returns:
|
|
314
314
|
bool: 是否成功执行
|
|
315
315
|
"""
|
|
316
316
|
print(f"开始移动: vx={vx}, vy={vy}, vyaw={vyaw}, 持续时间={duration}秒")
|
|
317
317
|
start_time = time.time()
|
|
318
|
-
|
|
318
|
+
|
|
319
319
|
try:
|
|
320
320
|
while time.time() - start_time < duration:
|
|
321
321
|
if not self.Move(vx, vy, vyaw):
|
|
322
322
|
return False
|
|
323
323
|
time.sleep(0.1) # 每100ms调用一次
|
|
324
|
-
|
|
324
|
+
|
|
325
|
+
# 时间到后,主动停止移动
|
|
326
|
+
self.StopMove()
|
|
325
327
|
print("移动完成")
|
|
326
328
|
return True
|
|
327
|
-
|
|
329
|
+
|
|
328
330
|
except KeyboardInterrupt:
|
|
329
331
|
print("移动被用户中断")
|
|
332
|
+
self.StopMove()
|
|
330
333
|
return False
|
|
331
334
|
|
|
332
335
|
def Forward(self, speed=0.3, duration=2.0):
|
|
@@ -615,12 +618,11 @@ class Go2:
|
|
|
615
618
|
self._call(self.sport_client.Dance2)
|
|
616
619
|
|
|
617
620
|
def HandStand(self, flag: int):
|
|
618
|
-
"""倒立行走。"""
|
|
621
|
+
"""倒立行走。flag=1开启,flag=0关闭。"""
|
|
619
622
|
# 执行指令
|
|
620
|
-
self._call(lambda: self.sport_client.HandStand(bool(flag)))
|
|
621
|
-
if
|
|
622
|
-
|
|
623
|
-
self._call(lambda: self.sport_client.HandStand(False))
|
|
623
|
+
result = self._call(lambda: self.sport_client.HandStand(bool(flag)))
|
|
624
|
+
success = result == 0 if result is not None else False
|
|
625
|
+
return success
|
|
624
626
|
|
|
625
627
|
def LeftFlip(self):
|
|
626
628
|
"""左空翻。"""
|
|
@@ -651,68 +653,38 @@ class Go2:
|
|
|
651
653
|
return result == 0 if result is not None else False
|
|
652
654
|
|
|
653
655
|
def FreeBound(self, flag: int):
|
|
654
|
-
""" 并腿跑模式。"""
|
|
656
|
+
""" 并腿跑模式。flag=1开启,flag=0关闭。"""
|
|
655
657
|
# 执行指令
|
|
656
658
|
result = self._call(lambda: self.sport_client.FreeBound(bool(flag)))
|
|
657
659
|
success = result == 0 if result is not None else False
|
|
658
|
-
|
|
659
|
-
if flag and success:
|
|
660
|
-
# 如果成功开启,等待2秒后自动关闭(这是为了演示效果)
|
|
661
|
-
time.sleep(2)
|
|
662
|
-
self._call(lambda: self.sport_client.FreeBound(False))
|
|
663
|
-
|
|
664
660
|
return success
|
|
665
661
|
|
|
666
662
|
def FreeJump(self, flag: int):
|
|
667
|
-
""" 跳跃模式。"""
|
|
663
|
+
""" 跳跃模式。flag=1开启,flag=0关闭。"""
|
|
668
664
|
# 执行指令
|
|
669
665
|
result = self._call(lambda: self.sport_client.FreeJump(bool(flag)))
|
|
670
666
|
success = result == 0 if result is not None else False
|
|
671
|
-
|
|
672
|
-
if flag and success:
|
|
673
|
-
# 如果成功开启,等待4秒后自动关闭(这是为了演示效果)
|
|
674
|
-
time.sleep(4)
|
|
675
|
-
self._call(lambda: self.sport_client.FreeJump(False))
|
|
676
|
-
|
|
677
667
|
return success
|
|
678
668
|
|
|
679
669
|
def FreeAvoid(self, flag: int):
|
|
680
|
-
""" 闪避模式。"""
|
|
670
|
+
""" 闪避模式。flag=1开启,flag=0关闭。开启后可配合Move函数进行自动避障移动。"""
|
|
681
671
|
# 执行指令
|
|
682
672
|
result = self._call(lambda: self.sport_client.FreeAvoid(bool(flag)))
|
|
683
673
|
success = result == 0 if result is not None else False
|
|
684
|
-
|
|
685
|
-
if flag and success:
|
|
686
|
-
# 如果成功开启,等待2秒后自动关闭(这是为了演示效果)
|
|
687
|
-
time.sleep(2)
|
|
688
|
-
self._call(lambda: self.sport_client.FreeAvoid(False))
|
|
689
|
-
|
|
690
674
|
return success
|
|
691
675
|
|
|
692
676
|
def WalkUpright(self, flag: int):
|
|
693
|
-
""" 后腿直立模式。"""
|
|
677
|
+
""" 后腿直立模式。flag=1开启,flag=0关闭。"""
|
|
694
678
|
# 执行指令
|
|
695
679
|
result = self._call(lambda: self.sport_client.WalkUpright(bool(flag)))
|
|
696
680
|
success = result == 0 if result is not None else False
|
|
697
|
-
|
|
698
|
-
if flag and success:
|
|
699
|
-
# 如果成功开启,等待4秒后自动关闭(这是为了演示效果)
|
|
700
|
-
time.sleep(4)
|
|
701
|
-
self._call(lambda: self.sport_client.WalkUpright(False))
|
|
702
|
-
|
|
703
681
|
return success
|
|
704
682
|
|
|
705
683
|
def CrossStep(self, flag: int):
|
|
706
|
-
""" 交叉步模式。"""
|
|
684
|
+
""" 交叉步模式。flag=1开启,flag=0关闭。"""
|
|
707
685
|
# 执行指令
|
|
708
686
|
result = self._call(lambda: self.sport_client.CrossStep(bool(flag)))
|
|
709
687
|
success = result == 0 if result is not None else False
|
|
710
|
-
|
|
711
|
-
if flag and success:
|
|
712
|
-
# 如果成功开启,等待4秒后自动关闭(这是为了演示效果)
|
|
713
|
-
time.sleep(4)
|
|
714
|
-
self._call(lambda: self.sport_client.CrossStep(False))
|
|
715
|
-
|
|
716
688
|
return success
|
|
717
689
|
|
|
718
690
|
def AutoRecoverSet(self, flag: int):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ezgo
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16
|
|
4
4
|
Summary: 宇树Go2机器狗Python控制库
|
|
5
5
|
Author-email: ezgo <noreply@example.com>
|
|
6
6
|
License: MIT
|
|
@@ -417,6 +417,28 @@ pip install opencv-python numpy Pillow netifaces
|
|
|
417
417
|
|
|
418
418
|
## 更新日志
|
|
419
419
|
|
|
420
|
+
### v0.0.16 (2026-02-04)
|
|
421
|
+
**修复**:
|
|
422
|
+
- 🐛 修复 MoveForDuration 函数在 duration 时间结束后未自动停止移动的问题
|
|
423
|
+
- 🐛 Forward、Backward、Left、Right、TurnLeft、TurnRight 等移动控制函数现在会在指定时间后准确停止
|
|
424
|
+
- 🐛 MoveForDuration 在循环结束后自动调用 StopMove() 确保机器狗停止移动
|
|
425
|
+
- 🐛 修复 Keyboard 中断时未停止移动的问题
|
|
426
|
+
|
|
427
|
+
**改进**:
|
|
428
|
+
- 🔧 移动控制函数的行为现在与文档描述一致,duration 参数真正控制移动时间
|
|
429
|
+
- 🔧 提升用户体验,无需手动调用 StopMove() 即可实现定时移动
|
|
430
|
+
|
|
431
|
+
### v0.0.15 (2025-12-24)
|
|
432
|
+
**修复**:
|
|
433
|
+
- 🐛 移除所有模式函数的自动关闭逻辑,用户可以自主控制开启和关闭
|
|
434
|
+
- 🐛 修复FreeBound、FreeJump、FreeAvoid、WalkUpright、CrossStep、HandStand等函数的自动关闭问题
|
|
435
|
+
- 🐛 用户现在可以自由控制模式的持续时间,不再强制自动关闭
|
|
436
|
+
|
|
437
|
+
**改进**:
|
|
438
|
+
- 🔧 所有步态模式函数现在由用户完全控制,flag=1开启,flag=0关闭
|
|
439
|
+
- 🔧 FreeAvoid开启后可以配合Move函数进行真正的自动避障移动
|
|
440
|
+
- 🔧 更新所有相关函数的文档说明,明确参数含义
|
|
441
|
+
|
|
420
442
|
### v0.0.14 (2025-12-24)
|
|
421
443
|
**修复**:
|
|
422
444
|
- 🐛 彻底修复Move函数状态检查过严的问题
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
ezgo/__init__.py,sha256=
|
|
1
|
+
ezgo/__init__.py,sha256=XdJGNtFRNZwouVByMsopJ7APB23zkdAa7v5NvLrcpLw,2268
|
|
2
2
|
ezgo/camera.py,sha256=Vsr44vFtaop4LE0DlWyOHyvxF-jHnVO8iMPUwp5mbsE,2538
|
|
3
3
|
ezgo/ezcamera.py,sha256=6-3y-1X_L60QsWdsd5-caLoj7Quy9rpyHdp3Tq3JFbU,6536
|
|
4
4
|
ezgo/eztk.py,sha256=MHWkkZYIL1AFjUXFu2Qq8U9idJV_E1VxFUBe82dvbyA,10463
|
|
5
|
-
ezgo/go2.py,sha256=
|
|
5
|
+
ezgo/go2.py,sha256=i1__a--bsrz1-Td2gWkGy5fv57WSI2JLizHPwgqNKRs,31389
|
|
6
6
|
ezgo/go2_camera.py,sha256=nawUSLyvqTNiVRQ2sM-UdoJzqwZcySltLbCfUb0G9Qc,8614
|
|
7
7
|
ezgo/go2_vui.py,sha256=52I4Y8uqGkW9muDEnDzQ236HqVVTIgNIN_2gW5RTC48,10161
|
|
8
8
|
ezgo/ui.py,sha256=jUik6maaoemI2vsBM92OLZfJfskg54W7hwMls_gxppg,2777
|
|
9
|
-
ezgo-0.0.
|
|
10
|
-
ezgo-0.0.
|
|
11
|
-
ezgo-0.0.
|
|
12
|
-
ezgo-0.0.
|
|
13
|
-
ezgo-0.0.
|
|
9
|
+
ezgo-0.0.16.dist-info/LICENSE,sha256=Zk4eZBT3KaBhqM3LB_xN7QquwnoWsEHAoA6eLdE6W5M,1060
|
|
10
|
+
ezgo-0.0.16.dist-info/METADATA,sha256=57RUGJh-9Y0lSQOOzA-r0YmpySVJhh2OVi6ZGQOtofg,17835
|
|
11
|
+
ezgo-0.0.16.dist-info/WHEEL,sha256=WnJ8fYhv8N4SYVK2lLYNI6N0kVATA7b0piVUNvqIIJE,91
|
|
12
|
+
ezgo-0.0.16.dist-info/top_level.txt,sha256=BdCFEVD5V_4FxUtvH0BVlZKgxYnp7EKNsYs5OyFxj-g,5
|
|
13
|
+
ezgo-0.0.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|