天天看點

ROS Navigation-----amcl簡介

    amcl是一種機率定位系統,以2D方式對移動機器人定位。 它實作了自适應(或者KLD-采樣)蒙特卡洛定位法,使用粒子濾波跟蹤機器人在已知地圖中的位姿。

1 算法

   機率機器人一書中講述了許多算法以及它們使用的參數,建議讀者去書中檢視以獲得更多細節資訊。 這裡我們用到書中的算法包括:sample_motion_model_odometry,beam_range_finder_model,likelihood_field_range_finder_model,Augmented_MCL, andKLD_Sampling_MCL。

   基于目前現有的實作的話, 這個node僅能使用雷射掃描和掃描地圖來工作,但是可以進行擴充以使用其它傳感器資料。

2 示例

在base_scan topic上使用雷射資料定位:

amcl scan:=base_scan      

3 節點

3.1 amcl

  amcl節點輸入雷射地圖,雷射掃描,和tf轉換資訊,輸出位姿估計。 amcl在啟動時候依據提供的參數完成粒子濾波器初始化。但是需要注意,如果沒有指定參數值,使用預設參數的話,初始的濾波器狀态将是中心為(0,0,0)含有中等尺度大小粒子的雲。

3.1.1 Subscribed Topics

scan ( sensor_msgs/LaserScan)

  • 雷射掃描

tf ( tf/tfMessage)

  • 坐标轉換資訊

initialpose ( geometry_msgs/PoseWithCovarianceStamped)

  • 用來初始化粒子濾波器的均值和協方差

map ( nav_msgs/OccupancyGrid)

  • 當參數use_map_topic被設定後, AMCL訂閱map主題以擷取地圖完成基于雷射的定位

3.1.2 Published Topics

amcl_pose ( geometry_msgs/PoseWithCovarianceStamped)

  • 估計的機器人在地圖中的位姿,使用協方差表示

particlecloud ( geometry_msgs/PoseArray)

  • 粒子濾波器維護的位姿估計集合

tf ( tf/tfMessage)

  • 釋出從裡程(可以使用參數~odom_frame_id進行重映射)到地圖的轉換

3.1.3 Services

global_localization ( std_srvs/Empty)

  • 初始化全局定位,所有粒子被随機撒在地圖上的free空間

3.1.4 Services Called

static_map ( nav_msgs/GetMap)

  • amcl調用該服務用來定位, 通過這個service啟動子產品有了地圖

3.1.5 Parameters

   有3種ROS 參數用來配置amcl node: overall filter, laser model, and odometery model

1)Overall filter parameters

~min_particles (int, default: 100)

  • 允許的最少粒子數

~max_particles ( int, default: 5000)

  • 允許的最多粒子數

~kld_err ( double, default: 0.01)

  • 真實分布與估計分布之間最大誤差

~kld_z ( double, default: 0.99)

  • Upper standard normal quantile for (1 - p), where p is the probability that the error on the estimated distrubition will be less thankld_err.

~update_min_d ( double, default: 0.2 meters)

  • 執行一次濾波器更新所需的平移距離

~update_min_a ( double, default: π/6.0 radians)

  • 執行一次濾波器更新所需的旋轉角度

~resample_interval ( int, default: 2)

  • 重采樣之前濾波器更新次數

~transform_tolerance ( double, default: 0.1 seconds)

  • Time with which to post-date the transform that is published, to indicate that this transform is valid into the future.

~recovery_alpha_slow ( double, default: 0.0 ( disabled))

  • 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.

~recovery_alpha_fast ( double, default: 0.0 ( disabled))

  • 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.

~initial_pose_x ( double, default: 0.0 meters)

  • Initial pose mean (x), used to initialize filter with Gaussian distribution.

~initial_pose_y ( double, default: 0.0 meters)

  • Initial pose mean (y), used to initialize filter with Gaussian distribution.

~initial_pose_a ( double, default: 0.0 radians)

  • Initial pose mean (yaw), used to initialize filter with Gaussian distribution.

~initial_cov_xx ( double, default: 0.5*0.5 meters)

  • Initial pose covariance (x*x), used to initialize filter with Gaussian distribution.

~initial_cov_yy ( double, default: 0.5*0.5 meters)

  • Initial pose covariance (y*y), used to initialize filter with Gaussian distribution.

~initial_cov_aa ( double, default: (π/12)*(π/12) radian)

  • Initial pose covariance (yaw*yaw), used to initialize filter with Gaussian distribution.

~gui_publish_rate ( double, default: -1.0 Hz)

  • 指定最大可用多大速率(Hz)掃描并釋出用于可視化的路徑, -1.0 to disable

~save_pose_rate ( double, default: 0.5 Hz)

  • 指定存儲上次估計的位姿和協方差到參數伺服器的最大速率 (Hz),存儲變量為 ~initial_pose_* and ~initial_cov_*。儲存的位姿會在後面初始化濾波器時候使用。 -1.0 to disable

