1 Installation安装
1.1 Configure your Ubuntu repositories
1.1 配置你的Ubuntu repositories
Configure your Ubuntu repositories to allow "restricted," "universe," and "multiverse." You can follow the Ubuntu guide for instructions on doing this.
将你的Ubuntu respositories设置勾选"restricted," "universe," and "multiverse"。具体设置如下图所示。
(注:The "Ubuntu Software" tab displays a list of repositories or "Channels". The four main repositories are:
-
Main - Canonical-supported free and open-source software.
-
Universe - Community-maintained free and open-source software.
-
Restricted - Proprietary drivers for devices.
-
Multiverse - Software restricted by copyright or legal issues.)
1.2 Setup your sources.list
1.2 设置你的sources.list
Setup your computer to accept software from packages.ros.org.
在Ubuntu终端内输入如下命令以设置你的电脑允许安装来自packages.ros.org的软件。
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
1.3 Set up your keys
1.3 设置密钥
在Ubuntu终端内输入如下命令。
sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
1.4 Installation安装
First, make sure your Debian package index is up-to-date
首先,确保你的Debian package index是最新的即更新Debian package。在Ubuntu终端内输入如下命令。
sudo apt update
Now pick how much of ROS you would like to install.
然后,选择你将要安装的ROS版本。个人建议直接安装桌面完整版(Desktop-Full Install)。(注:桌面完全版安装对ROS功能的覆盖更全面)在Ubuntu终端输入如下命令。
sudo apt install ros-noetic-desktop-full
There are even more packages available in ROS. You can always install a specific package directly.
此外,有很多可在ROS中运行的(packages)包可供下载(因为桌面完整版并不能完全覆盖下载你所需要的所有功能包)。你可以在Ubuntu终端输入类似如下的命令以直接安装指定的包。
sudo apt install ros-noetic-PACKAGE
上述代码中的PACKAGE是指你要安装的包名字。例如,当你需要安装noetic中的slam-gmapping包可将PACKAGE替换为slam-gmapping即如下命令。
sudo apt install ros-noetic-slam-gmapping
To find available packages, see ROS Index or use:
为确保你所安装的包是否存在或安装成功,你可以查看ROS Index或在Ubuntu终端输入如下命令。
apt search ros-noetic
1.5 Environment setup 环境配置
You must source this script in every bash terminal you use ROS in.
你必须确保bash终端可以从你在用的ROS中获取脚本即ROS的环境配置。
source /opt/ros/noetic/setup.bash
It can be convenient to automatically source this script every time a new shell is launched. These commands will do that for you.
这可以使你每次启动的新终端很方便地获取ROS脚本。如下命令可以做到上述功能。
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
1.6 Dependencies for building packages安装依赖
Up to now you have installed what you need to run the core ROS packages. To create and manage your own ROS workspaces, there are various tools and requirements that are distributed separately. For example, rosinstall is a frequently used command-line tool that enables you to easily download many source trees for ROS packages with one command.
To install this tool and other dependencies for building ROS packages, run:
至此,你必须安装ROS内核包才能顺利运行ROS。有各种工具可以完成ROS工作空间的创建和管理。例如,rosinstall是经常被用来下载ROS依赖包的命令行工具。在Ubuntu终端输入如下命令以安装ROS内核包管理的工具和依赖。
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
1.6.1 Initialize rosdep 初始化ROS依赖
Before you can use many ROS tools, you will need to initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS. If you have not yet installed rosdep, do so as follows.
在你使用ROS工具之前需要完成ROS依赖的初始化。因为ROS依赖能确保你顺利地安装你需要的ROS内核功能。在Ubuntu终端输入依次如下命令即可完成ROS依赖的初始化。
sudo apt install python3-rosdep
sudo rosdep init
rosdep update
2 运行noetic测试
至此,已完成Ubuntu 20.04(Focal)中安装ROS noetic的步骤。可通过运行小海龟程序进行测试。
3 ROS One-line Installation ROS一站式安装命令
Check out this tutorial to install ROS Noetic using a single command.
在Ubuntu终端输入如下命令可完成noetic的一次性安装。
wget -c https://raw.githubusercontent.com/qboticslabs/ros_install_noetic/master/ros_install_noetic.sh && chmod +x ./ros_install_noetic.sh && ./ros_install_noetic.sh
当然,当你想要卸载noetic,也可以在Ubuntu终端输入如下命令完成一键式卸载。
wget -c https://raw.githubusercontent.com/qboticslabs/ros_install_noetic/master/ros_uninstall_noetic.sh && chmod +x ./ros_uninstall_noetic.sh && ./ros_uninstall_noetic.sh
官网教程link:noetic/Installation/Ubuntu - ROS Wiki
官网推荐demonstration:
Ubuntu20.04(Focal)安装ROS noetic--官方推荐安装教程
Ubuntu20.04(Focal)安装ROS noetic--官方推荐一键式安装、卸载教程