Could You please explain, why in the Multiwii.cpp in the YAW PID block of code
Code: Select all
//YAW
#define GYRO_P_MAX 300
#define GYRO_I_MAX 250
rc = (int32_t)rcCommand[YAW] * (2*conf.yawRate + 30) >> 5;
error = rc - imu.gyroData[YAW];
errorGyroI_YAW += (int32_t)error*conf.pid[YAW].I8;
errorGyroI_YAW = constrain(errorGyroI_YAW, 2-((int32_t)1<<28), -2+((int32_t)1<<28));
if (abs(rc) > 50) errorGyroI_YAW = 0;
PTerm = (int32_t)error*conf.pid[YAW].P8>>6;
#ifndef COPTER_WITH_SERVO
int16_t limit = GYRO_P_MAX-conf.pid[YAW].D8;
PTerm = constrain(PTerm,-limit,+limit);
#endif
ITerm = constrain((int16_t)(errorGyroI_YAW>>13),-GYRO_I_MAX,+GYRO_I_MAX);
axisPID[YAW] = PTerm + ITerm;
it must reset yaw if (abs(rc) > 50) errorGyroI_YAW = 0; ?? It curves my helicopter when i try to turn it in any way (clockwise or counterclockwise)... How can i improve it?