Advice on my PID settings for AltHold

Hi all,
I’m working from few days on my pid, it’s better but when I looked my lof I’m not totally satisfied, I’ve tried lot of tune but this is always the same.
In CTUN if I graph DAlt and Alt I’m not statisfied. The Alt graph it’s not linear enough for me

I’ve tried to change P&I for pitch/roll rate but (I lowered the values) but I always have oscillations as you can see above (this screenshot is the best tune I have). I’ve always leave the same value for P&I in ATC_RAT_PIT_I and ATC_RAT_PIT_P ATC_RAT_RLL_I ATC_RAT_RLL_P as it was recommended to me on the forum.

I’am not satisfed also with ATT.DesRoll and ATT.Roll.
Here is my bin file : here
I have an Hexacopter 7inches props, 3 batteries 4s Lipo, Orange Cube and the weight approximately 2,3Kg. I want to have a better setting before to run an AutoTune

Compass is somewhat affected by motor current, you could (carefully) run the Compass Motor calibration
https://ardupilot.org/copter/docs/common-compass-setup-advanced.html#common-compass-setup-advanced-compassmot-compensation-for-interference-from-the-power-wires-escs-and-motors

You vibrations are very low, which is usually a good thing. Just be sure that you haven’t over-dampened the flight controller, since then it wont pick up all movements it needs to know about. Most often the Cubes are mounted with some 3M double sided foam tape.

Everything else looks reasonable so far. Just set these:
BATT_ARM_VOLT,14.70
BATT_CRT_VOLT,14.00
BATT_LOW_VOLT,14.40
BATT_FS_CRT_ACT,1
BATT_FS_LOW_ACT,2
INS_LOG_BAT_MASK,7
INS_LOG_BAT_OPT,0
INS_HNTCH_ENABLE,1

As far as PIDs and tuning goes there can be a few steps:
1st try these: and check for oscillations, also check motor temperatures
ATC_ANG_RLL_P,6.5
ATC_ANG_PIT_P,6.5
ATC_RAT_RLL_P,0.11
ATC_RAT_RLL_I,0.11
ATC_RAT_RLL_D,0.006
ATC_RAT_PIT_P,0.11
ATC_RAT_PIT_I,0.11
ATC_RAT_PIT_D,0.006
If oscillations are worse, lower ATC_ANG_RLL_P and ATC_ANG_PIT_P to about 5 or 5.5

Then hover in AltHold for a while and maybe just do some gentle movements, nothing radical.
After that we can check the .bin log file for attitude control and set the rest of the Harmonic Notch Filter params.

EDIT
You can set these too:
PSC_ACCZ_P,0.2
PSC_ACCZ_I,0.4
ATC_THR_MIX_MAN,0.5

If you have to reduce the amount of damping for the flight controller and then vibrations are a bit worse you could try these filter settings, but dont put them in yet - wait till after we see the effects of the other changes and tests.

ATC_RAT_PIT_FLTD,20
ATC_RAT_PIT_FLTT,20
ATC_RAT_RLL_FLTD,20
ATC_RAT_RLL_FLTT,20
ATC_RAT_YAW_FLTE,2
ATC_RAT_YAW_FLTT,20
INS_GYRO_FILTER,40

first off all thanks @xfacta for your help. I’ve tried this morning your setup. With basi setup (give above) I had more vibrations.
So first oof all I’ve reduced , lower ATC_ANG_RLL_P and ATC_ANG_PIT_P to 5 and finnaly I lower to 4.5.
The best fly I have was the last in the log (roll and pitch seems to be good for me and my low experience). I just find my throttle control a bit soft and I think this is why in AltHold I have some time between throttle commande and drone reaction
I’ve tried to change the frequency off gyro filter but it’s worst with your tune
My bin

UPDATE
Another bin with better result BIN

That is some of the weirdest data I’ve seen. Motors are oscillating badly in both those logs.
Vibrations are unnaturally low - are you sure the flight controller is not over-damped?
Have you got a photo of the flight controller and mounting.

INS_ACCEL_FILTER,10 is way too low, this needs to be 20.
In the second log D term was too low compared to P and I, but that’s not the only issue of course.

You could probably set these, but they might need adjusting later when everything is better tuned
INS_HNTCH_REF,0.19
INS_HNTCH_FREQ,140
INS_HNTCH_BW,70

With those small props I would be tempted to try:
ATC_RAT_PIT_FLTD,30
ATC_RAT_PIT_FLTT,30
ATC_RAT_RLL_FLTD,30
ATC_RAT_RLL_FLTT,30
ATC_RAT_YAW_FLTT,30
INS_GYRO_FILTER,60
(yes I know, opposite way to what I said before :frowning: )
and go back to the Tuning guide and start systematically doing the manual tune.

If that’s not helping reset all to defaults and start over - because there is something strange in all your parameters causing oscillation (or the flight controller mount and frame interactions)

ah bad news, I thought it was better :roll_eyes:. Yes i’m sure the flight controller isn’t over-damped, he’s only mount on my pcb and tight with 4 screw, I don’t have any foam between the pcb and the Cube. Just a question how do you see motors oscillating badly in the log? Which params should I graph ? This is the oscillations we can see in DesRoll and Roll for example?

I’ll try to change accel filter and for the gyro filter, I’ve already set these parameters and I’ll increase D term for pitch and roll(is there a good ratio to maintain between P/I and D?)

You didn’t change the PSC_ACCZ as suggested. This can cause motor oscillation.

I’ve changed it but with lower value my AltHold throttle was really slow. I had a big latence between full throttle and drone reaction

To answer your question about where to look in the log it’s Rate>R/P out and the motor outputs.

I’m going over these logs again
but I’ve noticed these should be changed to what I have here, as a starting point, since the P was too low and the I was too high
ATC_RAT_YAW_I,0.075
ATC_RAT_YAW_P,0.75

better result here, it really more better in flight for my beginner feeling :blush:
bin

Definitely put in these and retest:

and BATT_LOW_VOLT,14.40 , although almost mandatory it’s not related to your tuning. Then you can utilise these settings:
BATT_FS_CRT_ACT,1
BATT_FS_LOW_ACT,2

Also set this to check how well the Harmonic Notch Filter is working, but I think the settings are all correct
INS_LOG_BAT_OPT,2

What I haven’t yet figured out is this oscillation before and after arming, seen it before in SITL but not the phsyical world. Is there any visible effects while motors are starting or stopping? Shaking or vibrations?

Regardless, you should still be able to run Autotune on at least 1 axis and see how that goes.

I’ll try it this morning thanks again for you help @xfacta .
For oscillation before and after arming this is beceause my drone is like a drone soccer

The drone is mount in rooling he’s not fix in the cage (the cage can move in all axis), so the drone can rool in all axis yaw pitch, so this is why I have oscillation before take off (time to the drone for stabilize) and after landing when motor are stops.