cartographer_ros提供了相应的节点,直接运行即可。
Build and install.
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash
建图过程中运行:
rosservice call /write_state ~/map/carto_map.pbstream
生成.pbstream文件, 再调用下面的节点转为ros格式地图
rosrun cartographer_ros cartographer_pbstream_to_ros_map -map_filestem=/home/chenyi/map/carto_map -pbstream_filename=/home/chenyi/map/carto_map.pbstream -resolution=0.05
注意调用.pbstream文件路径要正确,如果改为~/map/carto_map.pbstream就会报错
*** Check failure stack trace: ***
@ 0x7f30706895cd google::LogMessage::Fail()
@ 0x7f307068b433 google::LogMessage::SendToLog()
@ 0x7f307068915b google::LogMessage::Flush()
@ 0x7f307068be1e google::LogMessageFatal::~LogMessageFatal()
@ 0x47d62f cartographer::io::ProtoStreamReader::ProtoStreamReader()
@ 0x47a2a1 cartographer