Cause of huge Yaw spike

While testing 1.15.0 release on our platform, we experienced a strange event and I would like to figure out why it happened (also to understand EKF2 estimation better).

We were testing in an enclosed arena, using Optical Flow and EKF2 GPS aiding turned off. Just after lift off our logs indicate a spike in the Yaw rate estimate and a jump in the Yaw setpoint:

The cause cannot be RC input, as the goal of the test was to lift of, hover and get down without any movements in X/Y axes, so only the Thrust was operated:


It is hard to say if the magnetometer data was cause or result of the jump:

How else can I check the cause of that spike? I have access to the ULog file and can plot the full logs in the PlotJuggler as well.

You can see in the plot showing the “Norm of Magnetic Field” that it starts at 0.6 and goes down to 0.5. It also has the same shape as the thrust curve (but inverted). This means that the magnetometer is affected by the current flowing in the power cables (i.e.: battery and/or ESC cables). The change of magnetic field caused the heading estimate to reset, hence the large yaw jump. The small yawrate glitch is a consequence of this heading reset.

In summary you should try to improve the mag situation. Ideally, the norm of the mag field should be a constant value regardless of the motion of the drone and thrust.

We have just now noticed that our mag driver is not included in a stock 1.15.0 image and we “defaulted” to the v6x onboard mag :slight_smile: This does indeed explain some of our observations.

Ok, that explains it, yes!