Isn't compass used in AltHold mode so what made the copter yaw?

Hi guys,

I hope you are doing well.
I am flying and tuning a new H frame quadcopter - big one with 32 props.
When doing manual tune in AltHold, I figured out some strange behaviours. The drone did yawing without my input in the yaw channel. When analysing log, I realize there was some “noisy” or “abnormal” mangetic intensity in x and y axis. Right after the magnetic changed, the yaw rate changed, so I had to correct it by yaw stick (my input)


According to this discussion, the compass input may be used for correcting the gyro drift Does Alt Hold require a compass? - #6 by Rob_Lefebvre

Is it the case for my situation?
If this is not the reason, how can I minize this yaw-auto-rotating problem in the AltHold mode?

This is the log in case you need to do additional analysing: https://drive.google.com/file/d/1YHCh7_DiTQccqknALtl7TLHwANnjtdaH/view?usp=sharing

Thanks,
Vu.

Let me explain a little more about the time stamp:
At 1:
I observed the drone yaw leff - but it did not shown here!!!

At 2:
I started correcting it by applying input to yaw channel making the drone yaw right

At 3:
The drone came back to my desired yaw angle

It looks like the compass is responsive to throttle (current) to me:

That’s correct!
The external compass is mounted close to power wires - I know I need to choose a better position in loiter or poshold mode later on.

Even with normal throttle, yaw rate is still there without pilot input, yaw rate changed right after taking off successfully.

Even in AltHold, the controller commanded copter to yaw

I am setting parameters of compass:
. COMPASS_LEARN : 2 - EKF Learning
. EK3_MAG_CAL : 0 - When flying

Hi guys, it would be much appreciated if someone can confirm where this yaw effect came from.
Thanks.

Set these back to default and try the Magfit utility in MAVExplorer to calibrate the compass and set the compass motor offsets. Page down to the MAVExplorer section.
Magfit