This commit is contained in:
robofish 2025-07-07 23:27:42 +08:00
parent f14c0ebf26
commit e69bc8233c

32
start.sh Executable file
View File

@ -0,0 +1,32 @@
#!/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文件已按序启动"