参考链接:https://blog.csdn.net/qq_26482237/article/details/92676267
ROS版本为kinetic 系统为Ubuntu16.04 工作空间名称为carto_ws
- 安装工具
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
- 初始化工作空间
cd carto_ws
wstool init src
- 加入cartographer_ros.rosinstall并更新依赖
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
输入完第一个命令后需要改文件的下载地址,另起终端输入:
gedit carto_ws/src/.rosinstall
将最后一个git来源网址由https://ceres-solver.googlesource.com/ceres-solver.git改为https://github.com/ceres-solver/ceres-solver.git,,如该果可以挂VPN可以不改。
wstool update -t src
- 工作空间下安装proto否则编译会出错
src/cartographer/scripts/install_proto3.sh
- 安装依赖并下载cartographer相关功能包
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y
(我默认版本为kinetic,若是其他ROS版本相应替换)
- 编译并安装
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash
可以将这个命令放到bashrc文件中,否则每次运行demo都需要输入一遍,否则找不到launch文件
- 测试
2D包 .
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
如果下载速度慢,直接去网页下载。
3D 包
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag
- 我遇到的问题
编译时候rviz报错,错误原因是自动依赖了的pcl-1.9,应该依赖pcl-1.7。这个版本需要指定在cmake中,路径为:~/carto_ws/src/cartographer_ros/cartographer_ros/CMakeLists.txt