DAT and Log files attached
Hmm, aren't allowed to attach all the charts in this post ... strange. Have instead included them in post#9 for the curious member that wants to understand. You have to scroll back & forth between this post & next to tag along
Great ...
Yeah ... this wasn't a yaw error coming from a magnetic disturbed compass during powering on the drone. I believe instead it's one of those rare instances where the IMU makes a computational error...
First lining up everything from the DAT log concerning yaw movements in a chart to compare if something is deviating from the others ... (Chart only covers period from power on in the left to just after the problem have been resolved at 36,8sec after motor start)
-The pink & green background color = motor start & take-off
-The blue background color = ATTI mode (sufficient satellite lock but GPS level=0)
-The red graph = IMUYaw in cardinal degrees
-The green graph = magYaw in cardinal degrees (Compass)
-The purple graph = the difference between the red & green in order to quickly see if there is larger deviations between the 2.
-The yellow graph is the same IMUYaw as the red but this time the value is "unwrapped" meaning not in cardinal degrees, instead the value on the graph is the sum from adding degrees (by yawing CW) & subtracting (by yawing CCW) ... this is needed to compare the IMUYaw towards the Gyro which only have "unwrapped" values.
-The blue graph is the unwrapped gyro value (the gyro always starts from value zero when the drone gets power).
-The black graph is #satellites locked
See the chart pic 1 in post#9
Have placed the marker in the chart just where the log starts to record ... if everything is as it should both the IMUYaw(red) & magYaw(green) should have very near the same value & the gyro(blue) should start up on 0. All is correct regarding this here.
Before the first ATTI period (blue background) we don't see any large deviation between the IMUYaw & the magYaw ... it reaches a maximum deviation of approx 8 degrees which is far from enough to cause a Yaw error.
Comparing the unwrapped IMUYaw(yellow) with the gyro(blue) shape wise only, (as they doesn't have the same values) ... shape wise they agree very well = both register similar turn directions to a similar amount.
So nothing that points to any error so far...
If going into the DAT log event stream just where the GPS level falls to 0 just after 18sec shows this ...
See the chart pic 2 in post#9
The top yellow marked line there, clearly tells us that a computational error have occurred that the flight controller can't accept. All starts at 18,4sec & everything is normalized again at 36,8sec.
If comparing the GPS velocity with the IMU registered velocity (which during normal healthy conditions should be very near 0m/s) shows this ...
Red graph = velocity difference in northern direction
Green graph = velocity difference in eastern direction
Clearly something is going on in the eastern velocity direction (green) ... so is it the GPS or the IMU?
See the chart pic 3 in post#9
Below 2 graphs showing the velocities in the eastern direction only for the IMU(blue) & the GPS(purple). It's clear that something happens with the IMU velocity at 18,4sec ... it deviates away in the opposite direction compared to the GPS.
See the chart pic 4 in post#9
So which direction is the correct one?
If checking off how the drone moved between 18,4sec to 22sec (where I've placed the marker in the chart above, when the blue reunites with the purple). Have hand-drawn a yellow arrow covering this period in the sat.pic. below.
The drone is obviously moving in a negative eastern direction (westerly) ... But in the chart above the IMU says +1,43m/s & the GPS says -2,31m/s ... this confirms that the IMU have got it wrong.
This & nothing else caused the flight controller to believe that it lost it's direction & wrongly came up with a compass/yaw error. And this also caused the ATTI mode (as the FC no longer could trust what was feed to it.)
See the chart pic 5 in post#9
So hopefully this only was a rare random mistake by the IMU ... & shouldn't be taken as a proof of that it's permanently faulty ... but advice you to be observant regarding this & unmotivated ATTI modes some time ahead.