There is so much new stuff to learn in Betaflight 3.4, I am sure it’s a bit overwhelming for a lot of people! In this tutorial I will try to explain how I tune my quad with the latest Betaflight firmware in the simplest way possible. A lot have changed in the latest Betaflight, and. Oct 17, 2016 With Multiwii pid controller I was using about 13 for D term P should be way less too something like 5/6/10 p/r/y for multiwii (old), from memory. Loop time of 1000 is better, naze32 can go much lower though. By setting to 2500 you are slowing down the PID. C++ continue on next line.
There is so much new stuff to learn in Betaflight 3.4, I am sure it’s a bit overwhelming for a lot of people! In this tutorial I will try to explain how I tune my quad with the latest Betaflight firmware in the simplest way possible.
A lot have changed in the latest Betaflight, and you should “re-tune” your quad for the best possible performance. This guide has been updated for Betaflight 3.5.
The official tuning guide for Betaflight 3.4 is a bit daunting but definitely worth a read if you have time. It also explains the new changes in Betaflight 3.4: https://github.com/betaflight/betaflight/wiki/Tuning-Tips-for-Betaflight-3.4
Check out this article to see what Feed-Forward does. Here is how you tune it:
If you want sharper response and more control, increase F gain. If you want smoother stop of a flip and less prop wash, increase D gain. If you have oscillation on Yaw axis, you can try higher F and I values, then drop P to maintain the responsiveness while keeping oscillations caused by P gain to a minimum.
Autotune does not support pidcontroller 2 or higher (pidcontroller 0 is the Cleanflight default, pidcontroller 1 will work for autotune as well). Configure a two position switch on your transmitter to activate the AUTOTUNE mode. Autotune may be done in ether one of the both only, HORIZON or ANGLE mode (will then apply on both modes). Jul 30, 2017 PID tuning. Every aspect of flight dynamics is controlled by the selected 'PID controller'. This is an algorithm which is responsible for reacting to your stick inputs and keeping the craft stable in the air by using the gyroscopes and/or accelerometers (depending on your flight mode).
The range is 0 to 2000, but you will never need 2000, if you do put it on 2000, the quad might just freak out when you touch the sticks… Even the default value of 60 felt a bit too sensitive for me, so I reduced it down to around 50.
Apparently not only too much P and D can cause bounce-back, I gain can too! By enabling “I-term relax”, It can reduce bounce-back at the end of flips or rolls.
“I-term relax” also allows you to increase I term by 50% or more makes your quad fly more “locked in” in extreme conditions without feeling too “stiff”.
With “Throttle Boost”, when you move your throttle rapidly, Betaflight will spin up or slow down the motors faster than before. This makes an unresponsive or heavy quad a lot more responsive, and feel more like a smaller/lighter quad.
Throttle Boost is a bit like a dynamic throttle curve, it exaggerates throttle changes. However it only works with rapid throttle movement, and has no effect when you change throttle slowly.
If you are using RC smoothing filter, “Throttle Boost” can also cancel out some of the latency caused by that.
Pid Controller Autotuning
Make some rapid throttle movements when tuning this value. You want to land on a number where you get very responsive throttle without surging, overshoot and feeling over-sensitive.
Heavier quads, and quads with weak motors need higher Throttle Boost value. On my freestyle quad (weighs 550g+ with gopro and lipo), I have it at 15.
If you want a quad with smoother throttle you want to lower this, for example 3 to 5.
RC signal gets updated regularly, if you look at blackbox log you will find “stepping” in the original RC signal. Stepping in the RC signal results in rougher running motors.
RC Smoothing filter can smooth out these stepping. It can even reduce spikes and sharp edges from rapid stick inputs, your motors will run smoother and cooler.
Previously we used a method called “Interpolation”, but it has relatively high latency. In Betaflight 3.4, we are given a new method called “Filter” which has less smoothing, but also less latency. The benefit is that the aircraft feels more responsive and connected to your sticks.
Having said that, you may or may not feel the difference, but less delay is always a good thing.
If you notice a change in rapid stick response, consider adjusting “setpoint weight”, “throttle boost” and P gain to compensate.
SBUS or FPort users should set their radio link to D16 mode using 8 or fewer channels on the Taranis Model Setup Page.
This allows faster channel update by not sending the 9th to 16th channels (9ms vs. 18ms), and this fixes all the problems with RC smoothing filters. The only downside is that you can use only 8 channels, but that shouldn’t be a big problem for most racers and freestyle pilots.
The default PID values in BF3.4 are too low for all of my builds, especially D gain. They work okay built feel a bit sloppy, so I had to increase them quite a bit.
You may copy PID from the previous BF version. The wiki tuning guide suggests to increase P, I and D values by up to 20% from your previous tune to match the same level of responsiveness.
If you want to try tuning PID from scratch, check out my PID tuning tutorial.
There are now 4 low pass filters, 2 for Gyro and 2 for D term. These are all enabled by default. All of them are using PT1 and the new “dual filters” seems to work pretty well, so you only need to play with the filtering frequency depending on the setup and condition.
The lower the number, the higher level of filtering and latency. Lower filter frequency if you have oscillation or hot motors. You can turn the filters off by setting them to 0 (zero), don’t do this unless you know what you are doing.
When it comes to filters, it can get complicated. Not everyone has the time to play with blackbox and filters. If so just try the suggestions from the Betaflight Wiki.
Average buildClean buildNoisy / Beat-up quadEnable Dynamic Filter
It’s best to leave Dynamic filter enabled. Yes, it adds delay, but it’s useful when you are constantly bashing your props which changes the noise frequency. Dynamic filter can target that noise automatically and keep it down. So I think this should work well for most people. Only turn it off if you know what you are doing.
I hope this guide was easy to follow, feel free to share, comment and ask questions. I will try to keep this guide up to date.
Edit History
Related Articles
Every aspect of flight dynamics is controlled by the selected 'PID controller'. This is an algorithm which is responsible for reacting to your stick inputs and keeping the craft stable in the air by using the gyroscopes and/or accelerometers (depending on your flight mode).
The 'PIDs' are a set of tuning parameters which control the operation of the PID controller. The optimal PID settings are different on every craft, so if you can't find someone with your exact setup who will share their settings with you, some trial and error is required to find the best performing PID settings.
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 that you're commanding with your sticks. An error is computed which is the difference between your target rotation rate and the actual one measured by the gyroscopes, and the controller tries to bring this error to zero.
PIDs
The P term controls the strength of the correction that is applied to bring the craft toward the target angle or rotation rate. If the P term is too low, the craft will be difficult to control as it won't respond quickly enough to keep itself stable. If it is set too high, the craft will rapidly oscillate/shake as it continually overshoots its target.
The I term corrects small, long term errors. If it is set too low, the craft's attitude will slowly drift. If it is set 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 with 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)
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 than when your oscillations start so you'll want to experiment with the values to reduce/remove the oscillations.
PID controllers
Cleanflight 1.x had experimental pid controllers, for cleanflight 2.0 there is only one.
PID controller 'LUXFloat'
This is a new floating point based PID controller. MW23 and MWREWRITE use integer arithmetic, which was faster in the days of the slower 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 PIDs don't have to be retuned when the looptime setting changes.
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 controlled by the LEVEL 'P' PID term which is labeled 'Angle', 'Strength' in the GUI (prior to version v1.13.0 the parameter
level_angle was used). This can be used to tune the auto-leveling strength in Angle mode compared to Horizon mode. The default is 50.
The strength of the auto-leveling correction applied during Horizon mode is set by the LEVEL 'I' PID term which is labeled 'Horizon', 'Strength' in the GUI (prior to version v1.13.0 the parameter
level_horizon was used). The default is also 50.
The transition between self-leveling and acro behavior in Horizon mode is controlled by the LEVEL 'D' term which is labeled 'Horizon', 'Transition' in the GUI (prior to version of v1.13.0 the parameter
sensitivity_horizon parameter was used) . This sets the percentage of your stick travel that should have self-leveling applied to it, so smaller values cause more of the stick area to fly using only the gyros.
For example, at a setting of '100' for sensitivity horizon, 100% self-leveling strength will be applied at center stick, 50% self-leveling will be applied at 50% stick, and no self-leveling will be applied at 100% stick. If sensitivity 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.
See below for descriptions of the Horizon Mode Commands.
RC rate, Pitch and Roll Rates (P/R rate before they were separated), and Yaw rateRC Rate
An overall multiplier on the RC stick inputs for pitch, roll, and yaw.
This basically sets the baseline stick sensitivity.
Pitch and Roll rates
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.
Yaw Rate
It acts as a stick sensitivity multiplier, as explained above.
Filtersgyro_lpf sets the hardware gyro low pass filter value. If 0 or 256 the gyro uses the least hardware filtering available (256Hz) and the internal sampling rate is the fastest possible (8kHz) with the least possible delay. The lower the number the stronger the filtering. Stronger filtering reduces noise in the gyro signal before that data gets into the PID calculations. Stronger filtering adds delays that can be associated with wobble and reduced responsiveness. Filtering is needed because motor/frame noise can cause overheating of motors especially when amplified by Dterm in quads with low mass and fast braking ESCs. If 188 or lower are chosen, the gyro sampling is internally at 1kHz and delays are greater. Faster sampling is good because things are slightly more responsive but can cause aliasing noise. Setting to 188 allows syncing of the FC to the gyro at 1kHz (if gyro_sync is enabled and available in the code) which reduces aliasing a lot.
gyro_soft_lpf is an IIR (Infinite Impulse Response) software low-pass filter that can be configured to any desired frequency. If set to a value above zero it is active. It works after the hardware filter on the gyro (in the FC code) and further reduces noise. The two filters in series have twice the cut rate of one alone. There's not a lot of sense running gyro_soft_lpf at a value above gyro_lpf . If used, it is typically set about half the hardware filter rate to enhance the cut of higher frequencies before the PID calculations. Frequencies above 100Hz are of no interest to us from a flight control perspective - they can and should be removed from the signal before it gets to the PID calculation stage.
dterm_cut_hz is an IIR software low-pass filter that can be configured to any desired frequency. It works after the gyro_cut filters and specifically filters only the D term data. D term data is frequency dependent, the higher the frequency, the greater the computed D term value. This filter is required if despite the gyro filtering there remains excessive D term noise. Typically it needs to be set quite low because D term noise is a major problem with typical IIR filters. If set too low the phase shift in D term reduces the effectiveness of D term in controlling stop wobble, so this value needs some care when varying it. Again blackbox recording is needed to properly optimise the value for this filter.
Pid Auto TuningHorizon Mode Commands
The CLI commands
horizon_tilt_effect and horizon_tilt_expert_mode control the effect the current inclination has on self-leveling in the Horizon flight mode. (The current inclination is the number of degrees of pitch or roll that the vehicle is away from level, whichever is greater).
horizon_tilt_effect : Controls the effect the current inclination (tilt) has on self-leveling in the Horizon flight mode. Larger values result in less self-leveling (more 'acro') as the tilt of the vehicle increases. The default value of 75 provides good performance when doing large loops and fast-forward flight. With a value of 0 the strength of the self-leveling would be solely dependent on the stick position.
horizon_tilt_expert_mode OFF|ON: Sets the performance mode for 'horizon_tilt_effect'
OFF = leveling always active when sticks centered:
This is the 'safer' mode because the self-leveling is always active when the sticks are centered. So, when the vehicle is upside down (180 degrees) and the sticks are then centered, the vehicle will immediately be self-leveled to upright and flat. (Note that after this kind of very-fast 180-degree self-leveling, the heading of the vehicle can be unpredictable.)
ON = leveling can be totally off when inverted:
In this mode, the inclination (tilt) of the vehicle can fully 'override' the self-leveling. In this mode, when the 'horizon_tilt_effect' parameter is set to around 75, and the vehicle is upside down (180 degrees) and the sticks are then centered, the vehicle is not self-leveled. This can be desirable for performing more-acrobatic maneuvers and potentially for 3D-mode flying.
The 'horizon_tilt_effect' and 'horizon_tilt_expert_mode' values are separate for each profile.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |