1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

Throttle boost (#5508)

* throttle boost which temporarily boosts throttle in both directions to improve response

* fix comment and use pt1FilterGain

* incorporate review suggestions

* incorporate review suggestions

* use float constant to avoid double promotion

* formatting changes

* formatting change

* hopefully last style changes
This commit is contained in:
joelucid 2018-03-24 23:33:22 +01:00 committed by Michael Keller
parent 172642383d
commit efda704ee5
4 changed files with 22 additions and 1 deletions

View file

@ -130,7 +130,9 @@ void resetPidProfile(pidProfile_t *pidProfile)
.horizon_tilt_effect = 75,
.horizon_tilt_expert_mode = false,
.crash_limit_yaw = 200,
.itermLimit = 150
.itermLimit = 150,
.throttle_boost = 0,
.throttle_boost_cutoff = 15
);
}
@ -266,6 +268,8 @@ void pidInitFilters(const pidProfile_t *pidProfile)
ptermYawLowpassApplyFn = (filterApplyFnPtr)pt1FilterApply;
pt1FilterInit(&ptermYawLowpass, pt1FilterGain(pidProfile->yaw_lowpass_hz, dT));
}
pt1FilterInit(&throttleLpf, pt1FilterGain(pidProfile->throttle_boost_cutoff, dT));
}
static FAST_RAM float Kp[3], Ki[3], Kd[3];
@ -284,6 +288,8 @@ static FAST_RAM float crashGyroThreshold;
static FAST_RAM float crashSetpointThreshold;
static FAST_RAM float crashLimitYaw;
static FAST_RAM float itermLimit;
FAST_RAM float throttleBoost;
pt1Filter_t throttleLpf;
void pidInitConfig(const pidProfile_t *pidProfile)
{
@ -317,6 +323,7 @@ void pidInitConfig(const pidProfile_t *pidProfile)
crashSetpointThreshold = pidProfile->crash_setpoint_threshold;
crashLimitYaw = pidProfile->crash_limit_yaw;
itermLimit = pidProfile->itermLimit;
throttleBoost = pidProfile->throttle_boost * 0.1f;
}
void pidInit(const pidProfile_t *pidProfile)