Ubuntu20.04+ros-noetic配置Cartographer

一、概述

        因为要配置激光SLAM,Cartographer属于激光雷达SLAM 中比较经典的一款,在学习之前先将其在Ubuntu20.04首先配置出来并成功运行demo。

二、具体操作

(一)概述

        使用平台是Windows的wsl2上的Ubuntu20.04子系统,双系统与虚拟机的安装原理与这个相同。主要依照的安装操作是官方文档,链接如下所示。

Running Cartographer ROS on a demo bag — Cartographer ROS documentationicon-default.png?t=O83Ahttps://google-cartographer-ros.readthedocs.io/en/latest/demos.html        按照官方流程大概能安装下来,中间可能有些报错,这里将逐一分析我在安装过程中遇到的报错。

(二)操作流程

        1.安装依赖

        因为我的ros版本是noetic,所以根据官方的流程,我要进行这样的安装。如下所示、

sudo apt-get update
sudo apt-get install -y python3-wstool python3-rosdep ninja-build stow

        如果是之前的版本的话,可以使用下面的命令安装依赖。

sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build stow

        2.下载包

        按照官方文档操作将cartographer下载下来。官方文档中caktin_ws可以更换为其他的包名。例如我将其更换为了CartographerSLAM

mkdir catkin_ws
cd catkin_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src

        3. 配置依赖

       (1)运行        

        此步骤也是安装官方文档的操作进行即可,其命令以此如下面所示。需要将

${ROS_DISTRO}更改为noetic版本。
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=noetic -y

         需要注意的是,在官方文档中的更新命令如图所示。

        意思是假如之前使用rosdep init的话,这次使用会出现错误,但这个错误对之后没有什么影响,可以忽略掉。

        (2)报错

        这里会出现关于libabsl-dev的问题,如下所示

         报错的原因是因为无法安装这个依赖。

        在github上进行查询后,发现了这样的解决方法,链接如下所示。

Error while installing dependencies: libabsl-dev not available · Issue #1726 · cartographer-project/cartographer_ros · GitHubI tried installing cartographer ros on a newly set up ubuntu system (20.04.4 LTS with ros noetic installed) and followed the following steps of the documentation: sudo apt-get update sudo apt-get install -y python3-wstool python3-rosdep ...icon-default.png?t=O83Ahttps://github.com/cartographer-project/cartographer_ros/issues/1726        大致的解决思路是,将这个包在package.xml文件中的位置给注释掉。如下所示,注意是图中红色划出来的包。

        在下面将其注释掉,如图所示。

         之后这个依赖库会手动进行安装的,在这里不用担心。

        4.编译

        (1)运行命令
src/cartographer/scripts/install_abseil.sh

        再运行下面的命令,将可能的版本冲突避免掉,如下所示,由于我的版本是noetic版本,官网上面的ros版本号,我替换为noetic版本。

sudo apt-get remove ros-noetic-abseil-cpp

         在依赖安装完成后,进行编译,输入如下的命令。命令来源于官方。

catkin_make_isolated --install --use-ninja
        (2)报错

        如图所示,直接运行会出现下面的报错。

        这个地方出现报错的原因是,多个ceres库之间的版本出现了问题。导致出现多个版本的原因是因为之前在我的系统上面,我安装过ceres库。将之前那个库删除即可。再运行一遍上面安装依赖的命令。再次编译即可编译通过。

        参考链接如下。https://github.com/cartographer-project/cartographer/issues/1901icon-default.png?t=O83Ahttps://github.com/cartographer-project/cartographer/issues/1901

        5.跑示例包

        官方网站参考如下。

Running Cartographer ROS on a demo bag — Cartographer ROS documentationicon-default.png?t=O83Ahttps://google-cartographer-ros.readthedocs.io/en/latest/demos.html

  • 18
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

GFCGUO

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值