get track positions from trackerGNN

7 visualizzazioni (ultimi 30 giorni)
In this example:
how do you extract the track coordinates and uncertainties calculated from the tracker?
I tried this:
[positions, covariances] = getTrackPositions(allTracks,'constvel')
but positions was a 3x1 array.

Risposta accettata

Prashant Arora
Prashant Arora il 6 Feb 2025
Modificato: Prashant Arora il 6 Feb 2025
Hi,
For the Cartesian EKF, you should be able to use getTrackPositions(tracks, "constvel") and the output positions represents the position as 3xN array, where N is the number of tracks.
For the MSC-EKF, there's a helper function getTrackPositionsMSC defined in the example. You should be able to use that to get the position and covariance of the tracks.
Thanks,
Prashant
  5 Commenti
Prashant Arora
Prashant Arora il 7 Feb 2025
The "tracks" output from the tracker represents the estimate of the object at the current time. It does not represent the entire history of the object estimate. To get the estimate over a course of time, you can use the getTrackPositions or getTrackPositionsMSC function inside the loop.
Each element of the "tracks" has a TrackID which represents the unique identity of the object. The code below shows an example of logging positions of tracks using a struct, however, you can use any format to store this information. This approach should work for multiple tracks, but can be simplied for single track use-case.
% Use a struct to store track-based position log.
positionLog = repmat(struct('TrackID',0,...
'Position',zeros(0,3),...
'PositionCovariance',zeros(3,3,0)),0,1);
while advance(scenario)
% Code to simulate scenario and generate detections
% The output is the confirmed tracks at current time
tracks = tracker(detections, time);
% This represent the current positions and covariances of all the confirmed tracks
[pos, cov] = getTrackPositions(tracks, 'constvel');
for k = 1:numel(tracks)
idx = find([positionLog.TrackID] == tracks(k).TrackID);
if ~isempty(idx) % Track exists in the log
positionLog(idx).Position = [positionLog(idx).Position;pos(k,:)];
positionLog(idx).PositionCovariance = cat(3,positionLog(idx).PositionCovariance,cov(:,:,k));
else % Add new track to the log
newTrack.TrackID = tracks(k).TrackID;
newTrack.Position = pos(k,:);
newTrack.PositionCovariance = cov(:,:,k);
positionLog = [positionLog;newTrack];
end
end
end
black cat
black cat il 7 Feb 2025
I see, thank you so much for explaining!

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by