Oscillation after autotune of 6inch quadrotor

I tried to autotune each axis and used the tuned results to loiter, but the x axis of the IMU oscillates seriously. how to tune my drone? Could anyone can provide some help?

This is my flight log.https://drive.google.com/file/d/1aKDZLK5eI8KH9O0gVng1BoJMAoVLeT8K/view?usp=sharing

I might be biased towards low-level reasons, but I bet your main problem is filtering.

You don’t have any of the harmonic notches configured. Start here (Managing Gyro Noise with the Dynamic Harmonic Notch Filters — Copter documentation) and aim at INS_HNTCH_MODE = 3, which is ESC telemetry based filtering, for which you already have the sources working (nice ESC entries in the logs). This will get rid of 200ish Hz noise peak in the filtered data. Here is your current noise profile for reference (a web tool for this: ArduPilot Filter Review).

I blindly suggest the following parameters, which are quite typical:

  • INS_HNTCH_ENABLE = 1: this is where you start, and you have to reload parameters (or reboot) to get the rest of the parameters.
  • INS_HNTCH_ATT = 35: the default-ish attenuation which usually works well; this can safely go up to 40.
  • INS_HNTCH_FREQ = 30 and INS_HNTCH_BW = 3: here, the first is the minimum prop rotation frequency you want to cover with the filter, and although your hover is at about 200 Hz, you want lower values to be covered so that you can descend nicely, and especially you likely want it to be below 50 to prevent frame resonance excitation in that regime. For the second, what matters is the ratio between the first and the second, and for four nicely reported RPMs you want this large enough (way bigger than the default ratio of 2) to reduce negative implication of filters to the overall response.
  • INS_HNTCH_FM_RAT = 1: I prefer to keep this at default in ESC-based filtering settings, as otherwise the semantics of the two values above become quite complicated to explain.
  • INS_HNTCH_HMNCS = 7 as you have 1st, 2nd and 3rd harmonics visible in the noise profile. If your FC complains, try decreasing to 3.
  • INS_HNTCH_MODE = 3 for the filtering based on ESC telemetry as we want.
  • INS_HNTCH_OPTS = 6 for bits “multi-source” (absolutely mandatory here) and “update at loop rate” (normally works well).
  • INS_HNTCH_REF = 1: don’t forget to set this, or your filters won’t hear your ESCs at all.

You also have what seems to be two frame resonances at 57 (roll and yaw) and 65 (pitch) Hz. The first recommendation is to check whether you can eliminate these resonances by checking what is loose on the machine and fixing that. In my experience, carbon frames usually resonate at higher frequencies, so this might be something else.

If this is checked and nothing serious was found, I would configure the second notch filter to 61 Hz, maybe as a double notch, to cover those. If you do it successfully, you will see a sharp decrease in post-filter noise, and likely in pre-filter noise too. Here my suggestions are:

  • INS_HNTC2_ENABLE = 1
  • INS_HNTC2_ATT = 25 by the visual height of the peak
  • INS_HNTC2_FREQ = 61: the mean of the two resonances
  • INS_HNTC2_BW = 30: we want this quite wide
  • INS_HNTC2_HMNCS = 1: keep only the 1st harmonic
  • INS_HNTC2_FM_RAT = 1: this does not matter, keep at default
  • INS_HNTC2_MODE = 0: fixed notch
  • INS_HNTC2_REF = 0: is unused but kind of reinforces the “fixedness”
  • INS_HNTC2_OPTS = 1: for double notch, which is at least worth trying here.

I strongly suggest a test flight (preferrably in Stabilize: flying managed modes on an untuned machine is not the best idea) to see if all these changes took effect. I think you will immediately hear the difference in the sound of the propellers. Once happy, proceed below.

Because of all that unsuppressed noise, you apparently had to set up INS_GYRO_FILTER to about 60 and ATC_RAT_*_FLT* to about 32, which is, arguably, quite too low for a 6" quad that flies at throttle of 0.23. I would aim here for at least twice as much as that - once the noise is masked, of course. My 5" machine, which is probably quite similar, has the primary gyro filter set to 150 and rate filters set to 100, and feels quite well.

Once you raise these to something comfortable, test that in another flight, and don’t get fly-aways or nasty sounds, you are welcome to re-run autotune and hopefully get a better tuning. Roll/pitch accels closer to 350K are a good indication, my 5" sluggy slug has 500K+. You may also probably want to tune Yaw(D) if you do active flying (I’ve seen some sharp yaw changes in the logs), for which don’t forget to un-zero the corresponding ATC_RAT_YAW_FLTD.

2 Likes

Thanks for your help, I tuned the parameters according to your advice. This is the flight log I obtained. It seems another oscillation appears. Is it necessary to autotune again?https://drive.google.com/file/d/13r9CfEaHDsZBrcpXJ-71fiHYzkTIZ8J3/view?usp=sharing

No, BW at 3 is too small, try filtering like this,
filter(29).param (334 Bytes)
you don’t need 2nd and 3rd harmonics,


you may try main LPF at lower value at beginning, like start from 75, with sound setup it can go way higher.

