Dynamic gyro notch filter based on esc rpm telemetry

**_

yes, the stabilize roll/pitch P gains are used for acro mode. this is due to the control system tracking the pilots inputs and translating them to a target rate and subsequently an attitude.

_**

I am a little confused, the acro PID’s is enough to completely control the craft, why have another "stabilize P gain, unless its for another mode, like stabilize mode?
Since you said yes, then when would you use the normal P gain and the stabilize P gain when tuning acro mode? tia

Sorry I guess it should have said No, the stabilize P gain is used for both acro and stabilize modes. They are actually used in the autonomous modes as well. The PIDs are nested in the control loops for the loiter and autonomous modes.
So let’s review the gains. Are you using full parameter list or one of the pages in QGC or mission planner? Let me know and I will go thru them with you

I was mainly on the extended tuning page (the one that limits P gain to 0.05 painfully for mini quads, lol). I will use whatever it takes (tuning page or full parameter list) to tune this thing in acro mode.

I really dont like the delay that is in AC acro mode vs BF acro.

Ok. I just wanted to have a good frame of reference to ensure we weren’t talking apples to oranges when discussing the parameters since the names in the full param list don’t exactly match names in the extended tuning page. I will respond later with my thoughts on your predicament with AC tuning. I’m not an expert but I am very familiar with the AC control laws.

No Problems, take your time. this project started last May :smile:
I was confused when i saw auto tuning video in acro mode, but then it was adjusting stabilized P gains too.

Well I will keep my reference to gains relative to what is listed in the Extended Tuning page in Mission Planner. However, I will make reference to a few parameters from the full paramter list.

As I stated in my previous post, the attitude controller tracks the target attitude based on pilot inputs for acro (and essentially all manual modes). Although the pilot is commanding Pitch, Roll and Yaw rates, the attitude controller integrates them and tracks the target attitude. It limits accelerations and rates based on parameters the user sets. In the full parameter list these are ATC_ACCEL_X_MAX and ATC_RATE_X_MAX where the X stands for P, R, or Y indicating pitch, roll, and yaw. these can be set to detune the response in cases where you are concerned with high rates or accels affecting the vehicle. In your case I would set the rates to 0 which indicates no limit and set the accels pretty high. I think you have to have ATC_RATE_FF_ENABLED and non zero accel limits for the attitude controller to work normally. Setting ATC_RATE_FF_ENABLED to zero is not recommended.

the only other knobs asside from the PIDs shown in the extended tuning page are ACRO_RP_P, ACRO_RP_EXPO, ACRO_TRAINER. You definitely want to disable trainer. ACRO_RP_P and ACRO_RP_EXPO act the same as the Dual rate and expo settings in your transmitter. Hopefully you know that you don’t want to use any of those settings in your transmitter. All your stick feel settings should be done in AC. AC uses 4.5 as the nominal setting for ACRO_RP_P. This translates to a requested rate of 4500 centidegrees/second for full stick displacement. So this is interesting and maybe you knew this already, you want to raise your ACRO_RP_P to request higher rates otherwise the attitude controller artificially limits you to 45 deg/s based on the default ACRO_RP_P value. Be careful about just raising the ACRO_RP_P value, I dont think it will cause a problem down stream since it is just scaling your requested rate but if you play with it, I’d recommend increasing it gradually.
got to go. Ok I will write more on manual tuning later.

2 Likes

So I misspoke here. I thought 45 deg/s sounded a little low. 4.5 for ACRO_RP_P equates to 202.5 deg/s.

I set all of ATC_ACCEL_X_MAX and ATC_RATE_X_MAX to 0, increased ACRO_RP_P to 6 - can’t say it felt any different. Started increasing my PIDs…

Andy,
the thing to remember is that this flight control system takes your inputs and determines the desired rates (in the case for ACRO) and subsequently the predicted attitude and then drives the aircraft to the predicted/target values using the attitude and rate controllers (PIDs). Of course your quads ability to achieve those rates is a different story. So it depends on your quads ability to hit the desired rates and the PID tuning as to how it handles.
So I will preface my advice with a short blurb about my background. I fly quads and helicopters. I have not flown them in acro let alone do aerobatics. I am the maintainer for the helicopter code which is how I got so knowledgeable on the copter flight control laws. I have done a lot of tuning with helicopters but they are tuned quite a bit differently than quads. So I am confident on my statement above regarding the ACRO_RP_P, it will not roll or pitch any faster than 4500 * ACRO_RP_P in centidegrees. the rest is from my experience with PIDs and discussions with Leonard Hall the designer of the attitude controller.
First I would recommend backing off on the stabilize P gains. Put them back to the default values of 4.5.
Concentrate on your Rate PIDs first. Generally you want your Rate P gain to be as high as you can get it. This gain is what closes the loop on angular rates and for acro that is very important. So the recommendation is to increase it slowly until you see the aircraft start to oscillate. then take that value at which you started seeing oscillations and divide it by 2 and that is your Rate P gain The Rate I gain captures the error in the rate and that takes time to build for it to be effective. it is important but generally we set the Rate I gain to the Rate P gain value after P gain has been determined. the D gain will help but because it is looking at the change in rate or acceleration, it is very noisy. Therefore the filter is used to filter out the noise and generally probably shouldn’t be any higher than 10hz. You can put it higher but I think you will find that you won’t be able to increase the value much because you’ll start seeing oscillations. You can do this tuning in stabilize mode and use the TUNING feature which utilizes a knob on your transmitter to allow you to slowly increase the gains while flying. You can look at the RATE message in your log to see if you are achieving the desired rates. if you aren’t then your tuning is not quite there or your quad can’t perform to that level.

Hope this helps.
Bill

Found some really useful information here https://github.com/betaflight/betaflight/wiki/PID-Tuning-Guide and here https://github.com/betaflight/betaflight/wiki/Gyro-&-Dterm-filtering-recommendations
I’m definitely going to try and analyse the noise that is getting to the gyros and see if I can do better. Also the PID tuning recommendatons seem pretty informed for smaller faster copters, so I’m going to pursue this also. Just need some time and sunshine :slight_smile:
Does anyone know if there is an equivalent of this diagram for AC?

1 Like

I’m going to do some FFT analysis today! (well, if it stops snowing…)
I am unaware of how to see the pre and post filter data graphed the way we can in BF…
If you haven’t see it:
http://ardupilot.org/copter/docs/common-imu-batchsampling.html#common-imu-batchsampling

One thing Bill said that I have to disagree with (or maybe don’t fully understand) is his recommendation to keep the D term filter so low. My tiny copter is not tuneable w/ it as low as 10. 20 gives it a very low loose PID before it starts oscillating. Higher filter settings (less filtering) let me get higher PID’s and a more in control copter. Try it and see…

Also, the usual vibe analysis does not work on these little copters.
I have had almost no vibrations in the logs, but had vibration related issues on my tiny copters. I’m hoping the FFT will tell me more.

1 Like

Good luck! If you read the BF wiki pages I posted they say that the D term is almost unnecessary for high-powered copters with high-efficiency ESC’s - so I’m guessing that your small copters fall the other side of this consideration.

I’d call the .002 and below D terms we’re using pretty low :). Lower than MP will let you enter in the tuning section.
If you haven’t seen it, this is outdated and a lot of the parameter names have changed, but the general idea is sound… Even Leonard recommends getting the filters as high (less filtering) as possible for racers.

And thus the reason for my preface :wink: I have some wire diagrams that I drew up based on my research into heli control laws which effectively use the same control laws except the rate error is filtered for all of the PID terms not just the D term. I will share and hopefully will add some clarity.

@andyp1per the Rate P gains seem low to me but I’m guessing that may be due to your quad being overpowered? One thing I will point out, I suggested that you lower your stabilize P gain because that adds rate to the rate error based on attitude error. I believe lowering this should allow you to increase your Rate P gain which I think is more beneficial to the quick response of the aircraft. Of course you want enough stabilize P gain to ensure that the desired attitude matches the actual attitude. there is probably a balance there. But from my discussion with Leonard on heli tuning, generally if he sees an overshoot when stopping roll or pitch rate, that means there is too much stabilize P. Just some thoughts.

I really appreciate your input, as I am not an expert… But do have some experience w/ tiny copters and just wanted to offer my advice as well.

I completely agree about Stab P being too high… AutoTune always puts that at 18 for the little copters… One of the developers (Maybe Leonard) also mentioned that could be a problem in a thread somewhere.

Anyway, thanks for your input, and I look forward to any other info you post.

Yeah I’ve read that many times. I do find that the PID’s massively depend on battery cells and props, so although I’ve done everything in that blog there is still a fair amount of tuning to do afterwards!

To add to that, fast esc, good motors (with n52 magnets and tiny air gap), and lightweight quads.

EDIT: A fast roll on my quad is 130ms per roll, start to stop is ~300ms. https://tinyurl.com/ychhxldj