Too much compass varience

my hexacopter with MN 501S 240KV & Aplha 60A v2 esc facing problem of too much compass variance, EKF turning orange and red specially during turning in autonomous flying.
need suggestions

You definitely have some compass interference there from the battery current (throttle).
I’ve run that log through Magfit and this should make a slight improvement, but if you can do a flight with just circles, plenty of yaw and figure 8 if you can manage it - that will be a very useful log to redo the compass calibration and make further improvements. We just need the .bin log, not all the tlogs and stuff :slight_smile:

Carefully set these corrected values:

COMPASS_DIA_X,0.806
COMPASS_DIA_Y,0.800
COMPASS_DIA_Z,0.800
COMPASS_ODI_X,-0.191
COMPASS_ODI_Y,0.039
COMPASS_ODI_Z,0.067
COMPASS_OFS_X,190
COMPASS_OFS_Y,381
COMPASS_OFS_Z,172
COMPASS_MOT_X,9.482
COMPASS_MOT_Y,-8.826
COMPASS_MOT_Z,-0.604
COMPASS_DIA2_X,0.987
COMPASS_DIA2_Y,1.053
COMPASS_DIA2_Z,1.025
COMPASS_ODI2_X,0.011
COMPASS_ODI2_Y,0.026
COMPASS_ODI2_Z,-0.020
COMPASS_OFS2_X,-10
COMPASS_OFS2_Y,-183
COMPASS_OFS2_Z,283
COMPASS_MOT2_X,1.030
COMPASS_MOT2_Y,-0.020
COMPASS_MOT2_Z,0.166
COMPASS_MOTCT,2
COMPASS_SCALE,1.00
COMPASS_SCALE2,1.00

You can copy/paste them into notepad and save as “mag_adjustments.param” or similar, then use MissionPlanner Full Paramater List, “Load from File” to apply them without making typing mistakes.

This is what magfit produced, notice in the top graph the Expected and Uncorrected lines are separated.
In the next graph down the Corrected mostly overlays the Expected
There was another graph for the second compass too, but I didnt copy it here.

Please also set this critical battery failsafe action, even though you have an action set for Low voltage. If the Low voltage action gets cancelled for any reason, then you still have a Critical voltage action to fall back on.
BATT_FS_CRT_ACT,1
and you should use these values for you battery:

BATT_ARM_VOLT,44.30
BATT_CRT_VOLT,42.00
BATT_LOW_VOL,43.20

Also I just noticed, the non-damped IMU has very high vibrations.
You should investigate the vibrations and what is causing that before flying more - if Arducopter has to try and use that IMU for some reason, it will likely do a fly-away or have to just Land (if not crash).

One work-around is to disable that IMU, but that is just masking the problem, and it is much better to fix the problem.
For reference anything over 30 on that graph is bad.

Once vibrations are solved, I can help enable Harmonic Notch filter too, if you want to - this allowes for improved tuning.

thanks for your help I have done two flight by loading parameters sending file for the reference
first flight was done manually by 360 degree rotation left and right.
other flight was done autonomously
[2023-09-11 09-05-20.bin (2.2 MB)](1.rar - Google Drive)

thanks for your help I have done two flight by loading parameters sending file for the reference
first flight was done manually by 360 degree rotation left and right.
other flight was done autonomously.
kindly check

Both compasses will be improved further with these new settings:

COMPASS_DIA_X 0.962
COMPASS_DIA_Y 1.046
COMPASS_DIA_Z 0.800
COMPASS_ODI_X -0.003
COMPASS_ODI_Y 0.023
COMPASS_ODI_Z 0.044
COMPASS_OFS_X 92
COMPASS_OFS_Y 280
COMPASS_OFS_Z 175
COMPASS_MOT_X 7.994
COMPASS_MOT_Y -10.000
COMPASS_MOT_Z 0.449
COMPASS_DIA2_X 1.002
COMPASS_DIA2_Y 1.038
COMPASS_DIA2_Z 0.800
COMPASS_ODI2_X -0.004
COMPASS_ODI2_Y -0.023
COMPASS_ODI2_Z 0.024
COMPASS_OFS2_X 45
COMPASS_OFS2_Y -231
COMPASS_OFS2_Z 388
COMPASS_MOT2_X 0.436
COMPASS_MOT2_Y 0.336
COMPASS_MOT2_Z 0.165
COMPASS_SCALE2 1.00
COMPASS_SCALE 1.00
COMPASS_MOTCT 2

and that will be it for compass adjustments.

Many of the settings you have are defaults that suit a small quad with 10inch props. Connect to MissionPlanner and go to Setup, Mandatory, Initial Parameters.
Enter your prop size in inches and you battery cell count, Also select “Suggested” and T-Motor Flame options. Accept everything it offers to change.

Then also set these:

INS_ACCEL_FILTER,10
INS_HNTCH_ENABLE,1
INS_LOG_BAT_MASK,1
INS_LOG_BAT_OPT,4
PSC_ACCZ_I,0.6
PSC_ACCZ_P,0.3

