I have a IMU sensor that gives me orientation in terms of Quaternion and I would like to change it to readable RPY angles.
I found the formula to convert them intrinsically from Wiki
for a quaternion q= qr+qi+qj+qk
roll=atan2(2(qr*qi+qj*qk),1-2(qi^2+qj^2))
pitch=arcsin(2(qr*qj-qk*qi))
yaw=atan2(2(qr*qk+qi*qj),1-2(qj^2+qk^2))
I understand there can be gimbal lock problem when representing in RPY. How could I avoid this when pitch approaches +/- 90 degrees
P.S. I am coding in LabVIEW