get track positions from trackerGNN
조회 수: 8 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
Prashant Arora
2025년 2월 6일
편집: Prashant Arora
2025년 2월 6일
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
Prashant Arora
2025년 2월 7일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!