【踩坑指南】Cartographer踩坑指南
一、推荐方法(古月居代码)
- 建议直接使用古月居提供的工程:cartographer工程
- 步骤:
- 编译:
catkin_make_isolated --install --use-ninja
- 启动Gazebo(功能包在
catkin_ws_guyue6
工程下):roslaunch mbot_gazebo mbot_laser_nav_gazebo.launch
- 启动Cartegrapher(功能包在
google_ws
工程下):roslaunch cartographer_ros cartographer_demo_rplidar.launch
- 启动键盘控制节点(功能包在
catkin_ws_guyue6
工程下):roslaunch mbot_teleop mbot_teleop.launch
- 编译:
- 存在问题:地图保存为
.pbstream
后无法直接转换为ROS格式地图(.png
&.yaml
)
(暂未解决) - 原因分析:
cartographer
和cartographer_ros
功能包与官网最新版本不同,缺少地图转换需要的pbstream_to_ros_map_main.cc
及其相关的.launch
等文件。 - 参考文档:
二、安装
1. 官方文档
官方文档:Cartographer ROS和Cartographer
- 官方安装文档 (最终未成功)
- 遇到问题:
wstool merge
:
ERROR in config: Unable to download URL [https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall]: <urlopen error [Errno 110] Connection timed out>
- 解决方案:打开网址,手动将内容复制至
catkin_cartographer_ws/src/.rosinstall
注意换行后用4个空格而不能用# THIS IS AN AUTOGENERATED FILE, LAST GENERATED USING wstool ON 2022-01-14 - git: local-name: cartographer uri: 'https://github.com/cartographer-project/cartographer.git' version: 'master' - git: local-name: cartographer_ros uri: 'https://github.com/cartographer-project/cartographer_ros.git' version: 'master' - git: local-name: ceres-solver uri: 'https://github.com/ceres-solver/ceres-solver.git' version: 'master'
Tab
rosdep update
问题:
最终还是参考了ROS noetic ubuntu20.04 版本 rosdep init,rosdep update 问题解决方法,手动下载。- 问题:
参考安装cartographer,找不到 “absl” 解决方法。- protobuf报错:
- 解决方案:需要升级至protobuf3
- 参考:ProtoBuf3安装与使用
- 一些有用的参考:
- protobuf报错:
2. 其他教程
- 极速安装cartographer:(未尝试)推荐优先(使用没安装过cartographer的电脑)尝试!
- 谷歌Cartographer学习(1)-快速安装测试:尝试,但失败了
- ROS与SLAM入门教程-cartographer在Turltlebot的应用1-官方安装及补充:(未尝试)关于
ceres-solver
报错的解决方案 - 安装cartographer出现的问题及解决方法:一些问题的解决,作用不太大
三、地图保存方法
- 官方推荐:
- 使用
offline_pbstream_to_rosmap.launch
:roslaunch cartographer_ros offline_pbstream_to_rosmap.launch pbstream_filename:=${HOME}/Documents/map.pbstream map_filestem:=${HOME}/Documents/map resolution:=0.05
- 使用
offline_pbstream_to_rosmap.launch
:rosrun cartographer_ros cartographer_pbstream_to_ros_map -map_filestem=${HOME}/Documents/map -pbstream_filename=${HOME}/Documents/map.pbstream -resolution=0.05
- 使用修改的
map_server
:map server for cartographer - 其他参考:
- cartographer离线利用pbstream生成ros标准格式地图
- cartographer生成ros格式地图:结合上一条,靠谱!
- How to save the map #1032
- I can’t convert pbstream file into yaml file. Can I help you solve it? #1293
- cartographer-保存.pbstream地图:生成pbstream文件那句可能会报错
- cartographer建图完成后如何保存
6 相关问题: - I can’t convert pbstream file into yaml file. Can I help you solve it? #1293
- cartographer_pbstream_to_ros_map: Check failed: cairo_image_surface_get_format(surface.get()) == kCairoFormat (-1 vs. 0) #1203