~use_map_topic ( bool, default: false)

  • 如果設定為true, AMCL将訂閱地圖主題,不會使用service call擷取地圖。New in navigation 1.4.2

~first_map_only ( bool, default: false)

  • 如果設定為true,AMCL将使用訂閱到的第一個地圖,不會使用每次更新擷取的新地圖。New in navigation 1.4.2
2)Laser model parameters

注意:無論使用什麼混合權重,權重加總應該等于1。 beam model使用了所有的4種權重: z_hit, z_short, z_max, and z_rand。likelihood_field model僅僅使用了2種: z_hit and z_rand。

~laser_min_range (double, default: -1.0)

  • 最小掃描範圍; -1.0 will cause the laser's reported minimum range to be used.

~laser_max_range ( double, default: -1.0)

  • 最大掃描範圍; -1.0 will cause the laser's reported maximum range to be used.

~laser_max_beams ( int, default: 30)

  • 當更新濾波器時候,每次掃描有多少均勻分布(等間隔的)beam被使用

~laser_z_hit ( double, default: 0.95)

  • 模型z_hit部分混合權重

~laser_z_short ( double, default: 0.1)

  • 模型z_short部分混合權重

~laser_z_max ( double, default: 0.05)

  • 模型z_max部分混合權重

~laser_z_rand ( double, default: 0.05)

  • 模型z_rand部分混合權重

~laser_sigma_hit ( double, default: 0.2 meters)

  • 模型z_hit部分使用的高斯模型标準差混合權重

~laser_lambda_short ( double, default: 0.1)

  • 模型z_short部分指數衰減參數

~laser_likelihood_max_dist ( double, default: 2.0 meters)

  • Maximum distance to do obstacle inflation on map, for use in likelihood_field model.

~laser_model_type ( string, default: "likelihood_field")

  • 模型類型(beam, likelihood_field或者likelihood_field_prob) (same aslikelihood_field but incorporates the beamskip feature, if enabled).
3 ) Odometry model parameters

   如果參數~odom_model_type是"diff",那麼使用sample_motion_model_odometry算法,這種模型使用噪聲參數odom_alpha_1到odom_alpha4。

 如果參數~odom_model_type 是"omni",那麼使用客制化模型用于全向底座,使用噪聲參數odom_alpha_1到odom_alpha_5。前4個參數類似于“diff”模型,第5個參數用于捕獲機器人在垂直于前進方向的位移(沒有旋轉)趨勢。

   由于就模型有bug,解決了bug的新模型使用了新的類型"diff-corrected" 和"omni-corrected"。參數odom_alpha預設值僅僅适合舊的模型,對于新的模型這些值要小很多,請參考seehttp://answers.ros.org/question/227811/tuning-amcls-diff-corrected-and-omni-corrected-odom-models/。

~odom_model_type (string, default: "diff")

  • 模型類型("diff", "omni", "diff-corrected" or"omni-corrected")

~odom_alpha1 ( double, default: 0.2)

  • 指定裡程旋轉估計(機器人運動旋轉分量)中期望的噪聲

~odom_alpha2 ( double, default: 0.2)

  • 指定裡程旋轉估計(機器人運動位移分量)中期望的噪聲

~odom_alpha3 ( double, default: 0.2)

  • 指定裡程位移估計(來自機器人運動位移分量)中期望的噪聲

~odom_alpha4 ( double, default: 0.2)

  • 指定裡程位移估計(來自機器人運動旋轉分量)期望噪聲

~odom_alpha5 ( double, default: 0.2)

  • 位移相關噪聲參數 (only used if model is"omni").

~odom_frame_id ( string, default: "odom")

  • odometry使用的坐标系

~base_frame_id ( string, default: "base_link")

  • 基座坐标系

~global_frame_id ( string, default: "map")

  • 全局坐标系

~tf_broadcast ( bool, default: true)

  • 設定為false,amcl将不會釋出全局坐标系和裡程坐标系之間的轉換

3.1.6 Transforms

  amcl要把進來的雷射掃描資訊轉換到裡程坐标系 (~odom_frame_id)。是以,tf樹中必定會存在一條從釋出雷射的坐标系到裡程坐标系的路徑。

    實作細節是:amcl第一次收到雷射掃描後,它會檢視雷射坐标系與基座坐标系之間的轉換,并永久的記下這種轉換。是以,amcl不能用在相對于基座有相對位移的雷射器。

     下圖顯示了使用odomery和amcl定位的差異。在轉換過程,amcl會評估基座坐标系(~base_frame_id)相對于全局坐标系(~global_frame_id)的轉換,但是它僅釋出了全局坐标系和裡程坐标系(~odom_frame_id)之間的轉換,這種轉換過本質上是為解決使用裡程航迹推演出現的累計漂移。AMCL釋出的轉換可能帶有未來時間戳,但是對AMCL來說是有效的。

ROS Navigation-----amcl簡介

繼續閱讀