sweeper_200/start_all (copy).sh

23 lines
480 B
Bash
Raw Normal View History

2026-02-26 14:09:01 +08:00
#!/bin/bash
set -e
# ===== 环境 =====
source /opt/ros/humble/setup.bash
source /home/nvidia/Downloads/sweeper_200/install/setup.bash
# ===== 信号处理(这是核心)=====
terminate() {
echo "[start_ros2] Caught SIGTERM/SIGINT, shutting down ROS2..."
kill -TERM "$ROS2_PID"
wait "$ROS2_PID"
exit 0
}
trap terminate SIGINT SIGTERM
# ===== 启动 launch前台语义=====
ros2 launch launch_system start_all.launch.py &
ROS2_PID=$!
wait "$ROS2_PID"