CRAC Team / CRAC-Strat_2017_homologation_gros_rob

Fork of CRAC-Strat_2017_HOMOLOGATION_PETIT_ROBOT by CRAC Team

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Strategie_big.cpp Source File

Strategie_big.cpp

00001 
00002 #include "StrategieManager.h"
00003 #ifdef ROBOT_BIG
00004 #include "Config_big.h"
00005 
00006 unsigned char isStopEnable = 1;//Permet de savoir si il faut autoriser le stop via les balises
00007 unsigned short telemetreDistance;
00008 /****************************************************************************************/
00009 /* FUNCTION NAME: doFunnyAction                                                         */
00010 /* DESCRIPTION  : Permet de faire la funny action en fin de partie                      */
00011 /****************************************************************************************/
00012 void doFunnyAction(void) {
00013     //envoie de la funny action
00014     // 0x007, 01, 01
00015         CANMessage msgTx=CANMessage();
00016         msgTx.id=GLOBAL_FUNNY_ACTION;
00017         msgTx.format=CANStandard;
00018         msgTx.type=CANData;
00019         msgTx.len=2;
00020         msgTx.data[0]=0x01;
00021         msgTx.data[1]=0x01;
00022         can1.write(msgTx);
00023 }
00024 
00025 /****************************************************************************************/
00026 /* FUNCTION NAME: doAction                                                              */
00027 /* DESCRIPTION  : Effectuer une action specifique                                       */
00028 /****************************************************************************************/
00029 unsigned char doAction(unsigned char id, unsigned short speed, short angle) {
00030     CANMessage msgTx=CANMessage();
00031     int localData = 0, localData2;
00032     switch(id) {
00033         case 100: // position initiale
00034             msgTx.id=SERVO_AX12_ACTION;
00035             msgTx.format=CANStandard;
00036             msgTx.type=CANData;
00037             msgTx.len=2;
00038             
00039             if (InversStrat){ // si on est inversé, on echange les bras
00040                     if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00041                     else speed = BRAS_AVANT;
00042                 }
00043             
00044             msgTx.data[0]=1;
00045             msgTx.data[1]=speed;
00046             can1.write(msgTx);
00047         break;
00048         
00049         case 101:  /// preparation prise
00050             msgTx.id=SERVO_AX12_ACTION;
00051             msgTx.format=CANStandard;
00052             msgTx.type=CANData;
00053             msgTx.len=2;
00054             
00055             if (InversStrat){ // si on est inversé, on echange les bras
00056                     if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00057                     else speed = BRAS_AVANT;
00058                 }
00059             
00060             msgTx.data[0]=2;
00061             msgTx.data[1]=speed;
00062             can1.write(msgTx);
00063         break;
00064         
00065         case 102: // stockage haut
00066             msgTx.id=SERVO_AX12_ACTION;
00067             msgTx.format=CANStandard;
00068             msgTx.type=CANData;
00069             msgTx.len=2;
00070             
00071             if (InversStrat){ // si on est inversé, on echange les bras
00072                     if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00073                     else speed = BRAS_AVANT;
00074                 }
00075             
00076             msgTx.data[0]=3;
00077             msgTx.data[1]=speed;
00078             can1.write(msgTx);
00079         break;
00080         
00081         case 103: // stockage bas
00082             msgTx.id=SERVO_AX12_ACTION;
00083             msgTx.format=CANStandard;
00084             msgTx.type=CANData;
00085             msgTx.len=2;
00086             
00087             if (InversStrat){ // si on est inversé, on echange les bras
00088                     if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00089                     else speed = BRAS_AVANT;
00090                 }
00091             
00092             msgTx.data[0]=4;
00093             msgTx.data[1]=speed;
00094             can1.write(msgTx);
00095         break;
00096         
00097         case 104: // pousser module
00098             msgTx.id=SERVO_AX12_ACTION;
00099             msgTx.format=CANStandard;
00100             msgTx.type=CANData;
00101             msgTx.len=2;
00102             
00103             if (InversStrat){ // si on est inversé, on echange les bras
00104                     if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00105                     else speed = BRAS_AVANT;
00106                 }
00107             
00108             msgTx.data[0]=7;
00109             msgTx.data[1]=speed;
00110             can1.write(msgTx);
00111         break;
00112         
00113         case 105: // preparation prise
00114             msgTx.id=SERVO_AX12_ACTION;
00115             msgTx.format=CANStandard;
00116             msgTx.type=CANData;
00117             msgTx.len=2;
00118             
00119             if (InversStrat){ // si on est inversé, on echange les bras
00120                     if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00121                     else speed = BRAS_AVANT;
00122                 }
00123             
00124             msgTx.data[0]=6;
00125             msgTx.data[1]=speed;
00126             can1.write(msgTx);
00127         break;
00128         
00129         case 106: //deposer module
00130             msgTx.id=SERVO_AX12_ACTION;
00131             msgTx.format=CANStandard;
00132             msgTx.type=CANData;
00133             msgTx.len=2;
00134             
00135             if (InversStrat){ // si on est inversé, on echange les bras
00136                     if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00137                     else speed = BRAS_AVANT;
00138                 }
00139             
00140             msgTx.data[0]=5;
00141             msgTx.data[1]=speed;
00142             can1.write(msgTx);
00143         break;
00144         
00145         case 110: // repos bras avant
00146             msgTx.id=SERVO_AX12_ACTION;
00147             msgTx.format=CANStandard;
00148             msgTx.type=CANData;
00149             msgTx.len=2;
00150             speed = BRAS_AVANT; 
00151             if (InversStrat){ // si on est inversé, on echange les bras
00152                     if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00153                     else speed = BRAS_AVANT;
00154             }
00155             if (speed == BRAS_AVANT)localData = 0x10;
00156             else localData = 0x24;
00157             
00158             msgTx.data[0]=localData;
00159             msgTx.data[1]=speed;
00160             can1.write(msgTx);
00161         break;
00162         
00163         case 111: // init bras module
00164             msgTx.id=SERVO_AX12_ACTION;
00165             msgTx.format=CANStandard;
00166             msgTx.type=CANData;
00167             msgTx.len=2;
00168             speed = BRAS_AVANT;
00169             if (InversStrat){ // si on est inversé, on echange les bras
00170                     if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00171                     else speed = BRAS_AVANT;
00172             }
00173             if (speed == BRAS_AVANT)localData = 0x0A;
00174             else localData = 0x1E;
00175             
00176             msgTx.data[0]=localData;
00177             msgTx.data[1]=speed;
00178             can1.write(msgTx);
00179         break;
00180         
00181         case 112: // bouger module avant la gouttière
00182             msgTx.id=SERVO_AX12_ACTION;
00183             msgTx.format=CANStandard;
00184             msgTx.type=CANData;
00185             msgTx.len=2;
00186             speed = BRAS_AVANT;
00187             if (InversStrat){ // si on est inversé, on echange les bras
00188                     if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00189                     else speed = BRAS_AVANT;
00190             }
00191             if (speed == BRAS_AVANT)localData = 0x0B;
00192             else localData = 0x1F;
00193             
00194             msgTx.data[0]=localData;
00195             msgTx.data[1]=speed;
00196             can1.write(msgTx);
00197         break;
00198         
00199         case 113: // deposer module
00200             msgTx.id=SERVO_AX12_ACTION;
00201             msgTx.format=CANStandard;
00202             msgTx.type=CANData;
00203             msgTx.len=2;
00204             localData2 = BRAS_AVANT;
00205             
00206             if (InversStrat){ // si on est inversé, on echange les bras
00207                 if (localData2 == BRAS_AVANT) localData2 = BRAS_ARRIERE;
00208                 else localData2 = BRAS_AVANT;
00209             }
00210             
00211             if(localData2 == BRAS_AVANT){
00212                 if(speed == INV){
00213                         localData = 0x0E;
00214                     }else{
00215                         localData = 0x0C;
00216                     }
00217             }else{
00218                 if(speed == INV){
00219                         localData = 0x22;
00220                     }else{
00221                         localData = 0x20;
00222                     }
00223             }
00224             
00225             msgTx.data[0]=localData;
00226             msgTx.data[1]=localData2;
00227             can1.write(msgTx);
00228         break;
00229         
00230         case 114: // repositionner bras avant
00231             msgTx.id=SERVO_AX12_ACTION;
00232             msgTx.format=CANStandard;
00233             msgTx.type=CANData;
00234             msgTx.len=2;
00235             speed = BRAS_AVANT;
00236             if (InversStrat){ // si on est inversé, on echange les bras
00237                 if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00238                 else speed = BRAS_AVANT;
00239             }
00240             if (speed == BRAS_AVANT)localData = 0x0F;
00241             else localData = 0x23; 
00242             
00243             msgTx.data[0]=localData;
00244             msgTx.data[1]=speed;
00245             can1.write(msgTx);
00246         break;
00247         
00248         case 115: // pompe avant ON
00249             msgTx.id=0x400;
00250             msgTx.format=CANStandard;
00251             msgTx.type=CANData;
00252             msgTx.len=2;
00253             localData = BRAS_AVANT;
00254             if (InversStrat){ // si on est inversé, on echange les bras
00255                 if (localData == BRAS_AVANT) localData = BRAS_ARRIERE;
00256                 else localData = BRAS_AVANT;
00257             } 
00258             
00259             msgTx.data[0]=1;
00260             msgTx.data[1]=localData;
00261             
00262             can1.write(msgTx);
00263             wait_ms(1);
00264             can1.write(msgTx);
00265         break;
00266         
00267         case 116: // pompe avant OFF
00268             msgTx.id=0x400;
00269             msgTx.format=CANStandard;
00270             msgTx.type=CANData;
00271             msgTx.len=2;
00272             localData = BRAS_AVANT;
00273             if (InversStrat){ // si on est inversé, on echange les bras
00274                 if (localData == BRAS_AVANT) localData = BRAS_ARRIERE;
00275                 else localData = BRAS_AVANT;
00276             } 
00277             
00278             msgTx.data[0]=0;
00279             msgTx.data[1]=localData;
00280             
00281             can1.write(msgTx);
00282             wait_ms(1);
00283             can1.write(msgTx);
00284         break;
00285         
00286         case 120: // repos bras arrière
00287             msgTx.id=SERVO_AX12_ACTION;
00288             msgTx.format=CANStandard;
00289             msgTx.type=CANData;
00290             msgTx.len=2;
00291             speed = BRAS_ARRIERE;
00292             if (InversStrat){ // si on est inversé, on echange les bras
00293                 if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00294                 else speed = BRAS_AVANT;
00295             }
00296             if (speed == BRAS_AVANT)localData = 0x10;
00297             else localData = 0x24; 
00298             
00299             msgTx.data[0]=localData;
00300             msgTx.data[1]=speed;
00301             can1.write(msgTx);
00302         break;
00303         
00304         case 121: // position d'init avant de prendre un module bras arriere
00305             msgTx.id=SERVO_AX12_ACTION;
00306             msgTx.format=CANStandard;
00307             msgTx.type=CANData;
00308             msgTx.len=2;
00309             speed = BRAS_ARRIERE;
00310             if (InversStrat){ // si on est inversé, on echange les bras
00311                 if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00312                 else speed = BRAS_AVANT;
00313             }
00314             if (speed == BRAS_AVANT)localData = 0xA0;
00315             else localData = 0x1E; 
00316             
00317             msgTx.data[0]=localData;
00318             msgTx.data[1]=speed;
00319             can1.write(msgTx);
00320         break;
00321         
00322         case 122: // bouger le bras arriere avant la gouttiere
00323             msgTx.id=SERVO_AX12_ACTION;
00324             msgTx.format=CANStandard;
00325             msgTx.type=CANData;
00326             msgTx.len=2;
00327             speed = BRAS_ARRIERE;
00328             if (InversStrat){ // si on est inversé, on echange les bras
00329                 if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00330                 else speed = BRAS_AVANT;
00331             }
00332             if (speed == BRAS_AVANT)localData = 0x0B;
00333             else localData = 0x1F; 
00334             
00335             msgTx.data[0]=localData;
00336             msgTx.data[1]=speed;
00337             can1.write(msgTx);
00338         break;
00339         
00340         case 123: // deposer module
00341             msgTx.id=SERVO_AX12_ACTION;
00342             msgTx.format=CANStandard;
00343             msgTx.type=CANData;
00344             msgTx.len=2;
00345             localData2 = BRAS_ARRIERE;
00346             
00347             if (InversStrat){ // si on est inversé, on echange les bras
00348                 if (localData2 == BRAS_AVANT) localData2 = BRAS_ARRIERE;
00349                 else localData2 = BRAS_AVANT;
00350             }
00351             
00352             if(localData2 == BRAS_AVANT){
00353                 if(speed == INV){
00354                         localData = 0x0E;
00355                     }else{
00356                         localData = 0x0C;
00357                     }
00358             }else{
00359                 if(speed == INV){
00360                         localData = 0x22;
00361                     }else{
00362                         localData = 0x20;
00363                     }
00364             }
00365             
00366             msgTx.data[0]=localData;
00367             msgTx.data[1]=speed;
00368             can1.write(msgTx);
00369         break;
00370         
00371         case 124: // remettre le bras arriere en posiion initiale
00372             msgTx.id=SERVO_AX12_ACTION;
00373             msgTx.format=CANStandard;
00374             msgTx.type=CANData;
00375             msgTx.len=2;
00376             speed = BRAS_ARRIERE;
00377             if (InversStrat){ // si on est inversé, on echange les bras
00378                 if (speed == BRAS_AVANT) speed = BRAS_ARRIERE;
00379                 else speed = BRAS_AVANT;
00380             }
00381             if (speed == BRAS_AVANT)localData = 0x0F;
00382             else localData = 0x23; 
00383             
00384             msgTx.data[0]=localData;
00385             msgTx.data[1]=speed;
00386             can1.write(msgTx);
00387         break;
00388         
00389         case 125: // pompe pwm arriere ON
00390             msgTx.id=0x400;
00391             msgTx.format=CANStandard;
00392             msgTx.type=CANData;
00393             msgTx.len=2;
00394             localData = BRAS_ARRIERE;
00395             if (InversStrat){ // si on est inversé, on echange les bras
00396                 if (localData == BRAS_AVANT) localData = BRAS_ARRIERE;
00397                 else localData = BRAS_AVANT;
00398             } 
00399             
00400             msgTx.data[0]=1;
00401             msgTx.data[1]=localData;
00402             
00403             can1.write(msgTx);
00404             wait_ms(1);
00405             can1.write(msgTx);
00406         break;
00407         
00408         case 126: // pompe arriere pwm OFF
00409             msgTx.id=0x400;
00410             msgTx.format=CANStandard;
00411             msgTx.type=CANData;
00412             msgTx.len=2;
00413             localData = BRAS_ARRIERE;
00414             if (InversStrat){ // si on est inversé, on echange les bras
00415                 if (localData == BRAS_AVANT) localData = BRAS_ARRIERE;
00416                 else localData = BRAS_AVANT;
00417             } 
00418             
00419             msgTx.data[0]=0;
00420             msgTx.data[1]=localData;
00421             
00422             can1.write(msgTx);
00423             wait_ms(1);
00424             can1.write(msgTx);
00425         break;
00426         
00427         case 130: // baiser bras turbine
00428             msgTx.id=SERVO_AX12_ACTION;
00429             msgTx.format=CANStandard;
00430             msgTx.type=CANData;
00431             msgTx.len=2;
00432             msgTx.data[0]=0x14;
00433             msgTx.data[1]=BRAS_AVANT;
00434             can1.write(msgTx);
00435         break;
00436         
00437         case 131: // lever bras turbine
00438             msgTx.id=SERVO_AX12_ACTION;
00439             msgTx.format=CANStandard;
00440             msgTx.type=CANData;
00441             msgTx.len=2;
00442             msgTx.data[0]=0x15;
00443             msgTx.data[1]=BRAS_AVANT;
00444             can1.write(msgTx);
00445         break;
00446         
00447         case 132: // allumer turbine
00448             msgTx.id=0x403;
00449             msgTx.format=CANStandard;
00450             msgTx.type=CANData;
00451             msgTx.len=2;
00452             msgTx.data[0]=1;
00453             msgTx.data[1]=BRAS_AVANT;
00454             can1.write(msgTx);
00455         break;
00456         
00457         case 133: // stop turbine
00458             msgTx.id=0x403;
00459             msgTx.format=CANStandard;
00460             msgTx.type=CANData;
00461             msgTx.len=2;
00462             msgTx.data[0]=0;
00463             msgTx.data[1]=BRAS_AVANT;
00464             can1.write(msgTx);
00465         break;
00466         
00467         case 140:// lanceur ON
00468             msgTx.id=0x402;
00469             msgTx.format=CANStandard;
00470             msgTx.type=CANData;
00471             msgTx.len=2;
00472             
00473             msgTx.data[0]=1;
00474             msgTx.data[1]=0x02;
00475             can1.write(msgTx);
00476         break;
00477         
00478         case 141: // lanceur OFF
00479             msgTx.id=0x402;
00480             msgTx.format=CANStandard;
00481             msgTx.type=CANData;
00482             msgTx.len=2;
00483             
00484             msgTx.data[0]=0;
00485             msgTx.data[1]=0x02;
00486             can1.write(msgTx);
00487         break;
00488 
00489         case 150:
00490             msgTx.id=0x404;
00491             msgTx.format=CANStandard;
00492             msgTx.type=CANData;
00493             msgTx.len=2;
00494             
00495             msgTx.data[0]=1;
00496             msgTx.data[1]=BRAS_AVANT;
00497             
00498             can1.write(msgTx);
00499         break;
00500         
00501         case 151:
00502             msgTx.id=0x404;
00503             msgTx.format=CANStandard;
00504             msgTx.type=CANData;
00505             msgTx.len=2;
00506             
00507             msgTx.data[0]=0;
00508             msgTx.data[1]=BRAS_AVANT;
00509             
00510             can1.write(msgTx);
00511         break;
00512         
00513         case 10://Désactiver le stop
00514             isStopEnable = 0;
00515         break;
00516         case 11://Activer le stop
00517             isStopEnable = 1;
00518         break;
00519         case 20://Désactiver l'asservissement
00520             setAsservissementEtat(0);
00521         break;
00522         case 21://Activer l'asservissement
00523             setAsservissementEtat(1);
00524         break;
00525         
00526         case 22://Changer la vitesse du robot
00527             SendSpeed(speed,(unsigned short)angle);
00528         break;
00529         
00530         case 30://Action tempo
00531             wait_ms(speed);
00532         break;
00533         
00534         /*case 40: // demande au telemetre la position d'un objet
00535             //SendRawId(TELEMETRE_RECHERCHE_OBJET);
00536             
00537             modeTelemetre = 1;
00538            
00539             //angle = angle /10;
00540             
00541             msgTx.id=TELEMETRE_OBJET;
00542             msgTx.format=CANStandard;
00543             msgTx.type=CANData;
00544             msgTx.len=1;
00545             // indice du module sur le terrain
00546             msgTx.data[0] = (unsigned char)speed;
00547             
00548             
00549             // x sur 2 octets
00550             msgTx.data[0]=(unsigned char)speed;
00551             msgTx.data[1]=(unsigned char)(speed>>8);
00552             // y sur 2 octets
00553             msgTx.data[2]=(unsigned char)angle;
00554             msgTx.data[3]=(unsigned char)(angle>>8);
00555             // theta signé sur 2 octets
00556             //msgTx.data[4]=(unsigned char)theta;
00557             //msgTx.data[5]=(unsigned char)(theta>>8);
00558             msgTx.data[4]=0;
00559             msgTx.data[5]=0;
00560             
00561             can1.write(msgTx);
00562             
00563         break;*/
00564         
00565        /* case 130://Lancer mouvement de sortie de la zone de départ
00566             msgTx.id=ACTION_BIG_DEMARRAGE;
00567             msgTx.format=CANStandard;
00568             msgTx.type=CANData;
00569             msgTx.len=1;
00570             msgTx.data[0] = (unsigned char)speed;
00571             can1.write(msgTx);
00572         break;*/
00573         
00574         default:
00575             return 0;//L'action n'existe pas, il faut utiliser le CAN
00576         
00577     }
00578     return 1;//L'action est spécifique.
00579     
00580 }
00581 
00582 /****************************************************************************************/
00583 /* FUNCTION NAME: initRobot                                                             */
00584 /* DESCRIPTION  : initialiser le robot                                                  */
00585 /****************************************************************************************/
00586 void initRobot(void) 
00587 {
00588     //Enregistrement de tous les AX12 présent sur la carte
00589     /*AX12_register(5,  AX12_SERIAL2);
00590     AX12_register(18, AX12_SERIAL2);
00591     AX12_register(13, AX12_SERIAL2);
00592     AX12_register(1,  AX12_SERIAL1);
00593     AX12_register(11,  AX12_SERIAL1);
00594     AX12_register(8,  AX12_SERIAL1);
00595     AX12_register(7,  AX12_SERIAL2);*/
00596     
00597     //AX12_setGoal(AX12_ID_FUNNY_ACTION, AX12_ANGLE_FUNNY_ACTION_CLOSE,AX12_SPEED_FUNNY_ACTION);
00598     //AX12_processChange();
00599     //runRobotTest();
00600     
00601 }
00602 
00603 /****************************************************************************************/
00604 /* FUNCTION NAME: initRobotActionneur                                                   */
00605 /* DESCRIPTION  : Initialiser la position des actionneurs du robot                      */
00606 /****************************************************************************************/
00607 void initRobotActionneur(void)
00608 {
00609     
00610 }
00611 
00612 /****************************************************************************************/
00613 /* FUNCTION NAME: runTest                                                               */
00614 /* DESCRIPTION  : tester l'ensemble des actionneurs du robot                            */
00615 /****************************************************************************************/
00616 void runRobotTest(void) 
00617 {
00618     /*
00619     int waitTime = 500;
00620     
00621     //Test des AX12 dans l'ordre
00622     doAction(111,0,0);//Fermeture pince arrière haute
00623     wait_ms(waitTime);
00624     doAction(110,0,0);//Ouverture pince arrière haute
00625     wait_ms(waitTime);
00626     doAction(113,0,0);//Fermeture pince arrière basse
00627     wait_ms(waitTime);
00628     doAction(112,0,0);//Ouverture pince arrière basse
00629     wait_ms(waitTime);
00630     doAction(115,0,0);//Fermeture porte arrière
00631     wait_ms(waitTime);
00632     doAction(114,0,0);//Ouverture porte arrière
00633     wait_ms(waitTime);
00634     doAction(101,0,0);//Fermer les portes avant
00635     wait_ms(waitTime);
00636     doAction(100,0,0);//Ouvrir les portes avant
00637     wait_ms(waitTime);
00638     doAction(103,0,0);//Descendre le peigne
00639     wait_ms(waitTime);
00640     doAction(102,0,0);//Remonter le peigne*/
00641 }
00642 
00643 /****************************************************************************************/
00644 /* FUNCTION NAME: SelectStrategy                                                        */
00645 /* DESCRIPTION  : Charger le fichier de stratégie correspondante à un id                */
00646 /* RETURN       : 0=> Erreur, 1=> OK si le fichier existe                               */
00647 /****************************************************************************************/
00648 int SelectStrategy(unsigned char id)
00649 {
00650     switch(id)
00651     {
00652         // strat de match
00653         case 1:
00654             strcpy(cheminFileStart,"/local/strat1.txt");
00655             return FileExists(cheminFileStart);
00656         case 2:
00657             strcpy(cheminFileStart,"/local/strat2.txt");
00658             return FileExists(cheminFileStart);
00659         case 3:
00660             strcpy(cheminFileStart,"/local/strat3.txt");
00661             return FileExists(cheminFileStart);
00662         case 4:
00663             strcpy(cheminFileStart,"/local/strat4.txt");
00664             return FileExists(cheminFileStart);
00665         case 5:
00666             strcpy(cheminFileStart,"/local/strat5.txt");
00667             return FileExists(cheminFileStart);
00668         case 6:
00669             strcpy(cheminFileStart,"/local/strat6.txt");
00670             return FileExists(cheminFileStart);
00671         case 7:
00672             strcpy(cheminFileStart,"/local/strat7.txt");
00673             return FileExists(cheminFileStart);
00674         case 8:
00675             strcpy(cheminFileStart,"/local/strat8.txt");
00676             return FileExists(cheminFileStart);
00677         case 9:
00678             strcpy(cheminFileStart,"/local/strat9.txt");
00679             return FileExists(cheminFileStart);
00680         case 10:
00681             strcpy(cheminFileStart,"/local/strat10.txt");
00682             return FileExists(cheminFileStart);
00683         
00684         // strat de demo
00685         case 0x10:
00686             strcpy(cheminFileStart,"/local/moteur.txt");
00687             return FileExists(cheminFileStart);
00688         case 0x11:
00689 #ifdef ROBOT_BIG
00690             strcpy(cheminFileStart,"/local/bras.txt");
00691 #else
00692             strcpy(cheminFileStart,"/local/porteAvant.txt");
00693 #endif
00694             return FileExists(cheminFileStart);
00695         case 0x12:
00696 #ifdef ROBOT_BIG
00697             strcpy(cheminFileStart,"/local/balancier.txt");
00698 #else
00699             strcpy(cheminFileStart,"/local/mainTourneuse.txt");
00700 #endif
00701             return FileExists(cheminFileStart);
00702         default:
00703             strcpy(cheminFileStart,"/local/strat1.txt");
00704             return 0;
00705     }
00706 }
00707 
00708 /****************************************************************************************/
00709 /* FUNCTION NAME: needToStop                                                            */
00710 /* DESCRIPTION  : Savoir si il faut autoriser le stop du robot via balise               */
00711 /****************************************************************************************/
00712 unsigned char needToStop(void)
00713 {
00714     return isStopEnable;
00715 }
00716 
00717 /****************************************************************************************/
00718 /* FUNCTION NAME: doBeforeEndAction                                                     */
00719 /* DESCRIPTION  : Terminer les actions du robot 1s avant la fin du match                */
00720 /****************************************************************************************/
00721 void doBeforeEndAction(void)
00722 {
00723     doAction(110,0,0);//Ouverture pince arrière haute
00724     doAction(112,0,0);//Ouverture pince arrière basse
00725     doAction(114,0,0);//Ouverture porte arrière
00726     doAction(100,0,0);//Ouvrir les portes avant
00727     doAction(102,0,0);//Remonter le peigne
00728 }
00729 
00730 #endif