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

Using hector slam with amcl for localization in a pre-made map

asked 2013-11-26 07:34:06 -0600

Fahad gravatar image

I wanted to exploit the fact that hector_mapping gives pretty accurate position estimate. I used the position estimate to find odometry and now hector_mapping successful publishes the odom message and gives the required tf. But when I run amcl and publish an already created map using map_server everything messes up because now both the hector_mapping and
map_server are publishing maps. Even if I remap the hector mapping map to something else to divert it my tf is disturbed. Please help how to resolve this issue

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-01-23 16:39:28 -0600

updated 2014-01-23 16:41:46 -0600

Hi, just stumbled across your question. Might be a little late, but the following should allow to use both at the same time:

  • Remap the map topic of hector_mapping away
  • Set the pub_map_odom_transform parameter to "false"
  • If you want odometry published, set the pub_odometry parameter to "true"

/edit: Duplicate of this Q/A

edit flag offensive delete link more



Just came across this post and I'm trying to do the same thing. I can't find the parameter for where the map topic is being published by hector_mapping. I know its /map but not sure how to remap it somewhere else.

Maybe putting <remap from="map" to="maphector"/> in the launch file?

musiqsoulchild gravatar image musiqsoulchild  ( 2015-03-16 01:43:13 -0600 )edit

yes, that should work.

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2015-03-18 03:05:01 -0600 )edit

This worked for me, but I have few concerns. First, since the mapping is also active and we're just ignoring it, if the map gets spoiled, due to searchangledir too large kind of error let's say, this would affect the new odometry and would spoil the final localization as well right? Second, is there a way to turn of mapping or map updates, since we don't need it and it wastes the computational resources? Thanks!

parzival gravatar image parzival  ( 2020-12-12 00:17:36 -0600 )edit

I am applying the same config (, but it doesn't create a transform between base_link and odom. So AMCL fails to catch the laser scan. It instead, creates a separate transform between odom and map.

zlg9 gravatar image zlg9  ( 2021-08-04 10:05:29 -0600 )edit

hi @zlg9, It is true that hector does not publish base_link --> odom, according to gmapping roswiki, this transformation is "usually provided by the odometry system (e.g., the driver for the mobile base)". Have are u able to get amcl worked on hector if this TF is absent?

jacob_lee gravatar image jacob_lee  ( 2021-11-01 21:48:47 -0600 )edit

answered 2020-11-03 04:43:42 -0600

ROSKam gravatar image

After remapping the topics, don' forget to set scan_subscriber_queue_size to 1.

edit flag offensive delete link more


Why is this necessary?

parzival gravatar image parzival  ( 2020-12-12 00:12:19 -0600 )edit

I think hector slam supplies older data to amcl with default scan_subscriber_queue_size of 5. In my case, amcl did not work with this setting. I changed it to the minimum value of 1 and it worked.

ROSKam gravatar image ROSKam  ( 2020-12-12 11:08:06 -0600 )edit

It actually worked fine for me with the param set to 5. Are you sure you didn't change anything else? Or do you think it would perform even better with your setting?

parzival gravatar image parzival  ( 2020-12-15 00:28:23 -0600 )edit

This might be an issue if the system is slow in processing. Putting the queue size to 1 might be assuring the latest data to amcl.

ROSKam gravatar image ROSKam  ( 2021-04-02 01:41:04 -0600 )edit

Question Tools



Asked: 2013-11-26 07:34:06 -0600

Seen: 4,361 times

Last updated: Jan 23 '14