Rosanswers logo

System Ubuntu 18.04 ROS Melodic

I am trying to create a 2D map by using Hokuyo LIDAR. I managed to record LIDAR data by following urg_node tutorial then I followed slam_gmapping tutorial. I created my own bag file but I couldn't make a map. I saw "waiting for the map" error and it keeps waiting.

While searching for possible solutions I saw that in the slam_gmapping tutorial rosbag tries to record tf topic but I am not publishing it. So how can I publish it?

Here are the steps I followed:

  1. roscore
  2. rosrun urg_node urg_node _ip_address:=
  3. rosbag record -O mylaserdata /scan /tf

After I record completed I close all terminals then I follow these steps:

  1. rosmake gmapping
  2. roscore
  3. rosparam set use_sim_time true
  4. rosrun gmapping slam_gmapping scan:=scan
  5. rosbag play --clock mylaserdata.bag
  6. rosrun map_server map_saver

Here is result when I use rosbag info mylaserdata.bag:

path:        mylaserdata.bag
version:     2.0
duration:    53.2s
start:       Oct 03 2019 10:15:58.93 (1570086958.93)
end:         Oct 03 2019 10:16:52.13 (1570087012.13)
size:        15.3 MB
messages:    1827
compression: none [21/21 chunks]
types:       sensor_msgs/LaserScan [90c7ef2dc6895d81024acba2ac42f369]
topics:      /scan   1827 msgs    : sensor_msgs/LaserScan

I downloaded a bag file from tutorial and here is the info of it:

path:        basic_localization_stage.bag
version:     2.0
duration:    35.5s
start:       Jan 01 1970 02:02:04.63 (124.63)
end:         Jan 01 1970 02:02:40.10 (160.10)
size:        462.6 KB
messages:    3617
compression: none [1/1 chunks]
types:       rosgraph_msgs/Clock   [a9c97c1d230cfc112e270351a944ee47]
             rosgraph_msgs/Log     [acffd30cd6b6de30f120938c17c593fb]
             sensor_msgs/LaserScan [90c7ef2dc6895d81024acba2ac42f369]
             tf/tfMessage          [94810edda583a504dfda3829e70d7eec]
topics:      /base_scan      24 msgs    : sensor_msgs/LaserScan
             /clock        3515 msgs    : rosgraph_msgs/Clock  
             /rosout          2 msgs    : rosgraph_msgs/Log    
             /rosout_agg      2 msgs    : rosgraph_msgs/Log    
             /tf             74 msgs    : tf/tfMessage

Originally posted by wallybeam on ROS Answers with karma: 57 on 2019-10-03

Post score: 0


1 Answer 1


Rosanswers logo

From the tutorial Making your own bag where you found the rosbag record command, you might have overlooked this :

  1. Bring up your robot, with laser scans and transform data published

You are only using urg_node so you only initialize the laser scans, you have ommited the transform and you have to use other nodes to create them. That would be robot_state_publisher using the URDF of the lidar.

Originally posted by Delb with karma: 3907 on 2019-10-04

This answer was ACCEPTED on the original site

Post score: 0


Your Answer

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