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.
Dependencies: mbed
Diff: PID_Cntrl.h
- Revision:
- 1:314e2e3727f2
- Parent:
- 0:4ed9a8952ddc
- Child:
- 3:477db0d9895e
diff -r 4ed9a8952ddc -r 314e2e3727f2 PID_Cntrl.h
--- a/PID_Cntrl.h Tue Apr 30 15:34:47 2019 +0000
+++ b/PID_Cntrl.h Tue May 07 10:22:30 2019 +0000
@@ -1,3 +1,7 @@
+#ifndef PID_CNTRL_H_
+#define PID_CNTRL_H_
+
+// PID Controller Class (Template)
class PID_Cntrl
{
public:
@@ -5,25 +9,20 @@
PID_Cntrl(float P, float I, float D, float tau_f, float Ts, float uMin, float uMax);
float operator()(float error) {
- return doStep((double)error);
+ return update((double)error);
}
virtual ~PID_Cntrl();
void reset(float initValue);
- float doStep(double error);
- void set_limits(double ,double );
- float get_ulimit(void);
+ float update(double error);
private:
+ float e_old,D_old,I_old;
+ float tau_f,Ts;
+ float Kp,Ki,Kd;
+ float uMin, uMax;
+ // here some local variables are defined
+};
- double Iold;
- double eold,yold,del;
- double uMax;
- double uMin;
- double Ts;
- double P,I,D;
- double p, Ka;
- void setCoefficients(float P, float I, float D, float tau_f, float Ts);
-
-};
+#endif
\ No newline at end of file