strat des robots
Fork of CRAC-Strat_2017 by
Robots/Strategie_big.cpp@8:0edc7dfb7f7e, 2016-04-27 (annotated)
- Committer:
- antbig
- Date:
- Wed Apr 27 13:05:03 2016 +0000
- Revision:
- 8:0edc7dfb7f7e
- Parent:
- 7:dcce34c7e06e
- Child:
- 9:d0042422d95a
D?but des actions du gros robot
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
antbig | 1:116040d14164 | 1 | #include "StrategieManager.h" |
antbig | 3:19f2285a4757 | 2 | #ifdef ROBOT_BIG |
antbig | 3:19f2285a4757 | 3 | #include "Config_big.h" |
antbig | 0:ad97421fb1fb | 4 | |
antbig | 0:ad97421fb1fb | 5 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 6 | /* FUNCTION NAME: doFunnyAction */ |
antbig | 0:ad97421fb1fb | 7 | /* DESCRIPTION : Permet de faire la funny action en fin de partie */ |
antbig | 0:ad97421fb1fb | 8 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 9 | void doFunnyAction(void) { |
antbig | 0:ad97421fb1fb | 10 | |
antbig | 0:ad97421fb1fb | 11 | |
antbig | 0:ad97421fb1fb | 12 | } |
antbig | 0:ad97421fb1fb | 13 | |
antbig | 0:ad97421fb1fb | 14 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 15 | /* FUNCTION NAME: doAction */ |
antbig | 0:ad97421fb1fb | 16 | /* DESCRIPTION : Effectuer une action specifique */ |
antbig | 0:ad97421fb1fb | 17 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 18 | unsigned char doAction(unsigned char id, unsigned short speed, short angle) { |
antbig | 0:ad97421fb1fb | 19 | switch(id) { |
antbig | 7:dcce34c7e06e | 20 | case 101: |
antbig | 3:19f2285a4757 | 21 | |
antbig | 7:dcce34c7e06e | 22 | break; |
antbig | 8:0edc7dfb7f7e | 23 | case 110://Ouvrir la pince arrière haute |
antbig | 8:0edc7dfb7f7e | 24 | AX12_setGoal(AX12_ID_PINCE_ARRIERE_HAUTE_GAUCHE, 205); |
antbig | 8:0edc7dfb7f7e | 25 | AX12_setGoal(AX12_ID_PINCE_ARRIERE_HAUTE_DROITE, 95); |
antbig | 8:0edc7dfb7f7e | 26 | AX12_processChange(); |
antbig | 8:0edc7dfb7f7e | 27 | break; |
antbig | 8:0edc7dfb7f7e | 28 | case 111://Fermer la pince arrière haute |
antbig | 8:0edc7dfb7f7e | 29 | AX12_setGoal(AX12_ID_PINCE_ARRIERE_HAUTE_GAUCHE, 145); |
antbig | 8:0edc7dfb7f7e | 30 | AX12_setGoal(AX12_ID_PINCE_ARRIERE_HAUTE_DROITE, 155); |
antbig | 8:0edc7dfb7f7e | 31 | AX12_processChange(); |
antbig | 8:0edc7dfb7f7e | 32 | break; |
antbig | 8:0edc7dfb7f7e | 33 | case 112://Ouvrir la pince arrière basse |
antbig | 8:0edc7dfb7f7e | 34 | |
antbig | 8:0edc7dfb7f7e | 35 | break; |
antbig | 8:0edc7dfb7f7e | 36 | case 113://Fermer la pince arrière basse |
antbig | 8:0edc7dfb7f7e | 37 | |
antbig | 8:0edc7dfb7f7e | 38 | break; |
antbig | 8:0edc7dfb7f7e | 39 | case 114://Ouvrir les portes arrières |
antbig | 8:0edc7dfb7f7e | 40 | AX12_setGoal(AX12_ID_PORTE_ARRIERE_GAUCHE, 250); |
antbig | 8:0edc7dfb7f7e | 41 | AX12_setGoal(AX12_ID_PORTE_ARRIERE_DROITE, 50); |
antbig | 8:0edc7dfb7f7e | 42 | AX12_processChange(); |
antbig | 8:0edc7dfb7f7e | 43 | break; |
antbig | 8:0edc7dfb7f7e | 44 | case 115://Fermer les portes arrière |
antbig | 8:0edc7dfb7f7e | 45 | AX12_setGoal(AX12_ID_PORTE_ARRIERE_GAUCHE, 145); |
antbig | 8:0edc7dfb7f7e | 46 | AX12_setGoal(AX12_ID_PORTE_ARRIERE_DROITE, 155); |
antbig | 8:0edc7dfb7f7e | 47 | AX12_processChange(); |
antbig | 8:0edc7dfb7f7e | 48 | break; |
antbig | 0:ad97421fb1fb | 49 | default: |
antbig | 0:ad97421fb1fb | 50 | return 0;//L'action n'existe pas, il faut utiliser le CAN |
antbig | 0:ad97421fb1fb | 51 | |
antbig | 0:ad97421fb1fb | 52 | } |
antbig | 0:ad97421fb1fb | 53 | return 1;//L'action est spécifique. |
antbig | 0:ad97421fb1fb | 54 | |
antbig | 0:ad97421fb1fb | 55 | } |
antbig | 0:ad97421fb1fb | 56 | |
antbig | 0:ad97421fb1fb | 57 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 58 | /* FUNCTION NAME: initRobot */ |
antbig | 0:ad97421fb1fb | 59 | /* DESCRIPTION : initialiser le robot */ |
antbig | 0:ad97421fb1fb | 60 | /****************************************************************************************/ |
antbig | 0:ad97421fb1fb | 61 | void initRobot(void) { |
antbig | 8:0edc7dfb7f7e | 62 | AX12_register(4, AX12_SERIAL1); |
antbig | 8:0edc7dfb7f7e | 63 | AX12_register(14, AX12_SERIAL1); |
antbig | 8:0edc7dfb7f7e | 64 | AX12_register(15, AX12_SERIAL1); |
antbig | 8:0edc7dfb7f7e | 65 | AX12_register(5, AX12_SERIAL2); |
antbig | 8:0edc7dfb7f7e | 66 | AX12_register(18, AX12_SERIAL2); |
antbig | 8:0edc7dfb7f7e | 67 | AX12_register(13, AX12_SERIAL2); |
antbig | 0:ad97421fb1fb | 68 | } |
antbig | 3:19f2285a4757 | 69 | |
antbig | 4:88431b537477 | 70 | /****************************************************************************************/ |
antbig | 4:88431b537477 | 71 | /* FUNCTION NAME: SelectStrategy */ |
antbig | 4:88431b537477 | 72 | /* DESCRIPTION : Charger le fichier de stratégie correspondante à un id */ |
antbig | 4:88431b537477 | 73 | /* RETURN : 0=> Erreur, 1=> OK si le fichier existe */ |
antbig | 4:88431b537477 | 74 | /****************************************************************************************/ |
antbig | 4:88431b537477 | 75 | int SelectStrategy(unsigned char id) |
antbig | 4:88431b537477 | 76 | { |
antbig | 4:88431b537477 | 77 | switch(id) |
antbig | 4:88431b537477 | 78 | { |
antbig | 4:88431b537477 | 79 | case 1: |
antbig | 4:88431b537477 | 80 | |
antbig | 4:88431b537477 | 81 | break; |
antbig | 4:88431b537477 | 82 | } |
antbig | 4:88431b537477 | 83 | return 0; |
antbig | 4:88431b537477 | 84 | } |
antbig | 4:88431b537477 | 85 | |
antbig | 3:19f2285a4757 | 86 | #endif |