start_all scipt
This commit is contained in:
parent
92beb100b8
commit
101bc924aa
22
start_all (copy).sh
Executable file
22
start_all (copy).sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/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"
|
||||||
Loading…
Reference in New Issue
Block a user