Main Content

initializeTrack

Initialize new track

Description

example

trackID = initializeTrack(obj,track) initializes a new track in the tracker or track fuser object, obj. The tracker or fuser must be updated at least once before initializing a track. If the track is initialized successfully, the tracker or fuser assigns the output trackID to the track, sets the UpdateTime of the track equal to the last step time in the tracker, and synchronizes the data in the input track to the initialized track.

A warning is issued if the tracker or track fuser already maintains the maximum number of tracks specified by itsMaxNumTracks property. In this case, the trackID is returned as 0, which indicates a failure to initialize the track.

Note

This syntax doesn't support using the trackingGSF, trackingPF, or trackingIMM filter object as the internal tracking filter for the tracker or track fuser. Use the second syntax in these cases.

trackID = initializeTrack(obj,track,filter) initializes a new track in the tracker or track fuser object, obj, using a specified tracking filter, filter.

Note

  • If the tracking filter used in the tracker or track fuser is trackingGSF, trackingPF, or trackingIMM, you must use this syntax instead of the first syntax.

  • This syntax does not support using trackFuser as the obj input.

Examples

collapse all

Create a GNN tracker and update the tracker with detections at t=0 and t=1second.

tracker = trackerGNN
tracker = 
  trackerGNN with properties:

                  TrackerIndex: 0
       FilterInitializationFcn: 'initcvekf'
                    Assignment: 'MatchPairs'
           AssignmentThreshold: [30 Inf]
                  MaxNumTracks: 100
                 MaxNumSensors: 20

                    TrackLogic: 'History'
         ConfirmationThreshold: [2 3]
             DeletionThreshold: [5 5]

            HasCostMatrixInput: false
    HasDetectableTrackIDsInput: false
               StateParameters: [1x1 struct]

                     NumTracks: 0
            NumConfirmedTracks: 0

detection1 = objectDetection(0,[1;1;1]);
detection2 = objectDetection(1,[1.1;1.2;1.1]);
tracker(detection1,0);
currentTrack = tracker(detection2,1);

As seen from the NumTracks property, the tracker now maintains one track.

tracker
tracker = 
  trackerGNN with properties:

                  TrackerIndex: 0
       FilterInitializationFcn: 'initcvekf'
                    Assignment: 'MatchPairs'
           AssignmentThreshold: [30 Inf]
                  MaxNumTracks: 100
                 MaxNumSensors: 20

                    TrackLogic: 'History'
         ConfirmationThreshold: [2 3]
             DeletionThreshold: [5 5]

            HasCostMatrixInput: false
    HasDetectableTrackIDsInput: false
               StateParameters: [1x1 struct]

                     NumTracks: 1
            NumConfirmedTracks: 1

Create a new track using the objectTrack object.

newTrack = objectTrack()
newTrack = 
  objectTrack with properties:

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

Initialize a track in the GNN tracker object using the newly created track.

trackID = initializeTrack(tracker,newTrack)
trackID = uint32
    2

As seen from the NumTracks property, the tracker now maintains two tracks.

tracker
tracker = 
  trackerGNN with properties:

                  TrackerIndex: 0
       FilterInitializationFcn: 'initcvekf'
                    Assignment: 'MatchPairs'
           AssignmentThreshold: [30 Inf]
                  MaxNumTracks: 100
                 MaxNumSensors: 20

                    TrackLogic: 'History'
         ConfirmationThreshold: [2 3]
             DeletionThreshold: [5 5]

            HasCostMatrixInput: false
    HasDetectableTrackIDsInput: false
               StateParameters: [1x1 struct]

                     NumTracks: 2
            NumConfirmedTracks: 2

Input Arguments

collapse all

Tracker or fuser object, specified as a trackerTOMHT, trackerJPDA, trackerGNN, or trackFuser object.

New track to be initialized, specified as an objectTrack object or a structure. If specified as a structure, the name, variable type, and data size of the fields of the structure must be the same as the name, variable type, and data size of the corresponding properties of the objectTrack object.

Data Types: struct | object

Output Arguments

collapse all

Track identifier, returned as a nonnegative integer. trackID is returned as 0 if the track is not initialized successfully.

Example: 2

Extended Capabilities

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

Introduced in R2020a