From e1a8a80584008ae0803991e3042c18ae271b954c Mon Sep 17 00:00:00 2001 From: ctzsnooze Date: Tue, 10 Sep 2019 19:08:20 +1000 Subject: [PATCH] fixes for ff_boost 1. Excludes yaw from ff_boost. 2. Removes suppression for 3x greater up-steps in FF to reduce boost glitching around zero sticks 3. Spike detection gets cleaner passband and tighter rejection above threshold; higher threshold is now possible with better suppression of large spikes. --- src/main/flight/interpolated_setpoint.c | 19 ++++++++++--------- src/main/flight/pid.c | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/flight/interpolated_setpoint.c b/src/main/flight/interpolated_setpoint.c index fbe1000a4..0d54e8780 100644 --- a/src/main/flight/interpolated_setpoint.c +++ b/src/main/flight/interpolated_setpoint.c @@ -66,15 +66,16 @@ FAST_CODE_NOINLINE float interpolatedSpApply(int axis, bool newRcFrame, ffInterp const float ffBoostFactor = pidGetFfBoostFactor(); float clip = 1.0f; float boostAmount = 0.0f; - if (ffBoostFactor != 0.0f) { - if (pidGetSpikeLimitInverse()) { - clip = 1 / (1 + fabsf(setpointAcceleration * pidGetSpikeLimitInverse())); - clip *= clip; - } - - // prevent kick-back spike at max deflection - if (fabsf(rawSetpoint) < 0.95f * ffMaxRate[axis] || fabsf(setpointSpeed) > 3.0f * fabsf(prevSetpointSpeed[axis])) { - boostAmount = ffBoostFactor * setpointAcceleration; + if ((axis == FD_ROLL)||(axis == FD_PITCH)) { + if (ffBoostFactor != 0.0f) { + if (pidGetSpikeLimitInverse()) { + clip = 1 / (1 + (setpointAcceleration * setpointAcceleration * pidGetSpikeLimitInverse())); + clip *= clip; + } + // prevent kick-back spike at max deflection + if (fabsf(rawSetpoint) < 0.95f * ffMaxRate[axis]) { + boostAmount = ffBoostFactor * setpointAcceleration; + } } } prevSetpointSpeed[axis] = setpointSpeed; diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index efdd04d7c..73c3c31d2 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -213,7 +213,7 @@ void resetPidProfile(pidProfile_t *pidProfile) .idle_pid_limit = 200, .idle_max_increase = 150, .ff_interpolate_sp = FF_INTERPOLATE_AVG, - .ff_spike_limit = 40, + .ff_spike_limit = 60, .ff_max_rate_limit = 100, .ff_boost = 15, ); -- 2.11.4.GIT