AutoTakeoff not holding heading

On autotakeoff the plane climbs in a constantly turning circle. In the log I see I DO have a couple of GPS glitches, but I thought that it would use compass during those. It performs flawlessly in other guided modes. For some reason, during takeoff, target nav bearing is not shown on a log display, but is in other guided flight modes.
This is the first time I have tried to look at a log file.

thanks

Both Mag and GPS are greatly affected by current , the number of satellites drop from 8 to 4 and then even to zero so also your ground speed is affected.

I suggest to move you power cables away from the GPS