kevin eccli
/
Freescale_CupV4
Adaptation K22F
Pid.h@0:6004a7230f87, 2014-12-16 (annotated)
- Committer:
- singularity
- Date:
- Tue Dec 16 15:52:17 2014 +0000
- Revision:
- 0:6004a7230f87
Creation k22F
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
singularity | 0:6004a7230f87 | 1 | #ifndef _PID_H |
singularity | 0:6004a7230f87 | 2 | #define _PID_H |
singularity | 0:6004a7230f87 | 3 | |
singularity | 0:6004a7230f87 | 4 | #include "mbed.h" |
singularity | 0:6004a7230f87 | 5 | |
singularity | 0:6004a7230f87 | 6 | struct Erreur { |
singularity | 0:6004a7230f87 | 7 | float p; |
singularity | 0:6004a7230f87 | 8 | float i; |
singularity | 0:6004a7230f87 | 9 | float d; |
singularity | 0:6004a7230f87 | 10 | }; |
singularity | 0:6004a7230f87 | 11 | |
singularity | 0:6004a7230f87 | 12 | class Pid |
singularity | 0:6004a7230f87 | 13 | { |
singularity | 0:6004a7230f87 | 14 | public: |
singularity | 0:6004a7230f87 | 15 | Pid(); |
singularity | 0:6004a7230f87 | 16 | Pid(float Kp, float Ki, float Kd); |
singularity | 0:6004a7230f87 | 17 | void setKp(float Kp); |
singularity | 0:6004a7230f87 | 18 | void setKi(float Ki); |
singularity | 0:6004a7230f87 | 19 | void setKd(float Kd); |
singularity | 0:6004a7230f87 | 20 | float getCommande(float p_erreur, float i_erreur, float d_erreur); |
singularity | 0:6004a7230f87 | 21 | float getCommande(Erreur e); |
singularity | 0:6004a7230f87 | 22 | |
singularity | 0:6004a7230f87 | 23 | private: |
singularity | 0:6004a7230f87 | 24 | float kp; |
singularity | 0:6004a7230f87 | 25 | float ki; |
singularity | 0:6004a7230f87 | 26 | float kd; |
singularity | 0:6004a7230f87 | 27 | |
singularity | 0:6004a7230f87 | 28 | }; |
singularity | 0:6004a7230f87 | 29 | |
singularity | 0:6004a7230f87 | 30 | #endif |