diff --git a/src/main/cli/settings.c b/src/main/cli/settings.c index dd1f4c1ff7..49f33b2f90 100644 --- a/src/main/cli/settings.c +++ b/src/main/cli/settings.c @@ -932,9 +932,6 @@ const clivalue_t valueTable[] = { { "crash_recovery", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_CRASH_RECOVERY }, PG_PID_PROFILE, offsetof(pidProfile_t, crash_recovery) }, { "iterm_rotation", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_PID_PROFILE, offsetof(pidProfile_t, iterm_rotation) }, -#if defined(USE_SMART_FEEDFORWARD) - { "smart_feedforward", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_PID_PROFILE, offsetof(pidProfile_t, smart_feedforward) }, -#endif #if defined(USE_ITERM_RELAX) { "iterm_relax", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_ITERM_RELAX }, PG_PID_PROFILE, offsetof(pidProfile_t, iterm_relax) }, { "iterm_relax_type", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_ITERM_RELAX_TYPE }, PG_PID_PROFILE, offsetof(pidProfile_t, iterm_relax_type) }, diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 8542730429..345664ad00 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -127,7 +127,7 @@ static FAST_RAM_ZERO_INIT float airmodeThrottleOffsetLimit; #define LAUNCH_CONTROL_YAW_ITERM_LIMIT 50 // yaw iterm windup limit when launch mode is "FULL" (all axes) -PG_REGISTER_ARRAY_WITH_RESET_FN(pidProfile_t, PID_PROFILE_COUNT, pidProfiles, PG_PID_PROFILE, 9); +PG_REGISTER_ARRAY_WITH_RESET_FN(pidProfile_t, PID_PROFILE_COUNT, pidProfiles, PG_PID_PROFILE, 10); void resetPidProfile(pidProfile_t *pidProfile) { @@ -168,7 +168,6 @@ void resetPidProfile(pidProfile_t *pidProfile) .throttle_boost = 5, .throttle_boost_cutoff = 15, .iterm_rotation = false, - .smart_feedforward = false, .iterm_relax = ITERM_RELAX_RP, .iterm_relax_cutoff = ITERM_RELAX_CUTOFF_DEFAULT, .iterm_relax_type = ITERM_RELAX_SETPOINT, @@ -500,10 +499,6 @@ pt1Filter_t throttleLpf; #endif static FAST_RAM_ZERO_INIT bool itermRotation; -#if defined(USE_SMART_FEEDFORWARD) -static FAST_RAM_ZERO_INIT bool smartFeedforward; -#endif - #ifdef USE_LAUNCH_CONTROL static FAST_RAM_ZERO_INIT uint8_t launchControlMode; static FAST_RAM_ZERO_INIT uint8_t launchControlAngleLimit; @@ -618,10 +613,6 @@ void pidInitConfig(const pidProfile_t *pidProfile) antiGravityOsdCutoff += ((itermAcceleratorGain - 1000) / 1000.0f) * 0.25f; } -#if defined(USE_SMART_FEEDFORWARD) - smartFeedforward = pidProfile->smart_feedforward; -#endif - #if defined(USE_ITERM_RELAX) itermRelax = pidProfile->iterm_relax; itermRelaxType = pidProfile->iterm_relax_type; @@ -1056,21 +1047,6 @@ float FAST_CODE applyRcSmoothingDerivativeFilter(int axis, float pidSetpointDelt } #endif // USE_RC_SMOOTHING_FILTER -#ifdef USE_SMART_FEEDFORWARD -void FAST_CODE applySmartFeedforward(int axis) -{ - if (smartFeedforward) { - if (pidData[axis].P * pidData[axis].F > 0) { - if (fabsf(pidData[axis].F) > fabsf(pidData[axis].P)) { - pidData[axis].P = 0; - } else { - pidData[axis].F = 0; - } - } - } -} -#endif // USE_SMART_FEEDFORWARD - #if defined(USE_ITERM_RELAX) #if defined(USE_ABSOLUTE_CONTROL) STATIC_UNIT_TESTED void applyAbsoluteControl(const int axis, const float gyroRate, float *currentPidSetpoint, float *itermErrorRate) @@ -1427,10 +1403,6 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, timeUs_t currentTim // no transition if feedForwardTransition == 0 float transition = feedForwardTransition > 0 ? MIN(1.f, getRcDeflectionAbs(axis) * feedForwardTransition) : 1; pidData[axis].F = feedforwardGain * transition * pidSetpointDelta * pidFrequency; - -#if defined(USE_SMART_FEEDFORWARD) - applySmartFeedforward(axis); -#endif } else { pidData[axis].F = 0; } diff --git a/src/main/flight/pid.h b/src/main/flight/pid.h index cc19659fbf..2cfa8e7092 100644 --- a/src/main/flight/pid.h +++ b/src/main/flight/pid.h @@ -139,7 +139,6 @@ typedef struct pidProfile_s { uint8_t throttle_boost; // how much should throttle be boosted during transient changes 0-100, 100 adds 10x hpf filtered throttle uint8_t throttle_boost_cutoff; // Which cutoff frequency to use for throttle boost. higher cutoffs keep the boost on for shorter. Specified in hz. uint8_t iterm_rotation; // rotates iterm to translate world errors to local coordinate system - uint8_t smart_feedforward; // takes only the larger of P and the D weight feed forward term if they have the same sign. uint8_t iterm_relax_type; // Specifies type of relax algorithm uint8_t iterm_relax_cutoff; // This cutoff frequency specifies a low pass filter which predicts average response of the quad to setpoint uint8_t iterm_relax; // Enable iterm suppression during stick input diff --git a/src/main/msp/msp.c b/src/main/msp/msp.c index 04353d0f64..ee8cf2eb45 100644 --- a/src/main/msp/msp.c +++ b/src/main/msp/msp.c @@ -1440,11 +1440,7 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst) sbufWriteU16(dst, currentPidProfile->itermAcceleratorGain); sbufWriteU16(dst, 0); // was currentPidProfile->dtermSetpointWeight sbufWriteU8(dst, currentPidProfile->iterm_rotation); -#if defined(USE_SMART_FEEDFORWARD) - sbufWriteU8(dst, currentPidProfile->smart_feedforward); -#else sbufWriteU8(dst, 0); -#endif #if defined(USE_ITERM_RELAX) sbufWriteU8(dst, currentPidProfile->iterm_relax); sbufWriteU8(dst, currentPidProfile->iterm_relax_type); @@ -2113,11 +2109,7 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src) if (sbufBytesRemaining(src) >= 14) { // Added in MSP API 1.40 currentPidProfile->iterm_rotation = sbufReadU8(src); -#if defined(USE_SMART_FEEDFORWARD) - currentPidProfile->smart_feedforward = sbufReadU8(src); -#else sbufReadU8(src); -#endif #if defined(USE_ITERM_RELAX) currentPidProfile->iterm_relax = sbufReadU8(src); currentPidProfile->iterm_relax_type = sbufReadU8(src); diff --git a/src/main/target/common_pre.h b/src/main/target/common_pre.h index edf8d029ca..4ffb888501 100644 --- a/src/main/target/common_pre.h +++ b/src/main/target/common_pre.h @@ -295,7 +295,6 @@ #define USE_ESCSERIAL_SIMONK #define USE_SERIAL_4WAY_SK_BOOTLOADER #define USE_CMS_FAILSAFE_MENU -#define USE_SMART_FEEDFORWARD #define USE_TELEMETRY_SENSORS_DISABLED_DETAILS // Re-enable this after 4.0 has been released, and remove the define from STM32F4DISCOVERY //#define USE_VTX_TABLE diff --git a/src/test/unit/pid_unittest.cc b/src/test/unit/pid_unittest.cc index 1a3035c3f3..4f6e256730 100644 --- a/src/test/unit/pid_unittest.cc +++ b/src/test/unit/pid_unittest.cc @@ -130,7 +130,6 @@ void setDefaultTestSettings(void) { pidProfile->throttle_boost = 0; pidProfile->throttle_boost_cutoff = 15; pidProfile->iterm_rotation = false; - pidProfile->smart_feedforward = false, pidProfile->iterm_relax = ITERM_RELAX_OFF, pidProfile->iterm_relax_cutoff = 11, pidProfile->iterm_relax_type = ITERM_RELAX_SETPOINT,