Files
hivecore_robot_os/HiveCoreR1/compile.sh

34 lines
770 B
Bash
Raw Permalink Normal View History

2025-06-24 20:08:26 +08:00
#!/bin/bash
# 检查是否在工作空间根目录
if [ ! -f "src/driver_pkg/CMakeLists.txt" ]; then
echo "错误: 请在工作空间根目录运行此脚本"
exit 1
fi
# 检查是否设置了ROS2环境
if [ -z "$ROS_DISTRO" ]; then
echo "错误: 未设置ROS2环境变量请先运行: source /opt/ros/<distro>/setup.bash"
exit 1
fi
# 创建编译目录
mkdir -p build install log
# 编译项目
echo "开始编译项目..."
colcon build --packages-select \
driver_pkg \
perception_pkg \
decision_pkg \
control_pkg \
interaction_pkg
# 检查编译是否成功
if [ $? -eq 0 ]; then
echo "编译成功!"
echo "请运行以下命令设置环境:"
echo " source install/setup.bash"
else
echo "编译失败,请检查错误信息。"
fi