ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

problem with building a map from a bag file

asked 2015-12-10 22:00:06 -0500

A.M Dynamics gravatar image


I am trying to build a map from a bag file (captured from a real Hokuyo) but when I run map server to save the map I receive a massage that saying “waiting for a map”.

I have already searched ros wiki for the same problem and someone said that the problem happens because the topics of bag file and gmapping can not link to each other, so I remapped the topic of bag file to gmapping(from /base to /base_scan). However, the problem has still remained. I would appreciate it if you help me out.

Here is the steps I follow


2-rosparam set use_sim_time true

3-rosrun gmapping slam_gmapping scan:=base_scan

4-rosbag play --clock mylaserdata.bag /base:=/base_scan

5-rosrun map_server map_saver

edit retag flag offensive close merge delete


Do you actually see that the map is being built from gmapping in rviz? If yes, check what the topics from gmapping are with rosnode info /slam_gmapping and that the /map topic is sent out correctly.

mgruhler gravatar image mgruhler  ( 2015-12-11 02:24:20 -0500 )edit

Thanks but I do not understand you at all. I think the message "waiting for a map" means that no map is produced, so how I can visualize it rviz? and for your second statement I do not understand to exactly check what with what? I would appreciate it if you clear it out.

A.M Dynamics gravatar image A.M Dynamics  ( 2015-12-12 11:26:26 -0500 )edit

This is the information that provides: Node [/slam_gmapping] Publications: * /map_metadata [nav_msgs/MapMetaData] * /rosout [rosgraph_msgs/Log] * /tf [tf2_msgs/TFMessage] * /map [nav_msgs/OccupancyGrid] * /slam_gmapping/entropy [std_msgs/Float64]

A.M Dynamics gravatar image A.M Dynamics  ( 2015-12-12 12:14:40 -0500 )edit

and the rest is: Subscriptions: * /tf_static [unknown type] * /base_scan [unknown type] * /tf [tf2_msgs/TFMessage] Now what I should do?

A.M Dynamics gravatar image A.M Dynamics  ( 2015-12-12 12:15:31 -0500 )edit

/slam_gmapping node is waiting for messages in a few topics. You need to publish also /tf_static, so you need to run rosbag record -O data.bag /scan /tf /tf_static

mundobot gravatar image mundobot  ( 2017-11-01 01:22:39 -0500 )edit

@A.M.Dynamics I am having the same issue here. Can you please let me know how did you fix this. I am using ROS Melodic Ubuntu 18.04.

KcR gravatar image KcR  ( 2020-08-19 01:12:09 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2015-12-18 08:58:36 -0500

mgruhler gravatar image

Given your output, you have no subscription from the slam_gmapping node to any laserscanner message. You can see this from the following line:

* /base_scan [unknown type]
* /tf [tf2_msgs/TFMessage]

It should read

* /base_scan [sensor_msgs/LaserScan]
* /tf [tf2_msgs/TFMessage]

Then you know, that there is actually (at least) one of each, subscriber and publisher, open on this topic. So you most probably have a wrong remapping on the scan topic.

If you need more help, please upload the relevant parts of your launch file and probably the rosbag play command you use.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-12-10 22:00:06 -0500

Seen: 1,351 times

Last updated: Dec 18 '15