ai_car1

Dependencies:   mbed ai_car ros_lib_melodic

Committer:
wngudwls000
Date:
Mon May 03 07:22:52 2021 +0000
Revision:
0:a35213e1e14e
45

Who changed what in which revision?

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