code avec modifs, programme mit dans les robots pour les derniers matchs

Dependencies:   mbed SerialHalfDuplex SDFileSystem liaison_Bluetooth ident_crac DISCO-F469NI_portrait

Revision:
14:6aa8aa1699ad
Parent:
11:848ea39838bf
Child:
15:5ece9c3ba389
--- a/Robots/Strategie_small.cpp	Wed Mar 04 12:38:22 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-#include "global.h"
-
-#ifdef ROBOT_SMALL
-
-unsigned short distance_recalage;
-unsigned short distance_revenir;
-
-unsigned short x;
-unsigned short y;
-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                      */
-/****************************************************************************************/
-void doFunnyAction(void)
-{
-
-
-}
-
-
-/*************************************************************************************************/
-/* 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)
-{
-    int retour = 1;
-    CANMessage msgTx=CANMessage();
-    msgTx.format=CANStandard;
-    msgTx.type=CANData;
-    //SendMsgCan(0x5BB, &id,1);
-    switch(id) {
-        case 101: //bras gabarit
-            SendRawId(GABARIT_PETIT_ROBOT);
-            break;
-        case 102: //attraper presentoir avant
-            SendRawId(PRESENTOIR_AVANT);
-            break;
-        case 103: //attraper presentoir arriere
-            SendRawId(PRESENTOIR_ARRIERE);
-            break;
-        case 104: //balance avant
-            SendRawId(BALANCE_AVANT);
-            break;
-        case 105: //balance arriere
-            SendRawId(BALANCE_ARRIERE);
-            break;
-        case 106: //accelerateur avant
-            //SendRawId(ACCELERATEUR_AVANT);
-            distance_recalage=arg1;
-            distance_revenir=arg2;
-            Send2Short(ACCELERATEUR_AVANT, distance_recalage,distance_revenir);
-            break;
-        case 107: //accelerateur arriere
-            distance_recalage=arg1;
-            distance_revenir=arg2;
-            Send2Short(ACCELERATEUR_ARRIERE, distance_recalage,distance_revenir);
-            break;
-        case 108: //goldenium avant
-            //SendRawId(GOLDENIUM_AVANT);
-            x = arg1;
-            if(InversStrat == 1) {
-                y = 3000 - arg2;
-            } else {
-                y = arg2;
-            }
-            Send2Short(GOLDENIUM_AVANT, x, y);
-            break;
-        case 109: //goldenium arriere
-            x=arg1;
-            y=arg2;
-            Send2Short(GOLDENIUM_ARRIERE, x,y);
-            break;
-        case 110: //sol avant
-            SendRawId(SOL_AVANT);
-            break;
-        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 114://relache les 3 ventouses avants
-            SendRawId(AVANT_RELACHE);
-            break;
-
-        case 115://relache les 3 ventouses arrieres
-            SendRawId(ARRIERE_RELACHE);
-            break;
-
-        case 116://relache une pompe
-            unsigned char arg_tempo;
-            if(InversStrat == 1) {
-                switch(arg1) {
-                    case AV_DROIT:
-                        arg_tempo = AV_GAUCHE;
-                        break;
-                    case AV_GAUCHE:
-                        arg_tempo = AV_DROIT;
-                        break;
-                    case AR_DROIT:
-                        arg_tempo = AR_GAUCHE;
-                        break;
-                    case AR_GAUCHE:
-                        arg_tempo = AR_DROIT;
-                        break;
-                    default :
-                        arg_tempo =(unsigned char)arg1;
-                        break;
-                }
-
-            } else arg_tempo =(unsigned char)arg1;
-            SendMsgCan(HACHEUR_RELEASE_ATOM, &arg_tempo,1);
-            waitingAckFrom = 0;
-            waitingAckID =0;
-            break;
-        case 117:
-            SendRawId(RECROQUEVILLER);
-            break;
-        case 118:
-            SendRawId(VENTOUSE_AV_CENTRE_BALANCE);
-            break;
-        case 119:
-            SendRawId(VENTOUSE_AR_CENTRE_BALANCE);
-            break;
-        case 120:
-            SendRawId(ACCELERATEUR_INSERTION_AVANT_GAUCHE);
-            break;
-
-        case 121:
-            SendRawId(ACCELERATEUR_INSERTION_ARRIERE_GAUCHE);
-            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;
-
-        case 201 :
-            SendRawId(0x99);//
-            retour = 2;
-            break;
-
-
-        case 11://0 Désactiver le stop,1 Activer le stop saut de strat,2 Activer le stop avec evitement
-            isStopEnable =(unsigned char) arg1;
-            // SendMsgCan(0x5BC, &isStopEnable,1);
-            waitingAckFrom = 0;
-            waitingAckID =0;
-            break;
-
-
-
-        case 20://Désactiver l'asservissement
-            setAsservissementEtat(0);
-            break;
-
-        case 21://Activer l'asservissement
-            setAsservissementEtat(1);
-            break;
-
-        case 22://Changer la vitesse du robot
-            SendSpeed(arg1);//,(unsigned short)arg2, (unsigned short)arg2);
-            wait_us(200);
-            waitingAckFrom = 0;
-            waitingAckID = 0;
-            break;
-        case 23:
-            SendAccel(arg1,(unsigned short)arg2);//,(unsigned short)arg2, (unsigned short)arg2);
-            wait_us(200);
-            waitingAckFrom = 0;
-            waitingAckID = 0;
-            break;
-
-
-        case 19: // CHANGER LA VITESSE + DECELERATION
-            //SendSpeedDecel(arg1,(unsigned short) arg2);
-            wait_us(200);
-            waitingAckFrom = 0;
-            waitingAckID =0;
-            break;
-
-        case 30://Action tempo
-            wait_ms(arg1);
-            waitingAckFrom = 0;
-            waitingAckID = 0;
-            break;
-
-        default:
-            retour = 0;//L'action n'existe pas, il faut utiliser le CAN
-
-    }
-    return retour;//L'action est spécifique.
-
-}
-
-
-
-/****************************************************************************************/
-/* FUNCTION NAME: needToStop                                                            */
-/* DESCRIPTION  : Savoir si il faut autoriser le stop du robot via balise               */
-/****************************************************************************************/
-unsigned char needToStop(void)
-{
-    return isStopEnable;
-}
-
-/****************************************************************************************/
-/* FUNCTION NAME: doBeforeEndAction                                                     */
-/* DESCRIPTION  : Terminer les actions du robot 1s avant la fin du match                */
-/****************************************************************************************/
-void doBeforeEndAction(void)
-{
-
-}
-
-#endif