Getting heading with only the gyrometer

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
PietB
Beginner
Posts: 2
Joined: Wed Dec 01, 2021 9:16 am

Getting heading with only the gyrometer

Post 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?
Attachments
Screenshot 2022-01-13 170632.png
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Getting heading with only the gyrometer

Post 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
PietB
Beginner
Posts: 2
Joined: Wed Dec 01, 2021 9:16 am

Re: Getting heading with only the gyrometer

Post by PietB »

Ah that makes sense. Thanks a lot for the detailed answer, very helpful :)
Post Reply