kevin eccli
/
Freescale_CupV4
Adaptation K22F
Moteur.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 _MOTEUR_H |
singularity | 0:6004a7230f87 | 2 | #define _MOTEUR_H |
singularity | 0:6004a7230f87 | 3 | |
singularity | 0:6004a7230f87 | 4 | #include "mbed.h" |
singularity | 0:6004a7230f87 | 5 | #include "Serie.h" |
singularity | 0:6004a7230f87 | 6 | #include "Pid.h" |
singularity | 0:6004a7230f87 | 7 | |
singularity | 0:6004a7230f87 | 8 | |
singularity | 0:6004a7230f87 | 9 | class Moteur |
singularity | 0:6004a7230f87 | 10 | { |
singularity | 0:6004a7230f87 | 11 | public: |
singularity | 0:6004a7230f87 | 12 | Moteur(PinName pin_pwm1, PinName pin_pwm2, PinName pin_feedback, PinName pin_capteur1, PinName pin_capteur2); |
singularity | 0:6004a7230f87 | 13 | void setVitesse(int v); |
singularity | 0:6004a7230f87 | 14 | void setKp(float k); |
singularity | 0:6004a7230f87 | 15 | void setKi(float k); |
singularity | 0:6004a7230f87 | 16 | void setKd(float k); |
singularity | 0:6004a7230f87 | 17 | void etalonnage(); |
singularity | 0:6004a7230f87 | 18 | void test1(); |
singularity | 0:6004a7230f87 | 19 | void test2(); |
singularity | 0:6004a7230f87 | 20 | |
singularity | 0:6004a7230f87 | 21 | |
singularity | 0:6004a7230f87 | 22 | void setVitesse(float v); |
singularity | 0:6004a7230f87 | 23 | float getMesure(); |
singularity | 0:6004a7230f87 | 24 | |
singularity | 0:6004a7230f87 | 25 | protected: |
singularity | 0:6004a7230f87 | 26 | void setPuissance(float p); |
singularity | 0:6004a7230f87 | 27 | void asserv(); |
singularity | 0:6004a7230f87 | 28 | void majErreur(); |
singularity | 0:6004a7230f87 | 29 | void interruptCapteurRise(); |
singularity | 0:6004a7230f87 | 30 | void interruptCapteurFall(); |
singularity | 0:6004a7230f87 | 31 | void mesure(); |
singularity | 0:6004a7230f87 | 32 | |
singularity | 0:6004a7230f87 | 33 | //IN-OUT |
singularity | 0:6004a7230f87 | 34 | AnalogIn feedbackCurrent; |
singularity | 0:6004a7230f87 | 35 | PwmOut m1; |
singularity | 0:6004a7230f87 | 36 | PwmOut m2; |
singularity | 0:6004a7230f87 | 37 | InterruptIn capteur1; |
singularity | 0:6004a7230f87 | 38 | DigitalIn capteur2; |
singularity | 0:6004a7230f87 | 39 | |
singularity | 0:6004a7230f87 | 40 | //MESURE |
singularity | 0:6004a7230f87 | 41 | Timer tmr; |
singularity | 0:6004a7230f87 | 42 | float derniere_mesure; |
singularity | 0:6004a7230f87 | 43 | |
singularity | 0:6004a7230f87 | 44 | //REGULATION |
singularity | 0:6004a7230f87 | 45 | Pid regulateur; |
singularity | 0:6004a7230f87 | 46 | Erreur erreur; |
singularity | 0:6004a7230f87 | 47 | float vitesse_consigne; |
singularity | 0:6004a7230f87 | 48 | }; |
singularity | 0:6004a7230f87 | 49 | |
singularity | 0:6004a7230f87 | 50 | #endif |