Gyro and accel filter

Hi all,

I’m on a quest to understand ardupilot as much as possible!!

When I’ve asked for advice here I’ve always been told to set my accel filter to 10hz instead of the default 20hz. I saw a post by Leonard Hall that stated that lower values filter more noise but adds latency.

Why should I set it to 10 and not 20? Is there a lowest value that would work or a highest, for larger multirorots? Is there any scenario where I would benefit from using a higher value than 10 for my 18 inch or 20 inch propeller quadcopter?

And what would different gyro accel values do?

Maybe you @Leonardthall could give an explanation to this? You wrote the stabilization algorithm, right?

Thanks!

My opinion is leave those gyro and accel filters at default or values calculated by Initial Parameters unless you have a specific reason to change them.

Setting accel filter to 10 could improve chances of a successful first flight, but should only be left at that, or below 20, based on log examination and vibrations.

If you have low vibrations there should be no reason to set accel filter to anything other than 20.
Tiny high powered quads are always a different case for a lot of parameters.

I’ve found if you have to lower gyro filter below calculated Initial Parameters value then you have something else wrong. Usually vibrations.

Rule 1 - fix vibration issues, below 15 or so is desirable.
Rule 2 - see rule 1

2 Likes

Thanks!

I’ve never noticed any difference with a value of 10. Just been advised to set it as that.

I got vibration levels of under 15 on all axis except pitch, I posted a log in our other conversation as well. Maybe you could take a look when or if you get time.

On the topic of noise, the D term can cause some noise issues as far as I know. How do I know if my D term is too high other than obvious oscillations? That’s if it can be to high without noticeable effect.

Thanks!

I have not noticed a latency issue even on smaller quads (4-7”) with the accel filter at 10hz so I don’t think it would be an issue on larger craft. Andy’s 7” LR build Blog has a parameter file attached and it’s at 10hz. My 4” that runs Auto Missions at 30m/s is at 10hz and that craft flies like its on rails.

I’ll probably leav it at 10 for now. At least untill I solved my tuning and autotune issues

Thanks!

The controllers are layered from fast to slow. The order pretty much goes like this:

  1. Rate Roll, Pitch
  2. Rate Yaw
  3. Attitude
  4. Acceleration Z
  5. Velocity
  6. Position

As you go down that list you can use lower filter frequencies to help prevent what should be slower loops interacting with faster loops.

When looking at any given control loop it is also important to understand how fast you really need to react in a given control problem. In this case we can get perfectly good altitude hold when controlling the throttle manually from 50m away though a human control system. This is SLOW. So reducing the filter value to reduce noise, energy consumption, and rate loop interaction has very little impact on the performance of the aircraft.

A question worth asking yourself here is do you want the aircraft going to minimum or maximum throttle because it felt a small bump or do you want it to move a few extra cm up or down and continue with a smoother throttle output?

I did drop the default to 10 Hz but we had a bunch of people that experienced oscillation after this changed because they were on the edge of stability. So we reversed that changed and made it a recommendation.

I found 10 Hz perfectly adequate on my 5 inch quad so I don’t think there are any normal real world cases where this will give you an advantage.

It isn’t clear what you are asking here.

In this case I recommend 10 Hz for all new aircraft because it was too much of a pain to change the defaults. But this isn’t going to make any huge difference anyway.

I disagree with this. There is no reason to increase it. 10 Hz is already fast for this axis.

Exactly.

Maybe we will try to drop it again now we have left it a few years with 10 Hz being a recommendation. Perhaps we will have less people on the edge now and not have to deal with the pain. It is hard to justify the support cost with this parameter change given how most people won’t notice the difference.

Thanks a lot for the clarification Leonard.
My opinion of leaving accel filter at 20 was based on the default value plus the param description of lowering it to cope with vibrations. I assumed the advice in the tuning guide was a “first flight” recommendation since the default value had not changed. I’ve not had a specific need to lower it in most cases.
I will take your advice of setting accel filter at 10 as the new default.

1 Like

Yeh, it was a pain that I couldn’t change the default with out a bunch of support load I couldn’t justify.

