sequences des strats

Committer:
JimmyAREM
Date:
Fri May 31 19:05:28 2019 +0000
Revision:
9:00361ecc429d
Parent:
8:55fe932fd696
Child:
10:c27f3e788466
Robot 1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JimmyAREM 0:a89fe490343e 1 #include "Strategie.h"
JimmyAREM 0:a89fe490343e 2
JimmyAREM 7:392aa81893eb 3 char bufferScore[3]= {'0','0','0'};
JimmyAREM 1:785b37686185 4
JimmyAREM 0:a89fe490343e 5 bool typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 4:7a9a9720e4d0 6 int typeEvitement = ARRET;
JimmyAREM 0:a89fe490343e 7
JimmyAREM 7:392aa81893eb 8 extern bool finActions;
JimmyAREM 0:a89fe490343e 9 extern int distanceUltrasonGauche;
JimmyAREM 0:a89fe490343e 10 extern int distanceUltrasonDroit;
JimmyAREM 0:a89fe490343e 11 extern int distanceUltrasonArriere;
JimmyAREM 0:a89fe490343e 12
JimmyAREM 0:a89fe490343e 13 extern int distanceTOF1;
JimmyAREM 0:a89fe490343e 14 extern int distanceTOF2;
JimmyAREM 0:a89fe490343e 15 extern int distanceTOF3;
JimmyAREM 0:a89fe490343e 16 extern int distanceTOF4;
JimmyAREM 0:a89fe490343e 17 extern int distanceTOF5;
JimmyAREM 0:a89fe490343e 18
JimmyAREM 0:a89fe490343e 19
JimmyAREM 0:a89fe490343e 20 extern bool stopCapteurs;
JimmyAREM 0:a89fe490343e 21
JimmyAREM 9:00361ecc429d 22 extern Serial pc;
JimmyAREM 9:00361ecc429d 23
JimmyAREM 0:a89fe490343e 24
JimmyAREM 1:785b37686185 25 Timeout tempsArretMvt;
JimmyAREM 9:00361ecc429d 26 bool actionLancer = false;
JimmyAREM 1:785b37686185 27
JimmyAREM 1:785b37686185 28
JimmyAREM 0:a89fe490343e 29 void updateAndWriteScore(char n1, char n2, char n3)
JimmyAREM 0:a89fe490343e 30 {
JimmyAREM 0:a89fe490343e 31 bufferScore[0] = n1;
JimmyAREM 0:a89fe490343e 32 bufferScore[1] = n2;
JimmyAREM 0:a89fe490343e 33 bufferScore[2] = n3;
JimmyAREM 0:a89fe490343e 34 write(bufferScore);
JimmyAREM 0:a89fe490343e 35 }
JimmyAREM 0:a89fe490343e 36
JimmyAREM 9:00361ecc429d 37
JimmyAREM 0:a89fe490343e 38 void LectureI2CCarteCapteur(deplacement robot)
JimmyAREM 0:a89fe490343e 39 {
JimmyAREM 9:00361ecc429d 40 pc.printf("Avant le traitement\n\r");
JimmyAREM 0:a89fe490343e 41 traitementBufferCapteurs();
JimmyAREM 9:00361ecc429d 42 pc.printf("Apres le traitement\n\r");
JimmyAREM 9:00361ecc429d 43 if(AnalyseDistance(distanceUltrasonGauche, distanceUltrasonDroit, distanceUltrasonArriere, typeMovement) == ROBOT) {
JimmyAREM 9:00361ecc429d 44 if( ((distanceUltrasonGauche <= 300) || (distanceUltrasonDroit <= 300)) || (distanceUltrasonArriere <= 300) && (typeMovement == DEPLACEMENT_AVANT) ) {
JimmyAREM 7:392aa81893eb 45 stopCapteurs = true;
JimmyAREM 7:392aa81893eb 46 } else {
JimmyAREM 7:392aa81893eb 47 stopCapteurs = false;
JimmyAREM 7:392aa81893eb 48 }
JimmyAREM 9:00361ecc429d 49 } else {
JimmyAREM 9:00361ecc429d 50 stopCapteurs = false;
JimmyAREM 9:00361ecc429d 51 }
JimmyAREM 0:a89fe490343e 52 }
JimmyAREM 0:a89fe490343e 53
JimmyAREM 1:785b37686185 54 void arretSystem()
JimmyAREM 1:785b37686185 55 {
JimmyAREM 7:392aa81893eb 56
JimmyAREM 1:785b37686185 57 deplacement robot;
JimmyAREM 7:392aa81893eb 58
JimmyAREM 1:785b37686185 59 robot.initialisation();
JimmyAREM 9:00361ecc429d 60 set_PWM_moteur_D(0);
JimmyAREM 9:00361ecc429d 61 set_PWM_moteur_G(0);
JimmyAREM 9:00361ecc429d 62 motors_stop();
JimmyAREM 9:00361ecc429d 63 stopPompe();
JimmyAREM 9:00361ecc429d 64 while(1);
JimmyAREM 9:00361ecc429d 65 //robot.arreterRobot();
JimmyAREM 1:785b37686185 66 }
JimmyAREM 1:785b37686185 67
JimmyAREM 2:e0402d1e9ed5 68 /*---------Debut Strategie homologation violet ------------------------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 69
JimmyAREM 2:e0402d1e9ed5 70
JimmyAREM 7:392aa81893eb 71 void strategieHomologationViolet(deplacement robot, Demarreur demarreur)
JimmyAREM 1:785b37686185 72 {
JimmyAREM 1:785b37686185 73 write(bufferScore);
JimmyAREM 1:785b37686185 74 Timer tempsMatch; // timer en seconde
JimmyAREM 1:785b37686185 75 int etapeMatch = 0;
JimmyAREM 7:392aa81893eb 76 while(demarreur.getState() == false) {
JimmyAREM 1:785b37686185 77 //on attend
JimmyAREM 8:55fe932fd696 78 pc.printf("On attend le depart du Robot Thanos\n\r");
JimmyAREM 1:785b37686185 79 }
JimmyAREM 1:785b37686185 80 tempsArretMvt.attach(&arretSystem, TEMPSMATCH);
JimmyAREM 8:55fe932fd696 81 //initViolet();
JimmyAREM 8:55fe932fd696 82 //robot.initialisation();
JimmyAREM 1:785b37686185 83 lancerTimerEcran();
JimmyAREM 1:785b37686185 84 tempsMatch.start();
JimmyAREM 1:785b37686185 85 typeEvitement = ARRET;
JimmyAREM 7:392aa81893eb 86 while(tempsMatch <= TEMPSMATCH) {
JimmyAREM 8:55fe932fd696 87 /*if(finActions == true)
JimmyAREM 7:392aa81893eb 88 {
JimmyAREM 7:392aa81893eb 89 etapeMatch++;
JimmyAREM 7:392aa81893eb 90 finActions = false;
JimmyAREM 8:55fe932fd696 91 }*/
JimmyAREM 1:785b37686185 92 switch (etapeMatch) {
JimmyAREM 1:785b37686185 93
JimmyAREM 7:392aa81893eb 94 case 0 : { /* On tourne pour aller vers le terrain adverse et on avance jusqu'au milieu du terrain */
JimmyAREM 9:00361ecc429d 95
JimmyAREM 1:785b37686185 96 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 97 setEmplacementTest();
JimmyAREM 9:00361ecc429d 98 init_odometrie();
JimmyAREM 8:55fe932fd696 99 robot.rotation_rel(90);
JimmyAREM 8:55fe932fd696 100 robot.ligne_droite_basique(50000);
JimmyAREM 9:00361ecc429d 101 robot.rotation_rel(-90);
JimmyAREM 9:00361ecc429d 102 robot.ligne_droite_basique(50000);
JimmyAREM 9:00361ecc429d 103 robot.rotation_rel(-90);
JimmyAREM 8:55fe932fd696 104 robot.ligne_droite_basique(50000);
JimmyAREM 9:00361ecc429d 105 robot.rotation_rel(-90);
JimmyAREM 8:55fe932fd696 106 robot.ligne_droite_basique(50000);
JimmyAREM 9:00361ecc429d 107 robot.rotation_rel(-90);
JimmyAREM 1:785b37686185 108 etapeMatch++;
JimmyAREM 7:392aa81893eb 109
JimmyAREM 7:392aa81893eb 110 break;
JimmyAREM 7:392aa81893eb 111
JimmyAREM 7:392aa81893eb 112 default: {
JimmyAREM 7:392aa81893eb 113 robot.vitesse_nulle_D(0);
JimmyAREM 7:392aa81893eb 114 robot.vitesse_nulle_G(0);
JimmyAREM 7:392aa81893eb 115 motors_stop();
JimmyAREM 7:392aa81893eb 116 }
JimmyAREM 1:785b37686185 117 }
JimmyAREM 7:392aa81893eb 118 }
JimmyAREM 7:392aa81893eb 119
JimmyAREM 7:392aa81893eb 120 //ArrĂȘter les moteurs
JimmyAREM 7:392aa81893eb 121 robot.vitesse_nulle_D(0);
JimmyAREM 7:392aa81893eb 122 robot.vitesse_nulle_G(0);
JimmyAREM 7:392aa81893eb 123 motors_stop();
JimmyAREM 7:392aa81893eb 124 while(1);
JimmyAREM 1:785b37686185 125 }
JimmyAREM 1:785b37686185 126 }
JimmyAREM 2:e0402d1e9ed5 127 /*-------Fin Stratégie homologation violet------------------------------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 128
JimmyAREM 2:e0402d1e9ed5 129
JimmyAREM 2:e0402d1e9ed5 130 /*-------Debut Strategie homologation jaune-----------------------------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 131
JimmyAREM 4:7a9a9720e4d0 132
JimmyAREM 7:392aa81893eb 133 void strategieHomologationJaune(deplacement robot, Demarreur demarreur)
JimmyAREM 2:e0402d1e9ed5 134 {
JimmyAREM 2:e0402d1e9ed5 135 write(bufferScore);
JimmyAREM 2:e0402d1e9ed5 136 Timer tempsMatch; // timer en seconde
JimmyAREM 2:e0402d1e9ed5 137 int etapeMatch = 0;
JimmyAREM 7:392aa81893eb 138 while(demarreur.getState() == false) {
JimmyAREM 2:e0402d1e9ed5 139 //on attend
JimmyAREM 2:e0402d1e9ed5 140 //pc.printf("On attend le depart du Robot Thanos\n\r");
JimmyAREM 2:e0402d1e9ed5 141 }
JimmyAREM 2:e0402d1e9ed5 142 tempsArretMvt.attach(&arretSystem, TEMPSMATCH);
JimmyAREM 9:00361ecc429d 143 //initJaune();
JimmyAREM 9:00361ecc429d 144 //robot.initialisation();
JimmyAREM 2:e0402d1e9ed5 145 lancerTimerEcran();
JimmyAREM 2:e0402d1e9ed5 146 tempsMatch.start();
JimmyAREM 2:e0402d1e9ed5 147 typeEvitement = ARRET;
JimmyAREM 7:392aa81893eb 148 while(tempsMatch <= TEMPSMATCH) {
JimmyAREM 4:7a9a9720e4d0 149 switch (etapeMatch) {
GuillaumeCH 6:db41c3f7245e 150
JimmyAREM 7:392aa81893eb 151 case 0 : { /* On tourne pour aller vers le terrain adverse et on avance jusqu'au milieu du terrain */
JimmyAREM 9:00361ecc429d 152
GuillaumeCH 6:db41c3f7245e 153 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 154 setEmplacementTest();
JimmyAREM 9:00361ecc429d 155 init_odometrie();
JimmyAREM 9:00361ecc429d 156 robot.va_au_point(80000,30000,-90);
JimmyAREM 9:00361ecc429d 157 robot.va_au_point(80000,80000,-90);
JimmyAREM 9:00361ecc429d 158 robot.va_au_point(30000,80000,-90);
JimmyAREM 9:00361ecc429d 159 robot.va_au_point(30000,30000,-90);
GuillaumeCH 6:db41c3f7245e 160 //robot.ligne_droite_basique(127500);
GuillaumeCH 6:db41c3f7245e 161 etapeMatch++;
JimmyAREM 7:392aa81893eb 162
JimmyAREM 7:392aa81893eb 163 break;
GuillaumeCH 6:db41c3f7245e 164 }
JimmyAREM 7:392aa81893eb 165 default: {
GuillaumeCH 6:db41c3f7245e 166 robot.vitesse_nulle_D(0);
GuillaumeCH 6:db41c3f7245e 167 robot.vitesse_nulle_G(0);
GuillaumeCH 6:db41c3f7245e 168 motors_stop();
JimmyAREM 9:00361ecc429d 169 stopPompe();
GuillaumeCH 6:db41c3f7245e 170 }
JimmyAREM 7:392aa81893eb 171 }
GuillaumeCH 6:db41c3f7245e 172 }
JimmyAREM 7:392aa81893eb 173
GuillaumeCH 6:db41c3f7245e 174 //ArrĂȘter les moteurs
GuillaumeCH 6:db41c3f7245e 175 robot.vitesse_nulle_D(0);
GuillaumeCH 6:db41c3f7245e 176 robot.vitesse_nulle_G(0);
GuillaumeCH 6:db41c3f7245e 177 motors_stop();
JimmyAREM 9:00361ecc429d 178 stopPompe();
GuillaumeCH 6:db41c3f7245e 179 while(1);
JimmyAREM 2:e0402d1e9ed5 180 }
JimmyAREM 2:e0402d1e9ed5 181
JimmyAREM 2:e0402d1e9ed5 182 /*Fin Strategie homologation jaune -------------------------------------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 183
JimmyAREM 2:e0402d1e9ed5 184
JimmyAREM 2:e0402d1e9ed5 185 /*Debut Strategie classique violet -------------------------------------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 186
JimmyAREM 2:e0402d1e9ed5 187
JimmyAREM 7:392aa81893eb 188 void strategieClassiqueViolet(deplacement robot, Demarreur demarreur)
JimmyAREM 0:a89fe490343e 189 {
JimmyAREM 0:a89fe490343e 190 write(bufferScore);
JimmyAREM 0:a89fe490343e 191 Timer tempsMatch; // timer en seconde
JimmyAREM 0:a89fe490343e 192 int etapeMatch = 0;
JimmyAREM 9:00361ecc429d 193 initViolet();
JimmyAREM 7:392aa81893eb 194 while(demarreur.getState() == false) {
JimmyAREM 0:a89fe490343e 195 //on attend
JimmyAREM 9:00361ecc429d 196 pc.printf("On attend le depart du Robot Thanos\n\r");
JimmyAREM 0:a89fe490343e 197 }
JimmyAREM 1:785b37686185 198 tempsArretMvt.attach(&arretSystem, TEMPSMATCH);
JimmyAREM 9:00361ecc429d 199 //robot.initialisation();//check si modif
JimmyAREM 0:a89fe490343e 200 lancerTimerEcran();
JimmyAREM 0:a89fe490343e 201 tempsMatch.start();
JimmyAREM 9:00361ecc429d 202 //typeEvitement = ARRET;
JimmyAREM 9:00361ecc429d 203
JimmyAREM 7:392aa81893eb 204 while(tempsMatch <= TEMPSMATCH) {
JimmyAREM 0:a89fe490343e 205 switch (etapeMatch) {
JimmyAREM 0:a89fe490343e 206
JimmyAREM 9:00361ecc429d 207 case 0 : { /* on prend les 3 palets du petit distributeur */
JimmyAREM 9:00361ecc429d 208 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 209 typeEvitement = ARRET;
JimmyAREM 9:00361ecc429d 210 robot.va_au_point(27500,178000,90);
JimmyAREM 9:00361ecc429d 211 etapeMatch++;
JimmyAREM 9:00361ecc429d 212 break;
JimmyAREM 9:00361ecc429d 213 }
JimmyAREM 9:00361ecc429d 214 case 1: {
JimmyAREM 9:00361ecc429d 215 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 216 prendre3Palets();
JimmyAREM 9:00361ecc429d 217 actionLancer = true;
JimmyAREM 9:00361ecc429d 218 }
JimmyAREM 9:00361ecc429d 219
JimmyAREM 9:00361ecc429d 220 if(finActions == true) {
JimmyAREM 9:00361ecc429d 221 finActions = false;
JimmyAREM 9:00361ecc429d 222 actionLancer = false;
JimmyAREM 9:00361ecc429d 223 etapeMatch++;
JimmyAREM 9:00361ecc429d 224 }
JimmyAREM 9:00361ecc429d 225 break;
JimmyAREM 9:00361ecc429d 226 }
JimmyAREM 9:00361ecc429d 227 case 2 : { /* On se place entre la case rouge et verte pour poser le palet rouge */
JimmyAREM 9:00361ecc429d 228 robot.poussette(2000);
JimmyAREM 9:00361ecc429d 229 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 230 robot.marche_arriere(-50000);
JimmyAREM 9:00361ecc429d 231 robot.rotation_abs(-90);
JimmyAREM 9:00361ecc429d 232 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 233 robot.va_au_point(22500,60000,-90);
JimmyAREM 9:00361ecc429d 234 etapeMatch++;
JimmyAREM 9:00361ecc429d 235 break;
JimmyAREM 9:00361ecc429d 236 }
JimmyAREM 9:00361ecc429d 237 case 3 : {
JimmyAREM 9:00361ecc429d 238 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 239 lacherVentouse3();
JimmyAREM 9:00361ecc429d 240 actionLancer = true;
JimmyAREM 9:00361ecc429d 241 }
JimmyAREM 9:00361ecc429d 242 if(finActions == true) {
JimmyAREM 9:00361ecc429d 243 updateAndWriteScore('0', '0', '6');
JimmyAREM 9:00361ecc429d 244 finActions = false;
JimmyAREM 9:00361ecc429d 245 actionLancer = false;
JimmyAREM 9:00361ecc429d 246 etapeMatch++;
JimmyAREM 9:00361ecc429d 247 }
JimmyAREM 9:00361ecc429d 248 break;
JimmyAREM 9:00361ecc429d 249 }
JimmyAREM 9:00361ecc429d 250 case 4 : { /* On se place entre la case verte et bleue pour poser le palet vert */
JimmyAREM 9:00361ecc429d 251 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 252 wait(2);
JimmyAREM 9:00361ecc429d 253 robot.marche_arriere(-30000);
JimmyAREM 9:00361ecc429d 254 etapeMatch++;
JimmyAREM 9:00361ecc429d 255 break;
JimmyAREM 9:00361ecc429d 256 }
JimmyAREM 9:00361ecc429d 257 case 5 : {
JimmyAREM 9:00361ecc429d 258 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 259 lacherVentouse2();
JimmyAREM 9:00361ecc429d 260 actionLancer = true;
JimmyAREM 9:00361ecc429d 261 }
JimmyAREM 9:00361ecc429d 262 if(finActions == true) {
JimmyAREM 9:00361ecc429d 263 updateAndWriteScore('0', '1', '2');
JimmyAREM 9:00361ecc429d 264 finActions = false;
JimmyAREM 9:00361ecc429d 265 actionLancer = false;
JimmyAREM 9:00361ecc429d 266 etapeMatch++;
JimmyAREM 9:00361ecc429d 267 }
JimmyAREM 9:00361ecc429d 268 break;
JimmyAREM 9:00361ecc429d 269 }
JimmyAREM 9:00361ecc429d 270 case 6 : { /* On se place en bordure de la case bleue pour poser le palet bleu */
JimmyAREM 9:00361ecc429d 271 wait(2);
JimmyAREM 9:00361ecc429d 272 robot.marche_arriere(-30000);
JimmyAREM 9:00361ecc429d 273
JimmyAREM 9:00361ecc429d 274 etapeMatch++;
JimmyAREM 9:00361ecc429d 275 break;
JimmyAREM 9:00361ecc429d 276 }
JimmyAREM 9:00361ecc429d 277 case 7 : {
JimmyAREM 9:00361ecc429d 278 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 279 lacherVentouse1();
JimmyAREM 9:00361ecc429d 280 stopPompe();
JimmyAREM 9:00361ecc429d 281 actionLancer = true;
JimmyAREM 9:00361ecc429d 282 }
JimmyAREM 9:00361ecc429d 283 if(finActions == true) {
JimmyAREM 9:00361ecc429d 284 updateAndWriteScore('0', '1', '8');
JimmyAREM 9:00361ecc429d 285 finActions = false;
JimmyAREM 9:00361ecc429d 286 actionLancer = false;
JimmyAREM 9:00361ecc429d 287 etapeMatch++;
JimmyAREM 9:00361ecc429d 288 }
JimmyAREM 9:00361ecc429d 289 break;
JimmyAREM 9:00361ecc429d 290 }
JimmyAREM 9:00361ecc429d 291 case 8 : {
JimmyAREM 9:00361ecc429d 292 wait(2);
JimmyAREM 9:00361ecc429d 293 robot.marche_arriere(-50000);
JimmyAREM 9:00361ecc429d 294 etapeMatch = 30;;
JimmyAREM 9:00361ecc429d 295 break;
JimmyAREM 9:00361ecc429d 296 }
JimmyAREM 9:00361ecc429d 297 case 9 : { /* on est placé devant le grand distributeur pour prendre les 4 premiers palets */
JimmyAREM 9:00361ecc429d 298 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 299 //robot.va_au_point(70000,130000,90);
JimmyAREM 9:00361ecc429d 300 robot.va_au_point(65000,130000,90);
JimmyAREM 9:00361ecc429d 301 robot.ligne_droite_basique(5000);
JimmyAREM 9:00361ecc429d 302 etapeMatch++;
JimmyAREM 9:00361ecc429d 303 break;
JimmyAREM 9:00361ecc429d 304 }
JimmyAREM 9:00361ecc429d 305 case 10 : {
JimmyAREM 9:00361ecc429d 306 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 307 prendre4Palets();
JimmyAREM 9:00361ecc429d 308 actionLancer = true;
JimmyAREM 9:00361ecc429d 309 }
JimmyAREM 9:00361ecc429d 310 if(finActions == true) {
JimmyAREM 9:00361ecc429d 311 finActions = false;
JimmyAREM 9:00361ecc429d 312 actionLancer = false;
JimmyAREM 9:00361ecc429d 313 etapeMatch++;
JimmyAREM 9:00361ecc429d 314 }
JimmyAREM 9:00361ecc429d 315 break;
JimmyAREM 9:00361ecc429d 316 }
JimmyAREM 9:00361ecc429d 317 case 11 : {
JimmyAREM 9:00361ecc429d 318 robot.poussette(2000);
JimmyAREM 9:00361ecc429d 319 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 320 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 321 etapeMatch++;
JimmyAREM 9:00361ecc429d 322 break;
JimmyAREM 9:00361ecc429d 323 }
JimmyAREM 9:00361ecc429d 324 case 12 : /* On se place devant la case bleu, on pousse le palet qui y est devant puis on lache le bleu */
JimmyAREM 9:00361ecc429d 325 {
JimmyAREM 9:00361ecc429d 326 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 327 robot.va_au_point(70000,105000,180);
JimmyAREM 9:00361ecc429d 328 robot.ligne_droite_basique(10000);
JimmyAREM 9:00361ecc429d 329 etapeMatch++;
JimmyAREM 9:00361ecc429d 330 break;
JimmyAREM 9:00361ecc429d 331 }
JimmyAREM 9:00361ecc429d 332 case 13 :
JimmyAREM 9:00361ecc429d 333 {
JimmyAREM 9:00361ecc429d 334 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 335 {
JimmyAREM 9:00361ecc429d 336 lacherVentouse4();
JimmyAREM 9:00361ecc429d 337 updateAndWriteScore('0', '2', '4');
JimmyAREM 9:00361ecc429d 338 actionLancer = true;
JimmyAREM 9:00361ecc429d 339 }
JimmyAREM 9:00361ecc429d 340 if(finActions)
JimmyAREM 9:00361ecc429d 341 {
JimmyAREM 9:00361ecc429d 342 actionLancer = false;
JimmyAREM 9:00361ecc429d 343 finActions = false;
JimmyAREM 9:00361ecc429d 344 etapeMatch++;
JimmyAREM 9:00361ecc429d 345 }
JimmyAREM 9:00361ecc429d 346 break;
JimmyAREM 9:00361ecc429d 347 }
JimmyAREM 9:00361ecc429d 348 case 14 : /* On se place devant la case verte et on lache le vert*/
JimmyAREM 9:00361ecc429d 349 {
JimmyAREM 9:00361ecc429d 350 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 351 robot.marche_arriere(-5000);
JimmyAREM 0:a89fe490343e 352 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 353 robot.va_au_point(58000,83000,180);
JimmyAREM 9:00361ecc429d 354 robot.ligne_droite_basique(5000);
JimmyAREM 9:00361ecc429d 355 etapeMatch++;
JimmyAREM 9:00361ecc429d 356 break;
JimmyAREM 9:00361ecc429d 357 }
JimmyAREM 9:00361ecc429d 358 case 15 :
JimmyAREM 9:00361ecc429d 359 {
JimmyAREM 9:00361ecc429d 360 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 361 {
JimmyAREM 9:00361ecc429d 362 lacherVentouse2();
JimmyAREM 9:00361ecc429d 363 updateAndWriteScore('0', '3', '0');
JimmyAREM 9:00361ecc429d 364 actionLancer = true;
JimmyAREM 9:00361ecc429d 365 }
JimmyAREM 9:00361ecc429d 366 if(finActions)
JimmyAREM 9:00361ecc429d 367 {
JimmyAREM 9:00361ecc429d 368 actionLancer = false;
JimmyAREM 9:00361ecc429d 369 finActions = false;
JimmyAREM 9:00361ecc429d 370 etapeMatch++;
JimmyAREM 9:00361ecc429d 371 }
JimmyAREM 9:00361ecc429d 372 break;
JimmyAREM 9:00361ecc429d 373 }
JimmyAREM 9:00361ecc429d 374 case 16 : /* On se place devant la case rouge et on lache le rouge*/
JimmyAREM 9:00361ecc429d 375 {
JimmyAREM 9:00361ecc429d 376 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 377 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 378 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 379 robot.va_au_point(58000,45000,180);
JimmyAREM 9:00361ecc429d 380 robot.ligne_droite_basique(5000);
JimmyAREM 9:00361ecc429d 381 etapeMatch++;
JimmyAREM 9:00361ecc429d 382 break;
JimmyAREM 9:00361ecc429d 383 }
JimmyAREM 9:00361ecc429d 384 case 17 :
JimmyAREM 9:00361ecc429d 385 {
JimmyAREM 9:00361ecc429d 386 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 387 {
JimmyAREM 9:00361ecc429d 388 //lacherVentouse1();
JimmyAREM 9:00361ecc429d 389 //lacherVentouse3();
JimmyAREM 9:00361ecc429d 390 stopPompe();
JimmyAREM 9:00361ecc429d 391 updateAndWriteScore('0', '4', '2');
JimmyAREM 9:00361ecc429d 392 actionLancer = true;
JimmyAREM 9:00361ecc429d 393 }
JimmyAREM 9:00361ecc429d 394 if(finActions)
JimmyAREM 9:00361ecc429d 395 {
JimmyAREM 9:00361ecc429d 396 actionLancer = false;
JimmyAREM 9:00361ecc429d 397 finActions = false;
JimmyAREM 9:00361ecc429d 398 etapeMatch++;
JimmyAREM 9:00361ecc429d 399 }
JimmyAREM 9:00361ecc429d 400 break;
JimmyAREM 9:00361ecc429d 401 }
JimmyAREM 9:00361ecc429d 402 case 18 :
JimmyAREM 9:00361ecc429d 403 {
JimmyAREM 9:00361ecc429d 404 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 405 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 406 etapeMatch++;
JimmyAREM 9:00361ecc429d 407 break;
JimmyAREM 9:00361ecc429d 408 }
JimmyAREM 9:00361ecc429d 409 case 19 : /* On depose prend les 2 derniers palets du grand distributeur */
JimmyAREM 9:00361ecc429d 410 {
JimmyAREM 9:00361ecc429d 411 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 412 robot.va_au_point(85000,130000,90);
JimmyAREM 9:00361ecc429d 413 robot.ligne_droite_basique(5000);
JimmyAREM 0:a89fe490343e 414 etapeMatch++;
JimmyAREM 9:00361ecc429d 415 break;
JimmyAREM 9:00361ecc429d 416 }
JimmyAREM 9:00361ecc429d 417 case 20 :
JimmyAREM 9:00361ecc429d 418 {
JimmyAREM 9:00361ecc429d 419 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 420 prendre2Palets();
JimmyAREM 9:00361ecc429d 421 actionLancer = true;
JimmyAREM 9:00361ecc429d 422 }
JimmyAREM 9:00361ecc429d 423 if(finActions == true) {
JimmyAREM 9:00361ecc429d 424 finActions = false;
JimmyAREM 9:00361ecc429d 425 actionLancer = false;
JimmyAREM 9:00361ecc429d 426 etapeMatch++;
JimmyAREM 9:00361ecc429d 427 }
JimmyAREM 7:392aa81893eb 428 break;
JimmyAREM 0:a89fe490343e 429 }
JimmyAREM 9:00361ecc429d 430 case 21 :
JimmyAREM 9:00361ecc429d 431 {
JimmyAREM 9:00361ecc429d 432 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 433 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 434 etapeMatch++;
JimmyAREM 9:00361ecc429d 435 break;
JimmyAREM 9:00361ecc429d 436 }
JimmyAREM 9:00361ecc429d 437 case 22 : /* On se place devant la case verte et on lache le vert*/
JimmyAREM 9:00361ecc429d 438 {
JimmyAREM 9:00361ecc429d 439 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 440 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 441 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 442 robot.va_au_point(58000,83000,180);
JimmyAREM 9:00361ecc429d 443 robot.ligne_droite_basique(5000);
JimmyAREM 9:00361ecc429d 444 etapeMatch++;
JimmyAREM 9:00361ecc429d 445 break;
JimmyAREM 9:00361ecc429d 446 }
JimmyAREM 9:00361ecc429d 447 case 23 :
JimmyAREM 9:00361ecc429d 448 {
JimmyAREM 9:00361ecc429d 449 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 450 {
JimmyAREM 9:00361ecc429d 451 lacherVentouse4();
JimmyAREM 9:00361ecc429d 452 updateAndWriteScore('0', '4', '8');
JimmyAREM 9:00361ecc429d 453 actionLancer = true;
JimmyAREM 9:00361ecc429d 454 }
JimmyAREM 9:00361ecc429d 455 if(finActions)
JimmyAREM 9:00361ecc429d 456 {
JimmyAREM 9:00361ecc429d 457 actionLancer = false;
JimmyAREM 9:00361ecc429d 458 finActions = false;
JimmyAREM 9:00361ecc429d 459 etapeMatch++;
JimmyAREM 9:00361ecc429d 460 }
JimmyAREM 9:00361ecc429d 461 break;
JimmyAREM 9:00361ecc429d 462 }
JimmyAREM 9:00361ecc429d 463 case 24 : /* On se place devant la case rouge et on lache le rouge*/
JimmyAREM 9:00361ecc429d 464 {
JimmyAREM 9:00361ecc429d 465 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 466 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 467 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 468 robot.va_au_point(58000,45000,180);
JimmyAREM 9:00361ecc429d 469 robot.ligne_droite_basique(5000);
JimmyAREM 9:00361ecc429d 470 etapeMatch++;
JimmyAREM 9:00361ecc429d 471 break;
JimmyAREM 9:00361ecc429d 472 }
JimmyAREM 9:00361ecc429d 473 case 25 :
JimmyAREM 9:00361ecc429d 474 {
JimmyAREM 9:00361ecc429d 475 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 476 {
JimmyAREM 9:00361ecc429d 477 //lacherVentouse3();
JimmyAREM 9:00361ecc429d 478 stopPompe();
JimmyAREM 9:00361ecc429d 479 updateAndWriteScore('0', '5', '4');
JimmyAREM 9:00361ecc429d 480 actionLancer = true;
JimmyAREM 9:00361ecc429d 481 }
JimmyAREM 9:00361ecc429d 482 if(finActions)
JimmyAREM 9:00361ecc429d 483 {
JimmyAREM 9:00361ecc429d 484 actionLancer = false;
JimmyAREM 9:00361ecc429d 485 finActions = false;
JimmyAREM 9:00361ecc429d 486 etapeMatch++;
JimmyAREM 9:00361ecc429d 487 }
JimmyAREM 9:00361ecc429d 488 break;
JimmyAREM 9:00361ecc429d 489 }
JimmyAREM 9:00361ecc429d 490 /* case 26 :
JimmyAREM 9:00361ecc429d 491 {
JimmyAREM 9:00361ecc429d 492 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 493 {
JimmyAREM 9:00361ecc429d 494 stopPompe();
JimmyAREM 9:00361ecc429d 495 actionLancer = true;
JimmyAREM 9:00361ecc429d 496 }
JimmyAREM 9:00361ecc429d 497 if(finActions)
JimmyAREM 9:00361ecc429d 498 {
JimmyAREM 9:00361ecc429d 499 actionLancer = false;
JimmyAREM 9:00361ecc429d 500 finActions = false;
JimmyAREM 9:00361ecc429d 501 etapeMatch++;
JimmyAREM 9:00361ecc429d 502 }
JimmyAREM 9:00361ecc429d 503 break;
JimmyAREM 9:00361ecc429d 504 }*/
JimmyAREM 9:00361ecc429d 505 case 26 : /* On laisse la place au robot2 */
JimmyAREM 9:00361ecc429d 506 {
JimmyAREM 9:00361ecc429d 507
JimmyAREM 9:00361ecc429d 508 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 509 robot.va_au_point(65000,130000,90);
JimmyAREM 9:00361ecc429d 510 etapeMatch++;
JimmyAREM 9:00361ecc429d 511 break;
JimmyAREM 9:00361ecc429d 512 }
JimmyAREM 7:392aa81893eb 513 default: {
JimmyAREM 0:a89fe490343e 514 robot.vitesse_nulle_D(0);
JimmyAREM 0:a89fe490343e 515 robot.vitesse_nulle_G(0);
JimmyAREM 0:a89fe490343e 516 motors_stop();
JimmyAREM 9:00361ecc429d 517 stopPompe();
JimmyAREM 9:00361ecc429d 518 stopPompe();
JimmyAREM 9:00361ecc429d 519 stopPompe();
JimmyAREM 0:a89fe490343e 520 }
JimmyAREM 7:392aa81893eb 521 }
JimmyAREM 0:a89fe490343e 522 }
JimmyAREM 7:392aa81893eb 523
JimmyAREM 0:a89fe490343e 524 //ArrĂȘter les moteurs
JimmyAREM 0:a89fe490343e 525 robot.vitesse_nulle_D(0);
JimmyAREM 0:a89fe490343e 526 robot.vitesse_nulle_G(0);
JimmyAREM 0:a89fe490343e 527 motors_stop();
JimmyAREM 9:00361ecc429d 528 stopPompe();
JimmyAREM 0:a89fe490343e 529 while(1);
JimmyAREM 0:a89fe490343e 530 }
JimmyAREM 0:a89fe490343e 531
JimmyAREM 2:e0402d1e9ed5 532 /*-------- Fin Strategie classique violet -----------------------------------------------*/
JimmyAREM 0:a89fe490343e 533
JimmyAREM 0:a89fe490343e 534
JimmyAREM 2:e0402d1e9ed5 535 /*------- Debut Strategie classique Jaune -----------------------------------------------*/
JimmyAREM 0:a89fe490343e 536
JimmyAREM 0:a89fe490343e 537
JimmyAREM 7:392aa81893eb 538 void strategieClassiqueJaune(deplacement robot, Demarreur demarreur)
JimmyAREM 0:a89fe490343e 539 {
JimmyAREM 0:a89fe490343e 540 write(bufferScore);
JimmyAREM 0:a89fe490343e 541 Timer tempsMatch; // timer en seconde
JimmyAREM 2:e0402d1e9ed5 542 int etapeMatch = 0;
JimmyAREM 9:00361ecc429d 543 initJaune();
JimmyAREM 7:392aa81893eb 544 while(demarreur.getState() == false) {
JimmyAREM 0:a89fe490343e 545 //on attend
JimmyAREM 0:a89fe490343e 546 //pc.printf("On attend le depart du Robot Thanos\n\r");
JimmyAREM 0:a89fe490343e 547 }
JimmyAREM 9:00361ecc429d 548 tempsArretMvt.attach(&arretSystem, TEMPSMATCH);
JimmyAREM 9:00361ecc429d 549 //robot.initialisation();//check si modif
JimmyAREM 0:a89fe490343e 550 lancerTimerEcran();
JimmyAREM 0:a89fe490343e 551 tempsMatch.start();
JimmyAREM 9:00361ecc429d 552 //typeEvitement = ARRET;
JimmyAREM 9:00361ecc429d 553
JimmyAREM 7:392aa81893eb 554 while(tempsMatch <= TEMPSMATCH) {
JimmyAREM 0:a89fe490343e 555 switch (etapeMatch) {
JimmyAREM 0:a89fe490343e 556
JimmyAREM 9:00361ecc429d 557 case 0 : { /* on prend les 3 palets du petit distributeur */
JimmyAREM 9:00361ecc429d 558 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 559 typeEvitement = ARRET;
JimmyAREM 9:00361ecc429d 560 //robot.va_au_point(271800,178000,90);
JimmyAREM 9:00361ecc429d 561 robot.ligne_droite_basique(77000);
JimmyAREM 9:00361ecc429d 562 robot.poussette(2000);
JimmyAREM 9:00361ecc429d 563 robot.marche_arriere(-3000);
JimmyAREM 9:00361ecc429d 564 etapeMatch++;
JimmyAREM 9:00361ecc429d 565 break;
JimmyAREM 9:00361ecc429d 566 }
JimmyAREM 9:00361ecc429d 567 case 1: {
JimmyAREM 9:00361ecc429d 568 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 569 prendre3Palets();
JimmyAREM 9:00361ecc429d 570 actionLancer = true;
JimmyAREM 9:00361ecc429d 571 }
JimmyAREM 9:00361ecc429d 572 if(finActions == true) {
JimmyAREM 9:00361ecc429d 573 finActions = false;
JimmyAREM 9:00361ecc429d 574 actionLancer = false;
JimmyAREM 9:00361ecc429d 575 etapeMatch++;
JimmyAREM 9:00361ecc429d 576 }
JimmyAREM 9:00361ecc429d 577 break;
JimmyAREM 9:00361ecc429d 578 }
JimmyAREM 9:00361ecc429d 579 case 2 : { /* On se place entre la case rouge et verte pour poser le palet rouge */
JimmyAREM 9:00361ecc429d 580 robot.poussette(2000);
JimmyAREM 9:00361ecc429d 581 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 582 robot.marche_arriere(-50000);
JimmyAREM 9:00361ecc429d 583 robot.rotation_abs(-90);
JimmyAREM 9:00361ecc429d 584 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 585 //robot.va_au_point(277500,60000,-90);
JimmyAREM 9:00361ecc429d 586 robot.ligne_droite_basique(95000);
JimmyAREM 9:00361ecc429d 587 etapeMatch++;
JimmyAREM 9:00361ecc429d 588 break;
JimmyAREM 9:00361ecc429d 589 }
JimmyAREM 9:00361ecc429d 590 case 3 : {
JimmyAREM 9:00361ecc429d 591 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 592 lacherVentouse2();
JimmyAREM 9:00361ecc429d 593 actionLancer = true;
JimmyAREM 9:00361ecc429d 594 }
JimmyAREM 9:00361ecc429d 595 if(finActions == true) {
JimmyAREM 9:00361ecc429d 596 updateAndWriteScore('0', '0', '6');
JimmyAREM 9:00361ecc429d 597 finActions = false;
JimmyAREM 9:00361ecc429d 598 actionLancer = false;
JimmyAREM 9:00361ecc429d 599 etapeMatch++;
JimmyAREM 9:00361ecc429d 600 }
JimmyAREM 9:00361ecc429d 601 break;
JimmyAREM 9:00361ecc429d 602 }
JimmyAREM 9:00361ecc429d 603 case 4 : { /* On se place entre la case verte et bleue pour poser le palet vert */
JimmyAREM 9:00361ecc429d 604 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 605 wait(1);
JimmyAREM 9:00361ecc429d 606 robot.marche_arriere(-30000);
JimmyAREM 9:00361ecc429d 607 etapeMatch++;
JimmyAREM 9:00361ecc429d 608 break;
JimmyAREM 9:00361ecc429d 609 }
JimmyAREM 9:00361ecc429d 610 case 5 : {
JimmyAREM 9:00361ecc429d 611 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 612 lacherVentouse3();
JimmyAREM 9:00361ecc429d 613 actionLancer = true;
JimmyAREM 9:00361ecc429d 614 }
JimmyAREM 9:00361ecc429d 615 if(finActions == true) {
JimmyAREM 9:00361ecc429d 616 updateAndWriteScore('0', '1', '2');
JimmyAREM 9:00361ecc429d 617 finActions = false;
JimmyAREM 9:00361ecc429d 618 actionLancer = false;
JimmyAREM 9:00361ecc429d 619 etapeMatch++;
JimmyAREM 9:00361ecc429d 620 }
JimmyAREM 9:00361ecc429d 621 break;
JimmyAREM 9:00361ecc429d 622 }
JimmyAREM 9:00361ecc429d 623 case 6 : { /* On se place en bordure de la case bleue pour poser le palet bleu */
JimmyAREM 9:00361ecc429d 624 wait(1);
JimmyAREM 9:00361ecc429d 625 robot.marche_arriere(-30000);
JimmyAREM 9:00361ecc429d 626 etapeMatch++;
JimmyAREM 9:00361ecc429d 627 break;
JimmyAREM 9:00361ecc429d 628 }
JimmyAREM 9:00361ecc429d 629 case 7 : {
JimmyAREM 9:00361ecc429d 630 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 631 lacherVentouse4();
JimmyAREM 9:00361ecc429d 632 actionLancer = true;
JimmyAREM 9:00361ecc429d 633 }
JimmyAREM 9:00361ecc429d 634 if(finActions == true) {
JimmyAREM 9:00361ecc429d 635 updateAndWriteScore('0', '1', '8');
JimmyAREM 9:00361ecc429d 636 finActions = false;
JimmyAREM 9:00361ecc429d 637 actionLancer = false;
JimmyAREM 9:00361ecc429d 638 etapeMatch++;
JimmyAREM 9:00361ecc429d 639 }
JimmyAREM 9:00361ecc429d 640 break;
JimmyAREM 9:00361ecc429d 641 }
JimmyAREM 9:00361ecc429d 642 case 8 : {
JimmyAREM 9:00361ecc429d 643 wait(1);
JimmyAREM 9:00361ecc429d 644 robot.marche_arriere(-15000);
JimmyAREM 9:00361ecc429d 645 robot.rotation_abs(180);
JimmyAREM 9:00361ecc429d 646 robot.ligne_droite_basique(40000);
JimmyAREM 9:00361ecc429d 647 robot.rotation_abs(90);
JimmyAREM 9:00361ecc429d 648 robot.ligne_droite_basique(5000);
JimmyAREM 9:00361ecc429d 649 robot.poussette(2000);
JimmyAREM 9:00361ecc429d 650 robot.marche_arriere(-3000);
JimmyAREM 9:00361ecc429d 651 etapeMatch++; //a modifier aprĂšs le match
JimmyAREM 9:00361ecc429d 652 break;
JimmyAREM 9:00361ecc429d 653 }
JimmyAREM 9:00361ecc429d 654 case 9 : { /* on est placé devant le grand distributeur pour prendre les 4 premiers palets */
JimmyAREM 9:00361ecc429d 655 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 656 prendre4Palets();
JimmyAREM 9:00361ecc429d 657 actionLancer = true;
JimmyAREM 9:00361ecc429d 658 }
JimmyAREM 9:00361ecc429d 659 if(finActions == true) {
JimmyAREM 9:00361ecc429d 660 finActions = false;
JimmyAREM 9:00361ecc429d 661 actionLancer = false;
JimmyAREM 9:00361ecc429d 662 etapeMatch++;
JimmyAREM 9:00361ecc429d 663 }
JimmyAREM 9:00361ecc429d 664 break;
JimmyAREM 9:00361ecc429d 665 }
JimmyAREM 9:00361ecc429d 666 case 10 : {
JimmyAREM 9:00361ecc429d 667 robot.poussette(3000);
JimmyAREM 9:00361ecc429d 668 robot.marche_arriere(-10000);
JimmyAREM 9:00361ecc429d 669 etapeMatch++;
JimmyAREM 9:00361ecc429d 670 break;
JimmyAREM 9:00361ecc429d 671 }
JimmyAREM 9:00361ecc429d 672 case 11 : {
JimmyAREM 9:00361ecc429d 673 //prise des 4
JimmyAREM 9:00361ecc429d 674 while(1);
JimmyAREM 9:00361ecc429d 675 robot.poussette(2000);
JimmyAREM 9:00361ecc429d 676 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 677 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 678 etapeMatch++;
JimmyAREM 9:00361ecc429d 679 break;
JimmyAREM 9:00361ecc429d 680 }
JimmyAREM 9:00361ecc429d 681 case 12 : /* On se place devant la case bleu, on pousse le palet qui y est devant puis on lache le bleu */
JimmyAREM 9:00361ecc429d 682 {
JimmyAREM 9:00361ecc429d 683 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 684 robot.va_au_point(230000,105000,0);
JimmyAREM 9:00361ecc429d 685 robot.ligne_droite_basique(10000);
JimmyAREM 9:00361ecc429d 686 etapeMatch++;
JimmyAREM 9:00361ecc429d 687 }
JimmyAREM 9:00361ecc429d 688 case 13 :
JimmyAREM 9:00361ecc429d 689 {
JimmyAREM 9:00361ecc429d 690 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 691 {
JimmyAREM 9:00361ecc429d 692 lacherVentouse1();
JimmyAREM 9:00361ecc429d 693 updateAndWriteScore('0', '2', '4');
JimmyAREM 9:00361ecc429d 694 actionLancer = true;
JimmyAREM 9:00361ecc429d 695 }
JimmyAREM 9:00361ecc429d 696 if(finActions)
JimmyAREM 9:00361ecc429d 697 {
JimmyAREM 9:00361ecc429d 698 actionLancer = false;
JimmyAREM 9:00361ecc429d 699 finActions = false;
JimmyAREM 9:00361ecc429d 700 etapeMatch++;
JimmyAREM 9:00361ecc429d 701 }
JimmyAREM 9:00361ecc429d 702 break;
JimmyAREM 9:00361ecc429d 703 }
JimmyAREM 9:00361ecc429d 704 case 14 : /* On se place devant la case verte et on lache le vert*/
JimmyAREM 9:00361ecc429d 705 {
JimmyAREM 9:00361ecc429d 706 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 707 robot.marche_arriere(-5000);
JimmyAREM 4:7a9a9720e4d0 708 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 709 robot.va_au_point(242000,83000,0);
JimmyAREM 9:00361ecc429d 710 robot.ligne_droite_basique(5000);
JimmyAREM 9:00361ecc429d 711 etapeMatch++;
JimmyAREM 9:00361ecc429d 712 break;
JimmyAREM 9:00361ecc429d 713 }
JimmyAREM 9:00361ecc429d 714 case 15 :
JimmyAREM 9:00361ecc429d 715 {
JimmyAREM 9:00361ecc429d 716 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 717 {
JimmyAREM 9:00361ecc429d 718 lacherVentouse3();
JimmyAREM 9:00361ecc429d 719 updateAndWriteScore('0', '3', '0');
JimmyAREM 9:00361ecc429d 720 actionLancer = true;
JimmyAREM 9:00361ecc429d 721 }
JimmyAREM 9:00361ecc429d 722 if(finActions)
JimmyAREM 9:00361ecc429d 723 {
JimmyAREM 9:00361ecc429d 724 actionLancer = false;
JimmyAREM 9:00361ecc429d 725 finActions = false;
JimmyAREM 9:00361ecc429d 726 etapeMatch++;
JimmyAREM 9:00361ecc429d 727 }
JimmyAREM 9:00361ecc429d 728 break;
JimmyAREM 9:00361ecc429d 729 }
JimmyAREM 9:00361ecc429d 730 case 16 : /* On se place devant la case rouge et on lache le rouge*/
JimmyAREM 9:00361ecc429d 731 {
JimmyAREM 9:00361ecc429d 732 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 733 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 734 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 735 robot.va_au_point(242000,45000,0);
JimmyAREM 9:00361ecc429d 736 robot.ligne_droite_basique(5000);
JimmyAREM 9:00361ecc429d 737 etapeMatch++;
JimmyAREM 9:00361ecc429d 738 break;
JimmyAREM 9:00361ecc429d 739 }
JimmyAREM 9:00361ecc429d 740 case 17 :
JimmyAREM 9:00361ecc429d 741 {
JimmyAREM 9:00361ecc429d 742 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 743 {
JimmyAREM 9:00361ecc429d 744 //lacherVentouse2();
JimmyAREM 9:00361ecc429d 745 //lacherVentouse4();
JimmyAREM 9:00361ecc429d 746 stopPompe();
JimmyAREM 9:00361ecc429d 747 updateAndWriteScore('0', '4', '2');
JimmyAREM 9:00361ecc429d 748 actionLancer = true;
JimmyAREM 9:00361ecc429d 749 }
JimmyAREM 9:00361ecc429d 750 if(finActions)
JimmyAREM 9:00361ecc429d 751 {
JimmyAREM 9:00361ecc429d 752 actionLancer = false;
JimmyAREM 9:00361ecc429d 753 finActions = false;
JimmyAREM 9:00361ecc429d 754 etapeMatch++;
JimmyAREM 9:00361ecc429d 755 }
JimmyAREM 9:00361ecc429d 756 break;
JimmyAREM 9:00361ecc429d 757 }
JimmyAREM 9:00361ecc429d 758 case 18 :
JimmyAREM 9:00361ecc429d 759 {
JimmyAREM 9:00361ecc429d 760 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 761 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 762 etapeMatch++;
JimmyAREM 9:00361ecc429d 763 break;
JimmyAREM 9:00361ecc429d 764 }
JimmyAREM 9:00361ecc429d 765 case 19 : /* On depose prend les 2 derniers palets du grand distributeur */
JimmyAREM 9:00361ecc429d 766 {
JimmyAREM 9:00361ecc429d 767 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 768 robot.va_au_point(215000,130000,90);
JimmyAREM 9:00361ecc429d 769 robot.ligne_droite_basique(5000);
JimmyAREM 0:a89fe490343e 770 etapeMatch++;
JimmyAREM 9:00361ecc429d 771 break;
JimmyAREM 9:00361ecc429d 772 }
JimmyAREM 9:00361ecc429d 773 case 20 :
JimmyAREM 9:00361ecc429d 774 {
JimmyAREM 9:00361ecc429d 775 if(actionLancer != true) {
JimmyAREM 9:00361ecc429d 776 prendre2Palets();
JimmyAREM 9:00361ecc429d 777 actionLancer = true;
JimmyAREM 9:00361ecc429d 778 }
JimmyAREM 9:00361ecc429d 779 if(finActions == true) {
JimmyAREM 9:00361ecc429d 780 finActions = false;
JimmyAREM 9:00361ecc429d 781 actionLancer = false;
JimmyAREM 9:00361ecc429d 782 etapeMatch++;
JimmyAREM 9:00361ecc429d 783 }
JimmyAREM 7:392aa81893eb 784 break;
JimmyAREM 0:a89fe490343e 785 }
JimmyAREM 9:00361ecc429d 786 case 21 :
JimmyAREM 9:00361ecc429d 787 {
JimmyAREM 9:00361ecc429d 788 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 789 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 790 etapeMatch++;
JimmyAREM 9:00361ecc429d 791 break;
JimmyAREM 9:00361ecc429d 792 }
JimmyAREM 9:00361ecc429d 793 case 22 : /* On se place devant la case verte et on lache le vert*/
JimmyAREM 9:00361ecc429d 794 {
JimmyAREM 9:00361ecc429d 795 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 796 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 797 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 798 robot.va_au_point(242000,83000,0);
JimmyAREM 9:00361ecc429d 799 robot.ligne_droite_basique(5000);
JimmyAREM 9:00361ecc429d 800 etapeMatch++;
JimmyAREM 9:00361ecc429d 801 break;
JimmyAREM 9:00361ecc429d 802 }
JimmyAREM 9:00361ecc429d 803 case 23 :
JimmyAREM 9:00361ecc429d 804 {
JimmyAREM 9:00361ecc429d 805 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 806 {
JimmyAREM 9:00361ecc429d 807 lacherVentouse1();
JimmyAREM 9:00361ecc429d 808 updateAndWriteScore('0', '4', '8');
JimmyAREM 9:00361ecc429d 809 actionLancer = true;
JimmyAREM 9:00361ecc429d 810 }
JimmyAREM 9:00361ecc429d 811 if(finActions)
JimmyAREM 9:00361ecc429d 812 {
JimmyAREM 9:00361ecc429d 813 actionLancer = false;
JimmyAREM 9:00361ecc429d 814 finActions = false;
JimmyAREM 9:00361ecc429d 815 etapeMatch++;
JimmyAREM 9:00361ecc429d 816 }
JimmyAREM 9:00361ecc429d 817 break;
JimmyAREM 9:00361ecc429d 818 }
JimmyAREM 9:00361ecc429d 819 case 24 : /* On se place devant la case rouge et on lache le rouge*/
JimmyAREM 9:00361ecc429d 820 {
JimmyAREM 9:00361ecc429d 821 typeMovement = DEPLACEMENT_ARRIERE;
JimmyAREM 9:00361ecc429d 822 robot.marche_arriere(-5000);
JimmyAREM 9:00361ecc429d 823 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 824 robot.va_au_point(242000,45000,00);
JimmyAREM 9:00361ecc429d 825 robot.ligne_droite_basique(5000);
JimmyAREM 9:00361ecc429d 826 etapeMatch++;
JimmyAREM 9:00361ecc429d 827 break;
JimmyAREM 9:00361ecc429d 828 }
JimmyAREM 9:00361ecc429d 829 case 25 :
JimmyAREM 9:00361ecc429d 830 {
JimmyAREM 9:00361ecc429d 831 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 832 {
JimmyAREM 9:00361ecc429d 833 //lacherVentouse2();
JimmyAREM 9:00361ecc429d 834 stopPompe();
JimmyAREM 9:00361ecc429d 835 updateAndWriteScore('0', '5', '4');
JimmyAREM 9:00361ecc429d 836 actionLancer = true;
JimmyAREM 9:00361ecc429d 837 }
JimmyAREM 9:00361ecc429d 838 if(finActions)
JimmyAREM 9:00361ecc429d 839 {
JimmyAREM 9:00361ecc429d 840 actionLancer = false;
JimmyAREM 9:00361ecc429d 841 finActions = false;
JimmyAREM 9:00361ecc429d 842 etapeMatch++;
JimmyAREM 9:00361ecc429d 843 }
JimmyAREM 9:00361ecc429d 844 break;
JimmyAREM 9:00361ecc429d 845 }
JimmyAREM 9:00361ecc429d 846 case 26 :
JimmyAREM 9:00361ecc429d 847 {
JimmyAREM 9:00361ecc429d 848 if(actionLancer == false)
JimmyAREM 9:00361ecc429d 849 {
JimmyAREM 9:00361ecc429d 850 stopPompe();
JimmyAREM 9:00361ecc429d 851 actionLancer = true;
JimmyAREM 9:00361ecc429d 852 }
JimmyAREM 9:00361ecc429d 853 if(finActions)
JimmyAREM 9:00361ecc429d 854 {
JimmyAREM 9:00361ecc429d 855 actionLancer = false;
JimmyAREM 9:00361ecc429d 856 finActions = false;
JimmyAREM 9:00361ecc429d 857 etapeMatch++;
JimmyAREM 9:00361ecc429d 858 }
JimmyAREM 9:00361ecc429d 859 break;
JimmyAREM 9:00361ecc429d 860 }
JimmyAREM 9:00361ecc429d 861 case 27 : /* On laisse la place au robot2 */
JimmyAREM 9:00361ecc429d 862 {
JimmyAREM 9:00361ecc429d 863
JimmyAREM 9:00361ecc429d 864 typeMovement = DEPLACEMENT_AVANT;
JimmyAREM 9:00361ecc429d 865 robot.va_au_point(235000,130000,90);
JimmyAREM 9:00361ecc429d 866 etapeMatch++;
JimmyAREM 9:00361ecc429d 867 break;
JimmyAREM 9:00361ecc429d 868 }
JimmyAREM 7:392aa81893eb 869 default: {
JimmyAREM 0:a89fe490343e 870 robot.vitesse_nulle_D(0);
JimmyAREM 0:a89fe490343e 871 robot.vitesse_nulle_G(0);
JimmyAREM 0:a89fe490343e 872 motors_stop();
JimmyAREM 9:00361ecc429d 873 stopPompe();
JimmyAREM 9:00361ecc429d 874 stopPompe();
JimmyAREM 9:00361ecc429d 875 stopPompe();
JimmyAREM 0:a89fe490343e 876 }
JimmyAREM 7:392aa81893eb 877 }
JimmyAREM 0:a89fe490343e 878 }
JimmyAREM 7:392aa81893eb 879
JimmyAREM 0:a89fe490343e 880 //ArrĂȘter les moteurs
JimmyAREM 0:a89fe490343e 881 robot.vitesse_nulle_D(0);
JimmyAREM 0:a89fe490343e 882 robot.vitesse_nulle_G(0);
JimmyAREM 0:a89fe490343e 883 motors_stop();
JimmyAREM 9:00361ecc429d 884 stopPompe();
JimmyAREM 0:a89fe490343e 885 while(1);
JimmyAREM 2:e0402d1e9ed5 886 }
JimmyAREM 2:e0402d1e9ed5 887 /*--------- Fin Strategie classique jaune --------------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 888
JimmyAREM 2:e0402d1e9ed5 889
JimmyAREM 2:e0402d1e9ed5 890 /*--------- Debut Strategie RCVA violet ----------------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 891
JimmyAREM 2:e0402d1e9ed5 892
JimmyAREM 7:392aa81893eb 893 void strategieRCVAViolet(deplacement robot, Demarreur demarreur)
JimmyAREM 2:e0402d1e9ed5 894 {
JimmyAREM 2:e0402d1e9ed5 895 write(bufferScore);
JimmyAREM 2:e0402d1e9ed5 896 Timer tempsMatch; // timer en seconde
JimmyAREM 2:e0402d1e9ed5 897 int etapeMatch = 0;
JimmyAREM 7:392aa81893eb 898 while(demarreur.getState() == false) {
JimmyAREM 2:e0402d1e9ed5 899 //on attend
JimmyAREM 2:e0402d1e9ed5 900 //pc.printf("On attend le depart du Robot Thanos\n\r");
JimmyAREM 2:e0402d1e9ed5 901 }
JimmyAREM 2:e0402d1e9ed5 902 tempsArretMvt.attach(&arretSystem, TEMPSMATCH);
JimmyAREM 7:392aa81893eb 903 initViolet();
JimmyAREM 3:4810f8316e38 904 robot.initialisation();
JimmyAREM 2:e0402d1e9ed5 905 lancerTimerEcran();
JimmyAREM 2:e0402d1e9ed5 906 tempsMatch.start();
JimmyAREM 2:e0402d1e9ed5 907 typeEvitement = ARRET;
JimmyAREM 2:e0402d1e9ed5 908 }
JimmyAREM 2:e0402d1e9ed5 909
JimmyAREM 2:e0402d1e9ed5 910
JimmyAREM 2:e0402d1e9ed5 911 /*-------- Fin Strategie RCVA violet -----------------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 912
JimmyAREM 2:e0402d1e9ed5 913
JimmyAREM 2:e0402d1e9ed5 914 /*-------- Debut Strategie RCVA jaune -----------------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 915
JimmyAREM 7:392aa81893eb 916 void strategieRCVAJaune(deplacement robot, Demarreur demarreur)
JimmyAREM 2:e0402d1e9ed5 917 {
JimmyAREM 2:e0402d1e9ed5 918 write(bufferScore);
JimmyAREM 2:e0402d1e9ed5 919 Timer tempsMatch; // timer en seconde
JimmyAREM 2:e0402d1e9ed5 920 int etapeMatch = 0;
JimmyAREM 7:392aa81893eb 921 while(demarreur.getState() == false) {
JimmyAREM 2:e0402d1e9ed5 922 //on attend
JimmyAREM 2:e0402d1e9ed5 923 //pc.printf("On attend le depart du Robot Thanos\n\r");
JimmyAREM 2:e0402d1e9ed5 924 }
JimmyAREM 2:e0402d1e9ed5 925 tempsArretMvt.attach(&arretSystem, TEMPSMATCH);
JimmyAREM 7:392aa81893eb 926 initJaune();
JimmyAREM 3:4810f8316e38 927 robot.initialisation();
JimmyAREM 2:e0402d1e9ed5 928 lancerTimerEcran();
JimmyAREM 2:e0402d1e9ed5 929 tempsMatch.start();
JimmyAREM 2:e0402d1e9ed5 930 typeEvitement = ARRET;
JimmyAREM 2:e0402d1e9ed5 931 }
JimmyAREM 2:e0402d1e9ed5 932
JimmyAREM 2:e0402d1e9ed5 933
JimmyAREM 2:e0402d1e9ed5 934 /*-------- Fin Strategie RCVA jaune --------------------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 935
JimmyAREM 2:e0402d1e9ed5 936 /*-------- Debut Strategie humiliation violet ---------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 937
JimmyAREM 7:392aa81893eb 938 void strategieHumiliationViolet(deplacement robot, Demarreur demarreur)
JimmyAREM 2:e0402d1e9ed5 939 {
JimmyAREM 2:e0402d1e9ed5 940 write(bufferScore);
JimmyAREM 2:e0402d1e9ed5 941 Timer tempsMatch; // timer en seconde
JimmyAREM 2:e0402d1e9ed5 942 int etapeMatch = 0;
JimmyAREM 7:392aa81893eb 943 while(demarreur.getState() == false) {
JimmyAREM 2:e0402d1e9ed5 944 //on attend
JimmyAREM 2:e0402d1e9ed5 945 //pc.printf("On attend le depart du Robot Thanos\n\r");
JimmyAREM 2:e0402d1e9ed5 946 }
JimmyAREM 2:e0402d1e9ed5 947 tempsArretMvt.attach(&arretSystem, TEMPSMATCH);
JimmyAREM 7:392aa81893eb 948 initViolet();
JimmyAREM 3:4810f8316e38 949 robot.initialisation();
JimmyAREM 2:e0402d1e9ed5 950 lancerTimerEcran();
JimmyAREM 2:e0402d1e9ed5 951 tempsMatch.start();
JimmyAREM 2:e0402d1e9ed5 952 typeEvitement = ARRET;
JimmyAREM 2:e0402d1e9ed5 953 }
JimmyAREM 2:e0402d1e9ed5 954
JimmyAREM 2:e0402d1e9ed5 955
JimmyAREM 2:e0402d1e9ed5 956 /*--------- Fin Strategie humiliation violet ----------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 957
JimmyAREM 2:e0402d1e9ed5 958
JimmyAREM 2:e0402d1e9ed5 959 /*-------- Debut Strategie humiliation jaune ----------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 960
JimmyAREM 7:392aa81893eb 961 void strategieHumiliationJaune(deplacement robot, Demarreur demarreur)
JimmyAREM 2:e0402d1e9ed5 962 {
JimmyAREM 2:e0402d1e9ed5 963 write(bufferScore);
JimmyAREM 2:e0402d1e9ed5 964 Timer tempsMatch; // timer en seconde
JimmyAREM 2:e0402d1e9ed5 965 int etapeMatch = 0;
JimmyAREM 7:392aa81893eb 966 while(demarreur.getState() == false) {
JimmyAREM 2:e0402d1e9ed5 967 //on attend
JimmyAREM 2:e0402d1e9ed5 968 //pc.printf("On attend le depart du Robot Thanos\n\r");
JimmyAREM 2:e0402d1e9ed5 969 }
JimmyAREM 2:e0402d1e9ed5 970 tempsArretMvt.attach(&arretSystem, TEMPSMATCH);
JimmyAREM 7:392aa81893eb 971 initJaune();
JimmyAREM 3:4810f8316e38 972 robot.initialisation();
JimmyAREM 2:e0402d1e9ed5 973 lancerTimerEcran();
JimmyAREM 2:e0402d1e9ed5 974 tempsMatch.start();
JimmyAREM 2:e0402d1e9ed5 975 typeEvitement = ARRET;
JimmyAREM 2:e0402d1e9ed5 976 }
JimmyAREM 2:e0402d1e9ed5 977
JimmyAREM 2:e0402d1e9ed5 978
JimmyAREM 2:e0402d1e9ed5 979 /*--------- Fin Strategie humiliation jaune -----------------------------------------*/
JimmyAREM 2:e0402d1e9ed5 980
JimmyAREM 2:e0402d1e9ed5 981
JimmyAREM 2:e0402d1e9ed5 982
JimmyAREM 2:e0402d1e9ed5 983