jiexuan fan
/
ServoController
mit
PID.h@2:89bb6272869b, 2013-06-28 (annotated)
- Committer:
- benkatz
- Date:
- Fri Jun 28 19:03:06 2013 +0000
- Revision:
- 2:89bb6272869b
- Child:
- 3:cae0b305d54c
V1.0;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
benkatz | 2:89bb6272869b | 1 | //Ben Katz, 2013 |
benkatz | 2:89bb6272869b | 2 | //PID Controller class |
benkatz | 2:89bb6272869b | 3 | |
benkatz | 2:89bb6272869b | 4 | #include "mbed.h" |
benkatz | 2:89bb6272869b | 5 | #ifndef PID_H |
benkatz | 2:89bb6272869b | 6 | #define PID_H |
benkatz | 2:89bb6272869b | 7 | |
benkatz | 2:89bb6272869b | 8 | class PIDController{ |
benkatz | 2:89bb6272869b | 9 | public: |
benkatz | 2:89bb6272869b | 10 | |
benkatz | 2:89bb6272869b | 11 | PIDController(float desired_position, float p_gain, float d_gain, float i_gain); |
benkatz | 2:89bb6272869b | 12 | ~PIDController(); |
benkatz | 2:89bb6272869b | 13 | |
benkatz | 2:89bb6272869b | 14 | float goal_position; |
benkatz | 2:89bb6272869b | 15 | |
benkatz | 2:89bb6272869b | 16 | float kp; |
benkatz | 2:89bb6272869b | 17 | float kd; |
benkatz | 2:89bb6272869b | 18 | float ki; |
benkatz | 2:89bb6272869b | 19 | |
benkatz | 2:89bb6272869b | 20 | float error; |
benkatz | 2:89bb6272869b | 21 | float old_error; |
benkatz | 2:89bb6272869b | 22 | float integral_error; |
benkatz | 2:89bb6272869b | 23 | |
benkatz | 2:89bb6272869b | 24 | float Update(void); |
benkatz | 2:89bb6272869b | 25 | |
benkatz | 2:89bb6272869b | 26 | private: |
benkatz | 2:89bb6272869b | 27 | |
benkatz | 2:89bb6272869b | 28 | |
benkatz | 2:89bb6272869b | 29 | |
benkatz | 2:89bb6272869b | 30 | |
benkatz | 2:89bb6272869b | 31 | |
benkatz | 2:89bb6272869b | 32 | |
benkatz | 2:89bb6272869b | 33 | }; |
benkatz | 2:89bb6272869b | 34 | #endif |