Betaflight tpa что это
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 that 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.
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.
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.
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.
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 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.
It acts as a stick sensitivity multiplier, as explained above.
gyro_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.
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.
Horizon Mode Commands
The CLI commands horizon_tilt_effect and horizon_tilt_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_mode SAFE|EXPERT: Sets the performance mode for ‘horizon_tilt_effect’
SAFE = leveling always active when sticks centered: This is the «safer» range 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.)
EXPERT = leveling can be totally off when inverted: In this range, 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_mode’ values are separate for each profile.
Betaflight tpa что это
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 to use 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.
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 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.
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.
Cleanflight has 3 built-in PID controllers which each have different flight behavior. Each controller requires different PID settings for best performance, so if you tune your craft using one PID controller, those settings will likely 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 Cleanflight Configurator, where x is the controller you want to use. Please read these notes first before trying one out.
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 the auto-leveling corrections in a similar way to the way that P and I settings are applied to roll and yaw axes in the acro flight 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 from all 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 should be. 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. 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 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.
There were initially some problems with horizon mode, and sluggishness in acro mode, that were recently fixed by nebbian 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» which is labeled «LEVEL Proportional» in the GUI. This can be used to tune the auto-leveling strength in Angle mode compared to Horizon mode. The default is 5.0.
The strength of the auto-leveling correction applied during Horizon mode is set by the parameter «level_horizon» which is labeled «LEVEL Integral» in the GUI. The default is 3.0, which makes the Horizon mode apply weaker self-leveling than the Angle mode. Note: There is currently a bug in the Configurator which shows this parameter divided by 100 (so it shows 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 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. The default is 75%
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.
RC rate, Pitch and Roll Rates (P/R rate before they were separated), and Yaw 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
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.
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.
In PID Controllers MWREWRITE and LUX, it acts as a stick sensitivity multiplier, as explained above.
Betaflight tpa что это
TPA stands for: Throttle PID Attenuation in Betaflight and Cleanflight.
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 – What a mouthful!!
Take the following example: You’re flying around quite happily but you want to punch out(throttle up quickly) to gain some altitude quickly, as you increase the throttle, you notice that your multi-rotor oscillates rapidly, but it doesn’t in normal conditions. see the video below for an example of what I mean. In this instance, the vibrations are caused by the PIDs being set too high for the amount of power you want to utilize, to resolve this and eliminate the vibrations, you need to apply some TPA.
I am going to assume that you have your throttle endpoints set to 1000 – 2000, with middle stick being 1500. To use TPA, you first will need to assess where your throttle is when you experience the oscillations, mine happened to be just after the mid point, so I set my TPA breakpoint to 1500 (red/blue/green line on the chart below), You may find that you only experience the oscillations later on in your throttle range, e.g. 3/4 throttle. In this instance you can set the TPA breakpoint to 1750 (black dotted line on the graph below).
You can set your TPA breakpoint by going to the CLI and typing:
you can substitute 1500 for whichever value you want, but for a mid point, 1500 will suffice (note: by default, cleanflight and Betaflight have 1650 set as the TPA breakpoint)
Once we are happy with where we have set the breakpoint, we can now concentrate on refining the TPA value. I tend to find my TPA value by incrementing by 0.05 or 0.1, depending on how bad the oscillations are. The trick here is to fly around, and throttle up quickly to see/hear if you still have oscillations, If you do, increment the value and try again.
Lets follow the blue line first. The PIDs of the quad are at 100% of the values you have tuned them to until the throttle is at 50% (1500). As we increase the throttle, the PIDs will decrease until at full throttle they are 50% of the value of which they were initially set.
Now lets follow the green line where we have set our TPA value to 0.75 (This is actually quite high). 0.75 means that at 100% throttle, our PIDs will be reduced by 75% leaving us with 25% of the values initially set. For example: P for roll is tuned to 4.2 – at full throttle with a TPA of 0.75 this will actually be 1.05.
In Cleanflight and Baseflight you can set your TPA value in the PID tuning tab. TPA in Cleanflight and Baseflight only affects P, I and D on ROLL and PITCH, it does not affect YAW.
FPV Квадрокоптер: Фильтрация в Betaflight
(Betaflight 4.1, на новых настройках еще не снимал)
На днях, я все таки решил обновиться до Betaflight 4.2 и все вокруг советуют включить фильтрацию с двухсторонним DShot. К слову она была и в 4.1.
Для начала, давайте немного разберемся, что такое фильтрация и зачем она нужна.
По умолчанию Betaflight задает общие настройки фильтрации подходящие для большинства моделей. Но для достижения наибольшего перфоманса, фильтрация может быть настроена по другому, так как ее может быть излишне или не достаточно для потрепанного квадрокоптера.
MEMS Гироскоп
У каждого квадрокоптера есть FC — Flight Controller, который по сути является мозгами. На этих контроллерах так же присутствует цифровой чип, который часто называют gyro — гироскоп. Это сенсор, который чувствует движение. Он содержит в себе маленькое электро-механическое устройство, которое так и называется — MEMS (Micro Electro Mechanical System).
Внутри этого устройства расположены механически резонирующие «вилки». Эти вилки, расположены по всем трем осям (pitch, roll, yaw) и двигаясь (механическая часть) создают флуктуации вольтажа (электрическая часть).
Флуктуации (колебания) вольтажа, по факту являются аналоговыми волнами, которые преобразуются в цифровую информацию для обработки полетным контроллером. Когда мы говорим 8k gyro, это значит, что 8000 раз в секунду, аналоговый сигнал превращается в цифровой и обрабатывается контроллером, прошивкой, в данном случае Betaflight.
Шум — это термин, который мы часто слышим, но, что это такое? Как правило, мы сразу же представляем звуковой шум или шумную обстановку в очередном 23 этажном муравейнике.
Гироскоп и PID контроллер сталкиваются с похожей проблемой. Так как гироскоп расположен на полетном контролере, который прикреплен к раме, он испытывает шум. Шум может исходить от: моторов, пропеллеров, ветра на скорость, общий шум от рамы, электроники etc.
PID Controller
PID Controller — это такая система которая корректирует позицию квадрокоптера согласно стикам (вашему управлению) или заданного положения (ну, что бы его не колбасило). PID настраивается за счет 3х параметров — P, I и D. К сожалению в этой статье мы не будем детально рассматривать настройку PID. Если вы пилот, то уже знаете, а если новичок, но на эту тему будет отдельная статья.
Эта система хорошо работает, когда количество шумов минимальна, иначе мы можем столкнуться с такими проблемами как осцилляция (вибрации) или перегрев моторов.
D term в PID контроллере имеет особенно отношение к шуму. D сглаживает быстрые движения, но вычисление D в PID контроллере значительно усиливает шум в сигнале. Это означает, что шум от гироскопа существенно усиливается значением D term и поэтому мы фильтруем в двух местах — гироскоп и D.
В качестве примера такого приумножения покажу вам такие вот логи:
Первый график — гироскоп
Второй график — PID
Третий — моторы
(это нормальные пропеллеры, с немного уменьшенной фильтрацией)
(Как видите вибрации от плохих пропеллеров усиливаются на этапе PID контроллера, что ведет к излишнему напрягу моторов, их буквально колбасит)
Фильтрация
Процесс фильтрации заключается в удалении лишнего шума из сигнала от гироскопа. Но какую часть сигнала от гироскопа мы хотим оставить, а какую отфильтровать?
Честно не могу вам в красках рассказать, но так сложилось, что в бетафлайт, шум, а точней вибрации измеряются в Hz. 1Hz — одна ротация в секунду. Делается это как для простоты визуализации и работы с этими переменными. А еще, турбулентность технически называется «rate of change of rotation» — частота изменения ротации.
Скорость движения квадрокоптера лежит в районе 0-30 Hz. Выше 30Hz до 80Hz у нас находится пропвош (propwash), когда квадрокоптер трясет от турбулентности в собственных потоках. Информация в пределах 0 — 80Hz важна для PID контроллера, поэтому ее мы трогать не будем.
С помощью PIDtoolbox можно рисовать вот такие карты:
Low Pass
Как показывает предыдущий график — сигнал от гироскопа содержит информацию от 0 Гц до 1000 Гц, но нас интересует только диапазон 0-80 Гц, поскольку это фактическое движение квадрокоптера, о котором должен знать PID-контроллер. Таким образом, нам нужно решение для фильтрации, чтобы позволить низким частотам проходить через PID-контроллер, в то же время ослабляя высокие частоты, и для этого мы можем использовать фильтр Low Pass (Низких частот).
Фильтры нижних частот пропускают низкочастотный сигнал и ослабляют высокие частоты, которые в основном являются просто шумом.
Устанавливается частота среза, и контроллер просто уменьшает сигналы выше этой частоты. Кривая затухания позволяет не срезать все под чистую, а чем выше частота шума, тем сильней происходит его затухание, плавно.
Часто пилоты допускают ошибку устанавливая такой фильтр на той же частоте, что и видимый шум. Например на 200Hz. Поскольку фильтр плавно ослабляет шум, установка такого фильтра не даст особого результата. Фильтр стоит устанавливать на более низкие частоты. Возможно, даже на 80Hz.
Чем ниже вы устанавливаете такой фильтр, тем больше фильтрации происходит
Устанавливая фильтрацию, следует помнить об одной простой вещи. Чем больше фильтрации тем больше задержка. Понятное дело, что она в миллисекундах и не значительная, но для PID-контроллера это критично. Так как он начнет реагировать на события позже, а это значит, что он будет пытаться выровнять квадракоптер в прошлом 🙂
Notch фильтр
Notch переводится как зарубка, собственно это примерно так и выглядит:
Фильтра откидывают часть шума ниже и часть шума выше. Начиная с Betaflight 3.1 эти фильтры являются динамическими, и подстраиваются под различный шум.
Фильтра используются в связке с Low Pass фильтрами, но используются уже для фильтрации шумов от моторов, которые находятся выше.
D term фильтрация
Как было сказано выше, D способен приумножать шумы от гироскопа, поэтому в Betaflight есть фильтрация D. Ниже на грификах видно уровень шума до фильтрации и после.
В сообществе нет четкого понимания, стоит ли сильно фильтровать D или нет. Но есть правило горячих моторов, чем меньше фильтрация и чем выше D, тем сильней они греются и могут даже сгореть. Но и в обратную сторону мы получаем задержку.
RPM Filter
Так вот, собственно, что новое я стал использовать, так это RPM фильтрацию. Она работает за счет двухстороннего протокола DSHOT который позволяет полетному контроллеру узнать точное количество оборотов конкретного мотора. И уже на основании этих данных применяется фильтрация.

(Ваш ESC должен поддерживать двухсторонний DHSOT)
Прошивка на ESC, от 3.7
Если моторы греются, то это проблема. Горячие моторы могут быть признаком того, что на моторы попадает много шума и они пытаются реагировать на вибрации так часто, что начинает выделяться тепло.
Греться моторы могут по ряду причин, старая рама, погнутые колокола у моторов, нарушенная балансировка, лишние прибомбасы на вашем коптере.
Конечно лучше иметь, как говорят clean build, и что бы все было новое, но можно сперва попробовать настроить фильтрацию.
Для начала можно начать с увеличения фильтрации D, делать шаги в 20 Hz. Проверяйте температуру после каждого такого шага и найдите свой оптимальный диапазон.
А искать его следует между температурой моторов и вибрациями. Как было сказано выше, хоть и фильтрация призвана уменьшить количество шума, она может накладывать некоторые задержки и PID контроллер может не успевать. И как бы это смешно не было, вызывать вибрации. Но эти вибрации не относятся к пропвош. Это уже просто неэффективная работа PID.
В последних версиях Betaflight есть ползунки, пробуйте не менять значения самих фильтров, а попробуйте использовать эти «мастер» ползунки.
На текущий момент у меня такие настройки с включенным RPM фильтром, возможно я попытаюсь уменьшить фильтрацию еще больше:











