Statistics
| Branch: | Revision:

root / control / pid_control.h @ c7e517ce

History | View | Annotate | Download (586 Bytes)

1
#ifndef _PID_CONTROL_H_
2
#define _PID_CONTROL_H_
3

    
4
class PID_control
5
{
6
  public:
7
    PID_control(float p_term, float d_term, float i_term, float goal); 
8
    PID_control(float p_term, float d_term, float i_term); 
9

    
10
    void change_goal(float goal);
11
    void change_p(float p);
12
    void change_i(float i);
13
    void change_d(float d);
14

    
15
    float pid(float input, double time);
16

    
17
  private:
18
    void reset();
19
    
20
    float k_p;
21
    float k_i;
22
    float k_d;
23
    
24
    float set_config;
25
    float prev_error;
26
    double prev_time;
27

    
28
    float P_err;
29
    float I_err;
30
    float D_err;
31
};
32

    
33
#endif