Takumi Nakagawara / PID
Revision:
0:be531c5604db
Child:
1:4705d8930670
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PID.h	Fri Jan 11 08:00:51 2019 +0000
@@ -0,0 +1,35 @@
+#ifndef PID_H
+#define PID_H
+
+#include "mbed.h"
+
+
+class PID {
+public:
+  PID();
+  float control(float target, float nowrpm, Timer *timer);
+  float PI_lateD(float target, float nowrpm, Timer *timer);
+  float control_P(float target, float nowrpm, float new_Kp);
+  float control_PI(float target, float nowrpm, Timer *timer);
+  void setParameter_pid(float new_Kp, float new_Ki, float new_Kd);
+  void setParameter_KuPu(float new_Ku, float new_Pu);
+  void reset(float target);
+
+  float Ku;
+  float Pu;
+  float Kp;
+  float Ti;
+  float Td;
+  float Ki;
+  float Kd;
+
+private:
+  Timer *timer;
+  float integral;
+  float prev_hensa;
+  float nowtime;
+  float prev_time;
+  float lateD;
+};
+
+#endif