ROS进阶学习(六)-- 谷歌Cartographer安装测试1

时间:2023-02-03 09:43:39

由于slam_gmapping对里程计的严重依赖建图效果并不理想,尝试谷歌的Cartographer。再不使用OpenCV,PCL,g2o这些流量杀手的情况下能建出如此效果的地图还是让人惊叹的。简单说下原理:就是用Grid(2D/3D)的形式建地图;局部匹配直接建模成一个非线性优化问题,利用IMU提供一个比较靠谱的初值;后端用Graph来优化,用分支定界算法来加速;2D和3D的问题统一在一个框架下解决。(引用知乎--邵天兰

0.安装所有依赖项

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-indigo-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev
1.首先安装ceres solver,选择的版本是1.11,路径随意
1.     git clone https://github.com/hitcm/ceres-solver-1.11.0.git

2.      cd ceres-solver-1.11.0/build

3.      cmake ..

4.      make –j

5.      sudo make install

2.然后安装 cartographer,路径随意

1.      git clone https://github.com/hitcm/cartographer.git

2 .     cd cartographer/build

3.       cmake .. -G Ninja

4.       ninja

5.       ninja test

6.       sudo ninja install 
3.安装cartographer_ros。
谷歌官方提供的安装方法比较繁琐,我对原来的文件进行了少许的修改,核心代码不变,只是修改了编译文件

下载到catkin_ws下面的src文件夹下面

git clone https://github.com/hitcm/cartographer_ros.git

然后到catkin_ws下面运行catkin_make即可。 

4.数据下载测试

2d数据,大概470M,用迅雷下载

https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
然后运行launch文件即可。

roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
ROS进阶学习(六)-- 谷歌Cartographer安装测试1

参考:https://www.cnblogs.com/hitcm/p/5939507.html