04.01.2021»»понедельник

Betaflight Auto Pid Tuning

04.01.2021

Every aspect of flight dynamics is controlled by the selected 'PID controller'. This is an algorithm which isresponsible for reacting to your stick inputs and keeping the craft stable in the air by using the gyroscopes and/oraccelerometers (depending on your flight mode).

  1. Betaflight Pid Settings
  2. Betaflight Auto Pid Tuning Parts
  3. Betaflight 3.5 Tuning Notes
  4. Betaflight Auto Pid Tuning Chart
  5. Pid Tuning For Dummies
  6. Betaflight Auto Pid Tuning Kit

The 'PIDs' are a set of tuning parameters which control the operation of the PID controller. The optimal PID settingsto use are different on every craft, so if you can't find someone with your exact setup who will share their settingswith you, some trial and error is required to find the best performing PID settings.

Jun 22, 2016 How to Tune a Quadcopter PID Loop: The Simple Way. One thing that most people don’t realize is that PID tuning is only half of the tuning process. Sweet cheat sheet Voodoo! Takes the headache out of understanding the whole animal that is PIDs I have developed my own process over the past year or so and it has worked well for me. May 26, 2019  Contribute to betaflight/betaflight development by creating an account on GitHub. PID Tuning Guide. Jump to bottom. Ghostface edited this page May 26. Angle/Horizon modes have their own values that interfere with tuning. Example PID values shown below correspond to the Rewrite PID controller (PID controller #1).

Jan 24, 2016  Step-by-step PID tuning guide? (Luxfloat / Betaflight) I love building them, and I enjoy flying them, but I SUCK at tuning the PIDs on my quads. In my case, I'm using Betaflight / luxfloat, and I've taken a look at some of the better video explanations and how-tos, but I'm still clueless, and my PIDs still suck. If anyone has a PID-tuning. Contribute to betaflight/betaflight development by creating an account on GitHub. And they do not include PID tuning or filter values, but they might show the kind of ranges for some of these numbers. Betaflight 4.2 now defaults to auto configure the yawspinthreshold to a value a small amount above the maximum configured yaw. May 26, 2019 It's essential that these step be done in Acro mode even if you are usually a Level/Horizon flyer. Angle/Horizon modes have their own values that interfere with tuning. Example PID values shown below correspond to the Rewrite PID controller (PID controller #1). Set the TPA value to 0 while performing this initial tune. This playlist is the continuation of my 'how to fly a racing drone' series. We leave the simulator behind and enter the real world. The lessons are a little less structured, since at this point, the pilot should have enough confidence to feel out moves for him or her-self.

A video on how to recognise and correct different flight problems caused by PID settings is available here:

Basically, the goal of the PID controller is to bring the craft's rotation rate in all three axes to the rate thatyou're commanding with your sticks. An error is computed which is the difference between your target rotation rate andthe actual one measured by the gyroscopes, and the controller tries to bring this error to zero.

##PIDs

Betaflight Pid Settings

The P term controls the strength of the correction that is applied to bring the craft toward the target angle orrotation rate. If the P term is too low, the craft will be difficult to control as it won't respond quickly enough tokeep itself stable. If it is set too high, the craft will rapidly oscillate/shake as it continually overshoots itstarget.

The I term corrects small, long term errors. If it is set too low, the craft's attitude will slowly drift. If it isset too high, the craft will oscillate (but with slower oscillations than with P being set too high).

The D term attempts to increase system stability by monitoring the rate of change in the error. If the error is rapidly converging to zero, the D term causes the strength of the correction to be backed off in order to avoid overshooting the target.

##TPA and TPA Breakpoint

TPA stands for Throttle PID Attenuation and according to AlexYork.net:

'TPA basically allows an aggressively tuned multi-rotor (one that feels very locked in) to reduce its PID gains when throttle is applied beyond the TPA threshold/breakpoint in order to eliminate fast oscillations.'

Note that TPA is set via CLI or on the PID TUNING tab of the GUI. tpa_breakpoint is set via CLI

Also note that TPA and tpa_breakpoint may not be used in certain PID Controllers. Check the description on the individual controller.

TPA applies a PID value reduction in relation to full Throttle. It is used to apply dampening of PID values as full throttle is reached.

TPA = % of dampening that will occur at full throttle.

tpa_breakpoint = the point in the throttle curve at which TPA will begin to be applied.

An Example: With TPA = 50 (or .5 in the GUI) and tpa_breakpoint = 1500 (assumed throttle range 1000 - 2000)

  • At 1500 on the throttle channel, the PIDs will begin to be dampened.
  • At 3/4 throttle (1750), PIDs are reduced by approximately 25% (half way between 1500 and 2000 the dampening will be 50% of the total TPA value of 50% in this example)
  • At full throttle (2000) the full amount of dampening set in TPA is applied. (50% reduction in this example)
  • TPA can lead into increase of rotation rate when more throttle applied. You can get faster flips and rolls when more throttle applied due to coupling of PID's and rates. Only PID controllers MWREWRITE and LUX are using linear TPA implementation, where no rotation rates are affected when TPA is being used.

How and Why to use this?

If you are getting oscillations starting at say 3/4 throttle, set tpa breakpoint = 1750 or lower (remember, this is assuming your throttle range is 1000-2000), and then slowly increase TPA until your oscillations are gone. Usually, you will want tpa breakpoint to start a little sooner then when your oscillations start so you'll want to experiment with the values to reduce/remove the oscillations.

PID controllers

Cleanflight has 3 built-in PID controllers which each have different flight behavior. Each controller requiresdifferent PID settings for best performance, so if you tune your craft using one PID controller, those settings willlikely not work well on any of the other controllers.

You can change between PID controllers by running set pid_controller=x on the CLI tab of the CleanflightConfigurator, where x is the controller you want to use. Please read these notes first before trying oneout.

Note that older Cleanflight versions had 6 pid controllers, experimental and old ones were removed in 1.11.0 / API 1.14.0.

PID controller 'MW23'

This PID Controller is a direct port of the PID controller from MultiWii 2.3 and later.

The algorithm is handling roll and pitch differently to yaw. Users with problems on yaw authority should try this one.

In Horizon and Angle modes, this controller uses both the LEVEL 'P' and 'I' settings in order to tune theauto-leveling corrections in a similar way to the way that P and I settings are applied to roll and yaw axes in the acroflight modes. The LEVEL 'D' term is used as a limiter to constrain the maximum correction applied by the LEVEL 'P' term.

PID controller 'MWREWRITE'

This is a newer PID controller that is derived from the one in MultiWii 2.3 and later. It works better fromall accounts, and fixes some inherent problems in the way the old one worked. From reports, tuning is apparently easier,and it tolerates a wider range of PID values well.

In Angle mode, this controller uses the LEVEL 'P' PID setting to decide how strong the auto-level correction shouldbe. Note that the default value for P_Level is 90. This is more than likely too high of a value for most, and will cause the model to be very unstable in Angle Mode, and could result in loss of control. It is recommended to change this value to 20 before using PID Controller 1 in Angle Mode.

In Horizon mode, this controller uses the LEVEL 'I' PID setting to decide how much auto-level correction should be applied. Level 'I' term: Strength of horizon auto-level. value of 0.030 in the configurator equals to 3.0 for Level P. /download-serum-free-plugins.html. Level 'D' term: Strength of horizon transition. 0 is more stick travel on level and 255 is more rate mode what means very narrow angle of leveling.

PID controller 'LUX'

This is a new floating point based PID controller. MW23 and MWREWRITE use integer arithmetic, which was faster in the days of theslower 8-bit MultiWii controllers, but is less precise.

This controller has code that attempts to compensate for variations in the looptime, which should mean that the PIDsdon't have to be retuned when the looptime setting changes.

There were initially some problems with horizon mode, and sluggishness in acro mode, that were recently fixed bynebbian in v1.6.0.

It is the first PID Controller designed for 32-bit processors and not derived from MultiWii.

The strength of the auto-leveling correction applied during Angle mode is set by the parameter 'level_angle' whichis labeled 'LEVEL Proportional' in the GUI. This can be used to tune the auto-leveling strength in Angle mode compared toHorizon mode. The default is 5.0.

The strength of the auto-leveling correction applied during Horizon mode is set by the parameter 'level_horizon' whichis labeled 'LEVEL Integral' in the GUI. The default is 3.0, which makes the Horizon mode apply weaker self-leveling thanthe Angle mode. Note: There is currently a bug in the Configurator which shows this parameter divided by 100 (so itshows as 0.03 rather than 3.0).

The transition between self-leveling and acro behavior in Horizon mode is controlled by the 'sensitivity_horizon'parameter which is labeled 'LEVEL Derivative' in the Cleanflight Configurator GUI. This sets the percentage of yourstick travel that should have self-leveling applied to it, so smaller values cause more of the stick area to fly usingonly the gyros. The default is 75%

For example, at a setting of '100' for 'sensitivity_horizon', 100% self-leveling strength will be applied at centerstick, 50% self-leveling will be applied at 50% stick, and no self-leveling will be applied at 100% stick. Ifsensitivity is decreased to 75, 100% self-leveling will be applied at center stick, 50% will be applied at 63%stick, and no self-leveling will be applied at 75% stick and onwards.

RC rate, Pitch and Roll Rates (P/R rate before they were separated), and Yaw rate

RC Rate

An overall multiplier on the RC stick inputs for pitch, rol;, and yaw.

On PID Controller MW23 can be used to set the 'feel' around center stick for small control movements. (RC Expo also affects this).For PID Controllers MWREWRITE and LUX, this basically sets the baseline stick sensitivity

Pitch and Roll rates

Betaflight Auto Pid Tuning Parts

In PID Controller MW23 the affect of the PID error terms for P and D are gradually lessened as the control sticks are moved away from center, ie 0.3 rate gives a 30% reduction of those terms at full throw, effectively making the stabilizing effect of the PID controller less at stick extremes. This results in faster rotation rates. So for these controllers, you can set center stick sensitivity to control movement with RC rate above, and yet have much faster rotation rates at stick extremes.

Betaflight 3.5 Tuning Notes

For PID Controllers MWREWRITE and LUX, this is an multiplier on overall stick sensitivity, like RC rate, but for roll and pitch independently. Stablility (to outside factors like turbulence) is not reduced at stick extremes. A zero value is no increase in stick sensitivity over that set by RC rate above. Higher values increases stick sensitivity across the entire stick movement range.

Betaflight Auto Pid Tuning Chart

Yaw Rate

Pid Tuning For Dummies

In PID Controllers MWREWRITE and LUX, it acts as a stick sensitivity multiplier, as explained above.

Betaflight Auto Pid Tuning Kit

novuh @ propwashed
Thread OP
I put together a video this weekend covering my favorite method to initially tune or re-tune my racing quads after a build/rebuild. I thought some on this forum may find it useful:
Initial PIDs the Easy Way [PropWashed Testbench] (8 min 53 sec)

I've copied over the associated write-up below, for those who can't/won't watch videos:
The operating concept I use for this tune is that the ‘P’ term is the most important value to tweak to get a “flyable” quad. The Betaflight & Cleanflight ‘I’ term defaults are generally acceptable for a first-time tune, and the ‘D’ term is more about stick feel than practicality.
The thing I like about this tuning method is that it is super simple once you get used to it. You can get a very good initial tune in 10-20 minutes using a very pragmatic procedure. I will never tell you to “keep adjusting this number until the quad ‘feels’ right” in this article. The adjustments made will only be in response to observable changes in your quads behavior as you go through the procedure. This article assumes you are good enough at flying your quad in 3rd person that you can fly it with the rear facing you for long periods of time with no crashes. It also assumes you are flying in 'rate' mode (or 'acro') - but the method will work, albeit less well, in 'level' mode. It will work fine on any flight controller software that can interface with Cleanflight Configurator, but as always I suggest you move to Betaflight as it is the premier flight controller software out there right now if you care at all about performance.
Transmitter Initial Set-up
The first thing you’ll need to do is set up a 3-position switch on your RC transmitter to control RC channel 6 or 7.
Set-up in Cleanflight
This tuning method uses Cleanflight’s in-flight adjustments feature. This feature, which is officially documented here, allows you to configure a switch on your transmitter which will allow you to increase or decrease many of your flight controller settings while in flight. In this case, we will be using it to adjust our P gain while flying. The in flight adjustment tab has a lot of really cool features, and I highly recommend you take the time to read the documentation if you are interested.
Hook up your quad to your computer. If your RC RX can be powered by USB power (which most should), you can leave the flight battery unplugged. Now, open up Cleanflight Configurator and connect to your quad. Go to the receiver tab and verify that your RX is working and that the switch you configured earlier on channel 6 is working correctly. It should show up as “AUX2”.
Now, go to the “Adjustments” tab. We will start by tuning the pitch P value. Set-up your top two adjustment areas so that they look like this:
Note that you will need to configure “AUX 2” (this is channel 7 – if you did not use this channel, pick the correct AUX for what you did use) in all four drop-downs, and select “Pitch P Adjustment”.
Now, flip the 3-position switch on your RC TX. When it is in the lowest position, the little green nub (circled in blue) on both of the sliders should be in the left area of the slider and should end up between the two sliders in the lower adjustment area:
If the green nub goes to the right side of the line, you will need to reverse your channel 6 on your transmitter.
Next, flip your switch to the middle position. The green nub should appear near the center of the sliders and should not be in between either of the sliders in any of the adjustment areas. This is your “dead position”, where nothing is happening:
Finally, flip your switch to the top position. The green nub should now appear near the right side of the slider bar and should appear between the sliders in the upper adjustment area:
Now, click “save” to save your changes. What you’ve done is set up your 3-position switch so that when it is in the uppermost position, the pitch P value will steadily increase. When it is in the lowest position, the pitch P value will steadily decrease. Finally, when it is neutral, nothing will happen.
Let’s check that this is working. Go to the PID Tuning tab and note your pitch P value on a piece of paper. Now, flip your switch to the lowest position and repeatedly click “Refresh” at the bottom of the Configurator window. You should see that your Pitch P value steadily decreasing. Nice! Flip the switch back to neutral and notice how the P value stays where it was at. Go ahead and reset the P value back to where it was before now.
Initial PID Configuration
I’m going to assume you are using Betaflight or Cleanflight, so that the default PID values are “reasonable” (e.g. – your quad at least flies with them). Write them all down for reference. Now, half all of your pitch and roll P, I and D values. You are halving your I and D values so that they don’t interfere with the P gain as much. Some people set these to zero but I find a low value seems to do just as good. You are halving the P value just in case it is too high to start with. Do not touch your yaw values. Click “Save” and lets go fly!
Flight Testing
The flight test is actually very simple. Simply hover your quad in front of you, and flip your 3-position adjustment switch up. Now slowly rock your quad forwards and aft with the pitch stick and wait. The quad will slowly get more and more “jittery” as the P value is increased by the in-flight adjustment bound to your stick. You are waiting for the moment when the quad starts to wobble noticeably without stopping. This can take up to a minute, depending on how low your initial settings are and how aggressive your set-up is. As soon as this happens, flip your adjustment switch back to the middle and land and disarm immediately. Flying for an extended amount of time like this can overheat your motors and ESCs. Do not unplug the battery.
What you have just determined is your quads maximum pitch P value. It is now stored in your quad, but it will be lost if you unplug the battery because in flight adjustments do not save through power cycles. You must attach your quad to your computer without powering it off to see what the maximum pitch P value is. To protect yourself from the props, through a blanket or pillow over the quad or lay it upside down so that if the props do decide to spin, at least it won’t take off into your face. Alternatively, you can plug your quad into your computer then immediately unplug the flight battery since the computer’s USB power will keep the flight controller alive.
Connect to the quad via Cleanflight Configurator and go to the PID tab. Note the P value, which should be much, much higher than it started, and reset it back to half the default you recorded earlier.
Now it’s time to do the roll axis. Reset the P value to half of it’s default. Next, go back into the adjustments tab and change them so that you are now adjusting the roll P values:
Hit save, and test that it is working, per the instructions above. The switch should now control the value of the roll P gain. Unplug the quad from your computer and go back outside. Repeat the above procedure to get the maximum roll P value.
Done!
Believe it or not, you now have the two most important numbers for your initial tune for your quadcopter. Plug the quadcopter into the computer if it is not already plugged in. Go to the PID tab and enter half of the maximum pitch P value into the pitch P text field. Now enter half of the maximum roll P value into the roll P text field. Go ahead and double your pitch and roll I and D values so that they are back to defaults. That’s it! Your quad should fly pretty damned well with these settings.
One thing you want to make sure to do is to disable the adjustments. If you don’t do this, you risk accidentally going to the field and leaving your TX adjustment switch up or down, causing the P values to rise or plummet until you crash. You can turn off adjustments by going to the adjustments tab and turning off the enabler switches: