Huge yaw movement everytime I take off


I would like to expose a problem that I’m having with two different hexacopters with the same firmware version:

Everytime that I take off, in the first seconds (before 01:09:27 on the following plot) I have a fast yaw movement, as you can see in the following plot

It doesn’t seem to be some yaw drift caused by the motors because it only happens after it’s in the air.

As anyone experienced the same behavior?

I think that it’s not the same problem described on the following topic, because I’m not seeing any interference on the magnetic field caused by the increasing motor thrust.

Currently, I’m using an external compass in both multicopters.

Thank you.

That yaw doesn’t look real. It jumps immediately without any change in yaw rate.

Are you sure it’s not the same issue? Look at the thrust and magnetic field plot -
Clearly not as bad as the other issue, but definitely correlated.

It could be the same problem, but in the two different multicopters that I use, it only started to happen with the 1.5.5 firmware.

Beside that, I think that if it was because of the variation of the magnetic field caused by the motor thrust, it would happen more times during the flight.

As you can see in the image, the magnetic field spike occurs after/almost at the same time the yaw movement happens, that’s why I think that the cause of the magnetic field spike is the yaw movement and not the opposite.

The movement is so fast and always to the same side and with the same rotation angle. That’s why it’s so strange to me.

Now plot the yaw rate or gyro z. I don’t think that initial jump in yaw physically happened, only the “correction” did.


I think that every yaw movement/position on the left plot happened, as you can see in the angular speeds plot on the right.

As I said previously, to me the first movement (the red box) is consistent to the effect caused by the motor thrust, but the huge spike doesn’t seem. What do you think?

Hi Guys,

I have seen this problem as well using ver 1.5.5

here is a video.

I think it is related to Compas calibration.

We discovered that we have to wait at least 2 mins at the exact location where it will be calibrated before calibrating it. All this to make sure MAG gets stabilized before calibrating it.



Hi pturcotte,

That’s exactly what happens to me, but with less magnitude (smaller yaw movement, but as fast as yours).

Tomorrow I will try your suggestion.

But it’s strange since in previous firmware version it didn’t happen.

The jump in yaw is a discontinuity. The vehicle yaw rate you see is the controller responding to yaw error that came out of nowhere.

You’re right, it’s a jump on the yaw position that happens from a measure to the next.
Now I just need to find what causes it :slight_smile:

but after that, it does not do it anymore.

If it can help, it looks like if we let the UAV on the ground after arming it (safety switch) it “accumulates” something wrong with the yaw. You take off, and then, it does this huge yaw movement.

I also discovered, that we really have to let the UAV on the ground for at least 2 minutes before calibrating the MAG, it helps a lot.

please let me know if you have a new firmware you want to test.



Are you both using EKF2?

Yes, I’m using the EKF2 estimator.

Yes, I am using the EKF2 as well, the one by default in 1.5.5

@Paul_Riseborough any comments on the yaw estimation here? In particular @pturcotte’s comment above. Huge yaw movement everytime I take off

The EKF2 default behaviour is to use simple magnetic heading fusion on the ground and switch to 3-axis fusion at 1.5m in air. This resets the yaw and field states and prevents large magnetic anomalies at ground level resulting in an incorrect heading and toilet bowling and potential loss of position control after takeoff when using GPS. The steel reinforcement in the concrete floor and/or building structure is causing a large change in magnetic field with height

Ardupilot deals with this in the controller with a leash on the yaw angle and additionally a controller set-point reset when the EKF publishes its yaw reset, but this functionality is not yet implemented in PX4.

Until it is I recommend you set EKF2_MAG_TYPE = 1. This will cause it to use the simple magnetic heading method for the entire flight.