aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/systemlib/pid/pid.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/systemlib/pid/pid.c b/apps/systemlib/pid/pid.c
index 7e277cdc7..0358caa25 100644
--- a/apps/systemlib/pid/pid.c
+++ b/apps/systemlib/pid/pid.c
@@ -155,8 +155,8 @@ __EXPORT float pid_calculate(PID_t *pid, float sp, float val, float val_dot, flo
// Calculate the error integral and check for saturation
i = pid->integral + (error * dt);
- if (fabs((error * pid->kp) + (i * pid->ki) + (d * pid->kd)) > pid->limit ||
- fabs(i) > pid->intmax) {
+ if (fabsf((error * pid->kp) + (i * pid->ki) + (d * pid->kd)) > pid->limit ||
+ fabsf(i) > pid->intmax) {
i = pid->integral; // If saturated then do not update integral value
pid->saturated = 1;