kevin eccli
/
Freescale_CupV4
Adaptation K22F
Propulsion.cpp@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 | #include "Propulsion.h" |
singularity | 0:6004a7230f87 | 2 | |
singularity | 0:6004a7230f87 | 3 | Propulsion::Propulsion() : |
singularity | 0:6004a7230f87 | 4 | moteurDroit(MOTD1_PIN,MOTD2_PIN,FBD_PIN,MOTD_CAPTEUR1_PIN,MOTD_CAPTEUR2_PIN), |
singularity | 0:6004a7230f87 | 5 | moteurGauche(MOTG1_PIN,MOTG2_PIN,FBG_PIN,MOTG_CAPTEUR1_PIN,MOTG_CAPTEUR2_PIN) |
singularity | 0:6004a7230f87 | 6 | { |
singularity | 0:6004a7230f87 | 7 | //Lors de leurs instanciations les moeturs ont leur puissance initialisée à 0. |
singularity | 0:6004a7230f87 | 8 | } |
singularity | 0:6004a7230f87 | 9 | |
singularity | 0:6004a7230f87 | 10 | //IMPLEMENTER LE DIFFERENTIEL ICI |
singularity | 0:6004a7230f87 | 11 | void Propulsion::setVitesse(float v) |
singularity | 0:6004a7230f87 | 12 | { |
singularity | 0:6004a7230f87 | 13 | this->moteurDroit.setVitesse(v); |
singularity | 0:6004a7230f87 | 14 | this->moteurGauche.setVitesse(v); |
singularity | 0:6004a7230f87 | 15 | } |
singularity | 0:6004a7230f87 | 16 | |
singularity | 0:6004a7230f87 | 17 | void Propulsion::testPropulsion1() |
singularity | 0:6004a7230f87 | 18 | { |
singularity | 0:6004a7230f87 | 19 | this->moteurDroit.test1(); |
singularity | 0:6004a7230f87 | 20 | this->moteurGauche.test1(); |
singularity | 0:6004a7230f87 | 21 | } |
singularity | 0:6004a7230f87 | 22 | |
singularity | 0:6004a7230f87 | 23 | void Propulsion::setDKp(float k) |
singularity | 0:6004a7230f87 | 24 | { |
singularity | 0:6004a7230f87 | 25 | this->moteurDroit.setKp(k); |
singularity | 0:6004a7230f87 | 26 | } |
singularity | 0:6004a7230f87 | 27 | |
singularity | 0:6004a7230f87 | 28 | void Propulsion::setDKi(float k) |
singularity | 0:6004a7230f87 | 29 | { |
singularity | 0:6004a7230f87 | 30 | this->moteurDroit.setKi(k); |
singularity | 0:6004a7230f87 | 31 | } |
singularity | 0:6004a7230f87 | 32 | |
singularity | 0:6004a7230f87 | 33 | void Propulsion::setDKd(float k) |
singularity | 0:6004a7230f87 | 34 | { |
singularity | 0:6004a7230f87 | 35 | this->moteurDroit.setKd(k); |
singularity | 0:6004a7230f87 | 36 | } |
singularity | 0:6004a7230f87 | 37 | |
singularity | 0:6004a7230f87 | 38 | void Propulsion::setGKp(float k) |
singularity | 0:6004a7230f87 | 39 | { |
singularity | 0:6004a7230f87 | 40 | this->moteurGauche.setKp(k); |
singularity | 0:6004a7230f87 | 41 | } |
singularity | 0:6004a7230f87 | 42 | |
singularity | 0:6004a7230f87 | 43 | void Propulsion::setGKi(float k) |
singularity | 0:6004a7230f87 | 44 | { |
singularity | 0:6004a7230f87 | 45 | this->moteurGauche.setKi(k); |
singularity | 0:6004a7230f87 | 46 | } |
singularity | 0:6004a7230f87 | 47 | |
singularity | 0:6004a7230f87 | 48 | void Propulsion::setGKd(float k) |
singularity | 0:6004a7230f87 | 49 | { |
singularity | 0:6004a7230f87 | 50 | this->moteurGauche.setKd(k); |
singularity | 0:6004a7230f87 | 51 | } |
singularity | 0:6004a7230f87 | 52 | |
singularity | 0:6004a7230f87 | 53 | |
singularity | 0:6004a7230f87 | 54 | /* |
singularity | 0:6004a7230f87 | 55 | void Propulsion::testPropulsion2() |
singularity | 0:6004a7230f87 | 56 | { |
singularity | 0:6004a7230f87 | 57 | moteurD1.write(1); |
singularity | 0:6004a7230f87 | 58 | wait(1.0f); |
singularity | 0:6004a7230f87 | 59 | moteurG1.write(1); |
singularity | 0:6004a7230f87 | 60 | wait(1.0f); |
singularity | 0:6004a7230f87 | 61 | setPuissanceMoteurs(0.5,0.5); |
singularity | 0:6004a7230f87 | 62 | wait(1.0f); |
singularity | 0:6004a7230f87 | 63 | setPuissanceMoteurs(-0.5,-0.5); |
singularity | 0:6004a7230f87 | 64 | wait(1.0f); |
singularity | 0:6004a7230f87 | 65 | setPuissanceMoteurs(0,-0.5); |
singularity | 0:6004a7230f87 | 66 | wait(1.0f); |
singularity | 0:6004a7230f87 | 67 | setPuissanceMoteurs(0,0); |
singularity | 0:6004a7230f87 | 68 | } |
singularity | 0:6004a7230f87 | 69 | */ |