PID take away antiwindup protection
This commit is contained in:
parent
40454ae608
commit
c6d50810cb
@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
#define PTERM_SCALE 0.032029f /*P-term used as a scale value to the PID controller*/
|
||||
#define ITERM_SCALE 0.0012f /*I-term used as a scale value to the PID controller*/
|
||||
#define ITERM_SCALE 0.0012f /*I-term used as a scale value to the PID controller*/
|
||||
#define DTERM_SCALE 0.000529f /*D-term used as a scale value to the PID controller*/
|
||||
|
||||
#define RADIO_RANGE 500 /*Radio range input*/
|
||||
@ -31,7 +31,7 @@
|
||||
#define GYRO_RANGE 720 /*Determines the maximum rotational limit (limits the rc input)*/
|
||||
#define COMPASS_RANGE 180 /*Determines the maximum compass limit (limits the rc input)*/
|
||||
|
||||
#define PID_MAX_I 256 /*Constrains ITerm*/
|
||||
#define PID_MAX_I 256 /*Constrains ITerm*/
|
||||
#define PID_MAX_D 512 /*Constrains DTerm*/
|
||||
|
||||
/*Struct that belongs to a certain PID controller*/
|
||||
@ -315,14 +315,14 @@ void pidUAVcore(pidProfile_t *pidProfile, pidProfileBuff_t *pidProfileBuff,
|
||||
ITerm = constrainf(ITerm, -(int)PID_MAX_I, (int)PID_MAX_I);
|
||||
|
||||
// Anti windup protection
|
||||
if (motorLimitReached)
|
||||
{
|
||||
ITerm = constrainf(ITerm, -pidProfileBuff->ITermLimit[axis], pidProfileBuff->ITermLimit[axis]);
|
||||
}
|
||||
else
|
||||
{
|
||||
pidProfileBuff->ITermLimit[axis] = abs(ITerm);
|
||||
}
|
||||
// if (motorLimitReached)
|
||||
// {
|
||||
// ITerm = constrainf(ITerm, -pidProfileBuff->ITermLimit[axis], pidProfileBuff->ITermLimit[axis]);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// pidProfileBuff->ITermLimit[axis] = abs(ITerm);
|
||||
// }
|
||||
|
||||
pidProfileBuff->lastITerm[axis] = ITerm;
|
||||
|
||||
@ -631,10 +631,10 @@ void pidEproom(void)
|
||||
PidProfile[PID_ID_ACCELEROMETER].PIDweight[PITCH] = 2;
|
||||
PidProfile[PID_ID_ACCELEROMETER].PIDweight[YAW] = 100;
|
||||
|
||||
PidProfileBuff[PID_ID_GYRO].dT = SystemTasks[TASK_GYROPID].desiredPeriod/1000000; //<2F>NDRA TILL SEKUNDER inte ms
|
||||
PidProfileBuff[PID_ID_ACCELEROMETER].dT = SystemTasks[TASK_ACCELEROMETER].desiredPeriod/1000000;
|
||||
PidProfileBuff[PID_ID_COMPASS].dT = SystemTasks[TASK_COMPASS].desiredPeriod/1000000;
|
||||
PidProfileBuff[PID_ID_BAROMETER].dT = SystemTasks[TASK_BARO].desiredPeriod/1000000;
|
||||
PidProfileBuff[PID_ID_GYRO].dT = SystemTasks[TASK_GYROPID].desiredPeriod/1000; //<2F>NDRA TILL SEKUNDER inte ms
|
||||
PidProfileBuff[PID_ID_ACCELEROMETER].dT = SystemTasks[TASK_ACCELEROMETER].desiredPeriod/1000;
|
||||
PidProfileBuff[PID_ID_COMPASS].dT = SystemTasks[TASK_COMPASS].desiredPeriod/1000;
|
||||
PidProfileBuff[PID_ID_BAROMETER].dT = SystemTasks[TASK_BARO].desiredPeriod/1000;
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user