They problem you might face is this noise (pink area), that looks like frame resonances, ideally graph should go down in “quiet zone” as cyan line marks. Check that you have everything tight, no loose wires or some things that can vibrate, like gps or antennas.

You may want to try 2nd notch as Max suggests, but that noise is not constant and not very powerful.

I tried your param, but it still oscillates. I think the damping pad might be too soft, and I will change the copter configuration.

and this is my log.

AMC explains how to use PID notch filters to address the frame resonances.

1 Like

I tried to apply the PID notch filter on both roll and pitch axis, it improves a lot, but it still has a little oscillation at the notch frequency 63Hz. Is there any way to further improve it?

The last log shows a slightly different profile than the picture above, which to me looks like at least the prop noise is not going past the filters. The pitch peak at 63 also seems a bit less criminal than on your picture above.

This all may be flyable anyway. You do need to re-run autotune after major filtering changes. At least I see that PID contributions in the logs dropped drastically (due to less noise), so PIDs have a space to get increased, and you can get a better control overall.


There is also something like a 10dB increase around 112 Hz which is not present in your picture above, and can or cannot be something meaningful. If I were you, I would have tried to validate that 112 Hz feature by rapid descents (and because you have INS_HNTCH_FREQ = 150, you would likely hear funny sounds when descending if your machine is what I think it is - hence my reasoning for this and BW values). If you see a sharp spike around that location, and if your planned flights include this kind of actions, you may want to put a secondary notch there (the HNTC2 one, because it looks like all axes are affected) and benefit from that.

Thanks a lot! I apologized for putting the wrong figure. I will try to autotune again with the two PID notch filters on the roll and pitch axis ( 58Hz on the roll and 63Hz on the pitch).

The rapid descents is just a wrong operation and I will avoid it in the future. As a matter of fact, I wonder whether the INS_HNTCH_FREQ can be reduced to 30Hz to cover all the possible oscillating frequency, including both 112Hz and 200Hz ? Or will it focus on 112 Hz or 200 Hz?

With the ESC telemetry source, INS_HNTCH_FREQ defines the minimum frequency to be covered with filters, and the ratio of INS_HNTCH_FREQ to INS_HNTCH_BW defines the effective relative bandwidth. So, whenever you change INS_HNTCH_FREQ, you normally also change INS_HNTCH_BW by the same factor.

Alternatively, you can use this INS_HNTCH_FM_RAT parameter to do this kind of group adjustment. Setting this as INS_HNTCH_FM_RAT = 0.2 will do exactly the same as multiplying both INS_HNTCH_FREQ and INS_HNTCH_BW by 0.2. Yes, there are three parameters to control two values in a linear way, which might make some sense for some filtering modes, but not in our case. Newer FILT_* infrastructure uses a different convention, which is better from this point of view.

None of this will “focus” on 112 or 200 Hz, it will filter whatever the ESC feedback tells it to filter. Contrary to what some tools display, this will not induce a huge phase lag because the lower bound is at 30Hz, because the propeller noise freq will quite never be at this lower bound (except maybe on the ground shortly while spinning up, when nothing matters). And no, it does not replace frame resonance notches, it would just make it slightly harder to propellers to additionally excite these resonances.

1 Like

ok, I think I have understood it. The dynamic harmonic notch handles the variable propeller noise, and the fixed PID notches deal with the structural modes. Though the second fixed harmonic notch may also help in frame resonance, but it might not be quite intuitive as the PID notches.

Turn on fast attitude logging instead of medium in log_bitmask, to better see oscillations in the logs and how pids respond.

Medium and fast are combined to set logging rate.

Med+fast Sched_loop_rate
Fast SLR/2
Med SLR/4

PS this is for rate logging, but not attitude.

That’s not true, I don’t know the case to have both Fast and Medium logging enabled
Fast will give you resolution up to 200hz if looprate is 400hz, while with medium only up to 5

3 Likes

I have not deleted it….

It was deleted by the author of the post, not of the thread…

My post originally said to watch out for using multi source and too high of bandwidth/attenuation but I didn’t read your post carefully enough.

1 Like

I set up the PID notches on the roll and pitch axis ( 58Hz on the roll and 63Hz on the pitch). Then i autotuned the drone in both roll and pitch axis, it seems better in noise attenuation, but in real scenes, the drone is still oscillating (even worse). These are my autontuned log and thereafter hover test.

autotuned roll: https://drive.google.com/file/d/1Hf-ns_lbQOGgPqxSNYME7ajJOG7TF-9Z/view?usp=sharing

autotuned pitch: https://drive.google.com/file/d/16QkfMOWMhRlnM_SWH6PurHE2_MqFej00/view?usp=sharing

hover test: https://drive.google.com/file/d/1n3SYRuFUoVeBAomlqXN8lMHhgwFhfcCp/view?usp=sharing

The noise peaks itself does not usually cause oscilation, they just limit max PIDs you can set and also heats the motors.
You applied wrong notch to pitch axis PIDs filter, need ATC_RAT_PIT_NEF, 2 and than rerun autotune (or try quicktune), the values you got on pitch/roll axes are too different.
Apply this and record a log with more aggressive flying where oscillations are visible, it’s not enough data currently to judge.

Try tuning with Quicktune. I always had good results.