ubuntu 20.04 安装源码编译 ros humble过程
公司要兼容ros1还需要ros2 这个时候不得不使用ubuntu20.04 安装 humble 但实际上在20.04上安装humble是需要在源码编译的。
根据这个帖子 https://blog.csdn.net/m0_62353836/article/details/129730981 重写一份,以应对无法下载的问题
系统配置
#检查是否为UTF-8编码,是则跳过!
locale
#非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
增加带有apt 的ros2 gpg秘钥
sudo apt update && sudo apt install curl
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
这里由于无法通过githubusercontent下载,所以这么改
sudo curl -sSL https://raw.gitmirror.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 $(. /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 \
python3-flake8-docstrings \
python3-pip \
python3-pytest-cov \
ros-dev-tools
安装Ubuntu20.04所需软件包
python3 -m pip install -U \
flake8-blind-except \
flake8-builtins \
flake8-class-newline \
flake8-comprehensions \
flake8-deprecated \
flake8-import-order \
flake8-quotes \
"pytest>=5.3" \
pytest-repeat \
pytest-rerunfailures
获取ros2源码
mkdir -p ~/ros2_humble/src
cd ~/ros2_humble
vcs import --input https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos src
这里还是无法下载需要手动下载https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos这个文件,我们可以通过在镜像网站上下载此文件然后把github.com 改成bgithub.xyz。即可首先我们下载这个文件
wget https://raw.gitmirror.com/ros2/ros2/humble/ros2.repos
其内容为
repositories:
ament/ament_cmake:
type: git
url: https://github.com/ament/ament_cmake.git
version: humble
ament/ament_index:
type: git
url: https://github.com/ament/ament_index.git
version: humble
ament/ament_lint:
type: git
url: https://github.com/ament/ament_lint.git
version: humble
ament/ament_package:
type: git
url: https://github.com/ament/ament_package.git
version: humble
ament/google_benchmark_vendor:
type: git
url: https://github.com/ament/google_benchmark_vendor.git
version: humble
ament/googletest:
type: git
url: https://github.com/ament/googletest.git
version: humble
ament/uncrustify_vendor:
type: git
url: https://github.com/ament/uncrustify_vendor.git
version: humble
eProsima/Fast-CDR:
type: git
url: https://github.com/eProsima/Fast-CDR.git
version: v1.0.24
eProsima/Fast-DDS:
type: git
url: https://github.com/eProsima/Fast-DDS.git
version: 2.6.x
eProsima/foonathan_memory_vendor:
type: git
url: https://github.com/eProsima/foonathan_memory_vendor.git
version: master
eclipse-cyclonedds/cyclonedds:
type: git
url: https://github.com/eclipse-cyclonedds/cyclonedds.git
version: releases/0.10.x
eclipse-iceoryx/iceoryx:
type: git
url: https://github.com/eclipse-iceoryx/iceoryx.git
version: release_2.0
ignition/ignition_cmake2_vendor:
type: git
url: https://github.com/ignition-release/ignition_cmake2_vendor.git
version: humble
ignition/ignition_math6_vendor:
type: git
url: https://github.com/ignition-release/ignition_math6_vendor.git
version: humble
osrf/osrf_pycommon:
type: git
url: https://github.com/osrf/osrf_pycommon.git
version: master
osrf/osrf_testing_tools_cpp:
type: git
url: https://github.com/osrf/osrf_testing_tools_cpp.git
version: humble
ros-perception/image_common:
type: git
url: https://github.com/ros-perception/image_common.git
version: humble
ros-perception/laser_geometry:
type: git
url: https://github.com/ros-perception/laser_geometry.git
version: humble
ros-planning/navigation_msgs:
type: git
url: https://github.com/ros-planning/navigation_msgs.git
version: humble
ros-tooling/keyboard_handler