文章目录
前言
ubuntu20.04不支持navigation2-humble版本编译,于是使用docker环境进行navigation2-humble版本编译
一、navigation2是什么?
navigation2是ros2中常用的导航模块,ros2版本众多,navigation2-humble是其中一个较新的版本,其支持的功能模块也最全。
二、使用步骤
1.docker环境准备
docker安装参考其他教程
2.镜像下载及容器启动
sudo docker pull osrf/ros:humble-simulation
docker run -it --restart=always --name ros2humble --gpus all -v /home/xujin:/home/xujin osrf/ros:humble-simulation /bin/bash
3.下载navigation2源码
navigation2源码
4.进行容器进行编译
docker exec -it a4b1d4cf2fc8 /bin/bash
进入navigation2-humble上一级目录进行依赖安装
apt-get update
rosdep install -i --from-path navigation2-humble --rosdistro humble -y
编译
colcon build
可能会遇到如下问题
setuptools版本问题,需要重新安装版本
pip install setuptools==58.2.0
再次编译正常
5.cartographer编译
官网下载cartographer及cartographer-ros源码,将其添加至src目录
先编译abseil
cd scripts/
sudo apt install ninja-build
sudo apt install stow
sh install_abseil.sh
再安装相关依赖编译
sudo apt install libceres-dev
sudo apt install liblua5.3-dev
sudo apt install libcairo2-dev
sudo apt install libpcl-dev
sudo apt install ros-humble-pcl-conversions
sudo apt install python3-sphinx
colcon build
至此建图也编译成功
总结
安装过程中可能会遇到pull镜像失败问题,需要更换源