Small quad - fine tuning - fft

Hi all,

I’m trying to advance in the fine tuning of a small quad:
prop 5"
motor 2650 kv
weight 220g
power 2S Li-Ion 3400

So I made small flight indoor mainly hovering to try to understand how to fine tuning the ACC and GYRO filters.

INS_GYRO_Filter 80 and INS_ACCEL_Filter 20


Full Imu Log https://www.dropbox.com/s/kuaf10uoa0q9qjm/dB%205.bin?dl=0

INS_GYRO_Filter 80 and INS_ACCEL_Filter 40


Full Imu Log https://www.dropbox.com/s/kudnk24m1t8oax1/INS_ACCEL_filter%2040.bin?dl=0

Changing the ACC filter from 20 to 40 I cannot see difference and I keep not understanding whats best !
@Leonardthall whats your suggestion for INS_ACC ?

Without knowing the above I keep INS_ACC 40 and try to work with the notch filter
I’ve used frequency 140 and bandwith 24
and here 5 dB


Full Imu Log https://www.dropbox.com/s/kuaf10uoa0q9qjm/dB%205.bin?dl=0

15 dB


Full Imu Log https://www.dropbox.com/s/ivduy04h23fgfpd/dB15.bin?dl=0

25 dB


Full Imu Log https://www.dropbox.com/s/oq7srh35u2s28br/dB25.bin?dl=0

30dB


Full Imu Log https://www.dropbox.com/s/pziyk289ak2c4zd/1%201-1-2000%201-01-16%20AM.bin?dl=0

I suggest starting with INS_GYRO_Filter 80 and INS_ACCEL_Filter 20. Then Set the ATC_XXX_D_FILT =40.

You will not see any changes to the filtering in those graphs because they are recorded before any filtering is done. It may be a good idea to consider adding logs that can record after the filtering too.

Your notch settings are fine but I would suggest an attenuation value of 25dB.

Some of the changes we are working on will update the loop rate and will let you see the post filtered data at a higher rate.

Which parameter is this “ATC_XXX_D_FILT”? Also, how to enable logs after filtering? Raw?

Sorry they are:

ATC_RAT_PIT_FILT
ATC_RAT_RLL_FILT
ATC_RAT_YAW_FILT

You can’t yet but the RATE. R, P, Y message in the logs are what the rate loop are using and are RAW + filtering.

Currently they are not recorded at a high rate. To get the best out of them you need to make sure FAST logging is enabled.

With some new changes coming up you will be able to run the rate loops at 1kHz and they will be exactly what you want then.

I suggest starting with INS_GYRO_Filter 80 and INS_ACCEL_Filter 20. Then Set the ATC_RATE_XXX_FILT =40.

Thanks Leonard, I’ve set INS_GYRO_Filter 80 and INS_ACCEL_Filter 20.

For ATC_RATE_XXX_FILT =40, I have
ATC_RAT_PIT_FILT and ATC_RAT_RLL_FILT already at 40,
but ATC_RAT_YAW_FILT is at 2.3, could you confirm it need to be 40 ?

Haven’t a clear idea about ATC_RAT_YAW_FILT I leave it at 2.3 and made several autotune indoor and Autotune on roll gives very inconsistent result:

log first autotune https://www.dropbox.com/s/ps431zmek1t73qq/autotune_Roll.bin?dl=0

log second autotune https://www.dropbox.com/s/ps431zmek1t73qq/autotune_Roll.bin?dl=0

ATC_ANG_RLL_P from 18 to 3.2 !
18 was a lot better, 3.2 was really weird

I need to understand how to set autotune min D and autotune AGGR for this quad

now min D 0.001
and autotune AGGR 0.1

Hi Giorgio,

Sorry ATC_RAT_YAW_FILT should be 2.3 NOT 40.

If you got a ATC_ANG_RLL_P of 3.2 then that tune was bad. Generally if you get a value as high as 18 you should drop it down to 10 ish. The new autotune will fix this issue. A mini quad can be very high though.

