一、安装cartographer
99%的博客都教你用源码安装,例如 这样 ,但是我通过这一行命令解决了
sudo apt-get install ros-melodic-cartographer*
一般不会报错,报错了就是少依赖,按照错误信息去安装就可以。这样是2进制安装,可以正常使用,但不能修改编译源码。
二、测试cartographer
1.下载.bag文件 链接: https://pan.baidu.com/s/18r_iJsACfouUXVyqBIazNw 提取码: iesg
2.roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=/home/lwh/cartographer/cartographer_paper_deutsches_museum.bag(按照自己的下载位置,定位到该.bag文件即可)
三、在工作空间中编译
在测试无误后,在工作空间内编译却无法通过。
第一个错:
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "cartographer" with
any of the following names:
cartographerConfig.cmake
cartographer-config.cmake
解决方案,将/opt/ros/melodic/share/cartographer目录下的cartographer-config.cmake复制到该目录下的cmake里。
第二个错:
CMake Error at /opt/ros/melodic/share/cartographer/cmake/cartographer-config.cmake:31 (message):
File or directory /opt/ros/melodic/share/share/cartographer/cmake
referenced by variable CARTOGRAPHER_CMAKE_DIR does not exist !
解决方案,/opt/ros/melodic/share/cartographer/cmake/cartographer-config.cmake第47行改为set_and_check(CARTOGRAPHER_CMAKE_DIR "${PACKAGE_PREFIX_DIR}/cartographer/cmake")
三、carto+move_base (抽时间更)
3.1配置cartographer
3.1.1 .lua文件
3.1.1 .launch文件
3.2配置move_base 使用
3.2.1 .launch文件
3.2.2 .yaml文件