声明:
系统:ubuntu16.04,ros-kinetic
本文主要参考hitcm的博客:https://www.cnblogs.com/hitcm/p/5939507.html
老规矩,先上图(当前仅测试了2D数据):
Screenshot from 2018-11-02 22-35-23.png1.首先安装依赖包
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
注意:ros-kinetic-tf2-eigen根据自己ros的版本修改,如indigo版本改为ros-indigo-tf2-eigen即可。
2.安装ceres solver
路径随意,建议先创建一个零时目录,然后在里面安装ceres solver和cartographer。
git clone https://github.com/hitcm/ceres-solver-1.11.0.git
cd ceres-solver-1.11.0
mkdir build
cd build
cmake ..
make
sudo make install
说明:hitcm的博客第6步用得make -j,本人直接运行电脑会卡死,原因暂时未知。
3.安装 cartographer
git clone https://github.com/hitcm/cartographer.git
cd cartographer
mkdir build
cd build
cmake ..
make
sudo make install
4.安装cartographer_ros
这里直接用hitcm的代码了(核心代码不变,只是修改了编译文件),亲测可用。
git clone https://github.com/hitcm/cartographer_ros.git
下载到catkin_ws下面的src文件夹下面,然后到catkin_ws下面运行catkin_make构建工作空间即可,若直接catkin_make出错,可尝试:
catkin_make_isolated --install --use-ninja
5.测试数据下载
2D数据,大概500M,建议用迅雷下载(本人只测试了2D数据):
https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
3D数据,8G左右,同样用迅雷下载:
https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/cartographer_3d_deutsches_museum.bag
若上面链接失效了,请用下面的:
https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/b3-2016-04-05-14-14-00.bag
6.运行launch文件
注意:请根据自己保存.bag文件的路径修改“=”后面的文件路径。
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=/home/Downloads/cartographer_paper_deutsches_museum.bag
或:
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=/home/Downloads/cartographer_3d_deutsches_museum.bag
补充(本段内容本人未遇到):
刚开始使用ROS的同学运行下面两句是无法工作的,可能出现的错误如下。
[demo_backpack_2d.launch] is neither a launch file in package [cartographer_ros] nor is [cartographer_ros] a launch file name
The traceback for the exception was written to the log file
这种错误的主要原因是ros的catkin_ws配置问题,可以运行rospack profile试试。
实在不行还有如下所示的两种解决方法。推荐第二种。
image.png
网友评论