Yeongsoo Kim / Mbed 2 deprecated Mecha_Speed_control

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SpeedController.h Source File

SpeedController.h

00001 #ifndef MBED_SPEEDCONTROLLER_H
00002 #define MBED_SPEEDCONTROLLER_H
00003 
00004 #include "mbed.h"
00005 
00006 
00007 class PIDController
00008 {
00009 private:
00010     float kp;
00011     float ki;
00012     float kd;
00013     float max_windup;
00014     float umin;
00015     float umax;
00016 
00017     float m_last_timestamp;
00018     float m_set_point;
00019     float m_start_time;
00020     float m_error_sum;
00021     float m_last_error;
00022     float m_last_d;
00023 
00024 public:
00025     PIDController(float kp, float ki, float kd, float max_windup,
00026                              float start_time,float umin, float umax);
00027     //void reset();
00028     float update(float measured_value, float timestamp);
00029     void setTarget(float target);
00030     void setKp(float kp);
00031     void setKi(float ki);
00032     void setKd(float kd);
00033     void setMaxWindup(float max_windup);
00034     float getLastTimeStamp();
00035 };
00036 
00037 #endif