Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Pid.h
- Revision:
- 0:2806fecd5288
diff -r 000000000000 -r 2806fecd5288 Pid.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Pid.h Wed Sep 20 04:19:32 2017 +0000
@@ -0,0 +1,38 @@
+#ifndef MBED_PID_H
+#define MBED_PID_H
+
+#include "mbed.h"
+
+class PositionPid
+{
+public :
+ void setup(float Kp, float Ki, float Kd, float dt);
+
+ void cal(float target, float nowval);
+
+ float duty();
+
+private :
+ float kp, ki, kd,
+ time, frequency,
+ old, now,
+ p, i, d, result;
+};
+
+class SpeedPid
+{
+public :
+ void setup(float Kp, float Ki, float Kd, float dt);
+
+ void cal(float target, float nowval);
+
+ float duty();
+
+private :
+ float kp, ki, kd,
+ time, frequency,
+ e, e1, e2,
+ p, i, d, result;
+};
+
+#endif
\ No newline at end of file