Ask Your Question
0

Export 2D map from Rviz and/or RTAB-Map

asked 2015-09-04 15:19:37 -0600

kenshin23 gravatar image

I've been working through my undergrad thesis based on ROS and RTAB-Map (questions about it here and here and need a little more help with one last issue. My thesis tutor is asking me whether he can use maps generated with RTAB-Map in Player/Stage, and since I'm still new with the software, I expect that the answer would be yes, but that I would need to export the 2D projection first and I don't know how to do that and what image format to expect from this.

Could anyone shed some light on this, please?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2015-09-04 17:17:25 -0600

matlabbe gravatar image

Hello,

I assume that you want to use the map generated by RTAB-Map for simulation experiments using Stage. It is possible to create a .world for Stage referencing an image (e.g. black pixels are walls). Here is an example to generate such images from an already built database. Using IROS14-kinect-challenge.db from this RTAB-Map's tutorial:

$ roscore
$ rosrun rtabmap_ros rtabmap _database_path:=IROS14-kinect-challenge.db
$ rosrun map_server map_saver map:=proj_map
$ rosservice call /publish_map 1 1 0

This takes some time for rtabmap node to build the projection map, but you should see this in the terminal of the map_saver:

[ INFO] [1441403556.668234515]: Waiting for the map
[ INFO] [1441403565.477020944]: Received a 508 X 420 map @ 0.050 m/pix
[ INFO] [1441403565.477108000]: Writing map occupancy data to map.pgm
[ INFO] [1441403565.482476945]: Writing map occupancy data to map.yaml
[ INFO] [1441403565.482683795]: Done

You may need to convert the PGM to a BMP for stage and change all the grey pixels to white. The map.pgm:

image description

map.yaml:

image: map.pgm
resolution: 0.050000
origin: [-9.033475, -11.844757, 0.000000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196

cheers

edit flag offensive delete link more

Comments

Is this method still legit? Because I followed as described, but when I call the rosservice I get the following output:

[ WARN] (2018-05-25 08:02:27.803) CoreWrapper.cpp:2333::publishMapCallback() No subscribers, don't need to publish!

arseen gravatar imagearseen ( 2018-05-25 01:03:36 -0600 )edit

Yes, is map_server subscribed to right topic? If rtabmap node is in rtabmap namespace (like when using rtabmap.launch) you may subscribe to /rtabmap/grid_map instead.

matlabbe gravatar imagematlabbe ( 2018-05-25 15:07:21 -0600 )edit

Thanks! It works now. Another question, that kinda relates to this one .. Is it possible to use the rtabmap db to create a .world file to use in gazeboo? For simulation purposes?

arseen gravatar imagearseen ( 2018-05-28 05:43:23 -0600 )edit

I think it is possible to do an extruded height map from a 2D occupancy grid (see this answer). Then import the mesh to gazebo. You could also use RTAB-Map standalone File->Export Cloud... to export a mesh with textures.

matlabbe gravatar imagematlabbe ( 2018-05-28 15:29:46 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2015-09-04 15:19:37 -0600

Seen: 2,817 times

Last updated: Sep 04 '15