recently I tried to measure yaw angle with MPU6050 and MahonyAHRS algorithm. As expected, the yaw angle consistently drifts.
But I could see that the changes caused by the drift are much smaller than the changes caused by real movements. So I put a simple if sentence to check whether the change is bigger than a threshold, if yes it is not a drift, if not it is a drift so don't add up.
yaw_change = read_yaw() - yaw_lastvalue if yaw_change > threshold_for_drift : yaw = yaw_startvalue + yaw_change
But it cant be that simple ? Is there any disadvantage for catching the drift in this way? Smaller movements than drift can be ignored in my case.