Ask Your Question

AMCL not localizing in pre-built map

asked 2017-05-23 22:42:52 -0500

mjedmonds gravatar image

updated 2017-05-23 22:43:39 -0500

I'm using AMCL with a Velodyne VLP-16. I'm using hector_slam to build the map, saving the map with map_server.

I'm using an IMU and wheel encoder velocities (twist messages) to fuse with robot_localization for odometry and the odom->base_link (base_footprint in my case) transform.

I want to use AMCL for global localization, but I'm having problems. AMCL is not aligning the laser scan with the prebuilt map, leading to incorrect global localization. I've attached a screenshot (if you rotate the laserscan by ~90 degrees clockwise, you get the about the correct alignment.

image description

The only potential problem might be that the laserscan is flat in the velodyne's frame, which is ~0.35m above the ground. Could that be an issue for AMCL?

I'm not very sure where to start debugging this, so any tips/hints/suggestions/requests for more info would be appreciated. I didn't want to dump my entire config in the first post, but I'm more than willing to.

And my AMCL config is pretty standard:

<node pkg="amcl" type="amcl" name="amcl">
  <!-- Publish scans from best pose at a max of 10 Hz -->
  <param name="odom_model_type" value="omni"/>
  <param name="odom_frame_id" value="odom" />
  <param name="base_frame_id" value="base_footprint" />
  <param name="global_frame_id" value="map" />
  <param name="use_map_topic" value="true" />
  <param name="odom_alpha5" value="0.1"/>
  <param name="transform_tolerance" value="0.2" />
  <param name="gui_publish_rate" value="10.0"/>
  <param name="laser_max_beams" value="30"/>
  <param name="min_particles" value="500"/>
  <param name="max_particles" value="5000"/>
  <param name="kld_err" value="0.05"/>
  <param name="kld_z" value="0.99"/>
  <param name="odom_alpha1" value="0.2"/>
  <param name="odom_alpha2" value="0.2"/>
  <!-- translation std dev, m -->
  <param name="odom_alpha3" value="0.8"/>
  <param name="odom_alpha4" value="0.2"/>
  <param name="laser_z_hit" value="0.5"/>
  <param name="laser_z_short" value="0.05"/>
  <param name="laser_z_max" value="0.05"/>
  <param name="laser_z_rand" value="0.5"/>
  <param name="laser_sigma_hit" value="0.2"/>
  <param name="laser_lambda_short" value="0.1"/>
  <param name="laser_lambda_short" value="0.1"/>
  <param name="laser_model_type" value="likelihood_field"/>
  <!-- <param name="laser_model_type" value="beam"/> -->
  <param name="laser_likelihood_max_dist" value="2.0"/>
  <param name="update_min_d" value="0.2"/>
  <param name="update_min_a" value="0.5"/>
  <param name="resample_interval" value="1"/>
  <param name="transform_tolerance" value="0.5"/>
  <param name="recovery_alpha_slow" value="0.0"/>
  <param name="recovery_alpha_fast" value="0.0"/>
edit retag flag offensive close merge delete


How far did you travel without localization?

Humpelstilzchen gravatar image Humpelstilzchen  ( 2017-05-24 03:41:37 -0500 )edit

Less than 2 meters. Should I travel farther to get a global alignment?

mjedmonds gravatar image mjedmonds  ( 2017-05-24 12:49:08 -0500 )edit

I only observed small updates with amcl, try to drive a few times in circle

Humpelstilzchen gravatar image Humpelstilzchen  ( 2017-05-24 12:50:25 -0500 )edit

Also was your 2d pose estimate as accurate as you could?

Humpelstilzchen gravatar image Humpelstilzchen  ( 2017-05-24 14:09:18 -0500 )edit

If I properly set the initial pose, it works, but this seems counterintuitive to me. The point of global localization is to align the sensor measurement to a prebuilt map. It seems amcl is really just keep the map roughly in place, but is incapable of a large adjust. Why is this the case? Thanks!

mjedmonds gravatar image mjedmonds  ( 2017-05-26 14:40:05 -0500 )edit

Does this answer help you?

Humpelstilzchen gravatar image Humpelstilzchen  ( 2017-05-27 03:57:10 -0500 )edit

Yes, thank you. Makes sense.

mjedmonds gravatar image mjedmonds  ( 2017-05-29 15:25:30 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-05-25 02:23:04 -0500

Procópio gravatar image

updated 2017-05-31 01:16:47 -0500

are you setting your initialpose with amcl?

EDIT: about your comment

The point of global localization is to align the sensor measurement to a prebuilt map. It seems amcl is really just keep the map roughly in place, but is incapable of a large adjust.

AMCL generates hypothesis of where the robot could be and how well the measurements of that hypothesis match the current measurement. When you call rosservice call move_base/global_localization it spreads the hypothesis all over the map and, as the robot moves, it reevaluate its hypothesis and prunes the unlikely ones, eventually converging to a reduced set of particles concentrated on the actual position.

But it is not magical, depending on the map you have and the measurements you are using, it may converge to a local minima and then it is hard to escape from there.

Localizing in a featureless map is really hard for AMCL, imagine your map is a square, and the robot is facing a corner. In which corner of the square are you? The /initialpose gives a hint to your filter and it will more often than not, converge to the true position.

edit flag offensive delete link more


/global_localization is what I was looking for. Thanks! Also this answer from Humpelstilzchen explains why

mjedmonds gravatar image mjedmonds  ( 2017-05-29 15:27:20 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-05-23 22:42:52 -0500

Seen: 2,414 times

Last updated: May 31 '17