使用cartographer_ros(在线/离线)构建地图后保存地图的方法

1,安装cartographer

请看我写的这篇文章虽然我使用的是ubuntu18.04的melodic版本的ROS,但是ROS是兼容的,即你的ROS版本和系统和我的不同,也可以使用这篇文章的方法正确的安装。

2,使用cartographer构建号地图后怎么保存成yaml和png文件呢?

关于cartographer_ros的文档,官方有提供,请看这里

2.1 保存地图

  1. 当使用cartographer在线建图时,cartographer不知道什么时候结束,所以要先调用服务来关闭传感器数据的接收。
rosservice call /finish_trajectory 0
  1. 将当前地图信息的快照保存为后缀名为.pbstream
# Ask Cartographer to serialize its current state.
# (press tab to quickly expand the parameter syntax)
rosservice call /write_state "{filename: '<绝对路径存放地图信息>/<地图保存的名字>.pbstream', include_unfinished_submaps: 'true'}"
  1. 通过cartographer提供的ros包,将后缀名为.pbstream的地图信息,转化成ros地图信息
rosrun cartographer_ros cartographer_pbstream_to_ros_map -map_filestem=<保存地图的绝对路径>/<地图命名> -pbstream_filename=<存放pbstream地图快照信息的绝对地址>/<filename>.pbstream -resolution=0.05

2.2 也可以尝试使用map_server保存地图

rosrun map_server map_saver map:=/<your map topic> -f <map_name>

不过保存cartographer的地图不是特别好,不推荐。

  • 5
    点赞
  • 40
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值