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

The map in hector_slam blinks.

asked 2014-01-29 23:50:13 -0500

alex.filgueira gravatar image

updated 2016-10-24 08:35:40 -0500

ngrennan gravatar image

Hi, I use a laser Hokuyo UTM-30LX with hector-slam in ROS hydro. I create a .bag used rosbag record -O name -a When run hokuyo_node and hector_slam. The problem is that when I play this .bag in hector_slam, the map created by hector_mapping in rviz blinks, the LaserScan and the Path are ok. And when the reproduction goes to the end, the map disappears. Someone knows why is this? Thank you very much.

EDIT: If I play my file .bag when I used rosrun rviz rviz. The map is OK but is not ok when I executed hector_slam. I want execute hector_slam and play my file .bag because I search rebuild a map and follow scan the room. This is the launch file that I use for launch hector_slam:


 <param name="/use_sim_time" value="false"/>ros

 <node pkg="rviz" type="rviz" name="rviz" 
 args="-d $(find hector_slam_launch)/rviz_cfg/mapping_demo.rviz"/>

 <include file="$(find slam_launch)/launch/hector_mapping.launch"/>

 <include file="$(find slam_launch)/launch/geotiff_mapper.launch">
 <arg name="trajectory_source_frame_name" value="scanmatcher_frame"/> 


This is the hector_mapping:


 <node pkg="hector_mapping" type="hector_mapping" name="hector_mapping"    output="screen">

 <param name="pub_map_odom_transform" value="true"/>
 <param name="map_frame" value="map" />
 <param name="base_frame" value="base_link" />
 <param name="odom_frame" value="base_link" />
 <param name="map_resolution" value="0.025"/>

 <param name="map_start_x" value="0.5"/>
 <param name="map_start_y" value="0.5" />
 <param name="laser_z_min_value" value="-2.5" />
 <param name="laser_z_max_value" value="7.5" />

  <param name="laser_max_dist" value="10" />
  <param name="map_size" value="5000"/>
  <param name="map_pub_period" value="1.0"/>
  <param name="output_timing" value="false"/>

 <param name="update_factor_free" value="0.4"/>
 <param name="update_factor_occupied" value="0.7" />    
 <param name="map_update_distance_thresh" value="0.2"/>
 <param name="map_update_angle_thresh" value="0.06" />

 <node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster"      args="0 0 0 0 0 0 /base_link /laser 100" />  


I can´t put links with my .bag but this is the output of rosbag info probatopics-7.bag :

path:        probatopics-7.bag
version:     2.0
duration:    13.2s
start:       Jan 30 2014 14:56:21.36 (1391090181.36)
end:         Jan 30 2014 14:56:34.54 (1391090194.54)
size:        317.4 MB
messages:    3236
compression: none [14/14 chunks]
types:       diagnostic_msgs/DiagnosticArray         [3cfbeff055e708a24c3d946a5c8139cd]
             dynamic_reconfigure/Config              [958f16a05573709014982821e6822580]
             dynamic_reconfigure/ConfigDescription   [757ce9d44ba8ddd801bb30bc456f946f]
             geometry_msgs/PoseStamped               [d3812c3cbc69362b77dc0b19b345f8f5]
             geometry_msgs/PoseWithCovarianceStamped [953b798c0f514ff060a53a3498ce6246]
             nav_msgs/MapMetaData                    [10cfc8a2818024d3248802c00c95f11b]
             nav_msgs/OccupancyGrid                  [3381f2d731d4076ec5c71b0759edbe4e]
             nav_msgs/Path                           [6227e2b7e9cce15051f669a5e197bbf7]
             rosgraph_msgs/Log                       [acffd30cd6b6de30f120938c17c593fb]
             sensor_msgs/LaserScan                   [90c7ef2dc6895d81024acba2ac42f369]
             sensor_msgs/PointCloud                  [d8e9c3f5afbdd8a130fd1d2763945fca]
             tf2_msgs/TFMessage                      [94810edda583a504dfda3829e70d7eec]
