mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 12:25:20 +03:00
Fixed throttle calculation.
This commit is contained in:
parent
7cd83464d6
commit
fb605aed01
1 changed files with 3 additions and 3 deletions
|
@ -291,9 +291,9 @@ float pidCompensateThrustLinearization(float throttle)
|
||||||
{
|
{
|
||||||
if (pidRuntime.thrustLinearization != 0.0f) {
|
if (pidRuntime.thrustLinearization != 0.0f) {
|
||||||
// for whoops where a lot of TL is needed, allow more throttle boost
|
// for whoops where a lot of TL is needed, allow more throttle boost
|
||||||
const float throttleCompensateAmount = (1.0f - 0.5f * thrustLinearization);
|
const float throttleCompensateAmount = (1.0f - 0.5f * pidRuntime.thrustLinearization);
|
||||||
const float throttleReversed = (1.0f - throttle);
|
const float throttleReversed = (1.0f - throttle);
|
||||||
throttle /= 1.0f + throttleCompensateAmount * throttleReversed * throttleReversed * thrustLinearization;
|
throttle /= 1.0f + throttleCompensateAmount * powerf(throttleReversed, 2) * pidRuntime.thrustLinearization;
|
||||||
}
|
}
|
||||||
return throttle;
|
return throttle;
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ float pidApplyThrustLinearization(float motorOutput)
|
||||||
if (pidRuntime.thrustLinearization != 0.0f) {
|
if (pidRuntime.thrustLinearization != 0.0f) {
|
||||||
if (motorOutput > 0.0f) {
|
if (motorOutput > 0.0f) {
|
||||||
const float motorOutputReversed = (1.0f - motorOutput);
|
const float motorOutputReversed = (1.0f - motorOutput);
|
||||||
motorOutput *= 1.0f + motorOutputReversed * motorOutputReversed * thrustLinearization;
|
motorOutput *= 1.0f + powerf(motorOutputReversed, 2) * pidRuntime.thrustLinearization;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return motorOutput;
|
return motorOutput;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue