本人为了对比研究三大经典SLAM算法(Gmapping、Cartographer、Hector)的优缺

因此考虑在Turtlebot3仿真环境下对这三个SLAM算法进行测试。

没想到测试第一个算法(Google的cartographer)就花了我将近一天的时间,现在把个人实现过程记录下来。

一、环境准备

ubuntu16.04  + ROSkinetic版本

如果只想跑下google的cartographer 算法的 看本篇

如果想cartographer算法结合Turtlebot3上的仿真实现的 建议直接看中下篇

二、最简单跑起来cartographer算法的安装方法(建议人群:只想跑cartographer)

先甩一个链接https://www.cnblogs.com/hitcm/p/5939507.html 感谢 hitcm大神的贡献

同时借鉴了https://blog.csdn.net/xmy306538517/article/details/81455625

自己测试了下,果然一遍测试成功

1. 安装依赖项

sudo apt-get install -y google-mock libboost-all-dev  libeigen3-dev libgflags-dev libgoogle-glog-dev liblua5.2-dev libprotobuf-dev  libsuitesparse-dev libwebp-dev ninja-build protobuf-compiler python-sphinx  ros-kinetic-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev

2.安装ceres solver 版本1.11

git clone https://github.com/hitcm/ceres-solver-1.11.0.git
cd ceres-solver-1.11.0
mkdir build
cd build
cmake ..
make -j4
sudo make install

3.安装cartographer

git clone https://github.com/hitcm/cartographer.git
cd cartographer
mkdir build
cd build
cmake .. -G Ninja
ninja
ninja test
sudo ninja install

4.安装cartographer_ros

#初始化工作空间
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
echo "source catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
 
#安装cartographer_ros
cd ~/catkin_ws/src
git clone https://github.com/hitcm/cartographer_ros.git
cd ~/catkin_ws
catkin_make

5.数据测试下载

2D数据下载:https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag

2D例程运行:

roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag

3D数据下载:https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/cartographer_3d_deutsches_museum.bag

3D例程运行

roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/cartographer_3d_deutsches_museum.bag

运行效果: