OK - the DAT file clearly shows the problem. It looks to me like a bad compass. The log has numerous magnetic heading errors:
1.826 : 3096 [L-FDI]NS(0) FUSION(0): fault on , magn_heading_err_large
111.223 : 9506 [L-FDI]NS(0) FUSION(0): fault on , magn_heading_err_large
111.360 : 9514 [L-FDI]NS(0) FUSION(1): fault on , magn_heading_err_large
220.979 : 15937 [L-FDI]NS(0) FUSION(1): fault on , magn_heading_err_large
239.360 : 17014 [L-FDI]NS(0) FUSION(1): fault on , magn_heading_err_large
350.891 : 23549 [L-FDI]NS(0) FUSION(1): fault on , magn_heading_err_large
351.300 : 23573 [L-FDI]NS(0) FUSION(0): fault on , magn_heading_err_large
Eventually that leads to fusion scheme failure with both IMUs:
228.523 : 16379 [L-FDI]NS(0) FUSION(0): fault on , disagree
228.523 : 16379 [L-FDI]NS(0) FUSION(1): fault on , disagree
That's what leads to the flight characteristics that you saw. The gimbal is simply trying to compensate.
In terms of the direct cause, recalling that the aircraft has two IMUs and one magnetic compass, if you integrate the two IMU z-axis rate gyros w.r.t. time and compare with the unwrapped magnetic yaw you get this:
View attachment 43372
That's ugly. The IMU rate gyros agree pretty well, aside from a slight bias difference, but the compass data are garbage, going spectacularly wrong at around 220 seconds. Even before take off the compass data are suspect:
View attachment 43373
My suspicion would be that the z-axis magnetometer has problems, but there are hints of the same periodic variation in all three:
View attachment 43374
I would do a couple more flights and check the logs to see if this behavior is continuing. If so then I would have to conclude that there is a hardware fault in there somewhere.