How to mark location in occupancy grid map?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to mark location in occupancy grid map?

yincanben
Hello,
    When I built a occupancy grid map,Then I want to navigation with it. I can obtain the actual location in the world frame.How to establish corresponding relationship between the location in the occupancy grid map and the location of in the real world?
    Also,I want to inquire how to save the occupancy grid?I have tried to run map_server,but it can't work.
    Thank you in advance.
Reply | Threaded
Open this post in threaded view
|

Re: How to mark location in occupancy grid map?

matlabbe
Administrator
The referential of the map is from where the robot is started, at (0,0,0) on the map frame. The relation between the /map referential and the /world referential is up to you.

/world -> /map -> /odom -> /base_link

The map_server is not really useful if you use already the grid_map_assembler node. If you still want to save the map using map_server, you can do that (example with the robot demo):
$ roslaunch rtabmap_ros demo_robot_mapping_rviz.launch
$ rosbag play --clock demo_mapping.bag
$ rosrun map_server map_saver map:=rtabmap/grid_map

[ INFO] [1418918495.308835788]: Waiting for the map
[ INFO] [1418918513.666870631, 1368730049.014493602]: Received a 531 X 245 map @ 0.050 m/pix
[ INFO] [1418918513.666947571, 1368730049.014493602]: Writing map occupancy data to map.pgm
[ INFO] [1418918513.670619867, 1368730049.014493602]: Writing map occupancy data to map.yaml
[ INFO] [1418918513.670841755, 1368730049.014493602]: Done

When restarting the robot in localization mode, you can regenerate the grid map from the database by calling /publish_map service:
$ rosservice call /rtabmap/publish_map 1 1 0
If there is a grid_map_assembler subscribed to rtabmap_ros/MapData topic from rtabmap node, it will regenerate the grid map.