Yaw drift after TakeOff on Loiter Mode

Hello.
Two days ago I made two flights. In the first flight everything went ok, taking off and landing in Loiter mode and flying in auto mode.
In the second flight, just after being take off in Loiter mode, the drone began to rotate quickly on the Yaw axis and could not keep it still.
From the log you see that just after take-off there is an offset on the Rate.ydes parameter.

Furthermore there is a strange behavior on the RCOU.C4 parameter.

I attach the log

Thanks to anyone who can help me

For me, although it is strange that motor 4 was very low, the FC wanted to do that, so I don’t think that motor be broken or similar. So I see two things, first that your second and third compass are largely affected by wires, motors, battery… because the mag field changes a lot with the throttle, so I recommend you to only activate the first compass and see if the problem is solved:

And second, I think that you also have motor imbalance, but it is more difficult to see due to the yaw rotation.

Thank you @davidae.
i will try to deactivate the second and third compass. I have to say that i never set a CompassMot calibration.

About motor imbalance i attach the previos log bout the flight that gone very well:

Thank you again

It seems you flew with a lot of wind or you have a lot of weight in front of the drone because motors 2, 4, 6, 8 were low whereas 1, 3, 5, 7 were high.

In a moment, some motors went to the minimum so the stabilization in those cases could be problematic.

And you also had problems with the magfield, so it wasn’t just a problem of the second flight.

Yes, i mounted a gimbal that is not balnced very well and it pull on the front of the drone.
I will solve this problem too.
But on the second flight there is no payload under the drone, so the shift on the RATE.YDes maybe is the magnetometer interference, but i sow on this topic that maybe it is a bug:

That is on master, and you flew with 4.0.7, so it isn’t related. Furthermore your problem is different.

Thank you @davidae.
So maybe is the influence on the magnetometer

Try to balance the weight, make the motors use the same amount of energy, more or less. And also calibrate your compass outside with 3D lock

Thank you @Yaros.
When the problem arose, the drone was without payload. So the system was balanced.
I calibrated the compass outside with 3D lock, but i didn’t do the CompassMot calibration.
So i will do that and i will use only the external compass.
I’ll let you know.

Yes! Use only external compass and make sure that its orientation is right!
Hope it goes well :slight_smile: tell me if it works after you test