# Docker构建Stretch MuJoCo仿真失败缺失SE3 xacro及URDF导出报错

> 原文链接：https://robotics.hellobike.com/pitfalls/2026-03-24-stretch-ros2-222
> 频道：pitfalls | 更新日期：2026-03-24 | 标签：auto, github-issue, stretch_ros2
> 核心摘要：Docker内运行MuJoCo仿真因缺失SE3 xacro文件启动失败，根因为构建脚本静默错误导致URDF未生成，需移除容错指令并重建镜像。

# Docker构建Stretch MuJoCo仿真失败缺失SE3 xacro及URDF导出报错

::: v-pre
> 本文由 AI 根据公开内容整理，可能有误，请以原文为准：[`stretch_mujoco_driver.launch.py` fails when running Mujoco simulation inside Docker (missing SE3 xacros)](https://github.com/hello-robot/stretch_ros2/issues/222)（GitHub hello-robot/stretch_ros2 #222）

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

## 问题

在Docker中执行`stretch_mujoco_driver.launch.py`启动MuJoCo仿真时，报`xacro.XacroException`找不到`stretch_description_SE3_eoa_wrist_dw3_tool_sg3.xacro`文件。

## 环境

hello-robot-stretch-robots, stretch_ros2 (humble分支), Docker容器, MuJoCo仿真环境, ROS2 Humble

## 解决办法

1. 进入`stretch_ros2/stretch_simulation`目录编辑`Dockerfile`，定位第127行附近的URDF导出命令，删除行尾的`|| true`以暴露构建错误。
2. 确保构建上下文中存在`stretch_uncalibrated.urdf`文件，若缺失需检查git子模块或前置依赖是否完整拉取。
3. 执行`git pull`获取最新修复代码后，重新构建镜像：`docker build -t stretch-simulation:latest .`。
4. 验证新镜像中`/root/ament_ws/install/stretch_description/share/stretch_description/urdf/`路径下包含`stretch_description_SE3_eoa_wrist_dw3_tool_sg3.xacro`文件。
5. 避免使用可能挂起的`docker compose up`，优先使用`docker run`配合`use_muj…

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

## 原始参考来源 (Sources)

- [GitHub hello-robot/stretch_ros2 #222：`stretch_mujoco_driver.launch.py` fails when running Mujoco simulation inside Docker (missing SE3 xacros)](https://github.com/hello-robot/stretch_ros2/issues/222)