Ubuntu 18.04 安装cartographer

环境:Ubuntu 18.04
ROS:Melodic

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-melodic-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev

2. 安装ceres-solver,随意路径

安装ceres-solver时,如安装低版本或者高版本都会出现不兼容而报错的现象,解决方法如下:

安装[seres-solver-1.13.0],此操作可能需要梯子(https://ceres-solver.googlesource.com/ceres-solver/+/refs/tags/1.13.0)
点击图中按钮下载:[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Ak44k94B-1610967069869)(1.png)]
下载完后,解压->新建build文件夹

$ cd ceres-solver-1.13.0/ build
$ cmake ..
$ make –j
$ sudo make install

3.安装cartographer,也是随意路径

$ git clone https://github.com/cartographer-project/cartographer.git
$ cd cartographer/build
$ cmake ..
$ make
$ sudo make install

安装时会出现以下问题:编译时出现缺少absl包

-- Found GMock: gmock_main;-lpthread
CMake Error at CMakeLists.txt:32 (find_package):
By not providing "Findabsl.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "absl", but
CMake did not find one.

Could not find a package configuration file provided by "absl" with any of
the following names:

abslConfig.cmake
absl-config.cmake

Add the installation prefix of "absl" to CMAKE_PREFIX_PATH or set
"absl_DIR" to a directory containing one of the above files. If "absl"
provides a separate development package or SDK, be sure it has been
installed.

解决方法

下载cartographer上有安装absl的脚本,装完后再次运行上面的安装程序。

$ sudo apt-get install stow
$ sudo chmod +x ~/catkin_ws/src/cartographer/scripts/install_abseil.sh
$ cd ~/catkin_ws/src/cartographer/scripts
$ ./install_abseil.sh

4.安装cartographer_ros

$ git clone https://github.com/cartographer-project/cartographer_ros.git

然后到catkin_ws下运行catkin_make即可。

5.官方数据下载测试,搭了梯子很快:

2d数据500M

3d数据8G左右

然后运行launch文件即可。

roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=/home/mckros/cartographer_paper_deutsches_museum.bag

效果如下:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-28mzWC74-1610967069872)(2.png)]

3d数据没有测试:

roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=/home/mckros/cartographer_3d_deutsches_museum.bag

Reference:

  1. https://www.cnblogs.com/hitcm/p/5939507.html

猜你喜欢

转载自blog.csdn.net/xiaokai1999/article/details/112791787