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

How to add odometry into hector slam?

asked 2017-08-02 19:43:59 -0600

scopus gravatar image

updated 2017-08-02 19:55:08 -0600

Hi, we are using hector slam for builiding 2D map with rpliar laser. To solve the problem that false mapping in environmets similiar to long corridor, we want to add odometry into hector slam.

We read the source code of hector_mapping. We think that we can achieve our goal by setting the parameter "p_use_tf_pose_start_estimate_" to be true.

In this way, the mapping process uses the odometry information stored in tf tree. The parameter "p_use_tf_pose_start_estimated_" may not be set to be true in the beginning. When the robot is going to walk througth a corridor, "p_use_tf_pose_start_estimated_" is set to be true.

However, in our tests, whenever the "p_use_tf_pose_start_estimate_" is set to be true, it always output following error

 [ERROR] [1501720267.512793847]: Transform from map to base_link failed with Lookup would require extrapolation into the future.  Requested time 84.940000000 but the latest data is at time 84.740000000, when looking up transform from frame [base_link] to frame [map]

So solve this error, we launched move_base as this link suggests. But it didn't work.

So we have two questions
1, How to solve above error? Why is it difficult for reading transforms from tf tree in hector slam?

2, What are other ways for adding odometry information into hector slam?

Looking for any valuable advices! Many thanks! Best Regards!

edit retag flag offensive close merge delete


who is providing the base_link -> map transform? if it is AMCL, can you post the launch/config file, please?

Procópio gravatar image Procópio  ( 2017-08-03 02:38:47 -0600 )edit

It is an online mapping and navigation, so we don't use AMCL. Hector slam provides the base_link-> map transform. Thanks!

scopus gravatar image scopus  ( 2017-08-03 22:52:31 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-08-03 03:04:28 -0600

Blupon gravatar image

updated 2017-08-03 04:12:04 -0600

Hi !

I'm not sure this can help but I'm using RTABMap to build a map and in order to do that, I have to launch hector_mapping thanks to this modified launch file, so that hector_mapping provides the odometry needed by RTABMap, and my first test indicated it was working (odometry showed nicely in RVIZ, and behaved as expected).

During the test, I got the following tf tree thanks to


tf tree

Here is the command line RTABMap log, which includes hector_mapping messages.

The rtabmap tutorial I used to set this up is here if you want to check the source of the launch file.

The use of hector_mapping to generate odometry in order to obtain a map thanks to RTABMap is also discussed here and here on RTABMap dedicated forum (posts on how to adapt the launch file).

Hope this helped you !

edit flag offensive delete link more


Thank you! It is a useful experience for us. It seems that another running package would influences the running time of data processing. We can't use camera, we will consider your advice when it is necessary.

scopus gravatar image scopus  ( 2017-08-03 22:57:54 -0600 )edit

@Blupon I found the parameter settings of hector mapping in your project, the parameter "p_use_tf_pose_start_estimate_" is not involved. Have you tried by setting it to be true and run your project again? Thanks!

scopus gravatar image scopus  ( 2017-08-04 16:59:45 -0600 )edit

I see that parameter in my logs but I don't see it described on hector_mapping wiki page, nor explained by google. Why do you wish to change it ? RTABMap's creator let it that way when using hector_mapping's odometry, I guess he had a good reason to ^^

Blupon gravatar image Blupon  ( 2017-08-08 03:32:20 -0600 )edit

We want the hector_mapping to build map with odometry information. The odometry information from the robot's wheel encoder. We don't want to use the odom data produced by the scan matching of hector_mapping.

scopus gravatar image scopus  ( 2017-08-08 03:47:47 -0600 )edit

Right ! it seems I misunderstood your aim & forgot to read your question update, my bad. How do you change the parameter ? Can you do it at launch ?

Blupon gravatar image Blupon  ( 2017-08-08 03:54:54 -0600 )edit

The odom data has been fused into tf tree. We think the keypoint is the paramter "p_use_tf_pose_start_estimate_". If this paramter is set to be true, the odom information from tf data can be used for estimate the pose of robot. However, as our question above mentioned, it failed.We don't know why

scopus gravatar image scopus  ( 2017-08-08 04:06:36 -0600 )edit

my question was: how do you set it to true ? :-)

Blupon gravatar image Blupon  ( 2017-08-08 04:08:19 -0600 )edit

In your launch file, add <param name="use_tf_pose_start_estimate" value="true"/> Maybe this parameter should be used with parameter p_map_with_known_poses_ , so you also can try by adding <param name="map_with_known_poses" value="true"/>. The default value of these two paramters are false.

scopus gravatar image scopus  ( 2017-08-08 04:49:21 -0600 )edit

Question Tools



Asked: 2017-08-02 19:43:59 -0600

Seen: 2,323 times

Last updated: Aug 03 '17