mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 12:55:19 +03:00
Merge pull request #8736 from joelucid/ff2_1
various ff2_0 improvements
This commit is contained in:
commit
75447ef2b8
8 changed files with 96 additions and 77 deletions
|
@ -130,7 +130,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, 12);
|
||||
PG_REGISTER_ARRAY_WITH_RESET_FN(pidProfile_t, PID_PROFILE_COUNT, pidProfiles, PG_PID_PROFILE, 13);
|
||||
|
||||
void resetPidProfile(pidProfile_t *pidProfile)
|
||||
{
|
||||
|
@ -212,10 +212,9 @@ void resetPidProfile(pidProfile_t *pidProfile)
|
|||
.idle_p = 50,
|
||||
.idle_pid_limit = 200,
|
||||
.idle_max_increase = 150,
|
||||
.ff_interpolate_sp = 0,
|
||||
.ff_spread = 0,
|
||||
.ff_max_rate_limit = 0,
|
||||
.ff_lookahead_limit = 0,
|
||||
.ff_interpolate_sp = FF_INTERPOLATE_AVG,
|
||||
.ff_jerk_limit = 25,
|
||||
.ff_max_rate_limit = 100,
|
||||
.ff_boost = 15,
|
||||
);
|
||||
#ifndef USE_D_MIN
|
||||
|
@ -315,6 +314,13 @@ 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 ffJerkLimitInverse;
|
||||
|
||||
float pidGetJerkLimitInverse()
|
||||
{
|
||||
return ffJerkLimitInverse;
|
||||
}
|
||||
|
||||
|
||||
float pidGetFfBoostFactor()
|
||||
{
|
||||
|
@ -460,6 +466,7 @@ void pidInitFilters(const pidProfile_t *pidProfile)
|
|||
pt1FilterInit(&antiGravityThrottleLpf, pt1FilterGain(ANTI_GRAVITY_THROTTLE_FILTER_CUTOFF, dT));
|
||||
|
||||
ffBoostFactor = (float)pidProfile->ff_boost / 10.0f;
|
||||
ffJerkLimitInverse = pidProfile->ff_jerk_limit ? 1.0f / ((float)pidProfile->ff_jerk_limit / 10.0f) : 0.0f;
|
||||
}
|
||||
|
||||
#ifdef USE_RC_SMOOTHING_FILTER
|
||||
|
@ -583,7 +590,7 @@ static FAST_RAM_ZERO_INIT float dMinSetpointGain;
|
|||
#endif
|
||||
|
||||
#ifdef USE_INTERPOLATED_SP
|
||||
static FAST_RAM_ZERO_INIT bool ffFromInterpolatedSetpoint;
|
||||
static FAST_RAM_ZERO_INIT ffInterpolationType_t ffFromInterpolatedSetpoint;
|
||||
#endif
|
||||
|
||||
void pidInitConfig(const pidProfile_t *pidProfile)
|
||||
|
@ -1408,7 +1415,7 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, timeUs_t currentTim
|
|||
float pidSetpointDelta = 0;
|
||||
#ifdef USE_INTERPOLATED_SP
|
||||
if (ffFromInterpolatedSetpoint) {
|
||||
pidSetpointDelta = interpolatedSpApply(axis, pidFrequency, newRcFrame);
|
||||
pidSetpointDelta = interpolatedSpApply(axis, newRcFrame, ffFromInterpolatedSetpoint);
|
||||
} else {
|
||||
pidSetpointDelta = currentPidSetpoint - previousPidSetpoint[axis];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue