一、前言

本文的最后目的是实现Google的cartographer SLAM算法跑在Turtlebot3机器人的仿真环境上

作者这样做的目的是为了横向对比三大经典SLAM算法(hector、gmapping、cartographer)

本文主要内容:

turtlebot3环境搭建

在Turtlebot3上的仿真环境跑cartographer建图算法

二、先直接上结果

就上一个视频截图吧,gazebo是真的强大,在Turtlebot3上跑cartographer建图算法

三、Turtlebot3环境搭建

这个直接跟创客智造的教程,应该没有坑

https://www.ncnynl.com/archives/201707/1788.html

四、在Turtlebot3上的仿真环境跑cartographer建图算法

1.(先排一个坑)修改turtlebot3_cartographer.launch

该launch文件在目录

Robot_Turtlebot3/src/turtlebot3/turtlebot3_slam/launch

修改lua配置文件

2.启动仿真地图

echo "export TURTLEBOT3_MODEL=burger" >> ~/.bashrc
roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch

3.给地图添加一个HOUSE

4.启动键盘控制小车

roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

5.运行slam算法

#运行cartographer算法
roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=cartographer
#运行hector算法
roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=hector
#运行gmapping算法
roslaunch turtlebot3_slam turtlebot3_slam.launch

这是本人在CSDN 上的第一篇文章,为了实现这个目的,前前后后一共花了好几天时间,用了无数种环境搭建的教程,踩了很多坑,最后发现其实也没那么难

在这里把整个过程记录下,一个是方便自己以后查阅,还一个是让有同样目的的读者少走弯路!有问题可以留言