How to publish tf topic for slam_gmapping?
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:
- roscore
- rosrun urg_node urg_node _ip_address:=192.168.1.11
- rosbag record -O mylaserdata /scan /tf
After I record completed I close all terminals then I follow these steps:
- rosmake gmapping
- roscore
- rosparam set use_sim_time true
- rosrun gmapping slam_gmapping scan:=scan
- rosbag play --clock mylaserdata.bag
- 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