Ubuntu20.04.04版本安装RO2 GALACTIC

2022-5-12

1、官网安装页

Building ROS 2 on Ubuntu Linux — ROS 2 Documentation: Galactic documentation

2、Ubuntu20.04.04下载地址

https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/focal/ubuntu-20.04.4-desktop-amd64.iso

3、RO2 版本发布日志

Distributions — ROS 2 Documentation: Rolling documentation

List of Distributions

Below is a list of current and historic ROS 2 distributions. Rows in the table marked in green are the currently supported distributions.

Distro Release date Logo EOL date
Humble Hawksbill May 23rd, 2022

Ubuntu20.04.04版本安装RO2 GALACTIC_第1张图片

May 2027
Galactic Geochelone May 23rd, 2021

November 2022
Foxy Fitzroy June 5th, 2020

May 2023
Eloquent Elusor November 22nd, 2019 November 2020
Dashing Diademata May 31st, 2019

Ubuntu20.04.04版本安装RO2 GALACTIC_第2张图片

May 2021
Crystal Clemmys December 14th, 2018 December 2019
Bouncy Bolson July 2nd, 2018

July 2019
Ardent Apalone December 8th, 2017

Ubuntu20.04.04版本安装RO2 GALACTIC_第3张图片

December 2018
beta3 September 13th, 2017 December 2017
beta2 July 5th, 2017 September 2017
beta1 December 19th, 2016 Jul 2017
alpha1 - alpha8 August 31th, 2015 December 2016

Future Distributions

For details on upcoming features see the roadmap.

There is a new ROS 2 distribution released yearly on May 23rd (World Turtle Day).

Distro Release date Supported until
Humble Hawksbill May 2022 May 2027

The expectation is to release new ROS 2 distributions once per year.

4、安装Ubuntu操作系统的教程自己百度。安装ROS2这个确实会出现一些意想不到的问题,大多数都有人踩过坑了。这是我第二次安装了,做个总结。

4.1安装注意事项

安装有三种方式,Building ROS 2 on Ubuntu Linux,Installing ROS 2 on Ubuntu Linux,Installing ROS 2 via Debian Packages,不要乱选,一会这个,一会那个,记住使用一个,并且安装的过程很漫长,大概会需要2个小时,最好有一个记事本记一下刚才执行过的命令和进行的修改。我是安装完操作系统直接就开始安装ROS2了。

4.2安装过程

我选的是第一个1官网安装页中的,Building ROS 2 on Ubuntu Linux,其他的没试,不做说明。这些命令,最好一行一行执行,不要一下全部复制执行。

1、设置locale,设置更新,设置编码支持。

locale  # check for UTF-8
​
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
​
locale  # verify settings

2、执行完下面这条命令,出现500 Index of /ubuntu focal/universe amd64 Packages release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=universe,b=amd64字样就证明系统没问题。

apt-cache policy | grep universe

3、在这先添加一下更新源。引用:ubuntu20.04更换清华源_PisaYu的博客-CSDN博客_ubuntu换清华源

首先打开网页,复制更新源。

#添加清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse multiverse

执行以下命令。

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vi /etc/apt/sources.list

打开文件之后,按Esc,dd一直按,删除全部文字,然后按i,鼠标放在光标处,右键粘贴。看到文件内容变为上面的更新源。然后,按Esc,输入:wq回车。然后执行下面的命令更新一下系统。

sudo apt-get update
sudo apt-get upgrade

4、修改一个重要的映射地址。

sudo vi /etc/hosts

在文件的最后一行输入o,然后输入下面的配置,然后Esc退出,输入:wq回车保存。

185.199.110.133 raw.githubusercontent.com

5、执行下面的安装命令

添加ROS 2 apt仓库到系统,授权apt GPG key。

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

安装开发工具和ROS工具。

sudo apt update && sudo apt install -y \
  build-essential \
  cmake \
  git \
  python3-colcon-common-extensions \
  python3-flake8 \
  python3-pip \
  python3-pytest-cov \
  python3-rosdep \
  python3-setuptools \
  python3-vcstool \
  wget
# install some pip packages needed for testing
python3 -m pip install -U \
  flake8-blind-except \
  flake8-builtins \
  flake8-class-newline \
  flake8-comprehensions \
  flake8-deprecated \
  flake8-docstrings \
  flake8-import-order \
  flake8-quotes \
  pytest-repeat \
  pytest-rerunfailures \
  pytest \
  setuptools

创建工作空间,拷贝repos。

mkdir -p ~/ros2_galactic/src
cd ~/ros2_galactic
wget https://raw.githubusercontent.com/ros2/ros2/galactic/ros2.repos
vcs import src < ros2.repos

用rosdep安装依赖。

sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-5.3.1 urdfdom_headers"

安装额外的DDS机制,可选。

cd ~/ros2_galactic/
colcon build --symlink-install

基本上按照上面的步骤,应该能够完整的安装ROS2了,剩下的就是学习开发了。

vi ~/.bashrc

在最后增加一行如下所示,保存退出。

. ~/ros2_galactic/install/local_setup.bash

关掉终端,再打开终端,执行

ros2 run demo_nodes_cpp talker

再次打开一个终端,执行

ros2 run demo_nodes_py listener

可以看到两边消息同步即可。

你可能感兴趣的:(ROS2,ubuntu,debian,linux,自动驾驶)