25RC_MID360_R2/start.sh
2025-07-07 23:27:42 +08:00

32 lines
960 B
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.

#!/bin/bash
# 初始化ROS环境根据实际路径修改
source /opt/ros/noetic/setup.bash
source ~/ws_lida/devel/setup.bash
# 工作空间环境初始化[1](@ref)
# 定义launch文件数组按顺序添加
LAUNCH_FILES=(
" livox_ros_driver2 msg_MID360.launch"
" fast_lio mapping_mid360.launch"
# "package3 launch_file3.launch"
)
# 顺序启动逻辑
for entry in "${LAUNCH_FILES[@]}"; do
# 分割包名与文件名rosrun map_server map_saver map:=/map -f src/FAST_LIO_LOCALIZATION/PCD/map
IFS=' ' read -r -a arr <<< "$entry"
pkg=${arr[0]}
file=${arr[1]}
# 启动新终端并执行launch
gnome-terminal --title="$pkg - $file" -- bash -c \
"echo '正在启动 $pkg$file'; \
roslaunch $pkg $file; \
exec bash" # 保持终端不关闭[3](@ref)
# 等待节点初始化(根据实际需求调整时长)
sleep 2 # 关键依赖节点建议8-10秒[4](@ref)
done
echo "所有launch文件已按序启动"