topics:      /diagnostics                            13 msgs    : diagnostic_msgs/DiagnosticArray        
             /hokuyo_node/parameter_descriptions      1 msg     : dynamic_reconfigure/ConfigDescription  
             /hokuyo_node/parameter_updates           1 msg     : dynamic_reconfigure/Config             
             /map                                    13 msgs    : nav_msgs/OccupancyGrid                 
             /map_metadata                            1 msg     : nav_msgs/MapMetaData                   
             /poseupdate                            483 msgs    : geometry_msgs/PoseWithCovarianceStamped
             /rosout                                 37 msgs    : rosgraph_msgs/Log                       (6 connections)
             /rosout_agg                             25 msgs    : rosgraph_msgs/Log                      
             /scan                                  522 msgs    : sensor_msgs/LaserScan                  
             /slam_cloud                            486 msgs    : sensor_msgs/PointCloud                 
             /slam_out_pose                         481 msgs    : geometry_msgs/PoseStamped              
             /tf                                   1169 msgs    : tf2_msgs/TFMessage                      (2 connections)
             /trajectory                              4 msgs    : nav_msgs/Path

EDIT2: This photo is when I make my field .bag: image description And this is when I execute my .bag and I run hector_slam: image description

edit retag flag offensive close merge delete


Did you run SLAM while recording the bag file and run it again while playing the bag file?

dornhege gravatar image dornhege  ( 2014-01-29 23:57:32 -0500 )edit

No, I only run SLAM while recording the bag file. When I playing the bag file I turn off the hokuyo_node.

alex.filgueira gravatar image alex.filgueira  ( 2014-01-30 00:18:14 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2014-01-30 00:40:16 -0500

Procópio gravatar image

updated 2014-02-10 22:57:46 -0500

This is probably happening because in your bag you have a map or transformations that are also being created by the nodes you are running to post-process the bag file. So, for example, you can have a map being published from your bag and a map being published from hector_slam.

You may try to create a bag file only with the laser topic:

rosbag record -O name /scan

In resume: take a look at hector_mapping, it only subscribes to /scan and /syscommand (this is only used to send a reset command, so you can disregard it). So if you want to create a bag file to use with your hector_slam launch file, it only requires information of the /scan topic.

edit flag offensive delete link more


I think that you be right. And How I could edit my file for run hector_slam and play my file .bag? Thank you very much!

alex.filgueira gravatar image alex.filgueira  ( 2014-01-30 02:59:27 -0500 )edit

If I create a .bag used /scan and /tf. When I reproduce this .bag in hector_slam I saw the laser scan. The problem is the map, if i use /scan /tf /map and /map_metadata, When I reproduce the .bag, the map blinks in the screen. No blinks if I execute rosrun rviz rviz, but I don´t want this.

alex.filgueira gravatar image alex.filgueira  ( 2014-01-30 05:27:12 -0500 )edit

try to record only /scan and them publish the static transformations that you have (e.g. from base to laser sensor) while playing the bag file and launching your hector launch file.

Procópio gravatar image Procópio  ( 2014-02-01 20:54:04 -0500 )edit

Sorry for the delay. If I understand well, I recorded only /scan and after I played this .bag while hector was running. The /tf is in EDIT:3

alex.filgueira gravatar image alex.filgueira  ( 2014-02-10 04:46:58 -0500 )edit

but does that solved your problem? I will edit your question because there is some info there that is not useful.

Procópio gravatar image Procópio  ( 2014-02-10 19:59:30 -0500 )edit

No, only with the /scan or with /scan and /tf, I can´t create a map. For create a map, I need /map and /tf. You can create a map only with /scan? Thanks for edit.

alex.filgueira gravatar image alex.filgueira  ( 2014-02-10 21:23:02 -0500 )edit

yes, that is what hector_slam does.

Procópio gravatar image Procópio  ( 2014-02-10 22:51:17 -0500 )edit

Umm.. I can create a map with /scan online, but no with /scan in file.bag

alex.filgueira gravatar image alex.filgueira  ( 2014-02-11 00:34:57 -0500 )edit

Question Tools

1 follower


Asked: 2014-01-29 23:50:13 -0500

Seen: 923 times

Last updated: Feb 10 '14