Programme carte strategie (disco)
Dependencies: mbed SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac
Diff: Robots/Strategie_small.cpp
- Revision:
- 46:a9b6bcb30b1c
- Parent:
- 45:4f93e99bac6e
- Child:
- 50:a5361ffeefc8
--- a/Robots/Strategie_small.cpp Thu May 09 08:38:45 2019 +0000 +++ b/Robots/Strategie_small.cpp Thu May 09 17:21:32 2019 +0000 @@ -11,9 +11,10 @@ /* FUNCTION NAME: doFunnyAction */ /* DESCRIPTION : Permet de faire la funny action en fin de partie */ /****************************************************************************************/ -void doFunnyAction(void) { - - +void doFunnyAction(void) +{ + + } @@ -21,17 +22,18 @@ /* FUNCTION NAME: doAction */ /* DESCRIPTION : Effectuer une action specifique correspondant au numéro dans le fichier strat */ /*************************************************************************************************/ -unsigned char doAction(unsigned char id, unsigned short arg1, short arg2) { +unsigned char doAction(unsigned char id, unsigned short arg1, short arg2) +{ int retour = 1; CANMessage msgTx=CANMessage(); msgTx.format=CANStandard; msgTx.type=CANData; switch(id) { case 101: //bras gabarit - SendRawId(GABARIT_PETIT_ROBOT); + SendRawId(GABARIT_PETIT_ROBOT); break; case 102: //attraper presentoir avant - SendRawId(PRESENTOIR_AVANT); + SendRawId(PRESENTOIR_AVANT); break; case 103: //attraper presentoir arriere SendRawId(PRESENTOIR_ARRIERE); @@ -60,65 +62,71 @@ case 111: //sol arriere SendRawId(SOL_ARRIERE); break; - + case 112: //sol avant relache + SendRawId(SOL_AVANT_RELACHE); + break; + case 113: //sol arriere relache + SendRawId(SOL_ARRIERE_RELACHE); + break; + case 150: SCORE_PR+=arg1; liaison_Tx.envoyer_short(0x30,SCORE_PR); waitingAckFrom = 0; waitingAckID = 0; break; - - + + case 200 : SendRawId(DATA_TELEMETRE); /*telemetreDistance = dataTelemetre(); wait_ms(1); telemetreDistance = dataTelemetre(); telemetreDistance = telemetreDistance - 170;*/ - break; - + break; + case 201 : SendRawId(0x99); retour = 2; - break; - + break; + case 10://Désactiver le stop isStopEnable = 0; - break; + break; case 11://Activer le stop isStopEnable = 1; - break; + break; case 20://Désactiver l'asservissement setAsservissementEtat(0); - break; + break; case 21://Activer l'asservissement setAsservissementEtat(1); - break; - + break; + case 22://Changer la vitesse du robot SendSpeed(arg1,(unsigned short)arg2); wait_us(200); waitingAckFrom = 0; waitingAckID = 0; - break; - - case 19: // CHANGER LA VITESSE + DECELERATION + break; + + case 19: // CHANGER LA VITESSE + DECELERATION SendSpeedDecel(arg1,(unsigned short) arg2); wait_us(200); waitingAckFrom = 0; waitingAckID =0; - break; - + break; + case 30://Action tempo wait_ms(arg1); - break; - + break; + default: retour = 0;//L'action n'existe pas, il faut utiliser le CAN - + } return retour;//L'action est spécifique. - + } @@ -138,7 +146,7 @@ /****************************************************************************************/ void doBeforeEndAction(void) { - + } #endif