差别
这里会显示出您选择的修订版和当前版本之间的差别。
| 后一修订版 | 前一修订版 | ||
| 机器人:周边硬件:空间鼠标:space-mouse-在diffusion_policy项目中替换原有的代码 [2025/11/11 03:11] – 创建 ctbots | 机器人:周边硬件:空间鼠标:space-mouse-在diffusion_policy项目中替换原有的代码 [2025/11/11 07:06] (当前版本) – [替换diffusion_policy原有的老的spnav依赖] ctbots | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| + | {{htmlmetatags> | ||
| + | metatag-keywords=(diffusion_policy, | ||
| + | metatag-description=(了解如何在diffusion_policy项目中替换老旧的spnav依赖,使用pyspacemouse库解决Python版本兼容性问题,并学习如何初始化、安装和测试Space Mouse设备的数据读取功能。) | ||
| + | metatag-media-og: | ||
| + | metatag-og: | ||
| + | metatag-og: | ||
| + | }} | ||
| + | |||
| ====== space-mouse-在diffusion_policy项目中替换原有的代码 ====== | ====== space-mouse-在diffusion_policy项目中替换原有的代码 ====== | ||
| ===== 替换diffusion_policy原有的老的spnav依赖 ===== | ===== 替换diffusion_policy原有的老的spnav依赖 ===== | ||
| - | 主要问题是 diffusion_policy 依赖的spnav比较挑 python版本,我们进行替换 | + | 主要问题是 diffusion_policy 依赖的spnav比较挑 python版本,我们进行替换 |
| <code python spacemouse.py> | <code python spacemouse.py> | ||
| 行 96: | 行 104: | ||
| self.motion_state[1] = int(state.y * self.max_value) | self.motion_state[1] = int(state.y * self.max_value) | ||
| self.motion_state[2] = int(state.z * self.max_value) | self.motion_state[2] = int(state.z * self.max_value) | ||
| - | self.motion_state[3] = int(state.roll * self.max_value) | + | |
| - | self.motion_state[4] = int(state.pitch * self.max_value) | + | |
| - | self.motion_state[5] = int(state.yaw * self.max_value) | + | self.motion_state[4] = int(state.yaw * self.max_value) |
| + | self.motion_state[5] = int(state.roll * self.max_value) | ||
| + | | ||
| if state.buttons: | if state.buttons: | ||
| for i, pressed in enumerate(state.buttons): | for i, pressed in enumerate(state.buttons): | ||