quat2angle different result
显示 更早的评论
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 个评论
James Tursa
2020-11-12
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
2020-11-13
James Tursa
2020-11-14
I don't see any sign flipping in the quaternion data you posted.
回答(1 个)
David Goodmanson
2020-11-14
0 个投票
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Quaternion Math 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!