v2019
Dependencies: CRAC-Strat_2019 SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac
Dependents: Codeprincipal_2019 CRAC-Strat_2019
Robots/Strategie_big.cpp@2:8d8e2cf798a3, 2016-04-15 (annotated)
- Committer:
- antbig
- Date:
- Fri Apr 15 16:43:35 2016 +0000
- Revision:
- 2:8d8e2cf798a3
- Parent:
- 1:116040d14164
- Child:
- 3:19f2285a4757
Version utiliser pour la demo devant prof
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
antbig | 1:116040d14164 | 1 | #include "StrategieManager.h" |
antbig | 0:ad97421fb1fb | 2 | |
antbig | 0:ad97421fb1fb | 3 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 4 | /* FUNCTION NAME: doFunnyAction */ |
antbig | 0:ad97421fb1fb | 5 | /* DESCRIPTION : Permet de faire la funny action en fin de partie */ |
antbig | 0:ad97421fb1fb | 6 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 7 | void doFunnyAction(void) { |
antbig | 0:ad97421fb1fb | 8 | |
antbig | 0:ad97421fb1fb | 9 | |
antbig | 0:ad97421fb1fb | 10 | } |
antbig | 0:ad97421fb1fb | 11 | |
antbig | 0:ad97421fb1fb | 12 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 13 | /* FUNCTION NAME: doAction */ |
antbig | 0:ad97421fb1fb | 14 | /* DESCRIPTION : Effectuer une action specifique */ |
antbig | 0:ad97421fb1fb | 15 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 16 | unsigned char doAction(unsigned char id, unsigned short speed, short angle) { |
antbig | 0:ad97421fb1fb | 17 | |
antbig | 1:116040d14164 | 18 | led1 = 1; |
antbig | 1:116040d14164 | 19 | led2 = 1; |
antbig | 0:ad97421fb1fb | 20 | switch(id) { |
antbig | 1:116040d14164 | 21 | case 101://Descendre le bras pour les poissons |
antbig | 2:8d8e2cf798a3 | 22 | if(InversStrat == 1) {//Si c'est inversé |
antbig | 2:8d8e2cf798a3 | 23 | AX12_setGoal(1,200,0x0FF); |
antbig | 2:8d8e2cf798a3 | 24 | AX12_processChange(); |
antbig | 2:8d8e2cf798a3 | 25 | } else { |
antbig | 2:8d8e2cf798a3 | 26 | |
antbig | 2:8d8e2cf798a3 | 27 | } |
antbig | 1:116040d14164 | 28 | break; |
antbig | 1:116040d14164 | 29 | case 102://Remonter bras moiter |
antbig | 2:8d8e2cf798a3 | 30 | if(InversStrat == 1) {//Si c'est inversé |
antbig | 2:8d8e2cf798a3 | 31 | AX12_setGoal(1,270,0x0FF); |
antbig | 2:8d8e2cf798a3 | 32 | AX12_processChange(); |
antbig | 2:8d8e2cf798a3 | 33 | } else { |
antbig | 2:8d8e2cf798a3 | 34 | |
antbig | 2:8d8e2cf798a3 | 35 | } |
antbig | 1:116040d14164 | 36 | break; |
antbig | 1:116040d14164 | 37 | case 103://Lacher les poissons |
antbig | 2:8d8e2cf798a3 | 38 | if(InversStrat == 1) {//Si c'est inversé |
antbig | 2:8d8e2cf798a3 | 39 | |
antbig | 2:8d8e2cf798a3 | 40 | AX12_setGoal(1,210,0x0FF); |
antbig | 2:8d8e2cf798a3 | 41 | AX12_processChange(); |
antbig | 2:8d8e2cf798a3 | 42 | wait_ms(500); |
antbig | 2:8d8e2cf798a3 | 43 | AX12_setGoal(2,90);//Ouverture du bras |
antbig | 2:8d8e2cf798a3 | 44 | AX12_processChange(); |
antbig | 2:8d8e2cf798a3 | 45 | } else { |
antbig | 2:8d8e2cf798a3 | 46 | |
antbig | 2:8d8e2cf798a3 | 47 | } |
antbig | 1:116040d14164 | 48 | break; |
antbig | 1:116040d14164 | 49 | case 104://Rentrer le bras |
antbig | 2:8d8e2cf798a3 | 50 | if(InversStrat == 1) {//Si c'est inversé |
antbig | 2:8d8e2cf798a3 | 51 | AX12_setGoal(1,278,0x0FF); |
antbig | 2:8d8e2cf798a3 | 52 | AX12_setGoal(2,160);//fermer le bras |
antbig | 2:8d8e2cf798a3 | 53 | AX12_processChange(); |
antbig | 2:8d8e2cf798a3 | 54 | } else { |
antbig | 2:8d8e2cf798a3 | 55 | |
antbig | 2:8d8e2cf798a3 | 56 | } |
antbig | 0:ad97421fb1fb | 57 | break; |
antbig | 0:ad97421fb1fb | 58 | default: |
antbig | 0:ad97421fb1fb | 59 | return 0;//L'action n'existe pas, il faut utiliser le CAN |
antbig | 0:ad97421fb1fb | 60 | |
antbig | 0:ad97421fb1fb | 61 | } |
antbig | 0:ad97421fb1fb | 62 | return 1;//L'action est spécifique. |
antbig | 0:ad97421fb1fb | 63 | |
antbig | 0:ad97421fb1fb | 64 | } |
antbig | 0:ad97421fb1fb | 65 | |
antbig | 0:ad97421fb1fb | 66 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 67 | /* FUNCTION NAME: initRobot */ |
antbig | 0:ad97421fb1fb | 68 | /* DESCRIPTION : initialiser le robot */ |
antbig | 0:ad97421fb1fb | 69 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 70 | void initRobot(void) { |
antbig | 0:ad97421fb1fb | 71 | |
antbig | 0:ad97421fb1fb | 72 | } |