fix number boolean comparison in PIDs
This commit is contained in:
6
main.lua
6
main.lua
@@ -861,8 +861,8 @@ function CreatePID(kp, ki, kd)
|
|||||||
kd = kd,
|
kd = kd,
|
||||||
integral = 0, lastError = 0,
|
integral = 0, lastError = 0,
|
||||||
|
|
||||||
minOutput = 0,
|
minOutput = 0.0,
|
||||||
maxOutput = 256,
|
maxOutput = 256.0,
|
||||||
update = function(self, setpoint, pv, dt)
|
update = function(self, setpoint, pv, dt)
|
||||||
|
|
||||||
local error = setpoint - pv
|
local error = setpoint - pv
|
||||||
@@ -878,7 +878,7 @@ function CreatePID(kp, ki, kd)
|
|||||||
|
|
||||||
local clampedOutput = 0
|
local clampedOutput = 0
|
||||||
|
|
||||||
if self.minOutput <= potential_i <= self.maxOutput then
|
if self.minOutput <= potential_i and potential_i <= self.maxOutput then
|
||||||
self.integral = potential_i
|
self.integral = potential_i
|
||||||
clampedOutput = raw_output
|
clampedOutput = raw_output
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user