Relative yaw value?

So i don’t want to use magnetometer, I only want the yaw value which is expressed relative to the one before it. How can i get it from q0, q1, q2, q3? The current AHRS code with imu.getMotion6 and ahrs.getEuler returns a yaw value that decrease continuously.

This is because angular velocity is integrated and error is accumulated. Roll and pitch use accelerometers to compensate integrational error, but it is impossible to get long-term reference for yaw from them without magnetometer or another source of information about yaw.

Hi ivereninov, thanks for your reply. I understand that we can’t get long-term reference for yaw in case of lacking magnetometer. But what if i only want to get relative value of yaw in about 100 ms? The 3DIMU python apllication can get it and represent it into 3Dcube, right? So if there is a way to get short-term angle from quaternion, I’ll appreciate that.

This is what ahrs.getEuler(&roll, &pitch, &yaw); does, it converts quaternion to Euler angles. Does it behave differently from 3D cube? You will obviously see some drift in yaw angle, but over 100ms it should be quite precise.