This graphs shows Motors 2, 4 and 5 working harder than the others. This indicates a physical yaw bias probably caused by one or more motor mounts not perfectly aligned (twisted) on the arms.
If you fix that tuning will be easier and produce a better result.

image

If battery voltage levels and failsafe actions give you trouble, DO NOT change them - you need to fix the problem that would be causing the battery voltage to drop so fast. Changing the voltage levels and failsafe actions from the correctly calculated values is a trap many fall into, and the copter will end up crashing because of a failed battery.

Do another flight with those new settings, in AltHold mode and Loiter. Don’t do Auto flights until tuning is improved. This will give data for setup up the harmonic notch filter. After that you should probably be able to run Autotune.

as per your suggestion I have done flight again in loiter mode.
Kindly have a look ,waiting for further assistance

Can you just upload the .bin file without putting in a compressed rar? This one wont even download.

sorry for the inconvenience sending again bin file

Cant download it, it says it’s “in owners bin”

kindly check
thank you for your help

I could download that now, thanks.

You still have the physical yaw bias issue. See in this graph where yaw is quite steady, the motor outputs are still separated as I pointed out before. You will have to check more closely if your motor mounts are correctly aligned.

A simple way is to see if the prop tips point to each other when you look at them from the side.
image

What size props do you have?
For the harmonic notch filter, just change these parameters based on your flight data:

INS_HNTCH_BW,20
INS_HNTCH_REF,0.35
INS_HNTCH_FM_RAT,0.7

for this result:

The only odd thing is that rogue frequency at 30Hz that does not match any props you might be using.
If there is a video transmitter or something that has a cooling fan, then it needs some antivibration isolation.

If you can sort out the motor mount/yaw bias issue then you could be ready for an Autotune.

I’m using 15 inch propellers (15x5)

I’m using 15 inch propellers (15x5)
{T motor carbon fiber}

putting these value in initial tune parameter .
kindly check.
using two 6S 16AH battery connected in series

You already had all the required settings, so no need to do that again.

I wanted to check the prop size because 80Hz noise doesn’t quite match the expected noise frequency for 15inch, which would normally be more like 60Hz. The motors could produce 80Hz noise if they were running at maximum, but that’s not evident in the log.
So both the small 30Hz peak and the main 80Hz peak are bit of a mystery.

Use the values I already provided, check the motor mounts/arms for twist and fix that…

INS_HNTCH_BW,20
INS_HNTCH_REF,0.35
INS_HNTCH_FM_RAT,0.7

then do another test flight and we will see what happens.

EDIT:
The Initial Parameters calculator doesnt read in your existing values first, so it always starts with some default values. If you did run it again you would find there are no parameters listed to modify, since before writing anything it lists all the existing params and new params and gives you a chance to deselect any.

done test flight with new parameter setting sending log file

sending file after test flight with all parameter

There was only a tiny part of that log with level flight and no yaw, and the motor outputs looked reasonable even - so I guess you’ve done something to address the twisted motor mounts.
That little 30Hz peak went away.
You can make these minor adjustments

ATC_THR_MIX_MAN,0.5
INS_HNTCH_FREQ,83
INS_HNTCH_BW,30

and probably try Autotune for pitch and roll axis.

done flight again with parameters suggested by you enclosing bin file

moreover if my uav ask for compass calibration before flight the value goes to default value after calibration do i have to burn the parameter file again
COMPASS_DIA_X 0.962
COMPASS_DIA_Y 1.046
COMPASS_DIA_Z 0.800
COMPASS_ODI_X -0.003
COMPASS_ODI_Y 0.023
COMPASS_ODI_Z 0.044
COMPASS_OFS_X 92
COMPASS_OFS_Y 280
COMPASS_OFS_Z 175
COMPASS_MOT_X 7.994
COMPASS_MOT_Y -10.000
COMPASS_MOT_Z 0.449
COMPASS_DIA2_X 1.002
COMPASS_DIA2_Y 1.038
COMPASS_DIA2_Z 0.800
COMPASS_ODI2_X -0.004
COMPASS_ODI2_Y -0.023
COMPASS_ODI2_Z 0.024
COMPASS_OFS2_X 45
COMPASS_OFS2_Y -231
COMPASS_OFS2_Z 388
COMPASS_MOT2_X 0.436
COMPASS_MOT2_Y 0.336
COMPASS_MOT2_Z 0.165
COMPASS_SCALE2 1.00
COMPASS_SCALE 1.00
COMPASS_MOTCT 2
INS_ACCEL_FILTER,10
INS_HNTCH_ENABLE,1
INS_LOG_BAT_MASK,1
INS_LOG_BAT_OPT,4
PSC_ACCZ_I,0.6
PSC_ACCZ_P,0.3
INS_HNTCH_BW,20
INS_HNTCH_REF,0.35
INS_HNTCH_FM_RAT,0.7
ATC_THR_MIX_MAN,0.5
INS_HNTCH_FREQ,83
INS_HNTCH_BW,30