sweeper_200/start_all.sh
2026-02-28 17:00:02 +08:00

23 lines
480 B
Bash
Executable File
Raw 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.

#!/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"