sequences des strats
Strategie.cpp@0:a89fe490343e, 2019-05-20 (annotated)
- Committer:
- JimmyAREM
- Date:
- Mon May 20 23:04:57 2019 +0000
- Revision:
- 0:a89fe490343e
- Child:
- 1:785b37686185
maj pour publish
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JimmyAREM | 0:a89fe490343e | 1 | #include "Strategie.h" |
JimmyAREM | 0:a89fe490343e | 2 | |
JimmyAREM | 0:a89fe490343e | 3 | char bufferScore[3]={'0','0','0'}; |
JimmyAREM | 0:a89fe490343e | 4 | //extern I2CSlave i2c; |
JimmyAREM | 0:a89fe490343e | 5 | bool typeMovement = DEPLACEMENT_AVANT; |
JimmyAREM | 0:a89fe490343e | 6 | |
JimmyAREM | 0:a89fe490343e | 7 | extern int distanceUltrasonGauche; |
JimmyAREM | 0:a89fe490343e | 8 | extern int distanceUltrasonDroit; |
JimmyAREM | 0:a89fe490343e | 9 | extern int distanceUltrasonArriere; |
JimmyAREM | 0:a89fe490343e | 10 | |
JimmyAREM | 0:a89fe490343e | 11 | extern int distanceTOF1; |
JimmyAREM | 0:a89fe490343e | 12 | extern int distanceTOF2; |
JimmyAREM | 0:a89fe490343e | 13 | extern int distanceTOF3; |
JimmyAREM | 0:a89fe490343e | 14 | extern int distanceTOF4; |
JimmyAREM | 0:a89fe490343e | 15 | extern int distanceTOF5; |
JimmyAREM | 0:a89fe490343e | 16 | |
JimmyAREM | 0:a89fe490343e | 17 | |
JimmyAREM | 0:a89fe490343e | 18 | extern bool stopCapteurs; |
JimmyAREM | 0:a89fe490343e | 19 | |
JimmyAREM | 0:a89fe490343e | 20 | |
JimmyAREM | 0:a89fe490343e | 21 | void updateAndWriteScore(char n1, char n2, char n3) |
JimmyAREM | 0:a89fe490343e | 22 | { |
JimmyAREM | 0:a89fe490343e | 23 | bufferScore[0] = n1; |
JimmyAREM | 0:a89fe490343e | 24 | bufferScore[1] = n2; |
JimmyAREM | 0:a89fe490343e | 25 | bufferScore[2] = n3; |
JimmyAREM | 0:a89fe490343e | 26 | write(bufferScore); |
JimmyAREM | 0:a89fe490343e | 27 | } |
JimmyAREM | 0:a89fe490343e | 28 | |
JimmyAREM | 0:a89fe490343e | 29 | void LectureI2CCarteCapteur(deplacement robot) |
JimmyAREM | 0:a89fe490343e | 30 | { |
JimmyAREM | 0:a89fe490343e | 31 | traitementBufferCapteurs(); |
JimmyAREM | 0:a89fe490343e | 32 | if(AnalyseDistance(distanceUltrasonGauche, distanceUltrasonDroit, distanceUltrasonArriere, typeMovement) == ROBOT) |
JimmyAREM | 0:a89fe490343e | 33 | { |
JimmyAREM | 0:a89fe490343e | 34 | if( ((distanceUltrasonGauche <= 300) || (distanceUltrasonDroit <= 300)) && (typeMovement == DEPLACEMENT_AVANT) ) |
JimmyAREM | 0:a89fe490343e | 35 | { |
JimmyAREM | 0:a89fe490343e | 36 | stopCapteurs = true; |
JimmyAREM | 0:a89fe490343e | 37 | } |
JimmyAREM | 0:a89fe490343e | 38 | else if ( (distanceUltrasonArriere <= 300) && (typeMovement == DEPLACEMENT_ARRIERE) ) |
JimmyAREM | 0:a89fe490343e | 39 | { |
JimmyAREM | 0:a89fe490343e | 40 | stopCapteurs = true; |
JimmyAREM | 0:a89fe490343e | 41 | } |
JimmyAREM | 0:a89fe490343e | 42 | else |
JimmyAREM | 0:a89fe490343e | 43 | { |
JimmyAREM | 0:a89fe490343e | 44 | stopCapteurs = false; |
JimmyAREM | 0:a89fe490343e | 45 | } |
JimmyAREM | 0:a89fe490343e | 46 | } |
JimmyAREM | 0:a89fe490343e | 47 | else |
JimmyAREM | 0:a89fe490343e | 48 | { |
JimmyAREM | 0:a89fe490343e | 49 | stopCapteurs = false; |
JimmyAREM | 0:a89fe490343e | 50 | } |
JimmyAREM | 0:a89fe490343e | 51 | } |
JimmyAREM | 0:a89fe490343e | 52 | |
JimmyAREM | 0:a89fe490343e | 53 | void strategieClassiqueViolet(deplacement robot, Pompe pompe, Demarreur demarreur, Bras brasGauche, Bras brasDroit, BrasPousser brasPousserGauche, BrasPousser brasPousserDroit) |
JimmyAREM | 0:a89fe490343e | 54 | { |
JimmyAREM | 0:a89fe490343e | 55 | write(bufferScore); |
JimmyAREM | 0:a89fe490343e | 56 | Timer tempsMatch; // timer en seconde |
JimmyAREM | 0:a89fe490343e | 57 | int etapeMatch = 0; |
JimmyAREM | 0:a89fe490343e | 58 | while(demarreur.getState() == false) |
JimmyAREM | 0:a89fe490343e | 59 | { |
JimmyAREM | 0:a89fe490343e | 60 | //on attend |
JimmyAREM | 0:a89fe490343e | 61 | //pc.printf("On attend le depart du Robot Thanos\n\r"); |
JimmyAREM | 0:a89fe490343e | 62 | } |
JimmyAREM | 0:a89fe490343e | 63 | lancerTimerEcran(); |
JimmyAREM | 0:a89fe490343e | 64 | tempsMatch.start(); |
JimmyAREM | 0:a89fe490343e | 65 | while(tempsMatch <= TEMPSMATCH) |
JimmyAREM | 0:a89fe490343e | 66 | { |
JimmyAREM | 0:a89fe490343e | 67 | switch (etapeMatch) { |
JimmyAREM | 0:a89fe490343e | 68 | |
JimmyAREM | 0:a89fe490343e | 69 | case 0 : /* On active l'expérience */ |
JimmyAREM | 0:a89fe490343e | 70 | { |
JimmyAREM | 0:a89fe490343e | 71 | typeMovement = DEPLACEMENT_AVANT; |
JimmyAREM | 0:a89fe490343e | 72 | robot.ligne_droite(25000); |
JimmyAREM | 0:a89fe490343e | 73 | robot.poussette(300); |
JimmyAREM | 0:a89fe490343e | 74 | updateAndWriteScore('0', '4', '0'); |
JimmyAREM | 0:a89fe490343e | 75 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 76 | |
JimmyAREM | 0:a89fe490343e | 77 | break; |
JimmyAREM | 0:a89fe490343e | 78 | } |
JimmyAREM | 0:a89fe490343e | 79 | case 1 : /* On pousse le palet bleu de la pente de l'accélérateur */ |
JimmyAREM | 0:a89fe490343e | 80 | { |
JimmyAREM | 0:a89fe490343e | 81 | typeMovement = DEPLACEMENT_ARRIERE; |
JimmyAREM | 0:a89fe490343e | 82 | robot.marche_arriere(-11200); |
JimmyAREM | 0:a89fe490343e | 83 | typeMovement = DEPLACEMENT_AVANT; |
JimmyAREM | 0:a89fe490343e | 84 | robot.rotation_rel(90); |
JimmyAREM | 0:a89fe490343e | 85 | robot.ligne_droite(130000); |
JimmyAREM | 0:a89fe490343e | 86 | brasDroit.activerBras(); |
JimmyAREM | 0:a89fe490343e | 87 | robot.ligne_droite(16000); |
JimmyAREM | 0:a89fe490343e | 88 | brasDroit.desactiverBras(); |
JimmyAREM | 0:a89fe490343e | 89 | updateAndWriteScore('0', '5', '0'); |
JimmyAREM | 0:a89fe490343e | 90 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 91 | |
JimmyAREM | 0:a89fe490343e | 92 | break; |
JimmyAREM | 0:a89fe490343e | 93 | } |
JimmyAREM | 0:a89fe490343e | 94 | case 2 : /* On récupère le goldenium */ |
JimmyAREM | 0:a89fe490343e | 95 | { |
JimmyAREM | 0:a89fe490343e | 96 | robot.ligne_droite(54500); |
JimmyAREM | 0:a89fe490343e | 97 | robot.rotation_rel(-90); |
JimmyAREM | 0:a89fe490343e | 98 | pompe.activer(); |
JimmyAREM | 0:a89fe490343e | 99 | robot.poussette(1000); |
JimmyAREM | 0:a89fe490343e | 100 | typeMovement = DEPLACEMENT_ARRIERE; |
JimmyAREM | 0:a89fe490343e | 101 | robot.marche_arriere(-10000); |
JimmyAREM | 0:a89fe490343e | 102 | typeMovement = DEPLACEMENT_AVANT; |
JimmyAREM | 0:a89fe490343e | 103 | updateAndWriteScore('0', '8', '0'); |
JimmyAREM | 0:a89fe490343e | 104 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 105 | |
JimmyAREM | 0:a89fe490343e | 106 | break; |
JimmyAREM | 0:a89fe490343e | 107 | } |
JimmyAREM | 0:a89fe490343e | 108 | case 3 : /* On met le goldenium dans la balance */ |
JimmyAREM | 0:a89fe490343e | 109 | { |
JimmyAREM | 0:a89fe490343e | 110 | |
JimmyAREM | 0:a89fe490343e | 111 | robot.rotation_rel(-90); |
JimmyAREM | 0:a89fe490343e | 112 | robot.ligne_droite(97000); |
JimmyAREM | 0:a89fe490343e | 113 | robot.rotation_rel(-90); |
JimmyAREM | 0:a89fe490343e | 114 | robot.ligne_droite(104000); |
JimmyAREM | 0:a89fe490343e | 115 | robot.poussette(1000); |
JimmyAREM | 0:a89fe490343e | 116 | pompe.desactiver(); |
JimmyAREM | 0:a89fe490343e | 117 | wait(2); |
JimmyAREM | 0:a89fe490343e | 118 | updateAndWriteScore('1', '0', '4'); |
JimmyAREM | 0:a89fe490343e | 119 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 120 | |
JimmyAREM | 0:a89fe490343e | 121 | break; |
JimmyAREM | 0:a89fe490343e | 122 | } |
JimmyAREM | 0:a89fe490343e | 123 | case 4 : /* On pousse la zone de chaos dans la zone du redium */ |
JimmyAREM | 0:a89fe490343e | 124 | { |
JimmyAREM | 0:a89fe490343e | 125 | typeMovement = DEPLACEMENT_ARRIERE; |
JimmyAREM | 0:a89fe490343e | 126 | robot.marche_arriere(-8000); |
JimmyAREM | 0:a89fe490343e | 127 | typeMovement = DEPLACEMENT_AVANT; |
JimmyAREM | 0:a89fe490343e | 128 | robot.rotation_rel(135); |
JimmyAREM | 0:a89fe490343e | 129 | brasPousserGauche.activerBras(); |
JimmyAREM | 0:a89fe490343e | 130 | brasPousserDroit.activerBras(); |
JimmyAREM | 0:a89fe490343e | 131 | robot.ligne_droite(112500); |
JimmyAREM | 0:a89fe490343e | 132 | updateAndWriteScore('1', '2', '4'); |
JimmyAREM | 0:a89fe490343e | 133 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 134 | |
JimmyAREM | 0:a89fe490343e | 135 | break; |
JimmyAREM | 0:a89fe490343e | 136 | } |
JimmyAREM | 0:a89fe490343e | 137 | case 5 : /* On pousse le palet vert ou le vert et les deux bleus dans la balance en passant par la pente */ |
JimmyAREM | 0:a89fe490343e | 138 | { |
JimmyAREM | 0:a89fe490343e | 139 | brasPousserGauche.desactiverBras(); |
JimmyAREM | 0:a89fe490343e | 140 | brasPousserDroit.desactiverBras(); |
JimmyAREM | 0:a89fe490343e | 141 | typeMovement = DEPLACEMENT_ARRIERE; |
JimmyAREM | 0:a89fe490343e | 142 | robot.marche_arriere(-8000); |
JimmyAREM | 0:a89fe490343e | 143 | typeMovement = DEPLACEMENT_AVANT; |
JimmyAREM | 0:a89fe490343e | 144 | robot.rotation_rel(-90); |
JimmyAREM | 0:a89fe490343e | 145 | robot.ligne_droite(45000); |
JimmyAREM | 0:a89fe490343e | 146 | robot.rotation_rel(-42); |
JimmyAREM | 0:a89fe490343e | 147 | robot.ligne_droite(86000); |
JimmyAREM | 0:a89fe490343e | 148 | robot.rotation_rel(-90); |
JimmyAREM | 0:a89fe490343e | 149 | brasPousserGauche.activerBras(); |
JimmyAREM | 0:a89fe490343e | 150 | brasPousserDroit.activerBras(); |
JimmyAREM | 0:a89fe490343e | 151 | //mettre la fonction pente |
JimmyAREM | 0:a89fe490343e | 152 | robot.commande_vitesse(30,30); |
JimmyAREM | 0:a89fe490343e | 153 | wait(7); |
JimmyAREM | 0:a89fe490343e | 154 | robot.commande_vitesse(150,150); |
JimmyAREM | 0:a89fe490343e | 155 | wait(3); |
JimmyAREM | 0:a89fe490343e | 156 | updateAndWriteScore('1', '3', '4'); |
JimmyAREM | 0:a89fe490343e | 157 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 158 | |
JimmyAREM | 0:a89fe490343e | 159 | break; |
JimmyAREM | 0:a89fe490343e | 160 | } |
JimmyAREM | 0:a89fe490343e | 161 | case 6 : /* On redescant de la pente */ |
JimmyAREM | 0:a89fe490343e | 162 | { |
JimmyAREM | 0:a89fe490343e | 163 | robot.commande_vitesse(-30,-30); |
JimmyAREM | 0:a89fe490343e | 164 | wait(2); |
JimmyAREM | 0:a89fe490343e | 165 | brasPousserGauche.desactiverBras(); |
JimmyAREM | 0:a89fe490343e | 166 | brasPousserDroit.desactiverBras(); |
JimmyAREM | 0:a89fe490343e | 167 | robot.commande_vitesse(-50,-50); |
JimmyAREM | 0:a89fe490343e | 168 | wait_ms(10000); |
JimmyAREM | 0:a89fe490343e | 169 | robot.vitesse_nulle_D(0); |
JimmyAREM | 0:a89fe490343e | 170 | robot.vitesse_nulle_G(0); |
JimmyAREM | 0:a89fe490343e | 171 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 172 | |
JimmyAREM | 0:a89fe490343e | 173 | break; |
JimmyAREM | 0:a89fe490343e | 174 | } |
JimmyAREM | 0:a89fe490343e | 175 | default: |
JimmyAREM | 0:a89fe490343e | 176 | { |
JimmyAREM | 0:a89fe490343e | 177 | robot.vitesse_nulle_D(0); |
JimmyAREM | 0:a89fe490343e | 178 | robot.vitesse_nulle_G(0); |
JimmyAREM | 0:a89fe490343e | 179 | motors_stop(); |
JimmyAREM | 0:a89fe490343e | 180 | pompe.desactiver(); |
JimmyAREM | 0:a89fe490343e | 181 | } |
JimmyAREM | 0:a89fe490343e | 182 | } |
JimmyAREM | 0:a89fe490343e | 183 | } |
JimmyAREM | 0:a89fe490343e | 184 | |
JimmyAREM | 0:a89fe490343e | 185 | //Arrêter les moteurs |
JimmyAREM | 0:a89fe490343e | 186 | robot.vitesse_nulle_D(0); |
JimmyAREM | 0:a89fe490343e | 187 | robot.vitesse_nulle_G(0); |
JimmyAREM | 0:a89fe490343e | 188 | motors_stop(); |
JimmyAREM | 0:a89fe490343e | 189 | pompe.desactiver(); |
JimmyAREM | 0:a89fe490343e | 190 | while(1); |
JimmyAREM | 0:a89fe490343e | 191 | } |
JimmyAREM | 0:a89fe490343e | 192 | |
JimmyAREM | 0:a89fe490343e | 193 | |
JimmyAREM | 0:a89fe490343e | 194 | |
JimmyAREM | 0:a89fe490343e | 195 | |
JimmyAREM | 0:a89fe490343e | 196 | |
JimmyAREM | 0:a89fe490343e | 197 | |
JimmyAREM | 0:a89fe490343e | 198 | void strategieClassiqueJaune(deplacement robot, Pompe pompe, Demarreur demarreur, Bras brasGauche, Bras brasDroit, BrasPousser brasPousserGauche, BrasPousser brasPousserDroit) |
JimmyAREM | 0:a89fe490343e | 199 | { |
JimmyAREM | 0:a89fe490343e | 200 | write(bufferScore); |
JimmyAREM | 0:a89fe490343e | 201 | Timer tempsMatch; // timer en seconde |
JimmyAREM | 0:a89fe490343e | 202 | int etapeMatch = 5; |
JimmyAREM | 0:a89fe490343e | 203 | while(demarreur.getState() == false) |
JimmyAREM | 0:a89fe490343e | 204 | { |
JimmyAREM | 0:a89fe490343e | 205 | //on attend |
JimmyAREM | 0:a89fe490343e | 206 | //pc.printf("On attend le depart du Robot Thanos\n\r"); |
JimmyAREM | 0:a89fe490343e | 207 | } |
JimmyAREM | 0:a89fe490343e | 208 | lancerTimerEcran(); |
JimmyAREM | 0:a89fe490343e | 209 | tempsMatch.start(); |
JimmyAREM | 0:a89fe490343e | 210 | while(tempsMatch <= TEMPSMATCH) |
JimmyAREM | 0:a89fe490343e | 211 | { |
JimmyAREM | 0:a89fe490343e | 212 | switch (etapeMatch) { |
JimmyAREM | 0:a89fe490343e | 213 | |
JimmyAREM | 0:a89fe490343e | 214 | case 0 : /* On active l'expérience */ |
JimmyAREM | 0:a89fe490343e | 215 | { |
JimmyAREM | 0:a89fe490343e | 216 | robot.ligne_droite(25000); |
JimmyAREM | 0:a89fe490343e | 217 | robot.poussette(300); |
JimmyAREM | 0:a89fe490343e | 218 | updateAndWriteScore('0', '4', '0'); |
JimmyAREM | 0:a89fe490343e | 219 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 220 | |
JimmyAREM | 0:a89fe490343e | 221 | break; |
JimmyAREM | 0:a89fe490343e | 222 | } |
JimmyAREM | 0:a89fe490343e | 223 | case 1 : /* On pousse le palet bleu de la pente de l'accélérateur */ |
JimmyAREM | 0:a89fe490343e | 224 | { |
JimmyAREM | 0:a89fe490343e | 225 | robot.marche_arriere(-11200); |
JimmyAREM | 0:a89fe490343e | 226 | robot.rotation_rel(-90); |
JimmyAREM | 0:a89fe490343e | 227 | robot.ligne_droite(130000); |
JimmyAREM | 0:a89fe490343e | 228 | brasDroit.activerBras(); |
JimmyAREM | 0:a89fe490343e | 229 | robot.ligne_droite(16000); |
JimmyAREM | 0:a89fe490343e | 230 | brasDroit.desactiverBras(); |
JimmyAREM | 0:a89fe490343e | 231 | updateAndWriteScore('0', '5', '0'); |
JimmyAREM | 0:a89fe490343e | 232 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 233 | |
JimmyAREM | 0:a89fe490343e | 234 | break; |
JimmyAREM | 0:a89fe490343e | 235 | } |
JimmyAREM | 0:a89fe490343e | 236 | case 2 : /* On récupère le goldenium */ |
JimmyAREM | 0:a89fe490343e | 237 | { |
JimmyAREM | 0:a89fe490343e | 238 | robot.ligne_droite(54500); |
JimmyAREM | 0:a89fe490343e | 239 | robot.rotation_rel(90); |
JimmyAREM | 0:a89fe490343e | 240 | pompe.activer(); |
JimmyAREM | 0:a89fe490343e | 241 | robot.poussette(1000); |
JimmyAREM | 0:a89fe490343e | 242 | robot.marche_arriere(-10000); |
JimmyAREM | 0:a89fe490343e | 243 | updateAndWriteScore('0', '8', '0'); |
JimmyAREM | 0:a89fe490343e | 244 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 245 | |
JimmyAREM | 0:a89fe490343e | 246 | break; |
JimmyAREM | 0:a89fe490343e | 247 | } |
JimmyAREM | 0:a89fe490343e | 248 | case 3 : /* On met le goldenium dans la balance */ |
JimmyAREM | 0:a89fe490343e | 249 | { |
JimmyAREM | 0:a89fe490343e | 250 | |
JimmyAREM | 0:a89fe490343e | 251 | robot.rotation_rel(90); |
JimmyAREM | 0:a89fe490343e | 252 | robot.ligne_droite(96000); |
JimmyAREM | 0:a89fe490343e | 253 | robot.rotation_rel(90); |
JimmyAREM | 0:a89fe490343e | 254 | robot.ligne_droite(104000); |
JimmyAREM | 0:a89fe490343e | 255 | robot.poussette(1000); |
JimmyAREM | 0:a89fe490343e | 256 | pompe.desactiver(); |
JimmyAREM | 0:a89fe490343e | 257 | wait(2); |
JimmyAREM | 0:a89fe490343e | 258 | updateAndWriteScore('1', '0', '4'); |
JimmyAREM | 0:a89fe490343e | 259 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 260 | |
JimmyAREM | 0:a89fe490343e | 261 | break; |
JimmyAREM | 0:a89fe490343e | 262 | } |
JimmyAREM | 0:a89fe490343e | 263 | case 4 : /* On pousse la zone de chaos dans la zone du redium */ |
JimmyAREM | 0:a89fe490343e | 264 | { |
JimmyAREM | 0:a89fe490343e | 265 | |
JimmyAREM | 0:a89fe490343e | 266 | robot.marche_arriere(-8000); |
JimmyAREM | 0:a89fe490343e | 267 | robot.rotation_rel(-135); |
JimmyAREM | 0:a89fe490343e | 268 | brasPousserGauche.activerBras(); |
JimmyAREM | 0:a89fe490343e | 269 | brasPousserDroit.activerBras(); |
JimmyAREM | 0:a89fe490343e | 270 | robot.ligne_droite(112500); |
JimmyAREM | 0:a89fe490343e | 271 | updateAndWriteScore('1', '2', '4'); |
JimmyAREM | 0:a89fe490343e | 272 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 273 | |
JimmyAREM | 0:a89fe490343e | 274 | break; |
JimmyAREM | 0:a89fe490343e | 275 | } |
JimmyAREM | 0:a89fe490343e | 276 | case 5 : /* On pousse le palet vert ou le vert et les deux bleus dans la balance en passant par la pente */ |
JimmyAREM | 0:a89fe490343e | 277 | { |
JimmyAREM | 0:a89fe490343e | 278 | brasPousserGauche.desactiverBras(); |
JimmyAREM | 0:a89fe490343e | 279 | brasPousserDroit.desactiverBras(); |
JimmyAREM | 0:a89fe490343e | 280 | /*robot.marche_arriere(-8000); |
JimmyAREM | 0:a89fe490343e | 281 | robot.rotation_rel(-90); |
JimmyAREM | 0:a89fe490343e | 282 | robot.ligne_droite(45000); |
JimmyAREM | 0:a89fe490343e | 283 | robot.rotation_rel(-42); |
JimmyAREM | 0:a89fe490343e | 284 | robot.ligne_droite(86000);*/ |
JimmyAREM | 0:a89fe490343e | 285 | robot.rotation_rel(90); |
JimmyAREM | 0:a89fe490343e | 286 | brasPousserGauche.activerBras(); |
JimmyAREM | 0:a89fe490343e | 287 | brasPousserDroit.activerBras(); |
JimmyAREM | 0:a89fe490343e | 288 | robot.commande_vitesse(30,30); |
JimmyAREM | 0:a89fe490343e | 289 | wait(7); |
JimmyAREM | 0:a89fe490343e | 290 | robot.commande_vitesse(150,150); |
JimmyAREM | 0:a89fe490343e | 291 | wait(3); |
JimmyAREM | 0:a89fe490343e | 292 | updateAndWriteScore('1', '3', '4'); |
JimmyAREM | 0:a89fe490343e | 293 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 294 | |
JimmyAREM | 0:a89fe490343e | 295 | break; |
JimmyAREM | 0:a89fe490343e | 296 | } |
JimmyAREM | 0:a89fe490343e | 297 | case 6 : /* On redescant de la pente */ |
JimmyAREM | 0:a89fe490343e | 298 | { |
JimmyAREM | 0:a89fe490343e | 299 | robot.commande_vitesse(-30,-30); |
JimmyAREM | 0:a89fe490343e | 300 | wait(2); |
JimmyAREM | 0:a89fe490343e | 301 | brasPousserGauche.desactiverBras(); |
JimmyAREM | 0:a89fe490343e | 302 | brasPousserDroit.desactiverBras(); |
JimmyAREM | 0:a89fe490343e | 303 | robot.commande_vitesse(-50,-50); |
JimmyAREM | 0:a89fe490343e | 304 | wait_ms(10000); |
JimmyAREM | 0:a89fe490343e | 305 | robot.vitesse_nulle_D(0); |
JimmyAREM | 0:a89fe490343e | 306 | robot.vitesse_nulle_G(0); |
JimmyAREM | 0:a89fe490343e | 307 | etapeMatch++; |
JimmyAREM | 0:a89fe490343e | 308 | |
JimmyAREM | 0:a89fe490343e | 309 | break; |
JimmyAREM | 0:a89fe490343e | 310 | } |
JimmyAREM | 0:a89fe490343e | 311 | default: |
JimmyAREM | 0:a89fe490343e | 312 | { |
JimmyAREM | 0:a89fe490343e | 313 | robot.vitesse_nulle_D(0); |
JimmyAREM | 0:a89fe490343e | 314 | robot.vitesse_nulle_G(0); |
JimmyAREM | 0:a89fe490343e | 315 | motors_stop(); |
JimmyAREM | 0:a89fe490343e | 316 | } |
JimmyAREM | 0:a89fe490343e | 317 | } |
JimmyAREM | 0:a89fe490343e | 318 | } |
JimmyAREM | 0:a89fe490343e | 319 | |
JimmyAREM | 0:a89fe490343e | 320 | //Arrêter les moteurs |
JimmyAREM | 0:a89fe490343e | 321 | robot.vitesse_nulle_D(0); |
JimmyAREM | 0:a89fe490343e | 322 | robot.vitesse_nulle_G(0); |
JimmyAREM | 0:a89fe490343e | 323 | motors_stop(); |
JimmyAREM | 0:a89fe490343e | 324 | while(1); |
JimmyAREM | 0:a89fe490343e | 325 | } |