trackingCKF

Cubature Kalman filter for object tracking

Description

The trackingCKF object represents a cubature Kalman filter designed for tracking objects that follow a nonlinear motion model or are measured by a nonlinear measurement model. Use the filter to predict the future location of an object, to reduce noise in a measured location, or to help associate multiple object detections with their tracks.

The cubature Kalman filter estimates the uncertainty of the state and the propagation of that uncertainty through the nonlinear state and measurement equations. There are a fixed number of cubature points chosen based on the spherical-radial transformation to guarantee an exact approximation of a Gaussian distribution up to the third moment. As a result, the corresponding filter is the same as an unscented Kalman filter, trackingUKF, with Alpha = 1, Beta = 0, and Kappa = 0.

Creation

Description

ckf = trackingCKF returns a cubature Kalman filter object with default state transition function, measurement function, state, and additive noise model.

example

ckf = trackingCKF(transitionFcn,measuremntFcn,state) specifies the StateTransitionFcn, MeasurementFcn, and State properties directly.

ckf = trackingCKF(___,Name,Value) specifies the properties of the Kalman filter using one or more Name,Value pair arguments. Any unspecified properties take default values.

Properties

expand all

Kalman filter state, specified as a real-valued M-element vector.

Example: [200;0.2;150;0.1;0;0.25]

Data Types: double

State error covariance, specified as a positive-definite real-valued M-by-M matrix, where M is the size of the filter state. The covariance matrix represents the uncertainty in the filter state.

Example: eye(6)

State transition function, specified as a function handle. This function calculates the state vector at time step k from the state vector at time step k – 1. The function can take additional input parameters, such as control inputs or time step size. The function can also include noise values.

The valid syntaxes for the state transition function depend on whether the filter has additive process noise. The table shows the valid syntaxes based on the value of the HasAdditiveProcessNoise property.

Valid Syntaxes (HasAdditiveProcessNoise = true)Valid Syntaxes (HasAdditiveProcessNoise = false)
x(k) = statetransitionfcn(x(k-1))
x(k) = statetransitionfcn(x(k-1),parameters)
  • x(k) is the state at time k.

  • parameters stands for all additional arguments required by the state transition function.

x(k) = statetransitionfcn(x(k-1),w(k-1))
x(k) = statetransitionfcn(x(k-1),w(k-1),dt)
x(k) = statetransitionfcn(__,parameters)
  • x(k) is the state at time k.

  • w(k) is a value for the process noise at time k.

  • dt is the time step of the trackingCKF filter, filter, specified in the most recent call to the predict function. The dt argument applies when you use the filter within a tracker and call the predict function with the filter to predict the state of the tracker at the next time step. For the nonadditive process noise case, the tracker assumes that you explicitly specify the time step by using this syntax: predict(filter,dt).

  • parameters stands for all additional arguments required by the state transition function.

Example: @constacc

Data Types: function_handle

Process noise covariance:

  • When HasAdditiveProcessNoise is true, specify the process noise covariance as a scalar or a positive-definite real-valued M-by-M matrix. M is the dimension of the state vector. When specified as a scalar, the matrix is a multiple of the M-by-M identity matrix.

  • When HasAdditiveProcessNoise is false, specify the process noise covariance as a Q-by-Q matrix. Q is the size of the process noise vector.

    Specify ProcessNoise before any call to the predict function. In later calls to predict, you can optionally specify the process noise as a scalar. In this case, the process noise matrix is a multiple of the Q-by-Q identity matrix.

Example: [1.0 0.05 0; 0.05 1.0 2.0; 0 2.0 1.0]

Dependencies

This parameter depends on the HasAdditiveNoise property.

Option to model process noise as additive, specified as true or false. When this property is true, process noise is added to the state vector. Otherwise, noise is incorporated into the state transition function.

Measurement model function, specified as a function handle. This function can be a nonlinear function that models measurements from the predicted state. Input to the function is the M-element state vector. The output is the N-element measurement vector. The function can take additional input arguments, such as sensor position and orientation.

  • If HasAdditiveMeasurementNoise is true, specify the function using one of these syntaxes:

    z(k) = measurementfcn(x(k))
    
    z(k) = measurementfcn(x(k),parameters)
    where x(k) is the state at time k, and z(k) is the predicted measurement at time k. The parameters term stands for all additional arguments required by the measurement function.

  • If HasAdditiveMeasurementNoise is false, specify the function using one of these syntaxes:

    z(k) = measurementfcn(x(k),v(k))
    
    z(k) = measurementfcn(x(k),v(k),parameters)
    where x(k) is the state at time k, and v(k) is the measurement noise at time k. The parameters argument stands for all additional arguments required by the measurement function.

Example: @cameas

Data Types: function_handle

Measurement noise covariance:.

  • When HasAdditiveMeasurementNoise is true, specify the measurement noise covariance as a scalar or an N-by-N matrix. N is the size of the measurement vector. When specified as a scalar, the matrix is a multiple of the N-by-N identity matrix.

  • When HasAdditiveMeasurementNoise is false, specify the measurement noise covariance as an R-by-R matrix. R is the size of the measurement noise vector.

    Specify MeasurementNoise before any call to the correct function. After the first call to correct, you can optionally specify the measurement noise as a scalar. In this case, the measurement noise matrix is a multiple of the R-by-R identity matrix.

Example: 0.2

Option to enable additive measurement noise, specified as true or false. When this property is true, noise is added to the measurement. Otherwise, noise is incorporated into the measurement function.

Object Functions

predictPredict state and state estimation error covariance of tracking filter
correctCorrect state and state estimation error covariance using tracking filter
correctjpdaCorrect state and state estimation error covariance using tracking filter and JPDA
distanceDistances between current and predicted measurements of tracking filter
likelihoodLikelihood of measurement from tracking filter
cloneCreate duplicate tracking filter
residualMeasurement residual and residual noise from tracking filter

Examples

collapse all

This example shows how to create and run a trackingCKF filter. Call the predict and correct functions to track an object and correct the state estimation based on measurements.

Create the filter. Specify the constant velocity motion model, the measurement model, and the initial state.

state = [0;0;0;0;0;0];
ckf = trackingCKF(@constvel,@cvmeas,state);

Call predict to get the predicted state and covariance of the filter. Use a 0.5 second time step.

[xPred,pPred] = predict(ckf,0.5);

Call correct with a given measurement.

meas = [1;1;0];
[xCorr,pCorr] = correct(ckf,meas);

Continue to predict the filter state. Specify the desired time step in seconds if necessary.

[xPred,pPred] = predict(ckf);         % Predict over 1 second
[xPred,pPred] = predict(ckf,2);       % Predict over 2 seconds

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2018b