# Stretch仿真Navigation模式混合流式位置控制时base移动超时异常

> 原文链接：https://robotics.hellobike.com/pitfalls/2025-11-18-stretch-ros2-213
> 频道：pitfalls | 更新日期：2025-11-18 | 标签：auto, github-issue, stretch_ros2
> 核心摘要：修复stretch_mujoco_driver中move_to_position在Navigation模式下误触发base运动超时检查，并增强非Position模式的base指令校验。

# Stretch仿真Navigation模式混合流式位置控制时base移动超时异常

::: v-pre
> 本文由 AI 根据公开内容整理，可能有误，请以原文为准：[Navigation mode for stretch simulation pauses during base movement](https://github.com/hello-robot/stretch_ros2/issues/213)（GitHub hello-robot/stretch_ros2 #213）

**状态**：有绕过办法

## 问题

在Stretch MuJoCo仿真中同时使用Navigation模式（发布/cmd_vel）与Streaming Position模式（发布/joint_pose_cmd）时，streaming回调调用move_to_position()会错误执行base运动完成等待逻辑，导致base速度非零时持续抛出actuator failed to move异常，阻断导航与关节控制的并行执行。

## 环境

Hello Robot Stretch仿真环境，stretch_ros2 humble分支，stretch_mujoco_driver.py，涉及Actuators.base_translate与base_rotate执行器及/joint_pose_cmd话题。

## 解决办法

1. 修改 `stretch_mujoco_driver.py` 中 `move_to_position()` 函数，将 base 执行器的 `wait_while_is_moving` 检查及超时异常抛出逻辑严格限制在 `self.robot_mode == "position"` 条件内，避免 Navigation 模式下因持续速度指令触发误报。
2. 在位置指令处理逻辑中增加模式校验：当 `robot_mode != "position"` 且检测到 `qpos[Idx.BASE_TRANSLATE]` 或 `qpos[Idx.BASE_ROTATE]` 非零时，记录错误日志 "Cannot set base position when not in position mode."，防止用户在 Navigation 模式下误发 base 位置指令。
3. 修正 `stretch_core/stretch_driver.py` 中关于 base 平移旋转冲突警告的文案拼写错误，确保错…

讨论原作者：@jehanyang 等，版权归原作者所有。
:::

## 原始参考来源 (Sources)

- [GitHub hello-robot/stretch_ros2 #213：Navigation mode for stretch simulation pauses during base movement](https://github.com/hello-robot/stretch_ros2/issues/213)