The results of the first autotune for roll looks good. Both of the files you have linked have the same name though.

These values are fine. The minimum D is only really important when you have too much noise to get a D tune. So if you see that minimum D in the result you know you had a bad tune. But if you have no other choice you can do a manual tune on D and then set that as your minimum D and let autotune take care of your rate P and ang P.

The aggr value goes from 0.05 to 0.1. the lower end is good for maximum reaction time, the upper end is better for disturbance rejection. The trick here is this also included noise. So if you have 0.05 (or 5%) noise relative to your step size then if you set it to 0.01 (10%) then you will get a 5% tune that is geared towards maximum response but could be a little higher for maximum disturbance rejection. That is why I set it to 10% by default it works for a wider range of people out of the box.

I hope that answers your questions.

Thank a lot Leonard,

ATC_ANG_RLL_P max value for my quad is 10-11 or whats could be a reasonable max value? So everything above it I have to drop it down to it :slight_smile:

After a lot of autotune tried and failed with this mini quad the general feeling is if set high ATC_ANG it tried to set lower RATE P and RATE I or if it set higher RATE, the corresponding ANG goes down.
Based on the above (but could be a wrong assumption), If my goal is to use this quad in auto mode and I want to improve its tuning for a solid auto-stabilize in moderate wind conditions (cause in a calm day or indoor its super stabile but with few wind not more), I need to set higher ATC_ANG or higher RATE P (Rate P and Rate I are both set same value)?
I’m searching for more crisp and fast stabilize than the actual wobbling unstable and with general slow response feeling.

These values are fine. The minimum D is only really important when you have too much noise to get a D tune. So if you see that minimum D in the result you know you had a bad tune. But if you have no other choice you can do a manual tune on D and then set that as your minimum D and let autotune take care of your rate P and ang P.

I have great difficult to make the manual tuning on the D term, as I told you I see not evident oscillation cranking up the D terms.
But realistically I think it could be set from 0.006 (maybe 0.004) to 0.001, for the above crisp and fast reaction in a windy environment I would prefer value closer to 0.006 or to 0.001 ?
So I could try to set that minumum D term and let search for the ang and rate.

The aggr value goes from 0.05 to 0.1. the lower end is good for maximum reaction time, the upper end is better for disturbance rejection. The trick here is this also included noise. So if you have 0.05 (or 5%) noise relative to your step size then if you set it to 0.01 (10%) then you will get a 5% tune that is geared towards maximum response but could be a little higher for maximum disturbance rejection. That is why I set it to 10% by default it works for a wider range of people out of the box.

If I undertasnd correctly, based on my goal of crispness and reactivness in the wind, I could need to set AGRR to 0.05 but instead I always use 0.1 because of the general noise… is that right ?
If yes, so I need to try to set AGGR the lower value I could, how to understand it? maybe when autotune set the D term equal to min D params that means AGGR need to be raised up ?

Sorry for all my questions but the needs to understand and fine tuning its performance are so strong now :blush:

Hi Giorgio,

It really depends on what is causing your failed tune. If it is noise you can increase the AGGR to 0.15. For small quads though it is often because the filter frequencies are not set up properly or you don’t have active braking on, you aren’t using oneshot.

You can force a higher D term by setting the min D to 0.006 but you should make sure the aircraft is not oscillating with a manual flight first.

I recommend going with an AGGR of 0.1 or higher now. Experience so far suggests that this is the best balance.

Angle P of 10 to 12 after autotune should be good. Otherwise drop it to that level.

Your initial settings don’t change the result of Autotune as long as they are stable.

If you do a manual tune then start with Rate D, then P, then P=I then you can increase Angle P to about 10 and make sure it is stable otherwise drop it back but it shouldn’t need to be lower than 5.

In short, Angle P is your last parameter and should not change your tune as long as it isn’t too big when you tune the Rate PIDs.

Has anyone tested on a tuned Quad to finetune by FFT and then autotune again?