mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 23:35:34 +03:00
PID3 mw23 implementation
Finish PID3 implementation
This commit is contained in:
parent
57a3e59a38
commit
33eef46db3
6 changed files with 185 additions and 10 deletions
|
@ -116,7 +116,7 @@ int16_t telemTemperature1; // gyro sensor temperature
|
|||
static uint32_t disarmAt; // Time of automatic disarm when "Don't spin the motors when armed" is enabled and auto_disarm_delay is nonzero
|
||||
|
||||
extern uint32_t currentTime;
|
||||
extern uint8_t PIDweight[3];
|
||||
extern uint8_t dynP8[3], dynI8[3], dynD8[3], PIDweight[3];
|
||||
extern bool antiWindupProtection;
|
||||
|
||||
static filterStatePt1_t filteredCycleTimeState;
|
||||
|
@ -256,6 +256,10 @@ void annexCode(void)
|
|||
rcCommand[axis] = (lookupYawRC[tmp2] + (tmp - tmp2 * 100) * (lookupYawRC[tmp2 + 1] - lookupYawRC[tmp2]) / 100) * -masterConfig.yaw_control_direction;
|
||||
prop1 = 100 - (uint16_t)currentControlRateProfile->rates[axis] * ABS(tmp) / 500;
|
||||
}
|
||||
// FIXME axis indexes into pids. use something like lookupPidIndex(rc_alias_e alias) to reduce coupling.
|
||||
dynP8[axis] = (uint16_t)currentProfile->pidProfile.P8[axis] * prop1 / 100;
|
||||
dynI8[axis] = (uint16_t)currentProfile->pidProfile.I8[axis] * prop1 / 100;
|
||||
dynD8[axis] = (uint16_t)currentProfile->pidProfile.D8[axis] * prop1 / 100;
|
||||
|
||||
// non coupled PID reduction scaler used in PID controller 1 and PID controller 2. YAW TPA disabled. 100 means 100% of the pids
|
||||
if (axis == YAW) {
|
||||
|
@ -292,6 +296,7 @@ void annexCode(void)
|
|||
scaleRcCommandToFpvCamAngle();
|
||||
}
|
||||
|
||||
|
||||
if (ARMING_FLAG(ARMED)) {
|
||||
LED0_ON;
|
||||
} else {
|
||||
|
@ -481,6 +486,7 @@ void processRx(void)
|
|||
}
|
||||
} else {
|
||||
pidResetErrorGyro();
|
||||
pidResetErrorAngle();
|
||||
}
|
||||
} else {
|
||||
antiWindupProtection = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue