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: Controller/SpeedController.h
- Revision:
- 0:c88a81d07287
- Child:
- 3:9c18af57b988
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Controller/SpeedController.h Wed Nov 06 01:17:46 2019 +0000
@@ -0,0 +1,38 @@
+#ifndef MBED_SPEEDCONTROLLER_H
+#define MBED_SPEEDCONTROLLER_H
+
+#include "mbed.h"
+
+
+class PIDController
+{
+private:
+ float kp;
+ float ki;
+ float kd;
+ float max_windup;
+ float alpha;
+ float umin;
+ float umax;
+
+ float m_last_timestamp;
+ float m_set_point;
+ float m_start_time;
+ float m_error_sum;
+ float m_last_error;
+ float m_last_d;
+
+public:
+ PIDController(float kp, float ki, float kd, float max_windup,
+ float start_time,float umin, float umax);
+ //void reset();
+ float update(float measured_value, float timestamp);
+ void setTarget(float target);
+ void setKp(float kp);
+ void setKi(float ki);
+ void setKd(float kd);
+ void setMaxWindup(float max_windup);
+ float getLastTimeStamp();
+};
+
+#endif