赞
踩
最近学习slam建图,想将自己建的图保存下来,到网上找了一些教程,都说可以利用cartographer自带的service保存地图,步骤如下所示:
- rosservice call /finish_trajectory 0
-
- rosservice call /write_state /home/tmb/map/car2.pbstream
-
- rosrun cartographer_ros cartographer_pbstream_to_ros_map -map_filestem=/home/tmb/map/car2 -pbstream_filename=/home/tmb/map/car2.pbstream -resolution=0.05
但是我第一步就报错了
- rosservice call /finish_trajectory 0
- ERROR: Unable to send request. One of the fields has an incorrect type:
- field stem must be of type str
-
- srv file:
- string stem
在网上也找不到解决办法,而且也没有/write_state这个service,因此直接利用map_server保存地图。
1.在工作空间下下载map_server
- cd ~/study_ws/src
-
- git clone https://github.com/HaoQChen/map_server.git
2.安装依赖
sudo apt-get install libsdl2-image-dev libsdl2-image-2.0-0 libsdl-image1.2 libsdl-image1.2-dev
3.编译使用
- cd ~/study_ws
-
- catkin_make
成功
利用cartographer建图后
另起终端
- mkdir map
-
- cd map
-
- source ~/study_ws/devel/setup.bash
-
- rosrun map_server map_saver -f trees
随后即可在map文件夹下发现图片
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。