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 Kommentare

James Tursa
James Tursa am 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
Sven Dietrich am 13 Nov. 2020
Yes the, ambigiuty could be. Attatched you can find a part of the the original data.
The plot does not make sens - confuses me - because I also did an animation to see the movement and this looks smooth with the same data.
James Tursa
James Tursa am 14 Nov. 2020
I don't see any sign flipping in the quaternion data you posted.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

David Goodmanson
David Goodmanson am 14 Nov. 2020

0 Stimmen

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.

Gefragt:

am 12 Nov. 2020

Beantwortet:

am 14 Nov. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by