# D.15  AMCL

သူကတော့ အားလုံးသိကြပြီးတဲ့အတိုင်း static map ကိုယူပြီး robot ကို localizing လုပ်ပေးတဲ့ ဆာဗာပါ။  Adaptive Monte-Carlo Localizer ကို သုံးပါပတယ်။

<table><thead><tr><th width="166">Param Names</th><th width="321">Description</th><th>Type</th><th>Default</th></tr></thead><tbody><tr><td>alpha1</td><td>Expected process noise in odometry’s rotation estimate from rotation.</td><td>double</td><td>0.2</td></tr><tr><td>alpha2</td><td>Expected process noise in odometry’s rotation estimate from translation.<br></td><td>double</td><td>0.2</td></tr><tr><td>alpha3</td><td>Expected process noise in odometry’s translation estimate from translation.<br></td><td>double</td><td>0.2</td></tr><tr><td>alpha4</td><td>Expected process noise in odometry’s translation estimate from rotation.<br></td><td>double</td><td>0.2</td></tr><tr><td>alpha5</td><td>For Omni models only: translation noise.<br></td><td>double</td><td>0.2</td></tr><tr><td>base_frame_id</td><td>Robot base frame.<br></td><td>string</td><td>“base_footprint”<br></td></tr><tr><td>beam_skip_distance</td><td>Ignore beams that most particles disagree with in Likelihood field model. Maximum distance to consider skipping for (m).<br></td><td>double</td><td>0.5</td></tr><tr><td>beam_skip_error_threshold</td><td>Percentage of beams after not matching map to force full update due to bad convergance.<br></td><td>double<br></td><td>0.9</td></tr><tr><td>beam_skip_threshold</td><td>Percentage of beams required to skip.<br></td><td>double<br></td><td>0.3</td></tr><tr><td>do_beamskip</td><td>Whether to do beam skipping in Likelihood field model.<br></td><td>bool</td><td>False<br></td></tr><tr><td>global_frame_id</td><td>The name of the coordinate frame published by the localization system.<br></td><td>string</td><td>“map”<br></td></tr><tr><td>lambda_short</td><td>Exponential decay parameter for z_short part of model.<br></td><td>double<br></td><td>0.1</td></tr><tr><td>laser_likelihood_max_dist</td><td>Maximum distance to do obstacle inflation on map, for use in likelihood_field model.<br></td><td>double</td><td>2</td></tr><tr><td>laser_max_range</td><td>Maximum scan range to be considered, -1.0 will cause the laser’s reported maximum range to be used.<br><br></td><td>double</td><td>100.0</td></tr><tr><td>laser_min_range</td><td>Minimum scan range to be considered, -1.0 will cause the laser’s reported minimum range to be used.<br></td><td>double</td><td>-1.0</td></tr><tr><td>laser_model_type</td><td>Which model to use, either beam, likelihood_field, or likelihood_field_prob. Same as likelihood_field but incorporates the beamskip feature, if enabled.<br></td><td>string</td><td>“likelihood_field”<br></td></tr><tr><td>set_initial_pose</td><td>Causes AMCL to set initial pose from the initial_pose* parameters instead of waiting for the initial_pose message.<br></td><td>bool<br></td><td>FALSE</td></tr><tr><td>initial_pose</td><td>X, Y, Z, and yaw coordinates of initial pose (meters and radians) of robot base frame in global frame.<br></td><td>Pose2D<br></td><td>{x: 0.0, y: 0.0, z: 0.0, yaw: 0.0}<br></td></tr><tr><td>max_beams</td><td>How many evenly-spaced beams in each scan to be used when updating the filter.<br></td><td>int</td><td>60</td></tr><tr><td>max_particles<br></td><td>Maximum allowed number of particles.<br></td><td>int</td><td>2000</td></tr><tr><td>min_particles</td><td>Minimum allowed number of particles.<br></td><td>int<br><br></td><td>500</td></tr><tr><td>odom_frame_id</td><td>Which frame to use for odometry.<br></td><td>string</td><td>“odom”<br></td></tr><tr><td>pf_err</td><td>Particle Filter population error.<br></td><td>double</td><td>0.05</td></tr><tr><td>pf_z</td><td>Particle filter population density.<br></td><td>double</td><td>0.99</td></tr><tr><td>recovery_alpha_fast</td><td>Exponential decay rate for the fast average weight filter, used in deciding when to recover by adding random poses. A good value might be 0.1.<br></td><td>double</td><td>0.0</td></tr><tr><td>recovery_alpha_slow</td><td>Exponential decay rate for the slow average weight filter, used in deciding when to recover by adding random poses. A good value might be 0.001.<br></td><td>double</td><td>0</td></tr><tr><td>resample_interval</td><td>Number of filter updates required before resampling.<br></td><td>int<br></td><td>1</td></tr><tr><td>robot_model_type</td><td>The fully-qualified type of the plugin class. Options are “nav2_amcl::DifferentialMotionModel” and “nav2_amcl::OmniMotionModel”. Users can also provide their own custom motion model plugin type.<br><br>Note for users of galactic and earlier<br>The models are selectable by string key (valid options: “differential”, “omnidirectional”) rather than plugins.<br><br></td><td>string</td><td>“nav2_amcl::DifferentialMotionModel”<br></td></tr><tr><td>save_pose_rate</td><td>Maximum rate (Hz) at which to store the last estimated pose and covariance to the parameter server, in the variables ~initial_pose_* and ~initial_cov_*. This saved pose will be used on subsequent runs to initialize the filter (-1.0 to disable).<br><br></td><td>double</td><td>0.5</td></tr><tr><td>sigma_hit</td><td>Standard deviation for Gaussian model used in z_hit part of the model.<br></td><td>double</td><td>0.2</td></tr><tr><td>tf_broadcast</td><td>Set this to false to prevent amcl from publishing the transform between the global frame and the odometry frame.<br></td><td>bool</td><td>True<br></td></tr><tr><td>transform_tolerance<br></td><td>Time with which to post-date the transform that is published, to indicate that this transform is valid into the future.<br></td><td>double</td><td>1</td></tr><tr><td>update_min_a</td><td>Rotational movement required before performing a filter update.<br></td><td>double</td><td>0.2</td></tr><tr><td>update_min_d</td><td>Translational movement required before performing a filter update.<br></td><td>double</td><td>0.25</td></tr><tr><td>z_hit</td><td>Mixture weight for z_hit part of model, sum of all used z weight must be 1. Beam uses all 4, likelihood model uses z_hit and z_rand..<br></td><td>double</td><td>0.5</td></tr><tr><td>z_max</td><td>Mixture weight for z_max part of model, sum of all used z weight must be 1. Beam uses all 4, likelihood model uses z_hit and z_rand.<br></td><td>double</td><td>0.05</td></tr><tr><td>z_rand</td><td>Mixture weight for z_rand part of model, sum of all used z weight must be 1. Beam uses all 4, likelihood model uses z_hit and z_rand..<br></td><td>double<br><br></td><td>0.5</td></tr><tr><td>z_short</td><td>Mixture weight for z_short part of model, sum of all used z weight must be 1. Beam uses all 4, likelihood model uses z_hit and z_rand.<br></td><td>double</td><td>0.005</td></tr><tr><td>always_reset_initial_pose</td><td>Requires that AMCL is provided an initial pose either via topic or initial_pose* parameter (with parameter set_initial_pose: true) when reset. Otherwise, by default AMCL will use the last known pose to initialize.<br></td><td>bool</td><td>FALSE</td></tr><tr><td>scan_topic</td><td>Laser scan topic to subscribe to.<br></td><td>string</td><td>scan</td></tr><tr><td>map_topic</td><td>Map topic to subscribe to.<br></td><td>string</td><td>map</td></tr><tr><td>first_map_only</td><td>Allows AMCL to accept maps more than once on the map_topic. This is especially useful when you’re using the LoadMap service in map_server. Prior to Humble, this is first_map_only_.<br></td><td>bool</td><td>FALSE</td></tr></tbody></table>

