quat2angle different result
Mostra commenti meno recenti
Hello everybody.
I am using the quat2angle function to analyse the yaw, pitch and roll of my sensor data. For that I did a Testfile, which looks fine, but on the original data there a lot of jumps. You can see it on the plots attached. Does anybody have an idea where jumps the jumps are comming from and any suggestions to get it as smooth as the testfile?
Test Original


It should be almost the same movement... The only difference is, that the testfile was recorded in the lab and the original data on a canoe on water.
PRY = compact(quaternion(w,x,y,z));
figure ('Name','p r y')
[yaw, pitch, roll] = quat2angle(PRY);
subplot(3,1,1);
plot(t, yaw)
title('yaw')
ylabel('Winkel (rad)')
legend('yaw','Location','NorthEastOutside')
subplot(3,1,2);
plot(t, pitch)
title('pitch')
ylabel('Winkel (rad)')
legend('pitch','Location','NorthEastOutside')
subplot(3,1,3);
plot(t, roll)
title('roll')
ylabel('Winkel (rad)')
legend('roll','Location','NorthEastOutside')
axes('pos',[.6 .5 .5 .3])
imshow('Roll_pitch_yaw_gravitation_center_de.png')
3 Commenti
James Tursa
il 12 Nov 2020
Could be the sign ambiguity of the quaternion or a rollover of angles for the Euler Angles. Can you post a small subset of the data you are using that encompasses one of these jumps?
Sven Dietrich
il 13 Nov 2020
James Tursa
il 14 Nov 2020
I don't see any sign flipping in the quaternion data you posted.
Risposte (1)
David Goodmanson
il 14 Nov 2020
0 voti
Hi Sven,
it's pretty clear that both test and original have discontinuities because the function producing the angles, probably atan2, has range -pi to pi. That's clearest in the test roll plot, where the data drops below -pi and reappears at pi (or goes above pi and reappears at -pi). A straightforward way to fix that is to run those angles through the unwrap function.
Since the jumps are +-2*pi, keeping them or removing them makes no difference one you plug them into a trig function.
Categorie
Scopri di più su Quaternion Math in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!