fome-fw/firmware/controllers/math/pid.h

31 lines
530 B
C
Raw Normal View History

2014-09-15 22:03:07 -07:00
/**
* @file pid.h
*
* @date Sep 16, 2014
2015-01-12 15:04:10 -08:00
* @author Andrey Belomutskiy, (c) 2012-2015
2014-09-15 22:03:07 -07:00
*/
#ifndef PID_H_
#define PID_H_
class Pid {
public:
2014-09-16 14:03:03 -07:00
Pid(float pFactor, float iFactor, float dFactor, float minResult, float maxResult);
2014-09-15 23:02:58 -07:00
float getValue(float target, float input, float dTime);
2014-12-31 21:04:10 -08:00
void updateFactors(float pFactor, float iFactor, float dFactor);
void reset(void);
2014-09-15 22:03:07 -07:00
private:
float pFactor;
float iFactor;
float dFactor;
2014-09-16 14:03:03 -07:00
float minResult;
float maxResult;
2014-09-15 22:03:07 -07:00
2014-09-15 23:02:58 -07:00
float integration;
float prevError;
2014-09-15 22:03:07 -07:00
};
#endif /* PID_H_ */