mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 12:25:20 +03:00
Power 2 thrust compensation with 50% throttle compensation
^2 gain curve after discussions with Markus Variable throttle compensation, more with higher TL for whoops Calculator https://www.desmos.com/calculator/1rhq0pqoug
This commit is contained in:
parent
596c21686c
commit
7cd83464d6
4 changed files with 7 additions and 10 deletions
|
@ -290,7 +290,10 @@ void pidAcroTrainerInit(void)
|
|||
float pidCompensateThrustLinearization(float throttle)
|
||||
{
|
||||
if (pidRuntime.thrustLinearization != 0.0f) {
|
||||
throttle = throttle * (throttle * pidRuntime.thrustLinearization + 1.0f - pidRuntime.thrustLinearization);
|
||||
// for whoops where a lot of TL is needed, allow more throttle boost
|
||||
const float throttleCompensateAmount = (1.0f - 0.5f * thrustLinearization);
|
||||
const float throttleReversed = (1.0f - throttle);
|
||||
throttle /= 1.0f + throttleCompensateAmount * throttleReversed * throttleReversed * thrustLinearization;
|
||||
}
|
||||
return throttle;
|
||||
}
|
||||
|
@ -299,8 +302,8 @@ float pidApplyThrustLinearization(float motorOutput)
|
|||
{
|
||||
if (pidRuntime.thrustLinearization != 0.0f) {
|
||||
if (motorOutput > 0.0f) {
|
||||
motorOutput = sqrtf(motorOutput * pidRuntime.thrustLinearizationReciprocal +
|
||||
pidRuntime.thrustLinearizationB * pidRuntime.thrustLinearizationB) - pidRuntime.thrustLinearizationB;
|
||||
const float motorOutputReversed = (1.0f - motorOutput);
|
||||
motorOutput *= 1.0f + motorOutputReversed * motorOutputReversed * thrustLinearization;
|
||||
}
|
||||
}
|
||||
return motorOutput;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue