Fixed heading calculation, fixed heading controller

This commit is contained in:
Lorenz Meier
2012-09-29 18:00:01 +02:00
parent 1725069c18
commit 7949ac1ad8
3 changed files with 47 additions and 15 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ __EXPORT float pid_calculate(PID_t *pid, float sp, float val, float val_dot, flo
pid->error_previous = error;
}
float output = (error * pid->kp) + (i * pid->ki) + (d * pid->kd);
float output = (pid->error_previous * pid->kp) + (i * pid->ki) + (d * pid->kd);
if (isfinite(output)) {
pid->last_output = output;