Cube Mini Solution
Dependencies: mbed QEI MPU6050 BLE_API nRF51822 MCP4725 eMPL_MPU6050
PID_Cntrl.h
- Committer:
- BoulusAJ
- Date:
- 2020-05-29
- Revision:
- 16:ff375f62a95f
- Parent:
- 0:8e87cdf07037
- Child:
- 20:b142ae11a12a
File content as of revision 16:ff375f62a95f:
#ifndef PID_Cntrl_H_ #define PID_Cntrl_H_ // PID Controller Class class PID_Cntrl { public: PID_Cntrl(float Kp, float Ki, float Kd, float Tf, float Ts, float uMin, float uMax); float operator()(float error) { return update((double)error); } virtual ~PID_Cntrl(); void reset(float initValue); float update(double error); private: // controller parameters (member variables) float Kp_, Ki_, Kd_, Tf_, Ts_, uMin_, uMax_; // storage for signals (member variables) float P_new, I_new, D_new, PID_output, P_old, I_old, D_old, delta_error, error, e_old; }; #endif