Files
ros_contorl/scripts/run_sim.sh

20 lines
1.1 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 快速启动 mock 机械臂。模型在工位程序里看,不再弹出 RViz。
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# shellcheck disable=SC1091
source "${ROOT}/install/setup.bash"
# mock 栈用的是**真机的** install/(不是 install_sim/),节点名与真机一模一样
# (/controller_manager、/robot_state_publisher、/arm_status_node…),
# 所以它必须待在**真机的域**里,绝不能跟着调用者的环境落到仿真的 77 上。
#
# 2026-09-28 实测就是这么踩的:这个脚本 source 的是 install/ 又**没管域**,
# 调用者的 shell 里带着 77(之前跑过仿真),于是 mock 栈落到仿真域上、
# 与 Gazebo 仿真抢 /joint_states —— 冒名顶替的残留进程把 Gazebo 那边的 TF
# 盖成"静止",现象是"仿真上料失败、臂摆不到竖直位姿",而控制器其实一切正常。
# 详见 scripts/lib/ros_domain.sh 的文件头。
# shellcheck source=lib/ros_domain.sh
source "${ROOT}/scripts/lib/ros_domain.sh"
ros_domain_force_real
ros2 launch arm_bringup sim.launch.py use_rviz:=false