1.设置软件源
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.sjtug.sjtu.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
我使用的是交大的源,在使用清华和中科大的源时sudo apt install ros-noetic-desktop-full都定位不到软件包,据这篇文章似乎需要找到适合电脑硬件的源。
注意:不要在软件和更新以及命令行中添加同一源,否则安装过错中会出现有一些软件包无法被安装。如果您用的是 unstable 发行版,这也许是因为系统无法达到您要求的状态造成的
到95%后面的包都下不了,在软件和更新中切换为sjtu的源就可以了
2.添加密匙
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
3.更新列表
sudo apt update
4.安装noetic
sudo apt install ros-noetic-desktop-full
5.配置环境
source /opt/ros/noetic/setup.bash
注意:在使用ROS的每个bash终端中必须运行该命令,否则报错WARNING: unable to configure logging. No log files will be generated
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
7.测试
需要工作空间才可以
roscore
提醒未安装某个包(不记得了)安装后正常执行
再开一个终端
rosrun turtulesim turtlesim_mode
ROS官方安装
noetic/Installation/Ubuntu - ROS Wiki
主要参考博客