目 录CONTENT

文章目录

ROS2 Installation

GrantLi
2022-12-05 / 0 评论 / 2 点赞 / 982 阅读 / 15773 字 / 正在检测是否收录...

一、ROS2版本介绍

ROS2版本 Release date EOL date Ubuntu 版本 Documentation
Rolling Ridley May 2022 November 2024 Ubuntu 22.04 Rolling教程网址
Humble Hawksbill May 23rd, 2022 May 2027 Ubuntu 22.04 Humble教程网址
Galactic Geochelone May 23rd, 2021 November 2022 Ubuntu 20.04 Galactic教程网址
Foxy Fitzroy June 5th, 2020 May 2023 Ubuntu 20.04 Foxy教程网址
Eloquent Elusor November 22nd, 2019 November 2020 Ubuntu 18.04 Eloquent教程网址
Dashing Diademata May 31st, 2019 May 2021 Ubuntu 18.04 Dashing教程网址
Crystal Clemmys December 14th, 2018 December 2019 Ubuntu 18.04 Crystal教程网址
Bouncy Bolson July 2nd, 2018 July 2019 Ubuntu 16.04 -
Ardent Apalone December 8th, 2017 December 2018 Ubuntu 16.04 -
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 - -

ROS2 Releases
ROS源网址

根据上表,推荐安装Humble Hawksbill。

二、ROS2 Humble deb安装(ubuntu22.04)

1.Set 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.Setup Sources

sudo apt install software-properties-common
sudo add-apt-repository universe

sudo apt update && sudo apt install curl
sudo curl -sSL http://www.aigrantli.com:1080/GrantLi/rosdistro/-/raw/d007eb8f3ffab518312a8cfc47e039137cdb5593/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 $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

sudo apt update

3.安装ROS2

# Desktop Install (Recommended)
sudo apt install ros-humble-desktop

# ROS-Base Install (Bare Bones)
sudo apt install ros-humble-ros-base

# Development tools
sudo apt install ros-dev-tools

4.环境设置

source /opt/ros/humble/setup.bash
  1. 测试
    终端1:
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp talker

终端2:

source /opt/ros/humble/setup.bash
ros2 run demo_nodes_py listener

三、ROS2 Humble 源码安装(ubuntu20.04)

1.设置系统语言环境

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.添加ROS 2软件包下载源

sudo apt install software-properties-common
sudo add-apt-repository universe

sudo apt update && sudo apt install curl

sudo curl -sSL http://www.aigrantli.com:1080/GrantLi/rosdistro/-/raw/d007eb8f3ffab518312a8cfc47e039137cdb5593/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 $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

3.安装依赖

sudo apt update && sudo apt install -y \
  python3-flake8-docstrings \
  python3-pip \
  python3-pytest-cov \
  ros-dev-tools
  
sudo python3 -m pip install -U \
   flake8-blind-except \
   flake8-builtins \
   flake8-class-newline \
   flake8-comprehensions \
   flake8-deprecated \
   flake8-import-order \
   flake8-quotes \
   pytest-repeat \
   pytest-rerunfailures
  1. 下载ROS2源码
mkdir -p ~/ros2_humble/src
cd ~/ros2_humble
vcs import --input http://www.aigrantli.com:1080/GrantLi/ros2/-/raw/main/ros2.repos src
  1. 配置环境
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers"
  1. 安装DDS
sudo apt update && sudo apt install -q -y rti-connext-dds-6.0.1
export RTI_LICENSE_FILE=path/to/rti_license.dat
cd /opt/rti.com/rti_connext_dds-6.0.1/resource/scripts && source ./rtisetenv_x64Linux4gcc7.3.0.bash; cd -

DDS implementations

  1. 编译ROS2
cd ~/ros2_humble/
colcon build --symlink-install

Q:/usr/include/kdl/jacobian.hpp:26:10: fatal error: Eigen/Core: 没有那个文件或目录
26 | #include <Eigen/Core>
A:配置eigen3

sudo apt-get install libeigen3-dev
sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen

8.环境生效

# Replace ".bash" with your shell if you're not using bash
# Possible values are: setup.bash, setup.sh, setup.zsh
. ~/ros2_humble/install/local_setup.bash

