Hector_slam not working with my bag file
I am trying to do hector slam using lidar SICK LMS291-s05 , but I am unable to get map with the bag file generated by me. I can get the map with the bag file that comes with the hector slam library. Please note that I don't have any odometry data, but only LIDAR scan data. This is the procedure that I followed:
A) Generating the bag file containing laser scan data using tutorial http://wiki.ros.org/sicktoolbox_wrapp...:
$ sudo chmod a+rw /dev/ttyUSB0
$ ls -l /dev/ttyUSB0
$roscore
$rosrun sicktoolbox_wrapper sicklms _port:=/dev/ttyUSB0 _baud:=38400
$ rosbag record scan
(The bag file gets generated by the name 2016-05-10-05-20-45.bag)
B) Setting parameters for hector slam as explained in the tutorial http://wiki.ros.org/hector_slam/Tutor...
To do this, I copy pasted the following from the tutorial into the /home/akashan/catkin_ws/src/hector_slam/hector_mapping/launch/mapping_default.launch file.
<param name="pub_map_odom_transform" value="true"/>
<param name="map_frame" value="map" />
<param name="base_frame" value="base_frame" />
<param name="odom_frame" value="base_frame" />
(I am not sure whether I did the part B correctly. Please someone verify this whether I have copy pasted in the right launch file or not)
C) Running Hector SLAM in RVIZ as explained in the tutorial hector SLAM tutorial http://wiki.ros.org/hector_slam/Tutor...
1) $ rosrun tf static_transform_publisher 0 0 0 0 0 0 map scanmatcher_frame 10 (I did this becuase I was getting the warning "No transform between frames /map and scanmatcher_frame available after 20.002338 seconds of waiting. This warning only prints once."). Please note that the warning got removed.
2) rosrun tf static_transform_publisher 0 0 0 0 0 0 base_footprint laser 10 (I did this becuase I was getting the error "lookupTransform base_footprint to laser timed out. Could not transform laser scan into base_frame." ). Please note that the error is not getting removed after doing this.
3) $ roslaunch hector_slam_launch tutorial.launch
4) $ rosbag play 2016-05-10-05-20-45.bag --clock
Please someone help me.
========================================================================================= Edit: The above was my question. Now, I have been able to run hector slam properly. This is what I did to get my hector slam working:
1) Played the bag file that comes with the hector_slam package (Team_Hector_MappingBox_RoboCup_2011_Rescue_Arena.bag). My hector slam used to work with this file, but not with my own bag file since the bag file I was generating didn't have any tf.
2) called view_frames to view what frames does this file publish. (sorry I can't post this pdf since it always give error that 5 points are required).
3) Based on the generated frames.pdf file, I added 6 static_transform_publisher nodes in my mapping_default.launch. The following transforms were added.
node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="0 0 0 0 0 0 map nav 20"
node pkg="tf" type="static_transform_publisher" name="map_scanmatcher_broadcaster" args="0 0 0 0 0 0 map scanmatcher_frame 25"
node pkg="tf" type="static_transform_publisher" name="nav_baselink_broadcaster" args="0 0 0 0 0 0 nav base_link 13"
node pkg="tf ...