天天看点

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简介

继续阅读