10.4Cartographer介绍与安装.md 3.4 KB

10.4 Cartographer介绍与安装

1.Cartographer介绍

cartographer

Cartographer是Google开源的一个可跨多个平台和传感器配置以2D和3D形式提供实时同时定位和建图(SLAM)的系统。

github地址:https://github.com/cartographer-project/cartographer 文档地址:https://google-cartographer.readthedocs.io/en/latest

在小鱼呆过的机器人公司里,建图最终方案都是采用了Cartographer,甚至花费大量人力物力对Cartographer算法进行裁剪,这足以表明Cartographer算法的优越性。

Cartographer系统架构概述(简单看看即可,如果大家后面确定研究方向是SLAM可以深入学习):

简单的可以看到左边的可选的输入有深度信息、里程计信息、IMU数据、固定Frame姿态。

系统概述

2.Carttographer安装

2.1 apt安装

安装carotgrapher

sudo apt install ros-foxy-cartographer

需要注意我们不是直接使用cartographer,而是通过cartographer-ros功能包进行相关操作,所以我们还需要安装下cartographer-ros

sudo apt install ros-foxy-cartographer-ros

2.2 源码安装

小鱼比较推荐源码安装的方式,毕竟是以学习为目的,我们后面要稍微看一下源码。

将下面的源码克隆到fishbot_ws的src目录下:

git clone https://ghproxy.com/https://github.com/ros2/cartographer.git -b foxy
git clone https://ghproxy.com/https://github.com/ros2/cartographer_ros.git -b dashing

安装依赖

这里我们使用rosdepc进行依赖的安装,rosdepc指令找不到可以先运行下面的一键安装命令,选择一键配置rosdep即可。

wget http://fishros.com/install -O fishros && . fishros

接着在fishbot_ws下运行下面这个命令进行依赖的安装。

rosdepc install -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y

编译

这里有一个新的命令--packages-up-to,意思是其所有依赖后再编译该包

colcon build --packages-up-to cartographer_ros

2.3 测试是否安装成功

如果是源码编译请先source下工作空间后再使用下面指令查看是否安装成功;

ros2 pkg list | grep cartographer

能看到下面的结果即可

cartographer_ros
cartographer_ros_msgs

可能你会好奇为什么没有cartographer,因为cartographer包的编译类型原因造成的,不过没关系,cartographer_ros依赖于cartographer,所以有cartographer_ros一定有cartographer。

3.Cartographer参数配置

作为一个优秀的开源库,Cartographer提供了很多可以配置的参数,虽然灵活性提高了,但同时也提高了使用难度(需要对参数进行调节配置),所以有必要在正式使用前对参数进行基本的介绍。

4.总结

本节我们简单的介绍了Cartographer以及二进制和源码安装的方法,下一节我们就开始为fishbot配置cartographer,接着就可以使用fishbot进行建图了。


技术交流&&问题求助:

  • 微信公众号及交流群:鱼香ROS
  • 小鱼微信:AiIotRobot
  • QQ交流群:139707339

  • 版权保护:已加入“维权骑士”(rightknights.com)的版权保护计划