9.测试

# 终端1
. ~/ros2_humble/install/local_setup.bash
ros2 run demo_nodes_cpp talker

# 终端2
. ~/ros2_humble/install/local_setup.bash
ros2 run demo_nodes_py listener

四、花絮–修改配置文件

  1. 修改cpptoml.cmake.in文件:
gedit ~/ros2_humble/src/eclipse-iceoryx/iceoryx/iceoryx_dds/cmake/cpptoml/cpptoml.cmake.in

https://github.com/skystrife/cpptoml.git替换成http://119.29.41.151:1080/skystrife/cpptoml.git

gedit ~/ros2_humble/src/eclipse-iceoryx/iceoryx/iceoryx_posh/cmake/cpptoml/cpptoml.cmake.in

https://github.com/skystrife/cpptoml.git替换成http://119.29.41.151:1080/skystrife/cpptoml.git

  1. 修改foonathan_memory_vendor文件:
gedit ~/ros2_humble/src/eProsima/foonathan_memory_vendor/CMakeLists.txt

https://github.com/foonathan/memory.git替换成http://119.29.41.151:1080/foonathan/memory.git

  1. 修改shared_queues_vendor文件:
gedit ~/ros2_humble/src/ros2/rosbag2/shared_queues_vendor/CMakeLists.txt

https://github.com/cameron314/readerwriterqueue/archive/ef7dfbf553288064347d51b8ac335f1ca489032a.zip替换成http://aigrantli.com/%E8%B5%84%E6%96%99%E5%85%B1%E4%BA%AB/%E8%BD%AF%E4%BB%B6/ROS2/ef7dfbf553288064347d51b8ac335f1ca489032a.zip

https://github.com/cameron314/concurrentqueue/archive/8f65a8734d77c3cc00d74c0532efca872931d3ce.zip替换成http://aigrantli.com/%E8%B5%84%E6%96%99%E5%85%B1%E4%BA%AB/%E8%BD%AF%E4%BB%B6/ROS2/8f65a8734d77c3cc00d74c0532efca872931d3ce.zip

  1. 修改zstd文件:
gedit ~/ros2_humble/src/ros2/rosbag2/zstd_vendor/CMakeLists.txt

https://github.com/facebook/zstd.git替换成http://119.29.41.151:1080/facebook/zstd.git

  1. 修改rviz_ogre_vendor文件:
gedit ~/ros2_humble/src/ros2/rviz/rviz_ogre_vendor/CMakeLists.txt

https://github.com/OGRECave/ogre/archive/v1.12.1.zip替换成http://www.aigrantli.com:1080/OGRECave/ogre/uploads/cd24c66dba620eff336b1cfd816290b6/v1.12.1.zip

  1. 修改orocos_kdl_vendor文件:
gedit ~/ros2_humble/src/ros2/orocos_kdl_vendor/orocos_kdl_vendor/CMakeLists.txt

https://github.com/orocos/orocos_kinematics_dynamics.git替换成http://119.29.41.151:1080/orocos/orocos_kinematics_dynamics.git

  1. 修改uncrustify_vendor文件:
gedit ~/ros2_humble/src/ament/uncrustify_vendor/CMakeLists.txt

https://github.com/uncrustify/uncrustify.git替换成http://119.29.41.151:1080/uncrustify/uncrustify.git

  1. 修改google_benchmark_vendor文件:
gedit ~/ros2_humble/src/ament/google_benchmark_vendor/CMakeLists.txt

https://github.com/google/benchmark.git替换成http://119.29.41.151:1080/google/benchmark.git

  1. 修改mimick_vendor文件:
gedit ~/ros2_humble/src/ros2/mimick_vendor/CMakeLists.txt

https://github.com/ros2/Mimick.git替换成http://119.29.41.151:1080/ros2/mimick.git

  1. 修改console_bridge_vendor文件:
gedit ~/ros2_humble/src/ros2/console_bridge_vendor/CMakeLists.txt

https://github.com/ros/console_bridge/archive/1.0.2.tar.gz替换成http://www.aigrantli.com:1080/ros/console_bridge/-/archive/1.0.2/console_bridge-1.0.2.tar.gz

参考文献

2

评论区