Page 1 of 1

Getting heading with only the gyrometer

Posted: Thu Jan 13, 2022 4:21 pm
by PietB
I'm doing trying to use odometry for some basic navigation, and for that I need the heading of the drone. The only deck I'm using is the flowdeck, so I thought I could use the integrated data of the gyrometer to get the heading of the drone. I know this wouldn't be very accurate, but it doesn't have to be.

I saw that there are already logging variables (stateEstimate.yaw and stabilizer.yaw which are the same value) available which seem to give the heading data. However, when trying to use them I found that they seem to always convert to 0. I attached an image of the plotter where I turned the drone around 120 degrees (which is depicted accurately), but then when I let the drone go, the yaw value goes to 0 over time. Is there a solution to this?

Re: Getting heading with only the gyrometer

Posted: Fri Jan 14, 2022 8:46 am
by kristoffer
Hi!

First some background: When you use the flow deck the kalman estimator is automatically enabled and what you see is a mechanism in the kalman estimator that slowly "leaks" the yaw towards zero. The kalman estimator was implemented by Mike Hamer to handle Ultra Wide Band positioning, the Loco system in our case. This type of positioning system does not provide any yaw information and yaw is instead estimated using the gyros and the general motion of the Crazyflie. For this to work the platform must have a known yaw when taking off and this is where this "leak" comes in. The idea is that the user simply places the Crazyflie on the floor, heading in the positive X-axis direction, while the estimator automatically leaks back to yaw=0 and all is good for take off. Note, the leaking is only active when the Crazyflie is not flying.

This mechanism is active regardless of positioning method and this is what you see.

You can find the code here (https://github.com/bitcraze/crazyflie-f ... #L550-L557) if you want to comment it out

Re: Getting heading with only the gyrometer

Posted: Fri Jan 14, 2022 6:30 pm
by PietB
Ah that makes sense. Thanks a lot for the detailed answer, very helpful :)