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

Interpolated feed forward smoothing

This commit is contained in:
ctzsnooze 2019-11-20 11:28:04 +11:00
parent 881a256980
commit 3c91da0e59
5 changed files with 85 additions and 15 deletions

View file

@ -212,9 +212,10 @@ void resetPidProfile(pidProfile_t *pidProfile)
.idle_p = 50,
.idle_pid_limit = 200,
.idle_max_increase = 150,
.ff_interpolate_sp = FF_INTERPOLATE_AVG,
.ff_spike_limit = 60,
.ff_interpolate_sp = FF_INTERPOLATE_AVG2,
.ff_spike_limit = 50,
.ff_max_rate_limit = 100,
.ff_smooth_factor = 37,
.ff_boost = 15,
);
#ifndef USE_D_MIN
@ -314,6 +315,7 @@ static FAST_RAM_ZERO_INIT pt1Filter_t airmodeThrottleLpf2;
static FAST_RAM_ZERO_INIT pt1Filter_t antiGravityThrottleLpf;
static FAST_RAM_ZERO_INIT float ffBoostFactor;
static FAST_RAM_ZERO_INIT float ffSmoothFactor;
static FAST_RAM_ZERO_INIT float ffSpikeLimitInverse;
float pidGetSpikeLimitInverse()
@ -327,6 +329,11 @@ float pidGetFfBoostFactor()
return ffBoostFactor;
}
float pidGetFfSmoothFactor()
{
return ffSmoothFactor;
}
void pidInitFilters(const pidProfile_t *pidProfile)
{
@ -738,6 +745,7 @@ void pidInitConfig(const pidProfile_t *pidProfile)
#endif
#ifdef USE_INTERPOLATED_SP
ffFromInterpolatedSetpoint = pidProfile->ff_interpolate_sp;
ffSmoothFactor = 1.0f - ((float)pidProfile->ff_smooth_factor) / 100.0f;
interpolatedSpInit(pidProfile);
#endif
}