Main Content

getTrackPositions

Returns updated track positions and position covariance matrix

Description

example

positions = getTrackPositions(tracks,modelName) returns a matrix of track positions based on tracks and the model name.

example

positions = getTrackPositions(tracks,positionSelector) returns a matrix of track positions based on tracks and the position selector.

example

[positions,positionCovariances] = getTrackPositions(___) also returns the track position covariance matrices.

Examples

collapse all

Create an extended Kalman filter tracker for 3-D constant-acceleration motion.

tracker = multiObjectTracker('FilterInitializationFcn',@initcaekf);

Update the tracker with a single detection and get the tracks output.

detection = objectDetection(0,[10;-20;4],'ObjectClassID',3);
tracks = tracker(detection,0)
tracks = 
  objectTrack with properties:

                     TrackID: 1
                    BranchID: 0
                 SourceIndex: 0
                  UpdateTime: 0
                         Age: 1
                       State: [9x1 double]
             StateCovariance: [9x9 double]
             StateParameters: [1x1 struct]
               ObjectClassID: 3
    ObjectClassProbabilities: 1
                  TrackLogic: 'History'
             TrackLogicState: [1 0 0 0 0]
                 IsConfirmed: 1
                   IsCoasted: 0
              IsSelfReported: 1
            ObjectAttributes: [1x1 struct]

Obtain the position vector from the track state using the model name.

position1 = getTrackPositions(tracks,"constacc")
position1 = 1×3

    10   -20     4

Obtain the position vector from the track state using a position selector.

positionSelector = [1 0 0 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0; 0 0 0 0 0 0 1 0 0];
position2 = getTrackPositions(tracks,positionSelector)
position2 = 1×3

    10   -20     4

Create an extended Kalman filter tracker for 3-D constant-velocity motion.

tracker = multiObjectTracker("FilterInitializationFcn",@initcvekf);

Update the tracker with a single detection and get the tracks output.

detection = objectDetection(0,[10;3;-7],"ObjectClassID",3);
tracks = tracker(detection,0)
tracks = 
  objectTrack with properties:

                     TrackID: 1
                    BranchID: 0
                 SourceIndex: 0
                  UpdateTime: 0
                         Age: 1
                       State: [6x1 double]
             StateCovariance: [6x6 double]
             StateParameters: [1x1 struct]
               ObjectClassID: 3
    ObjectClassProbabilities: 1
                  TrackLogic: 'History'
             TrackLogicState: [1 0 0 0 0]
                 IsConfirmed: 1
                   IsCoasted: 0
              IsSelfReported: 1
            ObjectAttributes: [1x1 struct]

Obtain the position vector and position covariance for that track using the model name.

[position1,positionCovariance1] = getTrackPositions(tracks,"constvel")
position1 = 1×3

    10     3    -7

positionCovariance1 = 3×3

     1     0     0
     0     1     0
     0     0     1

Obtain the position vector and position covariance for that track using the position selector.

positionSelector = [1 0 0 0 0 0; 0 0 1 0 0 0; 0 0 0 0 1 0];
[position2,positionCovariance3] = getTrackPositions(tracks,positionSelector)
position2 = 1×3

    10     3    -7

positionCovariance3 = 3×3

     1     0     0
     0     1     0
     0     0     1

Input Arguments

collapse all

Object tracks, specified as an array of objectTrack objects or an array of structures containing sufficient information to obtain the track position information. At a minimum, these structures must contain a State column vector field and a positive-definite StateCovariance matrix field. For a sample track structure, see toStruct.

Motion model name, specified as one of these options:

  • "constvel" — The function obtains the position states based on the state definition in the constvel function.

  • "constacc" — The function obtains the position states based on the state definition in the constacc function.

  • "constturn" — The function obtains the position states based on the state definition in the constturn function.

  • "singer" — The function obtains the position states based on the state definition in the singer (Sensor Fusion and Tracking Toolbox) function. The use of singer model requires the Sensor Fusion and Tracking Toolbox™.

Position selector, specified as a D-by-N real-valued matrix of ones and zeros. D is the number of dimensions of the tracker. N is the size of the state vector. Using this matrix, the function extracts track positions from the state vector. Multiply the state vector by position selector matrix returns positions. The same selector is applied to all object tracks.

Output Arguments

collapse all

Positions of tracked objects at last update time, returned as a real-valued M-by-D matrix. D represents the number of position elements. M represents the number of tracks.

Position covariance matrices of tracked objects, returned as a real-valued D-by-D-M array. D represents the number of position elements. M represents the number of tracks. Each D-by-D submatrix is a position covariance matrix for a track.

More About

collapse all

Position Selector for 2-Dimensional Motion

Show the position selection matrix for two-dimensional motion when the state consists of the position and velocity.

[10000010]

Position Selector for 3-Dimensional Motion

Show the position selection matrix for three-dimensional motion when the state consists of the position and velocity.

[100000001000000010]

Position Selector for 3-Dimensional Motion with Acceleration

Show the position selection matrix for three-dimensional motion when the state consists of the position, velocity, and acceleration.

[100000000000100000000000100]

Extended Capabilities

Version History

Introduced in R2017a

expand all