1.首先安装常规手段安装乌班图系统
2.开始ROS 系统安装
1. 设置编码
$ sudo apt update && sudo apt install locales
$ sudo locale-gen en_US en_US.UTF-8
$ sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
$ export LANG=en_US.UTF-8
2.添加源
$ sudo apt update && sudo apt install curl gnupg lsb-release
$ sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
如遇报错“Failed to connect to raw.githubusercontent.com”,可参考古月居 - ROS机器人知识分享社区
3. 安装ROS2
1.配置Softerware & Updates
2.添加软件源
如果不添加软件源,是无法定位软件包的
清华源
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
3.设置key
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
4.更新并安装
更新
sudo apt update
安装(ros-noetic-desktop-full)
安装aptitude
sudo apt install aptitude
安装ROS软件包
sudo aptitude install ros-noetic-desktop-full
5.添加环境变量
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
6.安装构建依赖
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
初始化
sudo rosdep init
更新
rosdep update
7.测试
分别打开3个终端,在第1个终端输入:
roscore
在第2个终端输入:
rosrun turtlesim turtlesim_node
在第3个终端输入:
rosrun turtlesim turtle_teleop_key