homologation gros robot et test avec les ack de la carte a tout faire
Fork of CRAC-Strat_2017_HOMOLOGATION_PETIT_ROBOT by
Revision 21:7c60d6dfcab5, committed 2017-05-25
- Comitter:
- ClementBreteau
- Date:
- Thu May 25 06:36:48 2017 +0000
- Parent:
- 20:de595e4ff01d
- Commit message:
- homologation gros robot avec test au niveau des ack
Changed in this revision
--- a/Globals/constantes.h Wed May 24 21:09:59 2017 +0000 +++ b/Globals/constantes.h Thu May 25 06:36:48 2017 +0000 @@ -20,12 +20,12 @@ /**** ** Variable à modifier en fonction du robot ***/ -//#define ROBOT_BIG//Indique que l'on va compiler pour le gros robot -#define ROBOT_SMALL +#define ROBOT_BIG//Indique que l'on va compiler pour le gros robot +//#define ROBOT_SMALL #ifdef ROBOT_BIG - #define NOMBRE_CARTES 2//Le nombre de carte présente sur le gros robot + #define NOMBRE_CARTES 4//Le nombre de carte présente sur le gros robot //#define POSITION_DEBUT_X 1830 //#define POSITION_DEBUT_Y 900 //#define POSITION_DEBUT_T 180
--- a/Globals/ident_crac.h Wed May 24 21:09:59 2017 +0000 +++ b/Globals/ident_crac.h Thu May 25 06:36:48 2017 +0000 @@ -7,6 +7,8 @@ #define GLOBAL_START 0x002 // Start #define GLOBAL_END_INIT_POSITION 0x005 // Fin positionnement robot avant depart #define GLOBAL_FUNNY_ACTION 0x007 // Funny action start (0: start, 1: stop) +#define GLOBAL_JACK 0x008 +#define ACKNOWLEDGE_JACK 0x009 #define BALISE_STOP 0x003 // Trame stop
--- a/Robots/Strategie_big.cpp Wed May 24 21:09:59 2017 +0000 +++ b/Robots/Strategie_big.cpp Thu May 25 06:36:48 2017 +0000 @@ -4,7 +4,7 @@ #include "Config_big.h" unsigned char isStopEnable = 1;//Permet de savoir si il faut autoriser le stop via les balises - +unsigned short telemetreDistance; /****************************************************************************************/ /* FUNCTION NAME: doFunnyAction */ /* DESCRIPTION : Permet de faire la funny action en fin de partie */ @@ -364,7 +364,7 @@ } msgTx.data[0]=localData; - msgTx.data[1]=speed; + msgTx.data[1]=localData2; can1.write(msgTx); break; @@ -606,14 +606,7 @@ /****************************************************************************************/ void initRobotActionneur(void) { - wait(2); - doAction(101,1,0);// preparation prise pince arriere - doAction(101,0,0);// preparation prise pince avant - doAction(130,0,0);// baisser aspitr - wait(2); - doAction(100,1,0);// preparation prise pince arriere - doAction(100,0,0);// preparation prise pince avant - doAction(131,0,0);// baisser aspitr + } /****************************************************************************************/
--- a/Robots/Strategie_small.cpp Wed May 24 21:09:59 2017 +0000 +++ b/Robots/Strategie_small.cpp Thu May 25 06:36:48 2017 +0000 @@ -3,7 +3,7 @@ #include "Config_small.h" unsigned char isStopEnable = 1;//Permet de savoir si il faut autoriser le stop via les balises -unsigned short telemetreDistance; +//unsigned short telemetreDistance; /****************************************************************************************/
--- a/Strategie/Strategie.cpp Wed May 24 21:09:59 2017 +0000 +++ b/Strategie/Strategie.cpp Thu May 25 06:36:48 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_POMPES,CHECK_ACTIONNEURS}; +unsigned short id_alive[NOMBRE_CARTES]= {ALIVE_MOTEUR,ALIVE_BALISE,ALIVE_POMPES,ALIVE_ACTIONNEURS}; InterruptIn jack(p25); // entrée analogique en interruption pour le jack #else @@ -222,6 +222,7 @@ Il est aussi possible d'envoyer les ordres de debug */ modeTelemetre = 0; + telemetreDistance = 0; break; case ETAT_GAME_INIT: //On charge la liste des instructions @@ -410,8 +411,9 @@ gameEtat = ETAT_GAME_LOAD_NEXT_INSTRUCTION; #endif return; - #ifdef ROBOT_SMALL + } else if (tempo == 2) { + #ifdef ROBOT_SMALL // on est dans le cas de l'avance selon le telemetre waitingAckID = ASSERVISSEMENT_RECALAGE; waitingAckFrom = ACKNOWLEDGE_MOTEUR; @@ -420,7 +422,7 @@ GoStraight(telemetreDistance, 0, 0, 0); // on reset la distance du telemetre à 0 telemetreDistance = 5000; - #endif + #endif }else{ //C'est un AX12 qu'il faut bouger //AX12_setGoal(instruction.arg1,instruction.arg3/10,instruction.arg2); @@ -652,8 +654,10 @@ 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; @@ -775,7 +779,7 @@ if(gameEtat > ETAT_GAME_START && gameEtat != ETAT_WARNING_TIMEOUT) { SendRawId(ASSERVISSEMENT_STOP); - //while(1); + while(1); // while(1) pour se stop avec la balise gameEtat = ETAT_WARNING_TIMEOUT; if(gameEtat != ETAT_WARING_END_BALISE_WAIT) { timeoutWarning.reset();