before test
Dependencies: BEAR_Protocol_Edited BufferedSerial Debug MaxSonar PID Process QEI UI iSerial mbed
Fork of clean_V1 by
Diff: pidcontrol.h
- Revision:
- 2:f873deba2305
- Parent:
- 1:45f1573d65a1
- Child:
- 3:edaab92dbd2f
--- a/pidcontrol.h Mon Mar 21 20:21:12 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -#ifndef _PIDCONTROL_H_ -#define _PIDCONTROL_H_ - -#include "mbed.h" - -class PID{ - public: - PID(); - PID(float p,float i,float d); - void setGoal(float ref); - //float getGoal(); - void setCurrent(float sensor); - float compute(); - - void setMargin(float gap); - float getMargin(); - void setIntegalLimit(float limit); - float getIntegalLimit(); - - float getErrorNow(); - float getErrorLast(); - float getErrorDiff(); - float getErrorIntegal(); - - void setKp(float); - void setKi(float); - void setKd(float); - - float getKp(); - float getKi(); - float getKd(); - - private: - float e_n; //error now - float e_n_1; //error last time - float e_i; //error integal - float il; //integal limit - float margin; //output margin - - float Kp,Ki,Kd; - - float setpoint; - float input; - float output; -}; - - - -#endif