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: shared/PID_Control/I_PD/I_PD.h
- Revision:
- 0:ee7e9405e1c7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shared/PID_Control/I_PD/I_PD.h Wed Apr 14 07:26:19 2021 +0000
@@ -0,0 +1,37 @@
+#ifndef I_PD_H_
+#define I_PD_H_
+
+#include "PID.h"
+
+class I_PD : public PID
+{
+public:
+ I_PD(double k = 0, double Ti = 0, double Td = 0, double target = 0, double current = 0)
+ {
+ PID::set_PID(k, Ti, Td);
+ set_state(target, current);
+ }
+ ~I_PD(){}
+
+protected:
+
+ virtual double _get_control();
+ virtual void _calc_p();
+ virtual void _calc_i();
+ virtual void _calc_d();
+ virtual void _reset();
+
+private:
+
+ inline void _update(double *array, double present)
+ {
+ array[0] = array[1];
+ array[1] = present;
+ }
+ double _p, _i, _d;
+ double _diff[2];
+ double _integral;
+ double _measure[2];
+};
+
+#endif