I get the feeling there’s so much improvent in the code by yourself and others, coupled with the newer FCs (improved IMUs and MCUs) that there might not be much support load to making 10 the new default value of the INS_ACCEL_FILTER.
I’m just basing that on what I see on this forum, obviously I have little idea of you other activities :slight_smile:

If there’s anything my basic skills can handle feel free to send them my way if you are too busy. I’m not operating on a commercial basis.

Thanks Shawn,

It isn’t just the support load that I know people like yourself take a huge part of (and I can tell you on behalf of everybody, it is greatly appreciated!), it is the number of users that have to go through the process of upgrading, having a problem with alt_hold, looking or asking on the forums, changing parameters. The support load is really just repeating over and over again, go to this post and follow the instructions :slight_smile:

Sorry for my unclear question about the gyro filters.

I don’t really know a lot about the gyro filter other than that I should set it to what the tuning guide says based on my props.

I’m currently watching Andy Piper’s video about tuning where he tunes his smaller 7 inch. He uses really high filter settings since he has dealt with his noise very well.

I have an issue with autotune giving me a tune which cause oscillations when I give a small stick input. Sort of a too tight tune. I haven’t gotten into solving this in the field yet so I don’t know if it’s too high P, wrong D or I or what it might be.

My question was really just asking for an explanation on how the gyro filter works, but as you said, it wasn’t a very well formulated. Now that I have watched a bit on that video, could it benefit me regarding my autotune issue, to decrease my filters? Since maybe I haven’t dealt with my noise as well as he has.

You have probably seen issues where autotune gives a too tight tune resulting in some oscillations, but is there some problem that is more common to cause such symptoms, like wrong filter settings or noise?

I guess this question kind of changed now… But after watching the video I believe I understand some more about the filters. Or at least I think I do

Thanks!

Yes, this may be due to the lower levels of noise now we are getting the harmonic notch really working well. Andy is also seeing a similar problem.

If this is caused by low noise then you may solve it by auto tuning using:
AUTOTUNE_AGGR = 0.05
When I set the default value we didn’t have the harmonic notches and a significant portion of this figure would go to dealing with the noise.

High noise levels tend to cause low tunes, not high tunes so I am guessing it isn’t a high noise problem that will be improved by reducing the filter settings.

Let me know how you go!

Thanks!

Xfacta, Shawn suggested some notch improvements which helped. I’ll try to tune my harmonic notch a bit more before a second autotune attempt. Just to try and optimize it.

A bad yaw tune can have effect on the pitch and roll tune right? I’m currently watching some videos on the ardupilot youtube channel to get a better understanding of how filters, noise and vibrations affect autotune and the rate controller in general.

The autotune aggressiveness is a measurement of error, right? In degrees per second? What does it actually mean to have it set to 0.1 or 0.05? What would happen if I set it to like 0.01 or maybe even 1.0?

Thanks!

AUTOTUNE_AGGR is the bounce back that the D term creates and AUTOTUNE_AGGR / 2 is the overshoot in the rate response. The optimal level for the fastest response time is 5% or 0.05. However noise makes the measured overshoot look bigger than it really is so this is why it is set a little higher than 5%.

1 Like

okay,

So going below or over these values is just pointless than.

I felt like I got high D values from my autotune, D 0.0077, P and I 0.139

Could that have been affected by having autotune at 0.1?

Usually, high D values result in motors getting hot. Check their temps while you are playing with the D term.

1 Like

That D is within a “normal” range for that P and I, so it doesn’t seem to be in any danger zone.

1 Like

Thanks!

I’ll try and lower all pids a bit until I get rid of the oscillations and than try an autotune on 0.05

My motors are actually running a bit too large propellers for their size. 18 inch when t-motor only has test data between 15 and 17 inch. The motors a won’t get hot at all even after 45 mins of flight.

Thanks!

@Leonardthall
@xfacta
I noticed that after my first autotune the one that caused som ocsillations, my pids were lower than before.

My angle P and my acceleration way way higher. So much more responsive although my åids were a bil lower at .130 for P

I tested to use .145 lile before the autptune but the copter ocsillated a lot at that value.

Is this normal? How come it ocsillates at a lower P now?

Thanks!