R2024b cannot reproduce documented example result

12 Ansichten (letzte 30 Tage)
cui,xingxing
cui,xingxing am 7 Okt. 2024
Kommentiert: Paul am 10 Okt. 2024
When I am ready to use imufilter, "Tune imufilter to Optimize Orientation Estimate",the current latest version R2024b cannot reproduce the documented example results? Please fix it in time!
TEST in MATLAB online and desktop MATLAB
ld = load('imufilterTuneData.mat');
qTrue = ld.groundTruth.Orientation; % true orientation
fuse = imufilter;
qEstUntuned = fuse(ld.sensorData.Accelerometer, ...
ld.sensorData.Gyroscope);
% reset(fuse);
cfg = tunerconfig('imufilter');
tune(fuse, ld.sensorData, ld.groundTruth, cfg)
qEstTuned = fuse(ld.sensorData.Accelerometer, ...
ld.sensorData.Gyroscope);
dUntuned = rad2deg(dist(qEstUntuned, qTrue));
dTuned = rad2deg(dist(qEstTuned, qTrue));
rmsUntuned = sqrt(mean(dUntuned.^2))
rmsTuned = sqrt(mean(dTuned.^2))
N = numel(dUntuned);
t = (0:N-1)./ fuse.SampleRate;
plot(t, dUntuned, 'r', t, dTuned, 'b');
legend('Untuned', 'Tuned');
title('imufilter - Tuned vs Untuned Error')
xlabel('Time (s)');
ylabel('Orientation Error (degrees)');
  9 Kommentare
cui,xingxing
cui,xingxing am 9 Okt. 2024
Another issue I'd like to complain about is that whenever I ask this question, I can never seem to display the output results below the code. I just can't find the right adjustment button.
Paul
Paul am 10 Okt. 2024
If tune doesn't reset the filter on input and again on output, then I'd question the code snippet in the example. Seems like that would cause the tuning to be corrupted by the state of the filter on the call to tune, and subsquent use of the filter will be corrupted by its state after tune completes. That doesn't sound like a good system, and it should be documented in bold that that's how the function works.
As for displaying the output on Answers, what happens after you enter code (using cod formatting as you've done) and the click the green triangle in the Run section of the ribbon?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Brian Fanous
Brian Fanous am 9 Okt. 2024
Bearbeitet: Brian Fanous am 9 Okt. 2024
A bug in the imufilter and ahrsfilter that had a minor affect on the output was fixed in R2021b. For the setup in the code above the filter reached the ObjectiveLimit faster once the bug was addressed. This doc page was not updated after the fix. I have let our documentation group know.
Set the ObjectiveLimit to 0.03 and you'll see the filter tune itself for several iterations.
I would suggest always resetting the filter prior to tuning.
  1 Kommentar
cui,xingxing
cui,xingxing am 10 Okt. 2024
@Brian Fanous Thanks for the clarification, clear and accurate documentation is important!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by