- PID: use pot for testing

This commit is contained in:
jens
2020-12-02 11:24:31 +01:00
parent d6037b33d3
commit 6939650708
3 changed files with 23 additions and 10 deletions
+1 -2
View File
@@ -36,7 +36,7 @@ class Pid:
yp = kp * err
# Reset yi on error sign changes
if yp > self.y_max or yp < self.y_min:
if yp > self.y_max or yp <= self.y_min or np.sign(err) != np.sign(self.err):
self.yi = 0
self.err = err
@@ -44,7 +44,6 @@ class Pid:
y = yp + self.yi + yd
self.y = max(self.y_min, min(self.y_max, y))
print("yi = {}".format(self.yi))
def get_y(self):
return self.y