Correct setpoint behaviour
This commit is contained in:
parent
a2b24692da
commit
00414b29b6
|
@ -20,7 +20,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define EEPROM_CONF_VERSION 162
|
#define EEPROM_CONF_VERSION 163
|
||||||
|
|
||||||
bool isEEPROMContentValid(void);
|
bool isEEPROMContentValid(void);
|
||||||
bool loadEEPROM(void);
|
bool loadEEPROM(void);
|
||||||
|
|
|
@ -99,7 +99,7 @@ void resetPidProfile(pidProfile_t *pidProfile)
|
||||||
.pidAtMinThrottle = PID_STABILISATION_ON,
|
.pidAtMinThrottle = PID_STABILISATION_ON,
|
||||||
.levelAngleLimit = 55,
|
.levelAngleLimit = 55,
|
||||||
.setpointRelaxRatio = 100,
|
.setpointRelaxRatio = 100,
|
||||||
.dtermSetpointWeight = 60,
|
.dtermSetpointWeight = 0,
|
||||||
.yawRateAccelLimit = 100,
|
.yawRateAccelLimit = 100,
|
||||||
.rateAccelLimit = 0,
|
.rateAccelLimit = 0,
|
||||||
.itermThrottleThreshold = 350,
|
.itermThrottleThreshold = 350,
|
||||||
|
@ -488,7 +488,7 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
|
||||||
gyroRateFiltered = dtermLpfApplyFn(dtermFilterLpf[axis], gyroRateFiltered);
|
gyroRateFiltered = dtermLpfApplyFn(dtermFilterLpf[axis], gyroRateFiltered);
|
||||||
|
|
||||||
float dynC = 0;
|
float dynC = 0;
|
||||||
if ( (pidProfile->setpointRelaxRatio < 100) && (!flightModeFlags) ) {
|
if ( (pidProfile->dtermSetpointWeight > 0) && (!flightModeFlags) ) {
|
||||||
dynC = dtermSetpointWeight * MIN(getRcDeflectionAbs(axis) * relaxFactor, 1.0f);
|
dynC = dtermSetpointWeight * MIN(getRcDeflectionAbs(axis) * relaxFactor, 1.0f);
|
||||||
}
|
}
|
||||||
const float rD = dynC * currentPidSetpoint - gyroRateFiltered; // cr - y
|
const float rD = dynC * currentPidSetpoint - gyroRateFiltered; // cr - y
|
||||||
|
|
Loading…
Reference in New Issue