Yeongsoo Kim / Mbed 2 deprecated Mecha_Speed_control

Dependencies:   mbed

Committer:
yeongsookim
Date:
Wed Nov 06 01:17:46 2019 +0000
Revision:
0:c88a81d07287
Child:
3:9c18af57b988
First commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yeongsookim 0:c88a81d07287 1 #ifndef MBED_SPEEDCONTROLLER_H
yeongsookim 0:c88a81d07287 2 #define MBED_SPEEDCONTROLLER_H
yeongsookim 0:c88a81d07287 3
yeongsookim 0:c88a81d07287 4 #include "mbed.h"
yeongsookim 0:c88a81d07287 5
yeongsookim 0:c88a81d07287 6
yeongsookim 0:c88a81d07287 7 class PIDController
yeongsookim 0:c88a81d07287 8 {
yeongsookim 0:c88a81d07287 9 private:
yeongsookim 0:c88a81d07287 10 float kp;
yeongsookim 0:c88a81d07287 11 float ki;
yeongsookim 0:c88a81d07287 12 float kd;
yeongsookim 0:c88a81d07287 13 float max_windup;
yeongsookim 0:c88a81d07287 14 float alpha;
yeongsookim 0:c88a81d07287 15 float umin;
yeongsookim 0:c88a81d07287 16 float umax;
yeongsookim 0:c88a81d07287 17
yeongsookim 0:c88a81d07287 18 float m_last_timestamp;
yeongsookim 0:c88a81d07287 19 float m_set_point;
yeongsookim 0:c88a81d07287 20 float m_start_time;
yeongsookim 0:c88a81d07287 21 float m_error_sum;
yeongsookim 0:c88a81d07287 22 float m_last_error;
yeongsookim 0:c88a81d07287 23 float m_last_d;
yeongsookim 0:c88a81d07287 24
yeongsookim 0:c88a81d07287 25 public:
yeongsookim 0:c88a81d07287 26 PIDController(float kp, float ki, float kd, float max_windup,
yeongsookim 0:c88a81d07287 27 float start_time,float umin, float umax);
yeongsookim 0:c88a81d07287 28 //void reset();
yeongsookim 0:c88a81d07287 29 float update(float measured_value, float timestamp);
yeongsookim 0:c88a81d07287 30 void setTarget(float target);
yeongsookim 0:c88a81d07287 31 void setKp(float kp);
yeongsookim 0:c88a81d07287 32 void setKi(float ki);
yeongsookim 0:c88a81d07287 33 void setKd(float kd);
yeongsookim 0:c88a81d07287 34 void setMaxWindup(float max_windup);
yeongsookim 0:c88a81d07287 35 float getLastTimeStamp();
yeongsookim 0:c88a81d07287 36 };
yeongsookim 0:c88a81d07287 37
yeongsookim 0:c88a81d07287 38 #endif