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

Using Hector mapping for odometry with amcl for localization in a pre given map

asked 2013-11-26 07:32:53 -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


Hi Fahad,

did you manage to get this working?

Greetings, Max

ne0h gravatar image ne0h  ( 2015-11-16 05:15:27 -0600 )edit

Yes I am also trying to do it...

quentin gravatar image quentin  ( 2015-11-17 05:42:00 -0600 )edit

Do you try to use AMCL?

ne0h gravatar image ne0h  ( 2015-11-17 06:10:57 -0600 )edit

I got it running by providing the odometry data from hector_mapping as transform from scanmatcher->base_link. Here is my launch file:

ne0h gravatar image ne0h  ( 2015-11-19 06:20:32 -0600 )edit

Hi ne0h, I am working on a similar task to get amcl working with hector mapping odometry. I see in your repository that you had to make a minor timing delay change in hector mapping source file. Is it something specific to your task or essential to get this combination working?

pJ gravatar image pJ  ( 2015-11-20 04:09:51 -0600 )edit

Hi pJ, the timer delay has nothing to do with the amcl approach. We had to add the delay to get hector_slam working due to some timing errors in hector_slam. Perhabs the cpu was just to slow to meet the ROS timing rate...

ne0h gravatar image ne0h  ( 2015-11-20 08:26:58 -0600 )edit

Hi neOh, I am trying to use your launch (hector_mappping, AMCL, map_server, move_base) combined with a simulated robot (hector_quadrotor_gazebo). But I am getting tf trees errors which i am struggling WITH. Could you upload a screenshot of both your tf tree and your graph (nodes and topics)?

quentin gravatar image quentin  ( 2015-11-27 03:58:50 -0600 )edit

Hi quentin, no problem. Transform tree ( ) and messages tree ( ).

ne0h gravatar image ne0h  ( 2015-11-27 05:45:17 -0600 )edit

2 Answers

Sort by » oldest newest most voted

answered 2013-11-26 11:38:17 -0600

Haven´t tried it myself, but setting the "pub_map_odom_transform" transform parameter to "false" and remapping the map topic to somewhere else should help.

Then, two options for doing things come to my mind:

  • By using the undocumented "pub_odometry" parameter set to true, odometry is published as a nav_msgs/Odometry message on the "scanmatch_odom" topic. This could the used to generate the proper tf odometry via robot_pose_ekf or so.
  • AMCL supports the "odom_frame_id" parameter. If you set that to "scanmatcher_frame", there´s a chance things work. I´m not 100% sure the transform scanmatcher_frame has the correct parent link though.
edit flag offensive delete link more

answered 2015-11-17 21:06:09 -0600

quentin gravatar image

Good morning Neoh! It seems that we have the same questions ;)

I am new to ROS and Robotic. For the moment, I managed to get my existing map appears in the rviz environment, using the information provided by Stefan

Nevertheless, everything rely on the accuracy of the known initial position. The robot is not able to match the laser scan and the known map in order to identify the correct initial position. Is that the role of AMCL?

My final goal will be to merge the existing map (which is expected to be partially correct, and therefore helpful for path planning) and the sensed one.

edit flag offensive delete link more


Hi, "amcl is a probabilistic localization system for a robot moving in 2D". This means that AMCL takes the initial position that you provide and tries to find the correct position in the map. When you move the robot AMCL approximates its position. Is your transform tree correct?

ne0h gravatar image ne0h  ( 2015-12-03 11:02:22 -0600 )edit

Yes the tf tree is now correct... But is seems now that the AMCL doesn't update the pose, given in the map frame. I ll try to figure it out!

quentin gravatar image quentin  ( 2015-12-03 20:04:49 -0600 )edit

Question Tools



Asked: 2013-11-26 07:32:53 -0600

Seen: 5,189 times

Last updated: Nov 17 '15