Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of CRAC-Strat_2017_homologation_petit_rob by
Diff: Robots/Strategie_big.cpp
- Revision:
- 9:d0042422d95a
- Parent:
- 8:0edc7dfb7f7e
- Child:
- 11:ed13a480ddca
--- a/Robots/Strategie_big.cpp Wed Apr 27 13:05:03 2016 +0000 +++ b/Robots/Strategie_big.cpp Thu Apr 28 08:11:36 2016 +0000 @@ -7,7 +7,9 @@ /* DESCRIPTION : Permet de faire la funny action en fin de partie */ /****************************************************************************************/ void doFunnyAction(void) { - + AX12_setGoal(AX12_ID_FUNNY_ACTION, 275); + AX12_setGoal(AX12_ID_FUNNY_ACTION, 180); + AX12_processChange(); } @@ -17,9 +19,7 @@ /****************************************************************************************/ unsigned char doAction(unsigned char id, unsigned short speed, short angle) { switch(id) { - case 101: - break; case 110://Ouvrir la pince arrière haute AX12_setGoal(AX12_ID_PINCE_ARRIERE_HAUTE_GAUCHE, 205); AX12_setGoal(AX12_ID_PINCE_ARRIERE_HAUTE_DROITE, 95); @@ -30,12 +30,18 @@ AX12_setGoal(AX12_ID_PINCE_ARRIERE_HAUTE_DROITE, 155); AX12_processChange(); break; + case 112://Ouvrir la pince arrière basse - + AX12_setGoal(AX12_ID_PINCE_ARRIERE_BASSE_GAUCHE, 205); + AX12_setGoal(AX12_ID_PINCE_ARRIERE_BASSE_DROITE, 95); + AX12_processChange(); break; case 113://Fermer la pince arrière basse + AX12_setGoal(AX12_ID_PINCE_ARRIERE_BASSE_GAUCHE, 145); + AX12_setGoal(AX12_ID_PINCE_ARRIERE_BASSE_DROITE, 155); + AX12_processChange(); + break; - break; case 114://Ouvrir les portes arrières AX12_setGoal(AX12_ID_PORTE_ARRIERE_GAUCHE, 250); AX12_setGoal(AX12_ID_PORTE_ARRIERE_DROITE, 50); @@ -58,13 +64,38 @@ /* FUNCTION NAME: initRobot */ /* DESCRIPTION : initialiser le robot */ /****************************************************************************************/ -void initRobot(void) { +void initRobot(void) +{ + //Enregistrement de tous les AX12 présent sur la carte AX12_register(4, AX12_SERIAL1); AX12_register(14, AX12_SERIAL1); AX12_register(15, AX12_SERIAL1); AX12_register(5, AX12_SERIAL2); AX12_register(18, AX12_SERIAL2); AX12_register(13, AX12_SERIAL2); + AX12_register(1, AX12_SERIAL2); + + runRobotTest(); +} + +/****************************************************************************************/ +/* FUNCTION NAME: runTest */ +/* DESCRIPTION : tester l'ensemble des actionneurs du robot */ +/****************************************************************************************/ +void runRobotTest(void) +{ + //Test des AX12 dans l'ordre + doAction(111,0,0);//Fermeture pince arrière haute + wait_ms(500); + doAction(110,0,0);//Ouverture pince arrière haute + wait_ms(500); + doAction(113,0,0);//Fermeture pince arrière basse + wait_ms(500); + doAction(112,0,0);//Ouverture pince arrière basse + wait_ms(500); + doAction(115,0,0);//Fermeture porte arrière + wait_ms(500); + doAction(114,0,0);//Ouverture porte arrière } /****************************************************************************************/