diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2012-11-05 20:22:00 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2012-11-05 20:22:00 +0100 |
commit | be9b58e1b9fff8c1b5b6ada3ab05a20c478c64a4 (patch) | |
tree | ca8e18a68b1314ae857dd585fe79c876dccd2ed2 | |
parent | 487597b3859ee6bee9b0efda1069d15afb7bb29d (diff) | |
download | px4-firmware-be9b58e1b9fff8c1b5b6ada3ab05a20c478c64a4.tar.gz px4-firmware-be9b58e1b9fff8c1b5b6ada3ab05a20c478c64a4.tar.bz2 px4-firmware-be9b58e1b9fff8c1b5b6ada3ab05a20c478c64a4.zip |
re-adding pid limitation
-rw-r--r-- | apps/systemlib/pid/pid.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/systemlib/pid/pid.c b/apps/systemlib/pid/pid.c index dd8b6adc6..0358caa25 100644 --- a/apps/systemlib/pid/pid.c +++ b/apps/systemlib/pid/pid.c @@ -172,9 +172,9 @@ __EXPORT float pid_calculate(PID_t *pid, float sp, float val, float val_dot, flo // Calculate the output. Limit output magnitude to pid->limit float output = (pid->error_previous * pid->kp) + (i * pid->ki) + (d * pid->kd); - //if (output > pid->limit) output = pid->limit; + if (output > pid->limit) output = pid->limit; - //if (output < -pid->limit) output = -pid->limit; + if (output < -pid->limit) output = -pid->limit; if (isfinite(output)) { pid->last_output = output; |