carte_strategie_2019
Dependencies: mbed SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac
Diff: Strategie/Strategie.cpp
- Revision:
- 23:ab87d308eaf9
- Parent:
- 22:a466d08ac42b
- Child:
- 24:4a28a72781a6
--- a/Strategie/Strategie.cpp Thu May 25 14:40:49 2017 +0000 +++ b/Strategie/Strategie.cpp Thu May 25 17:14:58 2017 +0000 @@ -25,8 +25,8 @@ //unsigned short id_check[NOMBRE_CARTES]= {CHECK_BALISE,CHECK_MOTEUR,CHECK_ACTIONNEURS,CHECK_AX12,CHECK_POMPES}; //unsigned short id_alive[NOMBRE_CARTES]= {ALIVE_BALISE,ALIVE_MOTEUR,ALIVE_ACTIONNEURS,ALIVE_AX12,ALIVE_POMPES}; -unsigned short id_check[NOMBRE_CARTES]= {CHECK_MOTEUR,CHECK_MOTEUR}; -unsigned short id_alive[NOMBRE_CARTES]= {ALIVE_MOTEUR,ALIVE_MOTEUR}; +unsigned short id_check[NOMBRE_CARTES]= {CHECK_MOTEUR,CHECK_BALISE,CHECK_ACTIONNEURS_AVANT,CHECK_ACTIONNEURS_ARRIERE}; +unsigned short id_alive[NOMBRE_CARTES]= {ALIVE_MOTEUR,ALIVE_BALISE,ALIVE_ACTIONNEURS_AVANT,ALIVE_ACTIONNEURS_ARRIERE}; InterruptIn jack(p25); // entrée analogique en interruption pour le jack #else @@ -306,12 +306,16 @@ } } localData1 = ((instruction.direction == LEFT)?1:-1); + localData2 = instruction.arg3; if(InversStrat == 1) { localData1 = -localData1;//Inversion de la direction + #ifdef ROBOT_BIG + localData2 = -localData2; + #endif } - BendRadius(instruction.arg1, instruction.arg3, localData1, localData5); + BendRadius(instruction.arg1, localData2, localData1, localData5); break; case MV_LINE://Ligne droite waitingAckID = ASSERVISSEMENT_RECALAGE; @@ -350,10 +354,11 @@ } } - + #ifdef ROBOT_SMALL if(InversStrat == 1) { localData2 = -localData2; } + #endif Rotate(localData2); waitingAckID = ASSERVISSEMENT_ROTATION; waitingAckFrom = ACKNOWLEDGE_MOTEUR; @@ -372,6 +377,14 @@ localData3 = instruction.arg2; localData2 = instruction.arg3; } + + #ifdef ROBOT_BIG + if(InversStrat == 1) { + localData1 = -localData1; + localData3 = -localData3; + } + #endif + GoToPosition(instruction.arg1,localData3,localData2,localData1); waitingAckID = ASSERVISSEMENT_XYT; waitingAckFrom = ACKNOWLEDGE_MOTEUR; @@ -658,16 +671,18 @@ switch(msgRxBuffer[FIFO_lecture].id) { case DEBUG_FAKE_JAKE://Permet de lancer le match à distance + case GLOBAL_JACK: if(gameEtat == ETAT_GAME_WAIT_FOR_JACK) { gameEtat = ETAT_GAME_START; + SendRawId(ACKNOWLEDGE_JACK); } break; case ALIVE_BALISE: case ALIVE_MOTEUR: case ALIVE_IHM: - case ALIVE_ACTIONNEURS: - case ALIVE_POMPES: + case ALIVE_ACTIONNEURS_AVANT: + case ALIVE_ACTIONNEURS_ARRIERE: case ALIVE_AX12: case ECRAN_ALL_CHECK: if(waitingAckFrom == msgRxBuffer[FIFO_lecture].id) {