code petit robot pour homologation
Fork of CRAC-Strat_2017_V2 by
Robots/Strategie_small.cpp@15:c2fc239e85df, 2017-05-11 (annotated)
- Committer:
- ClementBreteau
- Date:
- Thu May 11 12:55:52 2017 +0000
- Revision:
- 15:c2fc239e85df
- Parent:
- 12:14729d584500
- Child:
- 16:7321fb3bb396
crac strat le 11/05/17
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
antbig | 3:19f2285a4757 | 1 | #include "StrategieManager.h" |
antbig | 3:19f2285a4757 | 2 | #ifdef ROBOT_SMALL |
antbig | 3:19f2285a4757 | 3 | #include "Config_small.h" |
antbig | 3:19f2285a4757 | 4 | |
antbig | 12:14729d584500 | 5 | unsigned char isStopEnable = 1;//Permet de savoir si il faut autoriser le stop via les balises |
antbig | 12:14729d584500 | 6 | |
antbig | 3:19f2285a4757 | 7 | /****************************************************************************************/ |
antbig | 3:19f2285a4757 | 8 | /* FUNCTION NAME: doFunnyAction */ |
antbig | 3:19f2285a4757 | 9 | /* DESCRIPTION : Permet de faire la funny action en fin de partie */ |
antbig | 3:19f2285a4757 | 10 | /****************************************************************************************/ |
antbig | 3:19f2285a4757 | 11 | void doFunnyAction(void) { |
antbig | 3:19f2285a4757 | 12 | |
antbig | 3:19f2285a4757 | 13 | |
antbig | 3:19f2285a4757 | 14 | } |
antbig | 10:a788d9cf60f2 | 15 | //L'angle est entre 0 et 1023 |
antbig | 10:a788d9cf60f2 | 16 | void XL320_setGoal(unsigned char id, unsigned short angle); |
antbig | 10:a788d9cf60f2 | 17 | |
antbig | 10:a788d9cf60f2 | 18 | void XL320_setGoal(unsigned char id, unsigned short angle) |
antbig | 10:a788d9cf60f2 | 19 | { |
antbig | 10:a788d9cf60f2 | 20 | CANMessage msgTx=CANMessage(); |
antbig | 10:a788d9cf60f2 | 21 | msgTx.id=SERVO_XL320; |
antbig | 10:a788d9cf60f2 | 22 | msgTx.len=3; |
antbig | 10:a788d9cf60f2 | 23 | msgTx.format=CANStandard; |
antbig | 10:a788d9cf60f2 | 24 | msgTx.type=CANData; |
antbig | 10:a788d9cf60f2 | 25 | msgTx.data[0]=(unsigned char)id; |
antbig | 10:a788d9cf60f2 | 26 | // from sur 2 octets |
antbig | 10:a788d9cf60f2 | 27 | msgTx.data[1]=(unsigned char)angle; |
antbig | 10:a788d9cf60f2 | 28 | msgTx.data[2]=(unsigned char)(angle>>8); |
antbig | 10:a788d9cf60f2 | 29 | |
antbig | 10:a788d9cf60f2 | 30 | can1.write(msgTx); |
antbig | 10:a788d9cf60f2 | 31 | } |
antbig | 3:19f2285a4757 | 32 | |
antbig | 3:19f2285a4757 | 33 | /****************************************************************************************/ |
antbig | 3:19f2285a4757 | 34 | /* FUNCTION NAME: doAction */ |
antbig | 3:19f2285a4757 | 35 | /* DESCRIPTION : Effectuer une action specifique */ |
antbig | 3:19f2285a4757 | 36 | /****************************************************************************************/ |
antbig | 3:19f2285a4757 | 37 | unsigned char doAction(unsigned char id, unsigned short speed, short angle) { |
antbig | 3:19f2285a4757 | 38 | switch(id) { |
ClementBreteau | 15:c2fc239e85df | 39 | case 100: // preparation prise bras central |
ClementBreteau | 15:c2fc239e85df | 40 | Preparation_prise(); |
ClementBreteau | 15:c2fc239e85df | 41 | break; |
ClementBreteau | 15:c2fc239e85df | 42 | case 101:// stockage haut bras central |
ClementBreteau | 15:c2fc239e85df | 43 | Stockage_haut(); |
ClementBreteau | 15:c2fc239e85df | 44 | break; |
ClementBreteau | 15:c2fc239e85df | 45 | case 102:// stockage bas bras central |
ClementBreteau | 15:c2fc239e85df | 46 | Stockage_bas(); |
ClementBreteau | 15:c2fc239e85df | 47 | break; |
ClementBreteau | 15:c2fc239e85df | 48 | case 103:// ouvrir la main du bras cental |
ClementBreteau | 15:c2fc239e85df | 49 | Deposer(); |
ClementBreteau | 15:c2fc239e85df | 50 | break; |
ClementBreteau | 15:c2fc239e85df | 51 | case 104:// preparation de depot du module bas du bras central |
ClementBreteau | 15:c2fc239e85df | 52 | Preparation_depot_bas(); |
ClementBreteau | 15:c2fc239e85df | 53 | break; |
ClementBreteau | 15:c2fc239e85df | 54 | case 105:// preparation de depot du module haut du bras central |
ClementBreteau | 15:c2fc239e85df | 55 | Preparation_depot_haut(); |
ClementBreteau | 15:c2fc239e85df | 56 | break; |
ClementBreteau | 15:c2fc239e85df | 57 | case 106:// positionner le bras afin de pousser un module debout |
ClementBreteau | 15:c2fc239e85df | 58 | Pousser_module(); |
ClementBreteau | 15:c2fc239e85df | 59 | break; |
ClementBreteau | 15:c2fc239e85df | 60 | case 110:// ouvrir une porte avant |
antbig | 11:ed13a480ddca | 61 | if(InversStrat == 1) {//Si c'est inversé, On utilise le bras coté droit |
ClementBreteau | 15:c2fc239e85df | 62 | if(speed == 1) speed = 0; |
ClementBreteau | 15:c2fc239e85df | 63 | else speed = 1; |
antbig | 3:19f2285a4757 | 64 | } else { |
ClementBreteau | 15:c2fc239e85df | 65 | |
antbig | 3:19f2285a4757 | 66 | } |
antbig | 3:19f2285a4757 | 67 | break; |
ClementBreteau | 15:c2fc239e85df | 68 | case 111:// securiser un module avec une porte avant |
antbig | 11:ed13a480ddca | 69 | if(InversStrat == 1) {//Si c'est inversé, On utilise le bras coté droit |
ClementBreteau | 15:c2fc239e85df | 70 | if(speed == 1) speed = 0; |
ClementBreteau | 15:c2fc239e85df | 71 | else speed = 1; |
ClementBreteau | 15:c2fc239e85df | 72 | } else { |
ClementBreteau | 15:c2fc239e85df | 73 | |
antbig | 11:ed13a480ddca | 74 | } |
antbig | 10:a788d9cf60f2 | 75 | break; |
ClementBreteau | 15:c2fc239e85df | 76 | case 112:// ranger le porte avant dans le robot |
antbig | 11:ed13a480ddca | 77 | if(InversStrat == 1) {//Si c'est inversé, On utilise le bras coté droit |
ClementBreteau | 15:c2fc239e85df | 78 | if(speed == 1) speed = 0; |
ClementBreteau | 15:c2fc239e85df | 79 | else speed = 1; |
antbig | 11:ed13a480ddca | 80 | } else { |
ClementBreteau | 15:c2fc239e85df | 81 | |
antbig | 11:ed13a480ddca | 82 | } |
antbig | 11:ed13a480ddca | 83 | break; |
ClementBreteau | 15:c2fc239e85df | 84 | case 120:// poser une main tourneuse |
antbig | 11:ed13a480ddca | 85 | if(InversStrat == 1) {//Si c'est inversé, On utilise le bras coté droit |
ClementBreteau | 15:c2fc239e85df | 86 | if(speed == 1) speed = 0; |
ClementBreteau | 15:c2fc239e85df | 87 | else speed = 1; |
antbig | 11:ed13a480ddca | 88 | } else { |
ClementBreteau | 15:c2fc239e85df | 89 | |
antbig | 11:ed13a480ddca | 90 | } |
antbig | 5:dcd817534b57 | 91 | break; |
antbig | 10:a788d9cf60f2 | 92 | |
ClementBreteau | 15:c2fc239e85df | 93 | case 121:// relever une main tourneuse |
ClementBreteau | 15:c2fc239e85df | 94 | if(InversStrat == 1) {//Si c'est inversé, On utilise le bras coté droit |
ClementBreteau | 15:c2fc239e85df | 95 | if(speed == 1) speed = 0; |
ClementBreteau | 15:c2fc239e85df | 96 | else speed = 1; |
antbig | 11:ed13a480ddca | 97 | } else { |
ClementBreteau | 15:c2fc239e85df | 98 | |
antbig | 11:ed13a480ddca | 99 | } |
antbig | 10:a788d9cf60f2 | 100 | break; |
antbig | 10:a788d9cf60f2 | 101 | |
ClementBreteau | 15:c2fc239e85df | 102 | case 122:// tourner un module |
ClementBreteau | 15:c2fc239e85df | 103 | if(InversStrat == 1) {//Si c'est inversé, On utilise le bras coté droit |
ClementBreteau | 15:c2fc239e85df | 104 | if(speed == 1) speed = 0; |
ClementBreteau | 15:c2fc239e85df | 105 | else speed = 1; |
antbig | 11:ed13a480ddca | 106 | } else { |
ClementBreteau | 15:c2fc239e85df | 107 | |
antbig | 11:ed13a480ddca | 108 | } |
antbig | 10:a788d9cf60f2 | 109 | break; |
ClementBreteau | 15:c2fc239e85df | 110 | |
antbig | 12:14729d584500 | 111 | case 10://Désactiver le stop |
antbig | 12:14729d584500 | 112 | isStopEnable = 0; |
antbig | 12:14729d584500 | 113 | break; |
antbig | 12:14729d584500 | 114 | case 11://Activer le stop |
antbig | 12:14729d584500 | 115 | isStopEnable = 1; |
antbig | 12:14729d584500 | 116 | break; |
antbig | 12:14729d584500 | 117 | case 20://Désactiver l'asservissement |
antbig | 12:14729d584500 | 118 | setAsservissementEtat(0); |
antbig | 12:14729d584500 | 119 | break; |
antbig | 12:14729d584500 | 120 | case 21://Activer l'asservissement |
antbig | 12:14729d584500 | 121 | setAsservissementEtat(1); |
antbig | 12:14729d584500 | 122 | break; |
antbig | 10:a788d9cf60f2 | 123 | |
antbig | 3:19f2285a4757 | 124 | default: |
antbig | 10:a788d9cf60f2 | 125 | return 0;//L'action n'existe pas, il faut utiliser le CAN |
antbig | 3:19f2285a4757 | 126 | |
antbig | 3:19f2285a4757 | 127 | } |
antbig | 11:ed13a480ddca | 128 | return 1;//L'action est spécifique. |
antbig | 3:19f2285a4757 | 129 | |
antbig | 3:19f2285a4757 | 130 | } |
antbig | 3:19f2285a4757 | 131 | |
antbig | 3:19f2285a4757 | 132 | /****************************************************************************************/ |
antbig | 3:19f2285a4757 | 133 | /* FUNCTION NAME: initRobot */ |
antbig | 3:19f2285a4757 | 134 | /* DESCRIPTION : initialiser le robot */ |
antbig | 3:19f2285a4757 | 135 | /****************************************************************************************/ |
antbig | 3:19f2285a4757 | 136 | void initRobot(void) { |
antbig | 3:19f2285a4757 | 137 | /** |
antbig | 3:19f2285a4757 | 138 | On enregistre les id des AX12 présent sur la carte |
antbig | 3:19f2285a4757 | 139 | **/ |
ClementBreteau | 15:c2fc239e85df | 140 | /*AX12_register(1,AX12_SERIAL1,0x0FF); |
antbig | 5:dcd817534b57 | 141 | AX12_register(2,AX12_SERIAL1); |
antbig | 5:dcd817534b57 | 142 | AX12_register(18,AX12_SERIAL1); |
antbig | 5:dcd817534b57 | 143 | AX12_register(4,AX12_SERIAL2); |
antbig | 5:dcd817534b57 | 144 | AX12_register(16,AX12_SERIAL2); |
ClementBreteau | 15:c2fc239e85df | 145 | AX12_register(17,AX12_SERIAL2,0x0FF);*/ |
antbig | 12:14729d584500 | 146 | |
antbig | 12:14729d584500 | 147 | //runRobotTest(); |
antbig | 12:14729d584500 | 148 | |
antbig | 5:dcd817534b57 | 149 | /* |
antbig | 5:dcd817534b57 | 150 | AX12_setGoal(AX12_ID_BRAS_BASE_INV,278,0x0FF); |
antbig | 5:dcd817534b57 | 151 | AX12_setGoal(AX12_ID_BRAS_RELACHEUR_INV,160);//fermer le bras |
antbig | 5:dcd817534b57 | 152 | AX12_setGoal(AX12_ID_BRAS_BASE,278,0x0FF); |
antbig | 5:dcd817534b57 | 153 | AX12_setGoal(AX12_ID_BRAS_RELACHEUR,160);//fermer le bras |
antbig | 5:dcd817534b57 | 154 | AX12_processChange();*/ |
antbig | 3:19f2285a4757 | 155 | } |
antbig | 3:19f2285a4757 | 156 | |
antbig | 4:88431b537477 | 157 | /****************************************************************************************/ |
antbig | 12:14729d584500 | 158 | /* FUNCTION NAME: initRobotActionneur */ |
antbig | 12:14729d584500 | 159 | /* DESCRIPTION : Initialiser la position des actionneurs du robot */ |
antbig | 12:14729d584500 | 160 | /****************************************************************************************/ |
antbig | 12:14729d584500 | 161 | void initRobotActionneur(void) |
antbig | 12:14729d584500 | 162 | { |
ClementBreteau | 15:c2fc239e85df | 163 | /*XL320_setGoal(XL320_ID_PINCE_GAUCHE, XL320_ANGLE_PINCE_GAUCHE_FERMER); |
antbig | 12:14729d584500 | 164 | XL320_setGoal(XL320_ID_PINCE_DROITE, XL320_ANGLE_PINCE_DROITE_FERMER); |
antbig | 12:14729d584500 | 165 | |
antbig | 12:14729d584500 | 166 | AX12_setGoal( |
antbig | 12:14729d584500 | 167 | AX12_ID_BRAS_RELACHEUR_DROIT, |
antbig | 12:14729d584500 | 168 | AX12_ANGLE_BRAS_RELACHEUR_DROIT_REPLIER, |
antbig | 12:14729d584500 | 169 | AX12_SPEED_BRAS_RELACHEUR |
antbig | 12:14729d584500 | 170 | ); |
antbig | 12:14729d584500 | 171 | AX12_setGoal( |
antbig | 12:14729d584500 | 172 | AX12_ID_BRAS_RELACHEUR_GAUCHE, |
antbig | 12:14729d584500 | 173 | AX12_ANGLE_BRAS_RELACHEUR_GAUCHE_REPLIER, |
antbig | 12:14729d584500 | 174 | AX12_SPEED_BRAS_RELACHEUR |
antbig | 12:14729d584500 | 175 | ); |
antbig | 12:14729d584500 | 176 | AX12_setGoal( |
antbig | 12:14729d584500 | 177 | AX12_ID_BRAS_BASE_DROIT, |
antbig | 12:14729d584500 | 178 | AX12_ANGLE_BRAS_BASE_DROIT_REPLIER, |
antbig | 12:14729d584500 | 179 | AX12_SPEED_BRAS_BASE |
antbig | 12:14729d584500 | 180 | ); |
antbig | 12:14729d584500 | 181 | AX12_setGoal( |
antbig | 12:14729d584500 | 182 | AX12_ID_BRAS_BASE_GAUCHE, |
antbig | 12:14729d584500 | 183 | AX12_ANGLE_BRAS_BASE_GAUCHE_REPLIER, |
antbig | 12:14729d584500 | 184 | AX12_SPEED_BRAS_RELACHEUR |
antbig | 12:14729d584500 | 185 | ); |
antbig | 12:14729d584500 | 186 | AX12_setGoal( |
antbig | 12:14729d584500 | 187 | AX12_ID_PALET_DROIT, |
antbig | 12:14729d584500 | 188 | AX12_ANGLE_PALET_DROIT_FERMER, |
antbig | 12:14729d584500 | 189 | AX12_SPEED_PALET |
antbig | 12:14729d584500 | 190 | ); |
antbig | 12:14729d584500 | 191 | AX12_setGoal( |
antbig | 12:14729d584500 | 192 | AX12_ID_PALET_GAUCHE, |
antbig | 12:14729d584500 | 193 | AX12_ANGLE_PALET_GAUCHE_FERMER, |
antbig | 12:14729d584500 | 194 | AX12_SPEED_PALET |
antbig | 12:14729d584500 | 195 | ); |
ClementBreteau | 15:c2fc239e85df | 196 | AX12_processChange(); */ |
antbig | 12:14729d584500 | 197 | } |
antbig | 12:14729d584500 | 198 | |
antbig | 12:14729d584500 | 199 | /****************************************************************************************/ |
antbig | 9:d0042422d95a | 200 | /* FUNCTION NAME: runTest */ |
antbig | 9:d0042422d95a | 201 | /* DESCRIPTION : tester l'ensemble des actionneurs du robot */ |
antbig | 9:d0042422d95a | 202 | /****************************************************************************************/ |
antbig | 9:d0042422d95a | 203 | void runRobotTest(void) |
antbig | 9:d0042422d95a | 204 | { |
ClementBreteau | 15:c2fc239e85df | 205 | /*XL320_setGoal(XL320_ID_PINCE_GAUCHE, XL320_ANGLE_PINCE_GAUCHE_SECURISE); |
antbig | 12:14729d584500 | 206 | XL320_setGoal(XL320_ID_PINCE_DROITE, XL320_ANGLE_PINCE_DROITE_SECURISE); |
antbig | 9:d0042422d95a | 207 | |
antbig | 12:14729d584500 | 208 | wait_ms(200); |
antbig | 12:14729d584500 | 209 | |
antbig | 12:14729d584500 | 210 | XL320_setGoal(XL320_ID_PINCE_GAUCHE, XL320_ANGLE_PINCE_GAUCHE_FERMER); |
antbig | 12:14729d584500 | 211 | XL320_setGoal(XL320_ID_PINCE_DROITE, XL320_ANGLE_PINCE_DROITE_FERMER); |
antbig | 12:14729d584500 | 212 | |
antbig | 12:14729d584500 | 213 | wait_ms(200); |
antbig | 12:14729d584500 | 214 | |
antbig | 12:14729d584500 | 215 | AX12_setGoal( |
antbig | 12:14729d584500 | 216 | AX12_ID_BRAS_BASE_DROIT, |
antbig | 12:14729d584500 | 217 | AX12_ANGLE_BRAS_BASE_DROIT_MOITER, |
antbig | 12:14729d584500 | 218 | AX12_SPEED_BRAS_BASE |
antbig | 12:14729d584500 | 219 | ); |
antbig | 12:14729d584500 | 220 | AX12_setGoal( |
antbig | 12:14729d584500 | 221 | AX12_ID_BRAS_BASE_GAUCHE, |
antbig | 12:14729d584500 | 222 | AX12_ANGLE_BRAS_BASE_GAUCHE_MOITER, |
antbig | 12:14729d584500 | 223 | AX12_SPEED_BRAS_BASE |
antbig | 12:14729d584500 | 224 | ); |
antbig | 12:14729d584500 | 225 | AX12_processChange(); |
antbig | 12:14729d584500 | 226 | |
antbig | 12:14729d584500 | 227 | wait_ms(500); |
antbig | 12:14729d584500 | 228 | |
antbig | 12:14729d584500 | 229 | AX12_setGoal( |
antbig | 12:14729d584500 | 230 | AX12_ID_BRAS_RELACHEUR_DROIT, |
antbig | 12:14729d584500 | 231 | AX12_ANGLE_BRAS_RELACHEUR_DROIT_OUVERT, |
antbig | 12:14729d584500 | 232 | AX12_SPEED_BRAS_RELACHEUR |
antbig | 12:14729d584500 | 233 | ); |
antbig | 12:14729d584500 | 234 | AX12_setGoal( |
antbig | 12:14729d584500 | 235 | AX12_ID_BRAS_RELACHEUR_GAUCHE, |
antbig | 12:14729d584500 | 236 | AX12_ANGLE_BRAS_RELACHEUR_GAUCHE_OUVERT, |
antbig | 12:14729d584500 | 237 | AX12_SPEED_BRAS_RELACHEUR |
antbig | 12:14729d584500 | 238 | ); |
antbig | 12:14729d584500 | 239 | AX12_processChange(); |
antbig | 12:14729d584500 | 240 | |
antbig | 12:14729d584500 | 241 | wait_ms(600); |
antbig | 12:14729d584500 | 242 | |
antbig | 12:14729d584500 | 243 | AX12_setGoal( |
antbig | 12:14729d584500 | 244 | AX12_ID_BRAS_RELACHEUR_DROIT, |
antbig | 12:14729d584500 | 245 | AX12_ANGLE_BRAS_RELACHEUR_DROIT_REPLIER, |
antbig | 12:14729d584500 | 246 | AX12_SPEED_BRAS_RELACHEUR |
antbig | 12:14729d584500 | 247 | ); |
antbig | 12:14729d584500 | 248 | AX12_setGoal( |
antbig | 12:14729d584500 | 249 | AX12_ID_BRAS_RELACHEUR_GAUCHE, |
antbig | 12:14729d584500 | 250 | AX12_ANGLE_BRAS_RELACHEUR_GAUCHE_REPLIER, |
antbig | 12:14729d584500 | 251 | AX12_SPEED_BRAS_RELACHEUR |
antbig | 12:14729d584500 | 252 | ); |
antbig | 12:14729d584500 | 253 | AX12_processChange(); |
antbig | 12:14729d584500 | 254 | |
antbig | 12:14729d584500 | 255 | wait_ms(500); |
antbig | 12:14729d584500 | 256 | |
antbig | 12:14729d584500 | 257 | AX12_setGoal( |
antbig | 12:14729d584500 | 258 | AX12_ID_BRAS_BASE_DROIT, |
antbig | 12:14729d584500 | 259 | AX12_ANGLE_BRAS_BASE_DROIT_REPLIER, |
antbig | 12:14729d584500 | 260 | AX12_SPEED_BRAS_BASE |
antbig | 12:14729d584500 | 261 | ); |
antbig | 12:14729d584500 | 262 | AX12_setGoal( |
antbig | 12:14729d584500 | 263 | AX12_ID_BRAS_BASE_GAUCHE, |
antbig | 12:14729d584500 | 264 | AX12_ANGLE_BRAS_BASE_GAUCHE_REPLIER, |
antbig | 12:14729d584500 | 265 | AX12_SPEED_BRAS_RELACHEUR |
antbig | 12:14729d584500 | 266 | ); |
antbig | 12:14729d584500 | 267 | AX12_processChange(); |
antbig | 12:14729d584500 | 268 | |
antbig | 12:14729d584500 | 269 | wait_ms(600); |
antbig | 12:14729d584500 | 270 | AX12_setGoal( |
antbig | 12:14729d584500 | 271 | AX12_ID_PALET_DROIT, |
antbig | 12:14729d584500 | 272 | AX12_ANGLE_PALET_DROIT_ROCHET, |
antbig | 12:14729d584500 | 273 | AX12_SPEED_PALET |
antbig | 12:14729d584500 | 274 | ); |
antbig | 12:14729d584500 | 275 | AX12_setGoal( |
antbig | 12:14729d584500 | 276 | AX12_ID_PALET_GAUCHE, |
antbig | 12:14729d584500 | 277 | AX12_ANGLE_PALET_GAUCHE_ROCHET, |
antbig | 12:14729d584500 | 278 | AX12_SPEED_PALET |
antbig | 12:14729d584500 | 279 | ); |
antbig | 12:14729d584500 | 280 | AX12_processChange(); |
antbig | 12:14729d584500 | 281 | |
antbig | 12:14729d584500 | 282 | wait_ms(500); |
antbig | 12:14729d584500 | 283 | |
antbig | 12:14729d584500 | 284 | AX12_setGoal( |
antbig | 12:14729d584500 | 285 | AX12_ID_PALET_DROIT, |
antbig | 12:14729d584500 | 286 | AX12_ANGLE_PALET_DROIT_FERMER, |
antbig | 12:14729d584500 | 287 | AX12_SPEED_PALET |
antbig | 12:14729d584500 | 288 | ); |
antbig | 12:14729d584500 | 289 | AX12_setGoal( |
antbig | 12:14729d584500 | 290 | AX12_ID_PALET_GAUCHE, |
antbig | 12:14729d584500 | 291 | AX12_ANGLE_PALET_GAUCHE_FERMER, |
antbig | 12:14729d584500 | 292 | AX12_SPEED_PALET |
antbig | 12:14729d584500 | 293 | ); |
ClementBreteau | 15:c2fc239e85df | 294 | AX12_processChange();*/ |
antbig | 9:d0042422d95a | 295 | } |
antbig | 9:d0042422d95a | 296 | |
antbig | 9:d0042422d95a | 297 | /****************************************************************************************/ |
antbig | 4:88431b537477 | 298 | /* FUNCTION NAME: SelectStrategy */ |
antbig | 4:88431b537477 | 299 | /* DESCRIPTION : Charger le fichier de stratégie correspondante à un id */ |
antbig | 4:88431b537477 | 300 | /* RETURN : 0=> Erreur, 1=> OK si le fichier existe */ |
antbig | 4:88431b537477 | 301 | /****************************************************************************************/ |
antbig | 4:88431b537477 | 302 | int SelectStrategy(unsigned char id) |
antbig | 4:88431b537477 | 303 | { |
antbig | 12:14729d584500 | 304 | |
antbig | 12:14729d584500 | 305 | |
antbig | 4:88431b537477 | 306 | switch(id) |
antbig | 4:88431b537477 | 307 | { |
antbig | 4:88431b537477 | 308 | case 1: |
antbig | 4:88431b537477 | 309 | strcpy(cheminFileStart,"/local/strat1.txt"); |
antbig | 4:88431b537477 | 310 | return FileExists(cheminFileStart); |
antbig | 4:88431b537477 | 311 | case 2: |
antbig | 4:88431b537477 | 312 | strcpy(cheminFileStart,"/local/strat2.txt"); |
antbig | 4:88431b537477 | 313 | return FileExists(cheminFileStart); |
antbig | 7:dcce34c7e06e | 314 | case 3: |
antbig | 7:dcce34c7e06e | 315 | strcpy(cheminFileStart,"/local/strat3.txt"); |
antbig | 7:dcce34c7e06e | 316 | return FileExists(cheminFileStart); |
antbig | 11:ed13a480ddca | 317 | case 4: |
antbig | 11:ed13a480ddca | 318 | strcpy(cheminFileStart,"/local/strat4.txt"); |
antbig | 11:ed13a480ddca | 319 | return FileExists(cheminFileStart); |
antbig | 11:ed13a480ddca | 320 | case 5: |
antbig | 11:ed13a480ddca | 321 | strcpy(cheminFileStart,"/local/strat5.txt"); |
antbig | 11:ed13a480ddca | 322 | return FileExists(cheminFileStart); |
antbig | 12:14729d584500 | 323 | case 6: |
antbig | 12:14729d584500 | 324 | strcpy(cheminFileStart,"/local/strat6.txt"); |
antbig | 12:14729d584500 | 325 | return FileExists(cheminFileStart); |
antbig | 12:14729d584500 | 326 | case 10: |
antbig | 12:14729d584500 | 327 | strcpy(cheminFileStart,"/local/grand_8.txt"); |
antbig | 12:14729d584500 | 328 | return FileExists(cheminFileStart); |
antbig | 4:88431b537477 | 329 | default: |
antbig | 12:14729d584500 | 330 | strcpy(cheminFileStart,"/local/strat1.txt"); |
antbig | 4:88431b537477 | 331 | return 0; |
antbig | 4:88431b537477 | 332 | } |
antbig | 4:88431b537477 | 333 | } |
antbig | 4:88431b537477 | 334 | |
antbig | 12:14729d584500 | 335 | /****************************************************************************************/ |
antbig | 12:14729d584500 | 336 | /* FUNCTION NAME: needToStop */ |
antbig | 12:14729d584500 | 337 | /* DESCRIPTION : Savoir si il faut autoriser le stop du robot via balise */ |
antbig | 12:14729d584500 | 338 | /****************************************************************************************/ |
antbig | 12:14729d584500 | 339 | unsigned char needToStop(void) |
antbig | 12:14729d584500 | 340 | { |
antbig | 12:14729d584500 | 341 | return isStopEnable; |
antbig | 12:14729d584500 | 342 | } |
antbig | 12:14729d584500 | 343 | |
antbig | 12:14729d584500 | 344 | /****************************************************************************************/ |
antbig | 12:14729d584500 | 345 | /* FUNCTION NAME: doBeforeEndAction */ |
antbig | 12:14729d584500 | 346 | /* DESCRIPTION : Terminer les actions du robot 1s avant la fin du match */ |
antbig | 12:14729d584500 | 347 | /****************************************************************************************/ |
antbig | 12:14729d584500 | 348 | void doBeforeEndAction(void) |
antbig | 12:14729d584500 | 349 | { |
antbig | 12:14729d584500 | 350 | |
antbig | 12:14729d584500 | 351 | } |
antbig | 12:14729d584500 | 352 | |
antbig | 3:19f2285a4757 | 353 | #endif |