Main Content

initctekf

Create constant turn-rate extended Kalman filter from detection report

Description

example

filter = initctekf(detection) creates and initializes a constant-turn-rate extended Kalman filter from information contained in a detection report. For more details, see Algorithms and trackingEKF.

Examples

collapse all

Create and initialize a 2-D constant turn-rate extended Kalman filter object from an initial detection report.

Create the detection report from an initial 2-D measurement, (-250,-40), of the object position. Assume uncorrelated measurement noise.

Extend the measurement to three dimensions by adding a z-component of zero.

detection = objectDetection(0,[-250;-40;0],'MeasurementNoise',2.0*eye(3), ...
    'SensorIndex',1,'ObjectClassID',1,'ObjectAttributes',{'Car',2});

Create the new filter from the detection report and display the filter properties.

filter = initctekf(detection)
filter = 
  trackingEKF with properties:

                          State: [7x1 double]
                StateCovariance: [7x7 double]

             StateTransitionFcn: @constturn
     StateTransitionJacobianFcn: @constturnjac
                   ProcessNoise: [4x4 double]
        HasAdditiveProcessNoise: 0

                 MeasurementFcn: @ctmeas
         MeasurementJacobianFcn: @ctmeasjac
         HasMeasurementWrapping: 1
               MeasurementNoise: [3x3 double]
    HasAdditiveMeasurementNoise: 1

                MaxNumOOSMSteps: 0

                EnableSmoothing: 0

Show the state.

filter.State
ans = 7×1

  -250
     0
   -40
     0
     0
     0
     0

Show the state covariance matrix.

filter.StateCovariance
ans = 7×7

    2.0000         0         0         0         0         0         0
         0  100.0000         0         0         0         0         0
         0         0    2.0000         0         0         0         0
         0         0         0  100.0000         0         0         0
         0         0         0         0  100.0000         0         0
         0         0         0         0         0    2.0000         0
         0         0         0         0         0         0  100.0000

Initialize a 2-D constant-turnrate extended Kalman filter from an initial detection report made from an initial measurement in spherical coordinates. If you want to use spherical coordinates, then you must supply a measurement parameter structure as part of the detection report with the Frame field set to 'spherical'. Set the azimuth angle of the target to 45 degrees, the range to 1000 meters, and the range rate to -4.0 m/s.

frame = 'spherical';
sensorpos = [25,-40,-10].';
sensorvel = [0;5;0];
laxes = eye(3);

Create the measurement parameters structure. Set 'HasElevation' to false. Then, the measurement consists of azimuth, range, and range rate.

measparms = struct('Frame',frame,'OriginPosition',sensorpos, ...
    'OriginVelocity',sensorvel,'Orientation',laxes,'HasVelocity',true, ...
    'HasElevation',false);
meas = [45;1000;-4];
measnoise = diag([3.0,2,1.0].^2);
detection = objectDetection(0,meas,'MeasurementNoise', ...
    measnoise,'MeasurementParameters',measparms)
detection = 
  objectDetection with properties:

                     Time: 0
              Measurement: [3x1 double]
         MeasurementNoise: [3x3 double]
              SensorIndex: 1
            ObjectClassID: 0
    ObjectClassParameters: []
    MeasurementParameters: [1x1 struct]
         ObjectAttributes: {}

filter = initctekf(detection);

Filter state vector.

disp(filter.State)
  732.1068
   -2.8284
  667.1068
    2.1716
         0
  -10.0000
         0

Input Arguments

collapse all

Detection report, specified as an objectDetection object.

Example: detection = objectDetection(0,[1;4.5;3],'MeasurementNoise', [1.0 0 0; 0 2.0 0; 0 0 1.5])

Output Arguments

collapse all

Extended Kalman filter, returned as a trackingEKF object.

Algorithms

  • The function initializes a trackingEKF object with a constturn motion model and a ctmeas measurement model. The state of the filter is defined as [x; vx; y; vy; ω; z; vz], in which ω is the angular rate in the x-y plane, x, y, z are the position coordinates, and vx, vy, vz are the corresponding velocities.

  • The detection input can be an objectDetection object of Cartesian or spherical measurement:

    • For a Cartesian objectDetection object,

      • By default, the function assumes the measurement is a 3-D position measurement ([x; y; z]). The function uses the measurement to initialize the position state of the filter and sets the velocity state as 0. Similarly, the function uses the position components of the measurement noise matrix in the detection as the position components of the state error covariance matrix and sets the velocity components of the state error covariance matrix as 100 m2/s2.

      • You can also use a 6-D measurement ([x; y; z; vx; vy; vz]) by specifying the MeasurementParameters property of the objectDetection object. Specify the HasVelocity field of the measurement parameter structure as true so that the initctekf function can recognize the 6-D measurement. In this case, the state and state error covariance matrix of the filter are the same as the measurement and measurement noise matrix of the detection, respectively.

      • Regardless of the dimension of the detection, the function sets the angular rate state ω of the filter as 0 and set its corresponding covariance as 100 deg2/s2.

    • For a spherical measurement, you must specify the Frame field in the MeasurementParameters property of the objectDetection object as "Spherical". Also, use the MeasurementParameters property to specify if the detection has azimuth, elevation, range, and range rate. A full spherical measurement has four elements [az, el, r, rr], representing azimuth in degrees, elevation in degrees, range in meters, and range-rate in meters per second, respectively. Some of the four elements can be missing.

      • If the detection has elevation, the function uses the elevation measurement and its covariance to construct the filter state and state error covariance after performing coordinate transformation from the spherical frame to the Cartesian frame. Without elevation, the function sets the elevation as 0 and set its covariance as 1802/12 deg2 before performing the coordinate transformation.

      • If the detection has range-rate, the function uses the range-rate measurement and its covariance to construct the filter sate and state error covariance. The function also assumes the velocity covariance of the cross-range direction is 100 m2/s2. Without range-rate, the function sets the velocity states of the filter as 0 and its corresponding covariances as 100 m2/s2.

      • Regardless of the dimension of the detection, the function sets the angular velocity state ω of the filter as 0 and set its corresponding covariance as 100 deg2/s2.

    • You can use other fields of the MeasurementParameters property of an objectDetection object, such as OriginPosition and OriginaVelocity, to further specify the measurement coordinates.

  • The function models the process noise as non-additive and computes the process noise matrix assuming an acceleration standard deviation of 1 m/s2 and an angular acceleration standard deviation of 1 deg/s2.

  • The measurement noise matrix in the initialized filter is the same as that in the detection.

  • You can use this function as the FilterInitializationFcn property of a multiObjectTracker object.

Extended Capabilities

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

Version History

Introduced in R2017a