ros2: nav2_amcl moves odom frame to compensate base_link even when robot is mobile

asked 2021-08-05 10:35:15 -0500

Per Edwardsson gravatar image

updated 2021-08-06 01:57:40 -0500

My robot runs nav2_amcl to take care of the map <-> odom transform, and runs robot_localization to take care of odom <-> base_link. Running the robot with slam_toolbox to map makes beautiful maps, so I have reason to believe that whatever localization it is doing is working fine, and that the odometry is working fine too. However, when I try to use nav2_amcl, mostly with stock options, the odom frame is instead moving when the robot is, and base_link is completely stationary in the map frame, regardless of how the robot is actually moving. My expected behaviour would be that the odom frame is only slightly adjusted to compensate for odometry drift, and that base_link is moving correctly in the map frame.

I use the data from one of my two lidars to feed into nav2_amcl, which is located in front and has a field of view of about 170 degrees. It is an RPLidar S1. The problem occurs both when navigating autonomously and when manually steering. Is the limited FOV a problem for amcl? If so, can I compensate via config?

Running Dashing, robot is a Jetson AGX Xavier with Ubuntu 18.04. AMCL Config is below. Navigation2 is installed via apt.

amcl:
  ros__parameters:
    use_sim_time: True
    alpha1: 0.2
    alpha2: 0.2
    alpha3: 0.2
    alpha4: 0.2
    alpha5: 0.0
    alwas_reset_initial_pose: False
    base_frame_id: "base_link"
    beam_skip_distance: 0.5
    beam_skip_error_threshold: 0.9
    beam_skip_threshold: 0.3
    do_beamskip: False
    global_frame_id: "map"
    lambda_short: 0.1
    laser_likelihood_max_dist: 2.0
    laser_max_range: 100.0
    laser_min_range: 1.0
    laser_model_type: "likelihood_field"
    max_beams: 200
    max_particles: 8000
    min_particles: 2000
    odom_frame_id: "odom"
    pf_err: 0.05
    pf_z: 0.99
    recovery_alpha_fast: 0.0
    recovery_alpha_slow: 0.0
    resample_interval: 1
    robot_model_type: "differential"
    save_pose_rate: 0.5
    set_initial_pose: True
    sigma_hit: 0.2
    tf_broadcast: True 
    transform_tolerance: 1.0
    update_min_a: 0.2
    update_min_d: 0.25
    z_hit: 0.5
    z_max: 0.05
    z_rand: 0.5
    z_short: 0.05
edit retag flag offensive close merge delete