my quadcopter's settling time is very large, that is it sets its setpoint in very large amount of time, during which it has covered a large distance. But at settle point, when i gives it a jerk or push its returns to settle in normal duration. doesnt over shoots(little). The problem is with the settling time that is when i move the stick front or back it takes huge amount of time. what could be wrong. i have tried giving more P value and I value to PID but then it overshoots and get unstable. This is my PID program. the PID values are given. I read 6 channels from remote using the command pulsein(). which i guess is taking upto 20ms per command.
kp = 1.32;
ki= 0.025;
kd= 0.307;
void PID() {
error = atan2(lx,ly);
error *= 1260/22;
error = setpoint1 - error;
now = millis();
dt = now - ptime;
ptime = now;
dt /= 1000;
integ = integ + (error * dt);
der = (error - prerror) / dt;
pidy = (kp * error);
pidy += (ki * integ);
pidy += (kd * der);
//Serial.println(error);
prerror = error;
}
pidy
is added and subtracted to esc speeds respectively.
D
gain. Don't addD
unless you cannot stabilize your system. Tune firstly forP
, whileI
andD
are zero. You will probably observe some drift withoutI
. SetI
to prevent drift, but don't increase it more than necessary or it could cause instability. $\endgroup$