How to achieve tracking using trackerJPDA with the position matrix below?

3 ビュー (過去 30 日間)
umutcan
umutcan 2024 年 5 月 22 日
回答済み: Sanju 2024 年 5 月 22 日
Hi, I am using the position matrix below and the codes. However, it does not see the target starting from 16000 and continues as 15500,15000,14500 etc. Where is my mistake?
position_matrix = [
1 5505 6472 6604 6990 7539 7940 8313 8498 9003 9652 10533 16000 0
2 5610 6346 6691 6939 7628 8036 8354 8618 9065 9553 10286 15900 0
3 5673 6392 6554 6902 7657 7876 8526 8494 8985 9652 10536 15800 0
4 5585 6407 6668 6921 7488 7979 8409 8661 9007 9517 10424 15700 6850
5 5636 6493 6673 6890 7569 7865 8343 8476 9071 9487 10268 15600 0
6 5586 6400 6647 6936 7546 7937 8403 8713 9093 9442 10489 15500 0
7 5673 6448 6595 6984 7675 7882 8342 8725 9069 9487 10342 13000 0
8 5640 6456 6614 7055 7541 7935 8295 8519 9096 9629 10558 12500 1500
9 5620 6320 6645 7039 7693 7874 8401 8510 9053 9450 10452 12000 0
10 5505 6315 6607 7012 7479 7942 8427 8673 9065 9636 10532 11500 0
11 5526 6449 6662 7031 7515 7987 8321 8683 8989 9573 10268 11000 2500
12 5632 6494 6601 6920 7523 8068 8363 8631 8878 9532 10461 0 0
13 5645 6429 6680 7082 7497 7882 8428 8693 9090 9619 10307 0 0
14 5589 6496 6657 6950 7590 7934 8380 8589 9120 9658 10329 0 0
15 5597 6459 6699 7039 7488 7914 8313 8674 8967 9653 10461 0 8000
16 5525 6400 6593 6971 7682 8040 8393 8654 8874 9544 10430 0 0
17 5637 6348 6514 6893 7496 7849 8426 8649 9062 9518 10338 0 0
18 5671 6334 6539 7099 7621 7949 8323 8495 9003 9461 10455 0 0
19 5551 6498 6691 7084 7556 8069 8306 8569 8974 9683 10364 0 0
20 5645 6410 6513 6980 7621 8068 8299 8483 8874 9452 10521 0 0
21 5655 6481 6583 7041 7593 8069 8437 8519 8960 9641 10331 0 0
22 5559 6474 6519 7072 7529 8015 8361 8628 8982 9546 10406 0 0
23 5639 6456 6644 6931 7491 7906 8374 8559 8932 9575 10541 5000 9575
24 5587 6469 6521 7033 7498 7996 8489 8693 8883 9482 10320 4500 0
25 5608 6336 6645 6946 7569 8045 8300 8659 9110 9443 10368 4000 0
26 5548 6504 6585 6973 7656 8057 8375 8688 8892 9482 10494 3500 0
];
JPDA_tracker = trackerJPDA( ... %'FilterInitializationFcn',@initIMMFilter,...
'MaxNumTracks', 50, ...
'FilterInitializationFcn',@initekfimm, ... % @initcvukf
'MaxNumSensors', 1, ...
'ConfirmationThreshold', [2 2],...
'DeletionThreshold', [2 3], ... % 30
'AssignmentThreshold',[3000 10000], ...
'TrackLogic','History'); % 'NewTargetDensity', beta,...
thPlot = theaterPlot('XLimits',[0 16000], 'Ylimits', [0 16000]);
trPlotter = trackPlotter(thPlot,'DisplayName','tracks', 'HistoryDepth',100,'Marker','o','MarkerSize',8,'MarkerFaceColor','green');
posSelector = [1 0 0 0 0 0; 0 0 1 0 0 0; 0 0 0 0 0 0]; % [x, y, 0]
title('JPDA Tracker');
time = position_matrix(:,1);
for tgt=1:size(position_matrix,1)
kk = 1;
for ii = 2: size(position_matrix,2)
x = position_matrix(tgt,ii);
if any(x) && x~=0
detections(kk) = {objectDetection(time(tgt),[x;x*0.8;0]);};
kk = kk+1;
end
end
confirmedTracks = JPDA_tracker(detections, time(tgt))
[pos,cov] = getTrackPositions(confirmedTracks,posSelector);
plotTrack(trPlotter,pos,cov);
drawnow
detections = {};
end

回答 (1 件)

