Ubuntu20.04.04版本安装RO2 GALACTIC

家电修理 2023-07-16 19:16www.caominkang.com电器维修

2022-5-12

1、官网安装页

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

2、Ubuntu20.04.04下载地址

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

3、RO2 版本发布日志

Distributions — ROS 2 Documentation: Rolling documentation

List of Distributions

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

DistroRelease dateLogoEOL dateHumble HaksbillMay 23rd, 2022 May 2027Galactic GeocheloneMay 23rd, 2021 November 2022Foxy FitzroyJune 5th, 2020 May 2023Eloquent ElusorNovember 22nd, 2019November 2020Dashing DiademataMay 31st, 2019 May 2021Crystal ClemmysDecember 14th, 2018December 2019Bouncy BolsonJuly 2nd, 2018 July 2019Ardent ApaloneDecember 8th, 2017 December 2018beta3September 13th, 2017December 2017beta2July 5th, 2017September 2017beta1December 19th, 2016Jul 2017alpha1 - alpha8August 31th, 2015December 2016 Future Distributions

For details on uping features see the roadmap.

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

DistroRelease dateSupported untilHumble HaksbillMay 2022May 2027

The expectation is to release ne 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./ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu./ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu./ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu./ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu./ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu./ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu./ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu./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,输入:q回车。然后执行下面的命令更新一下系统。

sudo apt-get update
sudo apt-get upgrade

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

sudo vi /etc/hosts

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

185.199.110.133 ra.githubusercontent.

5、执行下面的安装命令

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

sudo apt update && sudo apt install curl gnupg lsb-release
sudo curl -sSL https://ra.githubusercontent./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./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-mon-extensions 
  python3-flake8 
  python3-pip 
  python3-pytest-cov 
  python3-rosdep 
  python3-setuptools 
  python3-vcstool 
  get
# install some pip packages needed for testing
python3 -m pip install -U 
  flake8-blind-except 
  flake8-builtins 
  flake8-class-neline 
  flake8-prehensions 
  flake8-deprecated 
  flake8-docstrings 
  flake8-import-order 
  flake8-quotes 
  pytest-repeat 
  pytest-rerunfailures 
  pytest 
  setuptools

创建工作空间,拷贝repos。

mkdir -p ~/ros2_galactic/src
cd ~/ros2_galactic
get https://ra.githubusercontent./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

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

Copyright © 2016-2025 www.caominkang.com 曹敏电脑维修网 版权所有 Power by