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 test_carteAToutFaire_PR by
Revision 3:1bb26049bdd1, committed 2017-05-20
- Comitter:
- R66Y
- Date:
- Sat May 20 15:23:58 2017 +0000
- Parent:
- 2:9d280856a536
- Commit message:
- Programme de contr?le des AX12 avec rajout de l'MX12;
Changed in this revision
Actionneur.cpp | Show annotated file Show diff for this revision Revisions of this file |
Actionneur.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 9d280856a536 -r 1bb26049bdd1 Actionneur.cpp --- a/Actionneur.cpp Fri May 19 08:06:49 2017 +0000 +++ b/Actionneur.cpp Sat May 20 15:23:58 2017 +0000 @@ -18,8 +18,8 @@ static float TAB_ANGLE1[4], TAB_ANGLE2[4]; static char TAB_POSITION[4]; -AX12 *deux_myAX12, *trois_myAX12, *quatre_myAX12, *sept_myAX12, *huit_myAX12, *quinze_myAX12, *treize_myAX12, *quatorze_myAX12, *dixhuit_myAX12, *multiple_myAX12, *multiple2_myAX12; -AX12 *MilieuBrasPompe, *HautBrasPompe, *BasBrasPompe, *BrasPompeAx12, *TabPompeBras; +AX12 *un_myMX12, *deux_myAX12, *trois_myAX12, *quatre_myAX12, *sept_myAX12, *huit_myAX12, *quinze_myAX12, *treize_myAX12, *quatorze_myAX12, *dixhuit_myAX12, *multiple_myAX12, *multiple2_myAX12; +AX12 *TrappeLanceur, *MilieuBrasPompe, *HautBrasPompe, *BasBrasPompe, *BrasPompeAx12, *TabPompeBras; @@ -56,16 +56,22 @@ { short vitesse=700; + TrappeLanceur = new AX12(p9, p10, 1, 1000000); // MX12 + HautBrasPompe = new AX12(p9, p10, 3, 1000000); MilieuBrasPompe = new AX12(p9, p10, 2, 1000000); BasBrasPompe = new AX12(p9, p10, 1, 1000000); BrasPompeAx12 = new AX12(p9,p10,0xFE,1000000); + TrappeLanceur->Set_Goal_speed(vitesse); // MX12 + HautBrasPompe->Set_Goal_speed(vitesse); MilieuBrasPompe->Set_Goal_speed(vitesse); BasBrasPompe->Set_Goal_speed(vitesse); + TrappeLanceur->Set_Mode(0); // MX12 + HautBrasPompe->Set_Mode(0); MilieuBrasPompe->Set_Mode(0); BasBrasPompe->Set_Mode(0); @@ -78,7 +84,8 @@ pc.printf("Haut : %lf \n\r ", HautBrasPompe->Get_Position() ); pc.printf("Milieu : %lf \n\r ", MilieuBrasPompe->Get_Position() ); - pc.printf("Bas: %lf \n\r ", BasBrasPompe->Get_Position() ); + pc.printf("Bas: %lf \n\r ", BasBrasPompe->Get_Position() ); + pc.printf("Bas: %lf \n\r ", TrappeLanceur->Get_Position() ); // MX12 } @@ -95,12 +102,12 @@ unsigned int GoalPos1, GoalPos2, GoalPos3; switch(etat_ax12){ - case AX12_GET_POSITION: + case AX12_GET_POSITION: // 10 (10) GetPositionAx12(); break; - case AX12_VIDER_FUSEE_POMPE: + case AX12_VIDER_FUSEE_POMPE: // 8 (10) speed=511; @@ -134,7 +141,7 @@ Fin_action(); break; - case AX12_VIDER_FUSEE_POMPEBLEU: + case AX12_VIDER_FUSEE_POMPEBLEU: // 11 (10) speed=511; @@ -164,7 +171,7 @@ Fin_action(); break; - case AX12_REMPLIR_BASE_POMPE: + case AX12_REMPLIR_BASE_POMPE: // 9 (10) speed=511; @@ -193,7 +200,7 @@ Fin_action(); break; - case AX12_INITIALISATION : + case AX12_INITIALISATION : // 0 if (FlagAx12 == 1){ Initialisation_position(1); //Check_positionAX12(&TAB1[25], 1); @@ -206,7 +213,7 @@ } break; - case AX12_PREPARATION_PRISE : + case AX12_PREPARATION_PRISE : // 1 (10) Preparation_prise(choix_bras); if (action == 0){ Fin_action(); @@ -214,43 +221,49 @@ } break; - case AX12_STOCKAGE_HAUT : + case AX12_STOCKAGE_HAUT : // 2 (10) Stockage_haut(choix_bras); etat_ax12 = AX12_DEFAUT; Fin_action(); break; - case AX12_STOCKAGE_BAS : + case AX12_STOCKAGE_BAS : // 3 (10) Stockage_bas(choix_bras); etat_ax12 = AX12_DEFAUT; Fin_action(); break; - case AX12_DEPOSER : + case AX12_DEPOSER : // 4 (10) Deposer(choix_bras); etat_ax12 = AX12_DEFAUT; Fin_action(); break; - case AX12_PREPARATION_DEPOT_BAS : + case AX12_PREPARATION_DEPOT_BAS : // 5 (10) Preparation_depot_bas(choix_bras); etat_ax12 = AX12_DEFAUT; Fin_action(); break; - case AX12_PREPARATION_DEPOT_HAUT : + case AX12_PREPARATION_DEPOT_HAUT : // 6 (10) Preparation_depot_haut(choix_bras); etat_ax12 = AX12_DEFAUT; Fin_action(); break; - case AX12_POUSSER_MODULE : + case AX12_POUSSER_MODULE : // 7 (10) Pousser_module(choix_bras); etat_ax12 = AX12_DEFAUT; Fin_action(); break; - case AX12_DEFAUT : + case BOUGER_MX12 : // 12 (10) + bouger_MX12(choix_bras); // Le choix du bras détermine le sens de rotation de l'MX12 : 0 position initiale | 1 tourne à droite | 2 tourne à gauche. + etat_ax12 = AX12_DEFAUT; + Fin_action(); + break; + + case AX12_DEFAUT : // 20 (10) action = 0; break; } @@ -317,6 +330,7 @@ /* DESCRIPTION : Fonction qui place les bras en position verticale */ /****************************************************************************************/ void Initialisation_position(unsigned char choix){ + un_myMX12->Set_Secure_Goal(600); // Initialise la position de l'MX12 à 180° if (choix == 1){ multiple_myAX12->multiple_goal_and_speed(4,TAB1); wait(TIME); @@ -329,9 +343,7 @@ else if (choix == 3){ BrasPompeAx12->multiple_goal_and_speed(3,TabBrasPompePosInit); wait(TIME); - } - - + } } /****************************************************************************************/ @@ -459,6 +471,26 @@ } /****************************************************************************************/ +/* FUNCTION NAME: bouger_MX12 */ +/* DESCRIPTION : Fonction qui sélectionne le sens de rotation de l'MX12 et le bouge */ +/****************************************************************************************/ +void bouger_MX12(unsigned char choix){ + if( choix == 1) // Tourne à droite + { + un_myMX12->Set_Secure_Goal(0); // tourner droite + } + else if(choix == 2) // Tourne à gauche + { + un_myMX12->Set_Secure_Goal(1200); // tourner gauche + } + else if (choix == 0) + { + un_myMX12->Set_Secure_Goal(600); // position initiale + } +} + + +/****************************************************************************************/ /* FUNCTION NAME: Pousser_module */ /* DESCRIPTION : Fonction qui permet pousser le module situé à l'entrée de la bas */ /****************************************************************************************/
diff -r 9d280856a536 -r 1bb26049bdd1 Actionneur.h --- a/Actionneur.h Fri May 19 08:06:49 2017 +0000 +++ b/Actionneur.h Sat May 20 15:23:58 2017 +0000 @@ -14,6 +14,7 @@ #define AX12_REMPLIR_BASE_POMPE 9 #define AX12_GET_POSITION 10 #define AX12_VIDER_FUSEE_POMPEBLEU 11 +#define BOUGER_MX12 12 #define AX12_DEFAUT 20 #define TOLERANCE_AX12 50 @@ -78,6 +79,12 @@ void Pousser_module(unsigned char choix); /****************************************************************************************/ +/* FUNCTION NAME: bouger_MX12 */ +/* DESCRIPTION : Fonction qui sélectionne le sens de rotation de l'MX12 et le bouge */ +/****************************************************************************************/ +void bouger_MX12(unsigned char choix); + +/****************************************************************************************/ /* FUNCTION NAME: Check_positionAX12 */ /* DESCRIPTION : Fonction qui permet de verifier la position des AX12 */ /****************************************************************************************/