ROS2官网资料:https://index.ros.org/doc/ros2/
目前,大约每6个月就有一个新的ROS 2发行版。
Distro | Release date | Logo | EOL date |
---|---|---|---|
Eloquent Elusor | Nov 22nd, 2019 | Nov 2020 | |
Dashing Diademata | May 31st, 2019 | May 2021 | |
Crystal Clemmys | December 14th, 2018 | Dec 2019 | |
Bouncy Bolson | July 2nd, 2018 | Jul 2019 | |
Ardent Apalone | December 8th, 2017 | Dec 2018 | |
beta3 | September 13th, 2017 | Dec 2017 | |
beta2 | July 5th, 2017 | Sep 2017 | |
beta1 | December 19th, 2016 | Jul 2017 | |
alpha1 - alpha8 | August 31th, 2015 | Dec 2016 |
提供两种安装方法:二进制包和源码编译。此次采用编译好的二进制包进行安装。
安装二进制软件包有两种选项:Debian软件包和 fat archive。
推荐采用Debian软件包安装。因为它会自动安装必要的依赖项,所以更加方便。它还会与常规系统更新一起更新。
我们在64位x86和64位ARM上支持Ubuntu Linux Bionic Beaver(18.04)和Ubuntu Xenial Xerus(16.04)。注意:Ardent和Beta版本支持Ubuntu Xenial Xerus 16.04。
您将需要将ROS 2 apt仓库添加到系统中。为此,请首先使用如下所示的apt授权我们的GPG密钥:
sudo apt update && sudo apt install curl gnupg2 lsb-release
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
然后将仓库添加到源列表中:
sudo sh -c 'echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
sudo sh -c 'echo "deb [arch=amd64] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
前往下载页面 the releases page
下载最新的Linux软件包 ros2-eloquent-20200124-linux-bionic-amd64.tar.bz2
存放地址~/Downloads/ros2-eloquent-20200124-linux-bionic-amd64.tar.bz2
接着解压:
mkdir -p ~/ros2_eloquent
cd ~/ros2_eloquent
tar xf ~/Downloads/ros2-eloquent-linux-x86_64.tar.bz2
sudo apt update
sudo apt install -y python-rosdep
sudo rosdep init
rosdep update
根据您下载的版本设置rosdistro。
rosdep install --from-paths ros2-linux/share --ignore-src --rosdistro eloquent -y --skip-keys "console_bridge fastcdr fastrtps libopensplice67 libopensplice69 osrf_testing_tools_cpp poco_vendor rmw_connext_cpp rosidl_typesupport_connext_c rosidl_typesupport_connext_cpp rti-connext-dds-5.3.1 tinyxml_vendor tinyxml2_vendor urdfdom urdfdom_headers"
sudo apt install -y libpython3-dev
. ~/ros2_eloquent/ros2-linux/setup.bash
此处source可能会提示以下警告:
[connext_cmake_module] Warning: The location at which Connext was found when the workspace was built [[/opt/rti.com/rti_connext_dds-5.3.1]] does not point to a valid directory, and the NDDSHOME environment variable has not been set. Support for Connext will not be available.
警告的原因是二进制文件是在Connext支持下编译的,但是你的PC上没有Connext库,因此只是在说不能使用它。如果要摆脱它,则必须在/opt/rti.com/rti_connext_dds-5.3.1下安装Connext库。
默认情况下,系统将指向Fast-RTPS DDS库(开源,并且始终与ROS2一起安装)
查看系统配置:
系统根据以下环境变量的值选择执行ROS2应用程序时使用的RMW实现
echo $RMW_IMPLEMENTATION
可以通过以下方式设置不同的RMW:
export RMW_IMPLEMENTATION = rmw_fastrtps_cpp
export RMW_IMPLEMENTATION = rmw_opensplice_cpp
export RMW_IMPLEMENTATION = rmw_connext_cpp
只要不设置RMW_IMPLEMENTATION = rmw_connext_cpp
,就可以安全地忽略该警告。
如想摆脱警告提示,可参考以下教程https://index.ros.org/doc/ros2/Installation/DDS-Implementations/#dds-linux-binary进行安装。
https://answers.ros.org/question/323501/problem-with-ros2-installation/
启动一个命令行终端,启动C++的talker(在ROS1熟悉的例子):
. ~/ros2_eloquent/ros2-linux/setup.bash
ros2 run demo_nodes_cpp talker
另启一个命令行终端,启动Python的listener:
. ~/ros2_eloquent/ros2-linux/setup.bash
ros2 run demo_nodes_py listener
可以看到talker正在发布消息,而listener在监听这些消息。这可以验证C ++和Python API是否正常工作。搞定!
安装过程一些小问题:
忘记记录了,系统提示python module的依赖包等安装版本不对,总是无法删除重装,后面重新安装是先系统切换到国内镜像源,然后更新软件后再按上述步骤进行即可顺利通过。