နမူနာ

<table><thead><tr><th width="166">Param Names</th><th width="321">Description</th><th>Type</th><th>Default</th></tr></thead><tbody><tr><td>odom_frame_id</td><td>Which frame to use for odometry.<br></td><td>string</td><td>“odom”<br></td></tr><tr><td>pf_err</td><td>Particle Filter population error.<br></td><td>double</td><td>0.05</td></tr><tr><td>pf_z</td><td>Particle filter population density.<br></td><td>double</td><td>0.99</td></tr><tr><td>recovery_alpha_fast</td><td>Exponential decay rate for the fast average weight filter, used in deciding when to recover by adding random poses. A good value might be 0.1.<br></td><td>double</td><td>0.0</td></tr><tr><td>recovery_alpha_slow</td><td>Exponential decay rate for the slow average weight filter, used in deciding when to recover by adding random poses. A good value might be 0.001.<br></td><td>double</td><td>0</td></tr><tr><td>resample_interval</td><td>Number of filter updates required before resampling.<br></td><td>int<br></td><td>1</td></tr><tr><td>robot_model_type</td><td>The fully-qualified type of the plugin class. Options are “nav2_amcl::DifferentialMotionModel” and “nav2_amcl::OmniMotionModel”. Users can also provide their own custom motion model plugin type.<br><br>Note for users of galactic and earlier<br>The models are selectable by string key (valid options: “differential”, “omnidirectional”) rather than plugins.<br><br></td><td>string</td><td>“nav2_amcl::DifferentialMotionModel”<br></td></tr><tr><td>save_pose_rate</td><td>Maximum rate (Hz) at which to store the last estimated pose and covariance to the parameter server, in the variables ~initial_pose_* and ~initial_cov_*. This saved pose will be used on subsequent runs to initialize the filter (-1.0 to disable).<br><br></td><td>double</td><td>0.5</td></tr><tr><td>sigma_hit</td><td>Standard deviation for Gaussian model used in z_hit part of the model.<br></td><td>double</td><td>0.2</td></tr><tr><td>tf_broadcast</td><td>Set this to false to prevent amcl from publishing the transform between the global frame and the odometry frame.<br></td><td>bool</td><td>True<br></td></tr><tr><td>transform_tolerance<br></td><td>Time with which to post-date the transform that is published, to indicate that this transform is valid into the future.<br></td><td>double</td><td>1</td></tr><tr><td>update_min_a</td><td>Rotational movement required before performing a filter update.<br></td><td>double</td><td>0.2</td></tr><tr><td>update_min_d</td><td>Translational movement required before performing a filter update.<br></td><td>double</td><td>0.25</td></tr><tr><td>z_hit</td><td>Mixture weight for z_hit part of model, sum of all used z weight must be 1. Beam uses all 4, likelihood model uses z_hit and z_rand..<br></td><td>double</td><td>0.5</td></tr><tr><td>z_max</td><td>Mixture weight for z_max part of model, sum of all used z weight must be 1. Beam uses all 4, likelihood model uses z_hit and z_rand.<br></td><td>double</td><td>0.05</td></tr><tr><td>z_rand</td><td>Mixture weight for z_rand part of model, sum of all used z weight must be 1. Beam uses all 4, likelihood model uses z_hit and z_rand..<br></td><td>double<br><br></td><td>0.5</td></tr><tr><td>z_short</td><td>Mixture weight for z_short part of model, sum of all used z weight must be 1. Beam uses all 4, likelihood model uses z_hit and z_rand.<br></td><td>double</td><td>0.005</td></tr><tr><td>always_reset_initial_pose</td><td>Requires that AMCL is provided an initial pose either via topic or initial_pose* parameter (with parameter set_initial_pose: true) when reset. Otherwise, by default AMCL will use the last known pose to initialize.<br></td><td>bool</td><td>FALSE</td></tr><tr><td>scan_topic</td><td>Laser scan topic to subscribe to.<br></td><td>string</td><td>scan</td></tr><tr><td>map_topic</td><td>Map topic to subscribe to.<br></td><td>string</td><td>map</td></tr><tr><td>first_map_only</td><td>Allows AMCL to accept maps more than once on the map_topic. This is especially useful when you’re using the LoadMap service in map_server. Prior to Humble, this is first_map_only_.<br></td><td>bool</td><td>FALSE</td></tr></tbody></table>

```yaml
amcl:
  ros__parameters:
    alpha1: 0.2
    alpha2: 0.2
    alpha3: 0.2
    alpha4: 0.2
    alpha5: 0.2
    base_frame_id: "base_footprint"
    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: 60
    max_particles: 2000
    min_particles: 500
    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: "nav2_amcl::DifferentialMotionModel"
    save_pose_rate: 0.5
    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
    scan_topic: scan
    map_topic: map
    set_initial_pose: false
    always_reset_initial_pose: false
    first_map_only: false
    initial_pose:
      x: 0.0
      y: 0.0
      z: 0.0
      yaw: 0.0
```
