外观
踩坑GitHub unitreerobotics/unitree_sdk2_python6 个月前
Go2-W SportClient调用SwitchGait报AttributeError缺失属性
本文由 AI 根据公开内容整理,可能有误,请以原文为准:[ISSUE] : AttributeError: 'SportClient' object has no attribute 'SwitchGait'(GitHub unitreerobotics/unitree_sdk2_python #134)
状态:已解决
问题
在unitree_sdk2_python的go2w_sport_client.py示例中执行switch_gait测试(ID 6)时,调用sport_client.SwitchGait(1)触发AttributeError: 'SportClient' object has no attribute 'SwitchGait',导致无法切换步态模式,其余测试项正常。
环境
机型:Unitree Go2-W;SDK:unitree_sdk2_python;系统:Ubuntu;示例脚本:go2w_sport_client.py;网卡:eth0
解决办法
- 修改导入语句,弃用默认的SportClient,改为从b2模块导入:from unitree_sdk2py.b2.sport.sport_client import SportClient
- 保持原有sport_client.SwitchGait(1)调用逻辑不变,重新运行go2w_sport_client.py脚本
- 验证switch_gait测试项(ID 6)不再抛出AttributeError且步态切换功能恢复正常
讨论原作者:@KA1773-akash-pawar 等,版权归原作者所有。
来源
本页事实对应的公开页面,以原文为准。