How to Fix drift in AMCL

asked 2022-09-22 03:25:23 -0500

Azeem gravatar image

updated 2022-09-22 03:30:08 -0500

I am trying to use AMCL to localize my robot. I am converting 3D lidar data to 2D using Pointcloud_to_laserscan package. The parameters I use for the same are as follows,

 target_frame: os_sensor 
        transform_tolerance: 0.01
        min_height: 0.0
        max_height: 1.0

        angle_min: -3.14 # -M_PI
        angle_max: 3.14 # M_PI
        angle_increment: 0.0087 # M_PI/360.0
        scan_time: 0.1
        range_min: 0.3
        range_max: 50.0
        use_inf: true
        concurrency_level: 1

When the robot moves translationally, it has no drift and the laser scan matches properly with the corresponding features. But when my robot turns, laser scans drift a lot and realigns once when the robot starts to move linearly. I have attached the pictures of the same in this link as I am unable to attach pictures. In this link, first five pictures depict the drift that I mentioned above and the sixth image is the tf tree. The parameters that I use for AMCL are as follows,

  gui_publish_rate: 10.0
  kld_err: 0.05
  kld_z: 0.99
  laser_lambda_short: 0.1
  laser_likelihood_max_dist: 2.0
  laser_max_beams: 100
  laser_max_range: -1.0
  laser_min_range: -1.0
  laser_model_type: likelihood_field
  laser_sigma_hit: 0.2
  laser_z_hit: 0.5
  laser_z_max: 0.05
  laser_z_rand: 0.5
  laser_z_short: 0.05
  max_particles: 5000
  min_particles: 1000
  odom_alpha1: 0.05
  odom_alpha2: 0.05
  odom_alpha3: 0.12
  odom_alpha4: 0.05
  odom_alpha5: 0.1
  odom_frame_id: odom
  odom_model_type: diff-corrected
  recovery_alpha_fast: 0.0
  recovery_alpha_slow: 0.0
  resample_interval: 4
  restore_defaults: false
  save_pose_rate: 0.5
  tf_broadcast: true
  transform_tolerance: 0.2
  update_min_a: 0.6
  update_min_d: 0.15

I don't know where I am going wrong, I tried to compare my odometry that I generate using IMU and wheel encoders to that of a global referenced pose and it looks like my odometry is not very off. (I have added them in this link, pictures 7 and 8 and I have also added amcl params from rqt for reference)

Can someone point out the mistake that I am doing and guide me?

edit retag flag offensive close merge delete

Comments

Did you try to modify the odom_alphaX values during runtime with dynamic_reconfigure? Maybe also change the laser_model_type to likelihood_field_prob if your environment allows for frequent mismatches.

GeorgNo gravatar image GeorgNo  ( 2022-09-22 05:05:02 -0500 )edit

I see no evidence this is an amcl issue. This looks to me like bad odometry i.e. the odom->base_link is drifting way more than it ought to with wheel-encoders + IMU setup.

Do your pictures 7 and 8 plot the robot's x/y/yaw in the map frame (map->base_link) or the odom frame (odom->base_link)?

To check odometry, I would disable amcl and separately verify the odometry calculation with only wheel encoder data, then with only with IMU data. You can quickly judge how bad the drift is by driving the robot and in rviz watch the alignment of the white lidar dots with the walls on your map.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-09-24 12:21:02 -0500 )edit

@GeorgNo, Yes, I tried to change the values runtime but it didn't have much change. The only thing I noticed is if I used likelihood_field_prob the particles converge way too quickly.

Azeem gravatar image Azeem  ( 2022-09-26 00:32:59 -0500 )edit

@Mike Scheutzow, The pictures 7 and 8 are taken from plotjuggler and I think it should be from map -> base_link (I am not sure about this, if I'm wrong do correct me). Okay, I'll test odometry like you've mentioned.

Azeem gravatar image Azeem  ( 2022-09-26 01:03:40 -0500 )edit