Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed QEI MPU6050 BLE_API nRF51822 MCP4725 eMPL_MPU6050
PID_Cntrl.h
- Committer:
- BoulusAJ
- Date:
- 2020-08-28
- Revision:
- 24:c953b74ed88b
- Parent:
- 20:b142ae11a12a
File content as of revision 24:c953b74ed88b:
#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();
float 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