![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
to compare with V6, do not change.
Dependencies: mbed
Diff: PID_Control.h
- Revision:
- 0:01c109e18d49
diff -r 000000000000 -r 01c109e18d49 PID_Control.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PID_Control.h Fri May 26 12:33:39 2017 +0000 @@ -0,0 +1,55 @@ +/* + * PIDControl.h + * + * Created on: 16.04.2017 + * Author: chris + */ + +#ifndef COMMON_PID_CONTROL_H_ +#define COMMON_PID_CONTROL_H_ + +/** + * This class calculates a PID control + */ +class PID_Control +{ +public: + PID_Control(); // constructor + virtual ~PID_Control(); //destructor + + float calc(float e, float period); + void setPIDValues(float p, float i, float d, float max, float min, float _iMax); + +private: + /** + * the proportional gain + */ + float kp; + + /** + * integral gain + */ + float ki; + + /** + * differential gain + */ + float kd; + + /** + * Sum of all the errors + */ + float iSum; + + /** + * Error value one iteration befor + */ + float eOld; + + float max; + float min; + float iMax; + +}; + +#endif /* COMMON_PID_CONTROL_H_ */