Sanju
Sanju 2024 年 5 月 22 日
Your issue appears to be related to the values in your position matrix and how the detections are being processed. Specifically, the targets starting from 16000 and continuing to 15500, 15000, 14500, etc., might not be correctly detected due to how the objectDetection function is used or due to the limits set in your plot.
Here are a few suggestions to troubleshoot and potentially fix the issue,
  • Ensure the matrix values are correct and are within the expected range. Your position matrix seems to have valid values, but verify if there are any unintended zeroes or anomalies.
  • Verify that the plot limits are set correctly. Your code has XLimits and YLimits set to [0 16000]. If your targets go beyond this range, they will not be displayed.
  • Ensure that the detections are being created correctly. The function objectDetection(time(tgt), [x; x*0.8; 0]) might not be generating the expected values. You might want to log these values to ensure they are within the plot limits.
  • Check if the detections array is properly initialized and reset. The line detections = {}; correctly resets it after each target, but ensure there are no logical errors causing it to miss detections.
Here is a refined version of your code with additional comments for clarity:
position_matrix = [
1 5505 6472 6604 6990 7539 7940 8313 8498 9003 9652 10533 16000 0
2 5610 6346 6691 6939 7628 8036 8354 8618 9065 9553 10286 15900 0
3 5673 6392 6554 6902 7657 7876 8526 8494 8985 9652 10536 15800 0
4 5585 6407 6668 6921 7488 7979 8409 8661 9007 9517 10424 15700 6850
5 5636 6493 6673 6890 7569 7865 8343 8476 9071 9487 10268 15600 0
6 5586 6400 6647 6936 7546 7937 8403 8713 9093 9442 10489 15500 0
7 5673 6448 6595 6984 7675 7882 8342 8725 9069 9487 10342 13000 0
8 5640 6456 6614 7055 7541 7935 8295 8519 9096 9629 10558 12500 1500
9 5620 6320 6645 7039 7693 7874 8401 8510 9053 9450 10452 12000 0
10 5505 6315 6607 7012 7479 7942 8427 8673 9065 9636 10532 11500 0
11 5526 6449 6662 7031 7515 7987 8321 8683 8989 9573 10268 11000 2500
12 5632 6494 6601 6920 7523 8068 8363 8631 8878 9532 10461 0 0
13 5645 6429 6680 7082 7497 7882 8428 8693 9090 9619 10307 0 0
14 5589 6496 6657 6950 7590 7934 8380 8589 9120 9658 10329 0 0
15 5597 6459 6699 7039 7488 7914 8313 8674 8967 9653 10461 0 8000
16 5525 6400 6593 6971 7682 8040 8393 8654 8874 9544 10430 0 0
17 5637 6348 6514 6893 7496 7849 8426 8649 9062 9518 10338 0 0
18 5671 6334 6539 7099 7621 7949 8323 8495 9003 9461 10455 0 0
19 5551 6498 6691 7084 7556 8069 8306 8569 8974 9683 10364 0 0
20 5645 6410 6513 6980 7621 8068 8299 8483 8874 9452 10521 0 0
21 5655 6481 6583 7041 7593 8069 8437 8519 8960 9641 10331 0 0
22 5559 6474 6519 7072 7529 8015 8361 8628 8982 9546 10406 0 0
23 5639 6456 6644 6931 7491 7906 8374 8559 8932 9575 10541 5000 9575
24 5587 6469 6521 7033 7498 7996 8489 8693 8883 9482 10320 4500 0
25 5608 6336 6645 6946 7569 8045 8300 8659 9110 9443 10368 4000 0
26 5548 6504 6585 6973 7656 8057 8375 8688 8892 9482 10494 3500 0
];
% Tracker initialization
JPDA_tracker = trackerJPDA( ...
'MaxNumTracks', 50, ...
'FilterInitializationFcn', @initekfimm, ...
'MaxNumSensors', 1, ...
'ConfirmationThreshold', [2 2], ...
'DeletionThreshold', [2 3], ...
'AssignmentThreshold', [3000 10000], ...
'TrackLogic', 'History');
% Plot initialization
thPlot = theaterPlot('XLimits', [0 16000], 'Ylimits', [0 16000]);
trPlotter = trackPlotter(thPlot, 'DisplayName', 'tracks', 'HistoryDepth', 100, 'Marker', 'o', 'MarkerSize', 8, 'MarkerFaceColor', 'green');
posSelector = [1 0 0 0 0 0; 0 0 1 0 0 0; 0 0 0 0 0 0];
% Tracking and plotting
title('JPDA Tracker');
time = position_matrix(:,1);
for tgt = 1:size(position_matrix, 1)
kk = 1;
detections = {};
for ii = 2:size(position_matrix, 2)
x = position_matrix(tgt, ii);
if x ~= 0
detections{kk} = objectDetection(time(tgt), [x; x*0.8; 0]);
kk = kk + 1;
end
end
confirmedTracks = JPDA_tracker(detections, time(tgt));
[pos, cov] = getTrackPositions(confirmedTracks, posSelector);
plotTrack(trPlotter, pos, cov);
drawnow;
end
This script includes,
  • Correct initialization and reset of the detections array.
  • Proper assignment of objectDetection with checks.
If the issue persists, ensure the targets are within the plot limits and correctly detected in each loop iteration.
Hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by