zhaw_st16b_pes2_10 / Mbed 2 deprecated Pixy

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PID_Control.h Source File

PID_Control.h

00001 /*
00002  * PIDControl.h
00003  *
00004  *  Created on: 16.04.2017
00005  *      Author: chris
00006  */
00007 
00008 #ifndef COMMON_PID_CONTROL_H_
00009 #define COMMON_PID_CONTROL_H_
00010 
00011 /**
00012  * This class calculates a PID control
00013  */
00014 class PID_Control
00015 {
00016 public:
00017     PID_Control();
00018     virtual ~PID_Control();
00019 
00020     float calc(float e, float period);
00021     void setPIDValues(float p, float i, float d, float max, float min, float _iMax);
00022 
00023 private:
00024     /**
00025      * the proportional gain
00026      */
00027     float kp;
00028 
00029     /**
00030      * integral gain
00031      */
00032     float ki;
00033 
00034     /**
00035      * differential gain
00036      */
00037     float kd;
00038 
00039     /**
00040      * Sum of all the errors
00041      */
00042     float iSum;
00043 
00044     /**
00045      * Error value one iteration befor
00046      */
00047     float eOld;
00048     
00049     float max;
00050     float min;
00051     float iMax;
00052     
00053 };
00054 
00055 #endif /* COMMON_PID_CONTROL_H_ */