Drone yaw drift while in Position hold and Loiter mode

Nope, I tried.

This is a new log. I made physical changes to the drone itself. It has an external compass also that i did not use bc the initial calibration gave me results that were worse.

Hello,

Here is the updated flight. I changed things on the hardware side. WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free

When I take off, then I experience no toilet bowling, it does the yaw reset as intended, BUT. If i fly in a direction, the drone yaws and gets the right heading as it actually is. After that the heading is correct and everything is fine.

Is this log sufficient enough to get a reasonable magfit with it?
@Allister @dkemxr

No. It iterates forever and produces max scale compass MOT values and a very high Z-offset so I don’t think it’s good. What did you change on the hardware side?

I have two 2in1 esc-s that have a battery wire traveling through the fuselage.
a section of that wire was not twisted. I twisted it and used EMI shielding tape on that wire.
I also shielded with EMI tape other battery wires that are going for example to the camera and gimbal. Since it is a fairly small platform i do not have a really good place where to put the compass.
I also use steel screws to hold the autopilot in place, but i doubt that is contributing. Since the magfield corresponds to the battery current.
Both compasses are getting a high Z value.

Can you post a photo of the drone?

This is what I can share.
What you can see from here is the gimbal controller with the large connector, underneath that is the 2in1 ESC. In the middle of that ESC (Between the two jst-gh connectors) is the twisted battery cable coming from the second 2in1 esc

I think you simply need more isolation (distance) from an external module. Consider a discreet compass module perhaps.

I will try to place the external compass to a different location

Even one of those cheap GY-271 boards might work placed far enough away.

Main issue is that the only place where i could put is under a 1w radio. That would be 7cm away from first esc, but right ontop of the second while just the battery inbetween

You could try the Matek AP_Perip CAN RM3100 board. Those are reported to be more immune to local interference. I don’t have direct experience with this but they are not that expensive to try.
They do suggest >10cm from interference producing conponents.

I tried an external compass 10cm from first esc, 10cm from the bottom esc. Although it is right on top of the battery (maybe 5mm distance) I still get a worse result than the internal one:

INTERNAL -

External

Edit - X and Y seem better than yesterday. Way better than yesterdays position -

It needs to be away from all electric current.

Then run Magfit on it and try it.

Can someone give me some pointers for the magfit - I have used it as this -

Watch the video on the Wiki Page. Magfit

I have done it.
But, it says that you should use only the part where it is flying. I have set the flightmode to poshold/loiter, and since im not using the python version in linux I cannot use the commandline for it. At least I have not figured it out in windows.
Should I also change the offset max from 1500 to 500? What do the offdiagmin and max change?
What value does the cmot max affect?

Using MAVExplorer you don’t need to use the command line. Use the Zoom function and highlight a section of interest with some Yaw and throttle changes. Leave everything else at default and process it.

Hello,

Here are two logs - it seems that I have found a better place for the compass.

internal -

Externa-