4 Pid::Pid(
double _p_gain,
double _i_gain,
double _d_gain,
double _target){
10 double _diff,
double _integral,
double _target,
double _output) {
23 double diff = current_value - target;
25 integral += (old_diff + diff)/2 * del;
27 i = i_gain * integral;
28 d = d_gain * (diff - old_diff)/del;
40 void Pid::setPid(
double _p_gain,
double _i_gain,
double _d_gain,
double _target) {
48 if(pid_value > 100.0)
return 100.0;
49 if(pid_value < -100.0)
return -100.0;
void calculate(double light_value)
void wrapper_of_constructor(double _p_gain, double _i_gain, double _d_gain, double _diff, double _integral, double _target, double _output)
void setPid(double _p_gain, double _i_gain, double _d_gain, double _target)
double limitOutput(double pid_value)
Pid(double p_gain, double i_gain, double d_gain, double target)