Main Content

Particle Filter Parameters

To use thestateEstimatorPFparticle filter, you must specify parameters such as the number of particles, the initial particle location, and the state estimation method. Also, if you have a specific motion and sensor model, you specify these parameters in the state transition function and measurement likelihood function, respectively. The details of these parameters are detailed on this page. For more information on the particle filter workflow, seeParticle Filter Workflow

Number of Particles

要指定粒子的数量,请使用initializemethod. Each particle is a hypothesis of the current state. The particles are distributed across your state space based on either a specified mean and covariance, or on the specified state bounds. Depending on theStateEstimationMethod财产,粒子with the highest weight or the mean of all particles is taken to determine the best state estimate.

The default number of particles is 1000. Unless performance is an issue, do not use fewer than 1000 particles. A higher number of particles can improve the estimate but sacrifices performance speed, because the algorithm has to process more particles. Tuning the number of particles is the best way to affect your particle filters performance.

这些结果,基于stateEstimatorPF例如,显示使用100个颗粒和5000个颗粒时跟踪准确性的差异。

Initial Particle Location

When you initialize your particle filter, you can specify the initial location of the particles using:

  • Mean and covariance

  • State bounds

Your initial state is defined as a mean with a covariance relative to your system. This mean and covariance correlate to the initial location and uncertainty of your system. ThestateEstimatorPFobject distributes particles based on your covariance around the given mean. The algorithm uses this distribution of particles to get the best estimation of state, so an accurate initialization of particles helps to converge to the best state estimation quickly.

If an initial state is unknown, you can evenly distribute your particles across a given state bounds. The state bounds are the limits of your state. For example, when estimating the position of a robot, the state bounds are limited to the environment that the robot can actually inhabit. In general, an even distribution of particles is a less efficient way to initialize particles to improve the speed of convergence.

The plot shows how the mean and covariance specification can cluster particles much more effectively in a space rather than specifying the full state bounds.

State Transition Function

The state transition function,StateTransitionFcn, of a particle filter helps to evolve the particles to the next state. It is used during the prediction step of theParticle Filter Workflow。In thestateEstimatorPFobject, the state transition function is specified as a callback function that takes the previous particles, and any other necessary parameters, and outputs the predicted location. The function header syntax is:

函数预测台面= stateTransitionFCN(PF,PrevArticles,varargin)

By default, the state transition function assumes a Gaussian motion model with constant velocities. The function uses a Gaussian distribution to determine the position of the particles in the next time step.

For your application, it is important to have a state transition function that accurately describes how you expect the system to behave. To accurately evolve all the particles, you must develop and implement a motion model for your system. If particles are not distributed around the next state, thestateEstimatorPFobject does not find an accurate estimate. Therefore, it is important to understand how your system can behave so that you can track it accurately.

您还必须在StateTransitionFcn。Without random noise applied to the predicted system, the particle filter does not function as intended.

Although you can predict many systems based on their previous state, sometimes the system can include extra information. The use ofvarargin函数允许您输入的任何额外的标准ameters that are relevant for predicting the next state. When you call预测,您可以使用以下方式包含以下参数

预测(pf,param1,param2)

Because these parameters match the state transition function you defined, calling预测essentially calls the function as:

prejectParticles = StateTransitionFCN(PF,Prevarticles,param1,param2)

The output particles,预测Particles, are then either used by the测量似然函数to correct the particles, or used in the next prediction step if correction is not required.

测量似然函数

预测下一个状态后,您可以使用传感器的测量来纠正预测状态。通过指定aMeasurementLikelihoodFcn在里面stateEstimatorPFobject, you can correct your predicted particles using thecorrectfunction. This measurement likelihood function, by definition, gives a weight for the state hypotheses (your particles) based on a given measurement. Essentially, it gives you the likelihood that the observed measurement actually matches what each particle observes. This likelihood is used as a weight on the predicted particles to help with correcting them and getting the best estimation. Although the prediction step can prove accurate for a small number of intermediate steps, to get accurate tracking, use sensor observations to correct the particles frequently.

The specification of theMeasurementLikelihoodFcnis similar to theStateTransitionFcn。It is specified as a function handle in the properties of thestateEstimatorPFobject. The function header syntax is:

function likelihood = measurementLikelihoodFcn(pf,predictParticles,measurement,varargin)

The output is the likelihood of each predicted particle based on the measurement given. However, you can also specify more parameters invarargin。指某东西的用途varargin函数允许您输入的任何额外的标准ameters that are relevant for correcting the predicted state. When you callcorrect,您可以使用以下方式包含以下参数

correct(pf,measurement,param1,param2)

These parameters match the measurement likelihood function you defined:

likelihood = measurementLikelihoodFcn(pf,predictParticles,measurement,param1,param2)

Thecorrectfunction uses thelikelihoodoutput for particle resampling and giving the final state estimate.

Resampling Policy

颗粒的重新采样是连续跟踪对象的重要步骤。它使您可以根据当前状态选择粒子,而不是使用初始化时给出的粒子分布。通过连续重新采样当前估计值,您可以获得更准确的跟踪并改善长期性能。

When you callcorrect, the particles used for state estimation can be resampled depending on theResamplingPolicyproperty specified in thestateEstimatorPFobject. This property is specified as aresamplingPolicyPF(Navigation Toolbox)resamplingPolicyPFobject. TheTriggerMethodproperty on that object tells the particle filter which method to use for resampling.

You can trigger resampling at either a fixed interval or when a minimum effective particle ratio is reached. The fixed interval method resamples at a set number of iterations, which is specified in theSamplingIntervalproperty. The minimum effective particle ratio is a measure of how well the current set of particles approximates the posterior distribution. The number of effective particles is calculated by:

In this equation,Nis the number of particles, andwis the normalized weight of each particle. The effective particle ratio is thenNeff/NUMPARCTICLE。Therefore, the effective particle ratio is a function of the weights of all the particles. After the weights of the particles reach a low enough value, they are not contributing to the state estimation. This low value triggers resampling, so the particles are closer to the current state estimation and have higher weights.

State Estimation Method

The final step of the particle filter workflow is the selection of a single state estimate. The particles and their weights sampled across the distribution are used to give the best estimation of the actual state. However, you can use the particles information to get a single state estimate in multiple ways. With thestateEstimatorPF对象,您可以根据重量最高的粒子选择最佳估计值,也可以占用所有颗粒的平均值。在StateEstimationMethodproperty as either'mean'(default) or'maxweight'

Because you can estimate the state from all of the particles in many ways, you can also extract each particle and its weight from thestateEstimatorPFusing theParticlesproperty.

See Also

|

Related Examples

More About