0
$\begingroup$

Rosanswers logo

ubuntu 12.04 , Fuerte and rosbuild

I have an octomap in *.ot format which can be downloaded from https://dl.dropboxusercontent.com/u/95042389/level8_extended.ot.zip

I want to create an occupancy grid map from this. Does any one have a straight forward solution for this ?


Originally posted by sai on ROS Answers with karma: 1935 on 2014-01-16

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You can use octomap_server with your .ot file as an argument, that will load the map from file and publish it not only as an octomap but also as occupancy grid in ROS. As mentioned in the Wiki documentation, you just have to listen to the projected_map topic and there are various parameters you can set to your liking (such as minimum and maximum height of the map to consider for the projection).

Otherwise you can follow Stefan's advice and write your own map projection. Create an Octree-Iterator (as described in the OctoMap documentation, check for each node if it's occupied, and then set the corresponding coordinate in your map to occupied or free.


Originally posted by AHornung with karma: 5904 on 2014-01-20

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by sai on 2014-01-20:
I gave octomap as an argument and could display the 2d map in rviz. TO save the map, in the launch file I added these to a launch file it says that map is saved but i cannot find it

Comment by sai on 2014-01-20:
[ INFO] [1390236546.850389657]: Waiting for the map [ INFO] [1390236547.108151857]: Received a 873 X 994 map @ 0.050 m/pix [ INFO] [1390236547.108205638]: Writing map occupancy data to map.pgm [ INFO] [1390236547.131166233]: Writing map occupancy data to map.yaml [ INFO] [1390236547.131295422]: Done

Comment by sai on 2014-01-20:
I searched for map.pgm but cannot find it.

Comment by AHornung on 2014-01-20:
You can run map_saver from a different terminal and it will save the map in the current directory.

Comment by sai on 2014-01-20:
I did the same thing but i cannot find map.pgm in the current directory or at any other place too. Any suggestions

Comment by sai on 2014-01-20:
Could you tell me how i can add "rosrun map_saver map_saver -f /home/sai/my_map" into roslaunch file. I dont know how to add the base directory where the file should be saved into a roslaunch file.

Comment by sai on 2014-01-20:
Adding this line to the launch file solved the issue

I was finally able to save the map and view it. Thanks @AHornung

Comment by maxj_ros on 2019-03-24:
@sai I also want to convert an exiting octomap to 2d map, I saw your comment and try to get the launch file as following:

there is a octomap map naming result.ot in /home/maxj, issue occur when I run this launch file

[ INFO] [1553481365.104584712]: Waiting for the map

I am a newer for ROS, Is there anything wrong? what is the correct step?

correct step as following in one terminal : rosrun octomap_server octomap_server_node result.bt you can see the projected_map through rostop list

in another terminal : roslaunch xxx.launch

it works fine for me

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.