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.
Dependencies: mbed bloc_8_pompe2 Herkulex_library_2022 ident_crac1 bloc_pompe2
Revision 3:77e937c315f1, committed 2022-04-26
- Comitter:
- ares1999
- Date:
- Tue Apr 26 14:08:43 2022 +0000
- Parent:
- 2:c7f2e7d8b305
- Commit message:
- mesure position servo 4 5 6 sur serial 2
Changed in this revision
--- a/Action_bras/actions.cpp Tue Mar 08 16:03:27 2022 +0000
+++ b/Action_bras/actions.cpp Tue Apr 26 14:08:43 2022 +0000
@@ -3,25 +3,12 @@
uint8_t servos_bras_testeur[2] = {RLED_ON, 1};
uint16_t pos_testeur[1] = {400};
-void fct_opti(void)
-{
- //positionControl_Mul_ensemble_complex(1, 60, servos_bras_testeur, pos_testeur, SERIAL_BAS_DROITE);
-//(uint8_t nb_servo, uint8_t playtime, uint8_t* data, uint16_t* pos, uint8_t numero_serial) // uint16_t position, uint8_t setLED, uint8_t id
- //wait_ms(3000);
- positionControl(AR_HAUT, 750, PLAYTIME, GLED_ON, SERIAL_BAS_DROITE);
- positionControl_Mul_ensemble(AR_BASE, 1000, PLAYTIME, GLED_ON, AR_MILIEU, 160, GLED_ON, SERIAL_BAS_DROITE);
- wait_ms(TEMPO_LONGUE);
- positionControl(AR_HAUT, 650, PLAYTIME, GLED_ON, SERIAL_BAS_DROITE);
- positionControl_Mul_ensemble(AR_BASE, 500, PLAYTIME, GLED_ON, AR_MILIEU, 600, GLED_ON, SERIAL_BAS_DROITE);
- wait_ms(TEMPO_LONGUE);
-}
-
-void fct_prise_avant(char serial_select)
+/*void fct_prise_avant(char serial_select) //moteurs 1,2,3
{
//Rangement
positionControl_Mul_ensemble(AV_BASE, 1000, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, serial_select);
positionControl(AV_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
- wait_ms(2000);
+ wait_ms(TEMPO);
//Pré Prise
positionControl(AV_HAUT, 650, PLAYTIME, GLED_ON, serial_select);
positionControl_Mul_ensemble(AV_BASE, 500, PLAYTIME, GLED_ON, AV_MILIEU, 600, GLED_ON, serial_select);
@@ -33,28 +20,50 @@
//Rangement echantillon
positionControl_Mul_ensemble(AV_BASE, 1000, PLAYTIME, BLED_ON, AV_MILIEU, 160, BLED_ON, serial_select);
positionControl(AV_HAUT, 510, PLAYTIME, BLED_ON, serial_select);
+ wait_ms(TEMPO);
+}*/
+
+void fct_prise_arriere(char serial_select) //moteurs 4,5,6
+{
+ //Rangement
+ positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
+ positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
+ wait_ms(2000);
+ //Pré Prise
+ positionControl(BAR_HAUT, 650, PLAYTIME, GLED_ON, serial_select);
+ positionControl_Mul_ensemble(BAR_BASE, 500, PLAYTIME, GLED_ON, BAR_MILIEU, 600, GLED_ON, serial_select);
+ wait_ms(TEMPO_LONGUE);
+ //Prise
+ positionControl(BAR_HAUT, 685, PLAYTIME, GLED_ON, serial_select);
+ positionControl_Mul_ensemble(BAR_BASE, 445, PLAYTIME, GLED_ON, BAR_MILIEU, 590, GLED_ON, serial_select);
+ wait_ms(TEMPO_LONGUE);
+ //Rangement echantillon
+ positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, BLED_ON, BAR_MILIEU, 160, BLED_ON, serial_select);
+ positionControl(BAR_HAUT, 510, PLAYTIME, BLED_ON, serial_select);
wait_ms(3000);
}
-void fct_prise_arriere(char serial_select)
+
+void fct_prise(char moteur1, char moteur2, char moteur3,char serial_select)
{
//Rangement
- positionControl_Mul_ensemble(AR_BASE, 1000, PLAYTIME, RLED_ON, AR_MILIEU, 160, RLED_ON, serial_select);
- positionControl(AR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
+ positionControl_Mul_ensemble(moteur1, 570, PLAYTIME, RLED_ON, moteur2, 160, RLED_ON, serial_select);
+ positionControl(moteur3, 750, PLAYTIME, RLED_ON, serial_select);
wait_ms(2000);
//Pré Prise
- positionControl(AR_HAUT, 650, PLAYTIME, GLED_ON, serial_select);
- positionControl_Mul_ensemble(AR_BASE, 500, PLAYTIME, GLED_ON, AR_MILIEU, 600, GLED_ON, serial_select);
- wait_ms(TEMPO_LONGUE);
+ positionControl(moteur3, 650, PLAYTIME, GLED_ON, serial_select);
+ positionControl_Mul_ensemble(moteur1, 500, PLAYTIME, GLED_ON, moteur2, 600, GLED_ON, serial_select);
+ wait_ms(2000);
//Prise
- positionControl(AR_HAUT, 685, PLAYTIME, GLED_ON, serial_select);
- positionControl_Mul_ensemble(AR_BASE, 445, PLAYTIME, GLED_ON, AR_MILIEU, 590, GLED_ON, serial_select);
- wait_ms(TEMPO_LONGUE);
+ positionControl(moteur3, 685, PLAYTIME, GLED_ON, serial_select);
+ positionControl_Mul_ensemble(moteur1, 445, PLAYTIME, GLED_ON, moteur2, 590, GLED_ON, serial_select);
+ wait_ms(2000);
//Rangement echantillon
- positionControl_Mul_ensemble(AR_BASE, 1000, PLAYTIME, BLED_ON, AR_MILIEU, 160, BLED_ON, serial_select);
- positionControl(AR_HAUT, 510, PLAYTIME, BLED_ON, serial_select);
- wait_ms(3000);
+ positionControl_Mul_ensemble(moteur1, 1000, PLAYTIME, BLED_ON, moteur2, 160, BLED_ON, serial_select);
+ positionControl(moteur3, 510, PLAYTIME, BLED_ON, serial_select);
+ wait_ms(2000);
}
+/*
void fct_bras(void)
{
@@ -94,4 +103,56 @@
positionControl_Mul_ensemble(AV_HAUT, 750, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, SERIAL_BAS_GAUCHE);
positionControl(AV_BASE, 1000, PLAYTIME, RLED_ON, SERIAL_BAS_GAUCHE);
wait_ms(TEMPO);
+}*/
+
+void fct_bras_arriere(char serial_select)
+{
+//Rangement bras bas
+ positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
+ positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
+ wait_ms(TEMPO);
+//Rangement bras haut
+ positionControl_Mul_ensemble(HAR_BASE, 955, PLAYTIME, RLED_ON, HAR_MILIEU, 35, RLED_ON, serial_select);
+ positionControl(HAR_HAUT, 230, PLAYTIME, RLED_ON, serial_select);
+ wait_ms(TEMPO_LONGUE);
+
+//Prise bras bas
+ positionControl(BAR_HAUT, 685, PLAYTIME, GLED_ON, serial_select);
+ positionControl_Mul_ensemble(BAR_BASE, 445, PLAYTIME, GLED_ON, BAR_MILIEU, 600, GLED_ON, serial_select);
+ wait_ms(TEMPO_LONGUE);
+//Passe bras bas
+ positionControl_Mul_ensemble(BAR_BASE, 470, 40, BLED_ON, BAR_MILIEU, 800, BLED_ON, serial_select);
+ wait_ms(TEMPO+250);
+ positionControl(BAR_HAUT, 250, 40, BLED_ON, serial_select);
+ wait_ms(TEMPO_LONGUE);
+
+//Prise bras haut
+ positionControl(HAR_HAUT, 630, PLAYTIME, GLED_ON, serial_select);
+ wait_ms(500);
+ positionControl_Mul_ensemble(HAR_BASE, 800, PLAYTIME, GLED_ON, HAR_MILIEU, 110, GLED_ON, serial_select);
+ wait_ms(TEMPO_LONGUE);
+//Pré rangement bras haut
+ positionControl_Mul_ensemble(HAR_BASE, 920, PLAYTIME, RLED_ON, HAR_MILIEU, 70, RLED_ON, serial_select);
+ positionControl(HAR_HAUT, 650, PLAYTIME, RLED_ON, serial_select);
+
+//Pré rangement bras bas
+ positionControl_Mul_ensemble(BAR_BASE, 520, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
+ positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
+ wait_ms(TEMPO_LONGUE);
+//Rangement bras bas
+ positionControl_Mul_ensemble(BAR_HAUT, 750, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
+ positionControl(BAR_BASE, 1000, PLAYTIME, RLED_ON, serial_select);
+ wait_ms(TEMPO);
+}
+
+void activer_CN(void)
+{
+ positionControl_Mul_ensemble(CN_GAUCHE, 790, PLAYTIME, RLED_ON, CN_DROITE, 240, RLED_ON, SERIAL_SPECIAL);
+ wait_ms(TEMPO);
+}
+
+void desactiver_CN(void)
+{
+ positionControl_Mul_ensemble(CN_GAUCHE, 240, PLAYTIME, RLED_ON, CN_DROITE, 790, RLED_ON, SERIAL_SPECIAL);
+ wait_ms(TEMPO);
}
\ No newline at end of file
--- a/Action_bras/actions.h Tue Mar 08 16:03:27 2022 +0000 +++ b/Action_bras/actions.h Tue Apr 26 14:08:43 2022 +0000 @@ -6,10 +6,14 @@ void test_bras_bas(void); //On teste le bon fonctionnement de tous les moteurs du bras du bas void test_bras_haut(void); //On teste le bon fonctionnement de tous les moteurs du bras du haut -void fct_prise_avant(char serial); //Bras du bas avant prend un échantillon -void fct_prise_arriere(char serial); //Bras du bas arriere prend un échantillon +void fct_prise_avant(char serial_select); +void fct_prise_arriere(char serial_select); + +void fct_prise(char moteur1, char moteur2, char moteur3,char serial_select); //Bras du bas prend un échantillon -void fct_bras(void); //Fonction mouvement sans interruption --> modif de la librairie -void fct_opti(void); //Fonction mouvement la plus rapide possible +void fct_bras_arriere(char serial_select); //Fonction mouvement sans interruption --> modif de la librairie + +void activer_CN(void); //ouvre le chasse neige +void desactiver_CN(void); //ferme le chasse neige #endif \ No newline at end of file
--- a/Gestion_Torque/torque.cpp Tue Mar 08 16:03:27 2022 +0000
+++ b/Gestion_Torque/torque.cpp Tue Apr 26 14:08:43 2022 +0000
@@ -1,8 +1,8 @@
#include "torque.h"
-void activer_torque(void) //Active le couple sur tous les servomoteurs
+void activer_torque(void) //Active le couple sur de tous les servomoteurs sur toutes les liaisons séries
{
- for(int i=1;i<=6;i++)
+ for(int i=1;i<=12;i++)
{
setTorque(i,TORQUE_ON,1);
setTorque(i,TORQUE_ON,2);
@@ -12,9 +12,9 @@
}
}
-void desactiver_torque(void) //Désactive le couple sur tous les servomoteurs
+void desactiver_torque(void) //Désactive le couple de tous les servomoteurs sur toutes les liaisons séries
{
- for(int i=1;i<=6;i++)
+ for(int i=1;i<=12;i++)
{
setTorque(i,TORQUE_FREE,1);
setTorque(i,TORQUE_FREE,2);
--- a/Herkulex_library_2022.lib Tue Mar 08 16:03:27 2022 +0000 +++ b/Herkulex_library_2022.lib Tue Apr 26 14:08:43 2022 +0000 @@ -1,1 +1,1 @@ -Herkulex_library_2022#8cc3e51b5d85 +https://os.mbed.com/teams/CRAC-Team/code/Herkulex_library_2022/#8cc3e51b5d85
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bloc_8_pompe.lib Tue Apr 26 14:08:43 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/CRAC-Team/code/bloc_8_pompe2/#4b57f192bfeb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bloc_pompe.lib Tue Apr 26 14:08:43 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/CRAC-Team/code/bloc_pompe2/#499d754adfe2
--- a/ident_crac.lib Tue Mar 08 16:03:27 2022 +0000 +++ b/ident_crac.lib Tue Apr 26 14:08:43 2022 +0000 @@ -1,1 +1,1 @@ -ident_crac#d9f0c325012f +https://os.mbed.com/teams/CRAC-Team/code/ident_crac1/#df3c600db53b
--- a/main.cpp Tue Mar 08 16:03:27 2022 +0000
+++ b/main.cpp Tue Apr 26 14:08:43 2022 +0000
@@ -2,7 +2,7 @@
//initialisations relatives au Bus CAN
CAN bus_can(PB_8,PB_9,1000000);
-
+Serial pc(USBTX,USBRX,115200);
CANMessage rx_message ;
char data[1] = {0x28};
CANMessage tx_message(0x220,data,1,CANData,CANStandard);
@@ -17,17 +17,39 @@
signed char FIFO_lecture=0;//Position du fifo de lecture des messages CAN
unsigned short ackFinAction = 0;
+bloc_8_pompe::bloc_8_pompe classe_pompe (PC_9, PA_8, PB_0, //bloc 1
+ PA_9, PA_10, PB_1, //bloc 2
+ PA_11, PA_15, PC_1, //bloc 3
+ PB_7, PB_6, PC_0, //bloc 4
+ PC_7, PC_8, PC_5, //bloc 5
+ PB_10, PB_2, PC_4, //bloc 6
+ PA_6, PA_5, PA_7, //bloc 7
+ PA_0, PA_1, PA_4); //bloc 8
+
int main (void)
{
wait_ms(200); //tempo pour boot
bus_can.attach(&interruption_reception); //création de l'interrupt attachée à la réception sur le CAN
//servo_interrupt_en(); //permettre les interuptions
//activer_torque();
- wait_ms(200);
- //pc.printf("\nLAUNCHED\n\r");
+ //wait_ms(200);
+ //desactiver_torque();
+ pc.printf("\nLAUNCHED\n\r");
while(1)
{
+ //Envoi_msg_CAN(1);
+ wait_ms(100);
+ servo_interrupt_en();
+ Interrupt2_en();
+ pc.printf("Bar_base: %03d Bar_milieu: %03d Bar_haut: %03d \r",getPos(BAR_BASE,2),getPos(BAR_MILIEU,2),getPos(BAR_HAUT,2));
+ //Interrupt2_en();
+ /*Interrupt2_en();
+ printf("Har_base: %d \n",getPos(HAV_BASE,2));
+ Interrupt2_en();
+ printf("Har_milieu: %d \n",getPos(HAV_MILIEU,2));
+ Interrupt2_en();
+ printf("Har_haut: %d \n",getPos(HAV_HAUT,2));*/
if(flag_reception_CAN)
{
gestion_Message_CAN();
@@ -45,6 +67,8 @@
void gestion_Message_CAN(void)
{
int identifiant = rx_message.id ;
+ char num_groupe = 1 ;
+ char etat_groupe = 0 ;
switch (identifiant)
{
@@ -56,13 +80,48 @@
desactiver_torque();
break;
- case BRAS_PRISE:
- fct_prise_avant(SERIAL_BAS_DROITE);
+ case PRISE_ARRIERE:
+ //fct_prise(BAR_BASE, BAR_MILIEU, BAR_HAUT, SERIAL_GAUCHE);
+ fct_prise_arriere(SERIAL_DROITE);
+ break;
+
+ case PRISE_COMPLETE:
+ fct_bras_arriere(SERIAL_GAUCHE);
+ break;
+
+ case CN_OUVERTURE:
+ activer_CN();
+ break;
+
+ case CN_FERMETURE:
+ desactiver_CN();
break;
- case TORQUE_1:
- setTorque(AV_BASE,TORQUE_ON,5);
- break;
+ case VENT_AT:
+ num_groupe = rx_message.data[0];
+ classe_pompe.aspirer(num_groupe) ;
+ break;
+
+ case VENT_RE:
+
+ num_groupe = rx_message.data[0];
+ classe_pompe.relacher(num_groupe) ;
+ break;
+
+ case VENT_ETAT:
+ num_groupe = rx_message.data[0];
+ etat_groupe = classe_pompe.etat_actuel(num_groupe) ;
+
+ if(etat_groupe == 0x07)
+ {
+ classe_pompe.aspirer(num_groupe) ;
+ etat_groupe = classe_pompe.etat_actuel(num_groupe) ;
+ }
+
+
+ Envoi_msg_CAN(etat_groupe);
+
+ break;
default:
break;
@@ -81,4 +140,4 @@
message.data[0]=donnee;
bus_can.write(message);
-}
+}
\ No newline at end of file
--- a/main.h Tue Mar 08 16:03:27 2022 +0000 +++ b/main.h Tue Apr 26 14:08:43 2022 +0000 @@ -6,8 +6,9 @@ #include "fonctions_herkulex.h" #include "torque.h" #include "actions.h" +#include "bloc_8_pompe.h" -//Serial pc(USBTX,USBRX,115200); +// extern CAN can; extern Serial pc;