Arch Linux 安装配置 ROS/ROS2 环境

Arch Linux 安装配置 ROS/ROS2 环境

直接安装 ROS2 Humble

使用 Distrobox

多个 ROS 版本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# ROS 环境初始化选择函数
function init_ros_noetic() {
# ROS Noetic (Ubuntu 20.04)
source /opt/ros/noetic/setup.bash
# 可选:添加你的工作空间初始化
# source ~/catkin_ws/devel/setup.bash
echo "ROS Noetic 已初始化!"
}

function init_ros_foxy() {
# ROS Foxy (Ubuntu 20.04)
source /opt/ros/foxy/setup.bash
# 可选:添加你的工作空间初始化
# source ~/ros2_foxy/install/setup.bash
echo "ROS Foxy 已初始化!"
}

# 只在交互式终端展示选择菜单
if [[ $- == *i* ]]; then
echo "========================"
echo "是否初始化 ROS 环境?"
echo "1: 初始化 ROS Noetic (ROS1)"
echo "2: 初始化 ROS Foxy (ROS2)"
echo "其他: 跳过 ROS 初始化"
echo "========================"

read -p "请输入你的选择 (1/2/其他): " ros_choice

case $ros_choice in
1)
init_ros_noetic
;;
2)
init_ros_foxy
;;
*)
echo "未初始化 ROS 环境"
;;
esac
fi