mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
Small modification to ff boost spike suppression
The feed forward boost concept improves stick response by adding a stick acceleration factor to feed forward. Generating spikes when there are steps in the RC signal is the main problem. This PR makes one small change to how the spike suppression method is determined. It no longer uses the 'jerk' signal to generate the spike suppression 'clip' value. Instead it just uses the magnitude of the boost signal itself. We originally used jerk because it is more sensitive to spikes. Detailed testing shows that jerk is that it has an unwanted impact one full RC step after the spike. If we use the boost (acceleration) signal as the attenuator, that delayed impact does not occur, making the boost component more precise. The threshold value for suppression needs to be a bit higher to achieve equivalence. I've re-named the function to reflect it being related to spike suppression and removed 'jerk' since we aren't using that any more.
This commit is contained in:
parent
ab4328f293
commit
e381b27b9c
5 changed files with 16 additions and 17 deletions
|
@ -60,16 +60,15 @@ FAST_CODE_NOINLINE float interpolatedSpApply(int axis, bool newRcFrame, ffInterp
|
|||
|
||||
const float setpointSpeed = (rawSetpoint - prevRawSetpoint[axis]) * rxRate;
|
||||
const float setpointAcceleration = (setpointSpeed - prevSetpointSpeed[axis]) * pidGetDT();
|
||||
const float setpointJerk = setpointAcceleration - prevSetpointAcceleration[axis];
|
||||
|
||||
|
||||
setpointDeltaImpl[axis] = setpointSpeed * pidGetDT();
|
||||
|
||||
const float ffBoostFactor = pidGetFfBoostFactor();
|
||||
float clip = 1.0f;
|
||||
float boostAmount = 0.0f;
|
||||
if (ffBoostFactor != 0.0f) {
|
||||
if (pidGetJerkLimitInverse()) {
|
||||
clip = 1 / (1 + fabsf(setpointJerk * pidGetJerkLimitInverse()));
|
||||
if (pidGetSpikeLimitInverse()) {
|
||||
clip = 1 / (1 + fabsf(setpointAcceleration * pidGetSpikeLimitInverse()));
|
||||
clip *= clip;
|
||||
}
|
||||
|
||||
|
@ -83,10 +82,10 @@ FAST_CODE_NOINLINE float interpolatedSpApply(int axis, bool newRcFrame, ffInterp
|
|||
prevRawSetpoint[axis] = rawSetpoint;
|
||||
|
||||
if (axis == FD_ROLL) {
|
||||
DEBUG_SET(DEBUG_FF_INTERPOLATED, 0, setpointDeltaImpl[axis] * 1000);
|
||||
DEBUG_SET(DEBUG_FF_INTERPOLATED, 1, boostAmount * 1000);
|
||||
DEBUG_SET(DEBUG_FF_INTERPOLATED, 2, boostAmount * clip * 1000);
|
||||
DEBUG_SET(DEBUG_FF_INTERPOLATED, 3, setpointJerk * 1000);
|
||||
DEBUG_SET(DEBUG_FF_INTERPOLATED, 0, setpointDeltaImpl[axis] * 100);
|
||||
DEBUG_SET(DEBUG_FF_INTERPOLATED, 1, boostAmount * 100);
|
||||
DEBUG_SET(DEBUG_FF_INTERPOLATED, 2, boostAmount * clip * 100);
|
||||
DEBUG_SET(DEBUG_FF_INTERPOLATED, 3, clip * 100);
|
||||
}
|
||||
setpointDeltaImpl[axis] += boostAmount * clip;
|
||||
if (type == FF_INTERPOLATE_ON) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue