ROS2 Foxy 安装

悲剧的发现装错版本了。。。

要求

Ubuntu 20.04(64bit)下载地址:网易开源镜像

支持UTF-8字符集,使用以下命令测试:

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

安装

添加 apt 仓库

sudo apt update && sudo apt install curl gnupg2 lsb-release
curl http://repo.ros2.org/repos.key | sudo apt-key add - 
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://mirror.tuna.tsinghua.edu.cn/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'

这里主要是因为原安装教程中的那个地址被墙了,然后为了加速安装,我们这里使用清华的tuna源。

安装相关工具

sudo apt update && sudo apt install -y 
  build-essential 
  cmake 
  git 
  libbullet-dev 
  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 
  argcomplete 
  flake8-blind-except 
  flake8-builtins 
  flake8-class-newline 
  flake8-comprehensions 
  flake8-deprecated 
  flake8-docstrings 
  flake8-import-order 
  flake8-quotes 
  pytest-repeat 
  pytest-rerunfailures 
  pytest
# install Fast-RTPS dependencies
sudo apt install --no-install-recommends -y 
  libasio-dev 
  libtinyxml2-dev
# install Cyclone DDS dependencies
sudo apt install --no-install-recommends -y 
  libcunit1-dev

安装桌面版(NO SOURCE CODE!!)

sudo apt install ros-foxy-desktop

这一步需要的时间比较久。

source code installation

error1: rcl_logging_log4cxx
Starting >>> rcl_logging_log4cxx
--- stderr: rcl_logging_log4cxx                                                                                                      
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Log4cxx_INCLUDE_DIR (missing: Log4cxx_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindLog4cxx.cmake:35 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:16 (find_package)


---
Failed   <<< rcl_logging_log4cxx [17.2s, exited with code 1]

solution:

sudo apt install liblog4cxx-dev
error2

github banned!

solution2

参考资料

ROS2 官方文档
古月居 ROS2 安装教程
在Ubuntu 20.04中安装ROS2最新版本Foxy Fitzroy
清华大学开源软件镜像站新增ros2源

注意:

古月居的教程有一步:

sudo apt update
sudo apt install ros-foxy-rmw-connext-cpp # for RTI Connext (requires license agreement)

这个东西ros-foxy-rmw-connext-cpp暂时用不到,而且执行后会在每次apt更新或者安装时提示你处理这几个connext时缺少这个rti-connext-dds-5.3.1依赖,很烦。

这个rti-connext-dds-5.3.1需要用rosdep安装(参考官方教程),如果想搞的话,可以参考之前的那篇文章,里面有处理rosdep init时rawgithubcontents被墙的替代办法,这次就先不搞了。

原文地址:https://www.cnblogs.com/LuoboLiam/p/14505202.html