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: CRAC-Strat_2019 SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac
Dependents: Codeprincipal_2019 CRAC-Strat_2019
Revision 42:657b6a573e11, committed 2018-05-17
- Comitter:
- Sitkah
- Date:
- Thu May 17 13:08:31 2018 +0000
- Parent:
- 41:b029ddc4d60e
- Child:
- 43:afddbbe873e3
- Child:
- 44:badcbe8766e9
- Commit message:
- useless
Changed in this revision
--- a/Bluetooth/liaison_bluetooth.cpp Fri May 11 12:09:26 2018 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*#include "global.h"
-
-Serial pc(USBTX,USBRX);
-Serial rn42(PG_14,PG_9);
-int ack_bluetooth;
-
-void bluetooth_init(void){
- rn42.baud(115200);
- pc.baud(115200);
- pc.printf("ok1");
- /*while(1){
- while(pc.readable()){
- rn42.putc(pc.getc());
-
- }
- while(rn42.readable()){
- pc.putc(rn42.getc());
- }
- }
-}
-void liaison_bluetooth(void){
- if (rn42.readable()) {
- //rn42.putc(rn42.getc());
- if(rn42.writeable()&& rn42.getc()=='1'){
- rn42.printf("ok");
- ack_bluetooth=1;
- }
- }
-}
-
-void envoi_bluetooth(int robot, char info){
- char msg;
- if (robot==0){//GROS ROBOT
- msg='1';
- if(rn42.writeable()){
- rn42.putc(msg);
- }
- if(rn42.writeable()){
- rn42.putc(info);
- }
- }
- else if (robot==1){//petit robot
- msg=0;
- if(rn42.writeable()){
- rn42.putc(msg);
- rn42.putc(info);
- }
- }
-}
-
-//void paramètrage_bluetooth(void){*/
-
\ No newline at end of file
--- a/Bluetooth/liaison_bluetooth.h Fri May 11 12:09:26 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -/*void liaison_bluetooth(void); - -void bluetooth_init(void); - -void envoi_bluetooth(int robot, char info);*/ \ No newline at end of file
--- a/Evitement/Evitement.cpp Fri May 11 12:09:26 2018 +0000
+++ b/Evitement/Evitement.cpp Thu May 17 13:08:31 2018 +0000
@@ -4,7 +4,7 @@
#include <string.h>
#include <math.h>
-
+/////////////////////////////DEBUT D'UNE EBAUCHE DE CARTOGRAPHIE DU TERRAIN EN MODE DAMMIER AFIN DE PRATIQUER UN A* EN EVITEMENT/////////////////////////////////////////////////
/////////////////////ROBOTS/////////////////////////////////////////////
--- a/Globals/constantes.h Fri May 11 12:09:26 2018 +0000 +++ b/Globals/constantes.h Thu May 17 13:08:31 2018 +0000 @@ -11,17 +11,12 @@ #define SIZE 750 //Taille d'une ligne du fichier #define SIZE_BUFFER_FILE 150 //Taille du buffer d'instruction -#define BALLE 60 -#define CYLINDRE 61 -#define MODULE 62 - -#define NOMBRE_OBJETS 16 /**** ** Variable à modifier en fonction du robot ***/ -#define ROBOT_BIG//Indique que l'on va compiler pour le gros robot -//#define ROBOT_SMALL +//#define ROBOT_BIG//Indique que l'on va compiler pour le gros robot +#define ROBOT_SMALL #ifdef ROBOT_BIG
--- a/Globals/global.h Fri May 11 12:09:26 2018 +0000 +++ b/Globals/global.h Thu May 17 13:08:31 2018 +0000 @@ -17,7 +17,6 @@ #include "LCD_DISCO_F469NI.h" #include "fonts.h" #include "F469_GUI.hpp" -#include "Telemetre.h" #include "Config_big.h" #include "LiaisonBluetooth.h" #include "Evitement.h"
--- a/Globals/ident_crac2.h Fri May 11 12:09:26 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -#ifndef CRAC_IDENTH -#define CRAC_IDENTH - - - -#define GLOBAL_GAME_END 0x004 // Stop fin du match -#define GLOBAL_START 0x002 // Start -#define GLOBAL_END_INIT_POSITION 0x005 // Fin positionnement robot avant depart -#define GLOBAL_FUNNY_ACTION 0x007 // Funny action start (0: start, 1: stop) -#define GLOBAL_JACK 0x008 -#define ACKNOWLEDGE_JACK 0X009 - -#define BALISE_STOP 0x003 // Trame stop - -#define BALISE_DANGER 0xA // Trame danger - -#define BALISE_END_DANGER 0xB // Trame fin de danger - - -#define ASSERVISSEMENT_STOP 0x001 // Stop moteur -#define ASSERVISSEMENT_SPEED_DANGER 0x006 // Vitesse de danger -#define ASSERVISSEMENT_XYT 0x020 // Asservissement (x,y,theta) (0 : au choix 1 : avant -1 : arrière) -#define ASSERVISSEMENT_COURBURE 0x021 // Asservissement rayon de courbure (+ gauche, - droite , sens : 1avt , -1arr; enchainement => 1 oui, 0 => non, 2=>derniére instruction de l'enchainement) -#define ASSERVISSEMENT_CONFIG 0x022 // Asservissement paramètre (définir les valeurs de vitesse max et d'eccélération max) -#define ASSERVISSEMENT_ROTATION 0x023 // Asservissement rotation -#define ASSERVISSEMENT_RECALAGE 0x024 // Moteur tout droit (recalage : 0 mouvement seul, 1 x, 2y valeur : coordonnée à laquelle est recalé x/y; enchainement => 1 oui, 0 => non) -#define ACTION_BIG_DEMARRAGE 0x025 // Action de départ du GR (Lancement de la trajectoire de départ du GR) -#define ODOMETRIE_BIG_POSITION 0x026 // Odométrie position robot (Position actuel du robot) -#define ODOMETRIE_BIG_VITESSE 0x027 // Odométrie vitesse (Indication sur l'état actuel) -#define ODOMETRIE_SMALL_POSITION 0x028 // Odométrie position robot (Position actuel du robot) -#define ODOMETRIE_SMALL_VITESSE 0x029 // Odométrie vitesse (Indication sur l'état actuel) - - - -#define ASSERVISSEMENT_CONFIG_DECEL 0x019 // Asservissement paramètre (définir les valeurs de vitesse max et de decélération max) - - -//////////////////////////////////////////////////////////RESETS/////////////////////////////////////////////////// -#define RESET_BALISE 0x030 // Reset balise -#define RESET_MOTEUR 0x031 // Reset moteur -#define RESET_IHM 0x032 // Reset écran tactile -#define RESET_ACTIONNEURS 0x033 // Reset actionneurs -#define RESET_POMPES 0x034 // Reset pompes -#define RESET_HERKULEX 0x035 // Reset HERKULEX -#define RESET_TELEMETRE 0x036 // Reset telemetre - - - -#define RESET_STRAT 0x3A // Reset stratégie - -//////////////////////////////////////////////////////////CHECK CARTES///////////////////////////////////////////////// -#define CHECK_BALISE 0x060 // Check balise -#define CHECK_MOTEUR 0x061 // Check moteur -#define CHECK_IHM 0x062 // Check écran tactile -#define CHECK_ACTIONNEURS_AVANT 0x063 // Check actionneurs -#define CHECK_ACTIONNEURS_ARRIERE 0x064 // Check pompes -#define CHECK_HERKULEX 0x065 // Check HERKULEX -#define CHECK_OK_TELEMETRE 0x066 // Check telemetre - -//////////////////////////////////////////////////////////ACK CARTES/////////////////////////////////////////////////// -#define ALIVE_BALISE 0x070 // Alive balise -#define ALIVE_MOTEUR 0x071 // Alive moteur -#define ALIVE_IHM 0x072 // Alive écran tactile -#define ALIVE_ACTIONNEURS_AVANT 0x073 // Alive actionneurs -#define ALIVE_ACTIONNEURS_ARRIERE 0x074 // Alive pompes -#define ALIVE_HERKULEX 0x075 // Alive HERKULEX -#define ALIVE_TELEMETRE 0x076 // Alive telemetre - - -/////////////////////////////////////////////////////ACTIONS COMPLEXES///////////////////////////////////////////////// -#define MONTER_IMMEUBLE_DOUBLE 0x090 // Monte l'immeuble selon un code couleur -#define MONTER_IMMEUBLE 0x091 -#define ACK_ACTION 0x99 //autre action possible via les herkulex, ne peut pas passer en sendrawid - - - -/////////////////////////////////////////////////////////ACKS//////////////////////////////////////////////////////////// -#define ACKNOWLEDGE_BALISE 0x100 // Acknowledge balise -#define ACKNOWLEDGE_MOTEUR 0x101 // Acknowledge moteur -#define ACKNOWLEDGE_IHM 0x102 // Acknowledge ecran tactile -#define ACKNOWLEDGE_ACTIONNEURS 0x103 // Acknowledge actionneurs -#define ACKNOWLEDGE_POMPES 0x104 // Acknowledge pompes -#define ACKNOWLEDGE_TELEMETRE 0x105 // Acknowledge telemetre -#define ACKNOWLEDGE_HERKULEX 0x106 // Ack HERKUlEX -#define ACKNOWLEDGE_STRAT 0x10A // Acknowledge pompes -#define ACKNOWLEDGE_CAMERA 0x108 //Acknowledge couleur caméra - - -#define INSTRUCTION_END_BALISE 0x110 // Fin instruction balise (Indique que l'instruction est terminée) -#define INSTRUCTION_END_MOTEUR 0x111 // Fin instruction moteur (Indique que l'instruction est terminée) -#define INSTRUCTION_END_IHM 0x112 // Fin instruction ecran tactile (Indique que l'instruction est terminée) -#define INSTRUCTION_END_ACTIONNEURS 0x113 // Fin instruction actionneurs (Indique que l'instruction est terminée) -#define ACK_FIN_ACTION 0x116 - - - -/////////////////////////////////////////////////////////ERREURS//////////////////////////////////////////////////////// -#define ERROR_OVERFLOW_BALISE 0x040 // Overflow odométrie -#define ERROR_OVERFLOW_MOTEUR 0x041 // Overflow asservissement -#define ERROR_OVERFLOW_IHM 0x042 // Overflow balise -#define ERROR_OVERFLOW_STRAT 0x043 // Overflow stratégie -#define ERROR_BALISE 0x785 // Bug balise -#define ERROR_RTC 0x786 // Bug RTC -#define ERROR_MOTEUR 0x787 // Bug moteur -#define ERROR_TELEMETRIE 0x788 // Bug télémètre -#define ERROR_STRATEGIE 0x789 // Bug stratégie - - - - -/////////////////////////////////////////////////ACTIONS SIMPLES DU ROBOT///////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#define BAISSER_ATTRAPE_BLOC 0x220 -#define RELEVER_ATTRAPE_BLOC 0x221 - -#define BAISSER_ATTRAPE_BLOC_AvG 0x222 -#define RELEVER_ATTRAPE_BLOC_AvG 0x223 - -#define BAISSER_ATTRAPE_BLOC_AvD 0x224 -#define RELEVER_ATTRAPE_BLOC_AvD 0x225 - - - -#define BRAS_VENTOUSE_1 0x22A -#define BRAS_VENTOUSE_2 0x22B - -#define BRAS_ABEILLE_UP 0x202 -#define BRAS_ABEILLE_DOWN 0x203 -#define INCLINAISON_CHATEAU 0x204 -#define INCLINAISON_EPURATION 0x205 -#define ALLUMER_PANNEAU_UP 0x206 -#define ALLUMER_PANNEAU_DOWN 0x207 -#define BLOCAGE_BALLE 0x208 -#define LANCEMENT_MOTEUR_TIR_ON 0x209 -#define LANCEMENT_MOTEUR_TIR_OFF 0x20A -#define AIGUILLEUR_CENTRE 0x20B -#define AIGUILLEUR_GAUCHE 0x20C -#define AIGUILLEUR_DROITE 0x20D -#define TRI_BALLE 0x20E -#define NO_BLOC 0x20F - -///////////////////////////////////////////CAPTEURS/////////////////////////////////////////////////////////////////// -#define DATA_TELEMETRE 0x210 // Demande sa valeur à un télémètre parmis les -#define RECEPTION_DATA 0x211 // envoi de la valeur d'un des télémètres -#define TELEMETRE_OBJET 0x212 -#define OBJET_SUR_TABLE 0x213 -#define RECEPTION_RECALAGE 0x215 //Valeur des télémètres -#define DATA_RECALAGE 0x216 //Demande de la valeur de tous les télémètres afin de procèder au récalage -#define LIRE_PANNEAU 0x217 -#define VIBRO 0x218 -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////ENVOI DE PARAMETRES////////////////////////////////////////////////// -#define CHOICE_COLOR 0x602 // Couleur (0->VERT;1->ORANGE) -#define RECEPTION_COULEUR 0x603 //Code Couleur -#define ECRAN_ALL_CHECK 0x620 // Carte all check (Si provient de carte strat => toutes les cartes sont en ligne, Si provient IHM => forcer le lancement) - -///////////////////////////////////////////////////////////DEBUGS/////////////////////////////////////////////////////// -#define DEBUG_STRATEGIE_AUTOMATE 0x760 // Etat automate stratégie (Permet de savoir l'etat de l'automate) -#define DEBUG_FAKE_JAKE 0x761 // Fake jack (Permet d'outre passerr le JACk du robot) -#define DEBUG_ASSERV 0x762 // Info debug carte moteur - - - -#define POMPE_PWM 0x9A // pwm des pompes (pwm entre 0 et 100) - - -#define ASSERVISSEMENT_INFO_CONSIGNE 0x1F0 // Info Consigne et Commande moteur -#define ASSERVISSEMENT_CONFIG_KPP_DROITE 0x1F1 // Config coef KPP_Droit -#define ASSERVISSEMENT_CONFIG_KPI_DROITE 0x1F2 // Config coef KPI_Droit -#define ASSERVISSEMENT_CONFIG_KPD_DROITE 0x1F3 // Config coef KPD_Droit -#define ASSERVISSEMENT_CONFIG_KPP_GAUCHE 0x1F4 // Config coef KPP_Gauche -#define ASSERVISSEMENT_CONFIG_KPI_GAUCHE 0x1F5 // Config coef KPI_Gauche -#define ASSERVISSEMENT_CONFIG_KPD_GAUCHE 0x1F6 // Config coef KPD_Gauche -#define ASSERVISSEMENT_ENABLE 0x1F7 // Activation asservissement (0 : désactivation, 1 : activation) - -#endif
--- a/Robots/Strategie_small.cpp Fri May 11 12:09:26 2018 +0000
+++ b/Robots/Strategie_small.cpp Thu May 17 13:08:31 2018 +0000
@@ -17,10 +17,10 @@
}
-/****************************************************************************************/
-/* FUNCTION NAME: doAction */
-/* DESCRIPTION : Effectuer une action specifique */
-/****************************************************************************************/
+/*************************************************************************************************/
+/* FUNCTION NAME: doAction */
+/* DESCRIPTION : Effectuer une action specifique correspondant au numéro dans le fichier strat */
+/*************************************************************************************************/
unsigned char doAction(unsigned char id, unsigned short arg1, short arg2) {
int retour = 1;
CANMessage msgTx=CANMessage();
@@ -140,112 +140,7 @@
}
-/****************************************************************************************/
-/* FUNCTION NAME: initRobot */
-/* DESCRIPTION : initialiser le robot */
-/****************************************************************************************/
-//void initRobot(void) {
- /**
- On enregistre les id des AX12 présent sur la carte
- **/
- /*AX12_register(1,AX12_SERIAL1,0x0FF);
- AX12_register(2,AX12_SERIAL1);
- AX12_register(18,AX12_SERIAL1);
- AX12_register(4,AX12_SERIAL2);
- AX12_register(16,AX12_SERIAL2);
- AX12_register(17,AX12_SERIAL2,0x0FF);*/
-
- //runRobotTest();
-
- /*
- AX12_setGoal(AX12_ID_BRAS_BASE_INV,278,0x0FF);
- AX12_setGoal(AX12_ID_BRAS_RELACHEUR_INV,160);//fermer le bras
- AX12_setGoal(AX12_ID_BRAS_BASE,278,0x0FF);
- AX12_setGoal(AX12_ID_BRAS_RELACHEUR,160);//fermer le bras
- AX12_processChange();*/
-
- //initialisation_AX12();
-
-//}
-/****************************************************************************************/
-/* FUNCTION NAME: initRobotActionneur */
-/* DESCRIPTION : Initialiser la position des actionneurs du robot */
-/****************************************************************************************/
-/*void initRobotActionneur(void)
-{
- moteurGauchePWM(0);
- moteurDroitPWM(0);
- AX12_automate(AX12_PINCE_CENTRALE_POSITION_INITIALE);
- AX12_automate(AX12_GAUCHE_CROC_INITIALE);
- AX12_automate(AX12_DROIT_CROC_INITIALE);
- AX12_automate(AX12_TOURNANTE_GAUCHE_POSITION_INITIALE);
- AX12_automate(AX12_TOURNANTE_DROIT_POSITION_INITIALE);
-}
-*/
-/****************************************************************************************/
-/* FUNCTION NAME: runTest */
-/* DESCRIPTION : tester l'ensemble des actionneurs du robot */
-/****************************************************************************************/
-void runRobotTest(void)
-{
-
-}
-
-/****************************************************************************************/
-/* FUNCTION NAME: SelectStrategy */
-/* DESCRIPTION : Charger le fichier de stratégie correspondante à un id */
-/* RETURN : 0=> Erreur, 1=> OK si le fichier existe */
-/****************************************************************************************/
-int SelectStrategy(unsigned char id)
-{
-
- switch(id)
- {
- case 1:
- strcpy(cheminFileStart,"/sd/strat1.txt");
- return FileExists(cheminFileStart);
- case 2:
- strcpy(cheminFileStart,"/sd/strat2.txt");
- return FileExists(cheminFileStart);
- case 3:
- strcpy(cheminFileStart,"/sd/strat3.txt");
- return FileExists(cheminFileStart);
- case 4:
- strcpy(cheminFileStart,"/sd/strat4.txt");
- return FileExists(cheminFileStart);
- case 5:
- strcpy(cheminFileStart,"/sd/strat5.txt");
- return FileExists(cheminFileStart);
- case 6:
- strcpy(cheminFileStart,"/sd/strat6.txt");
- return FileExists(cheminFileStart);
- case 7:
- strcpy(cheminFileStart,"/sd/strat7.txt");
- return FileExists(cheminFileStart);
- case 8:
- strcpy(cheminFileStart,"/sd/strat8.txt");
- return FileExists(cheminFileStart);
- case 9:
- strcpy(cheminFileStart,"/sd/strat9.txt");
- return FileExists(cheminFileStart);
- case 10:
- strcpy(cheminFileStart,"/sd/strat10.txt");
- return FileExists(cheminFileStart);
- case 11:
- strcpy(cheminFileStart,"/sd/grand_8.txt");
- return FileExists(cheminFileStart);
-
- case 0x10:
- strcpy(cheminFileStart,"/sd/demoBras.txt");
- return FileExists(cheminFileStart);
-
- default:
- strcpy(cheminFileStart,"/sd/strat1.txt");
- SendRawId(0x258);
- return 0;
- }
-}
/****************************************************************************************/
/* FUNCTION NAME: needToStop */
--- a/Strategie/Strategie.cpp Fri May 11 12:09:26 2018 +0000
+++ b/Strategie/Strategie.cpp Thu May 17 13:08:31 2018 +0000
@@ -287,6 +287,8 @@
flagSendCan = 1;
}
+
+//Affiche une variable sur l'écran tactile//
void affichage_var(double Var){
if(ligne==7)
ligne=0;
@@ -296,7 +298,12 @@
//ligne++;
}
-
+
+
+/****************************************************************************************/
+/* FUNCTION NAME: affichage_debug */
+/* DESCRIPTION : Affiche l'état de gameEtat sur l'écran lcd */
+/****************************************************************************************/
void affichage_debug(int Var){
int i;
int conv=(int)Var;
@@ -310,7 +317,7 @@
lcd.SetBackColor(VERT);
lcd.DisplayStringAt(0, LINE(20+i), (uint8_t *)tableau_aff[i], LEFT_MODE);
}
- /*while(!ack_bluetooth){
+ /*while(!ack_bluetooth){ // mode pas à pas en bluetooth ou via écran
//liaison_bluetooth();
}
ack_bluetooth=0;*/
@@ -318,7 +325,10 @@
while(SUIVANT.Touched());*/
}
-
+/****************************************************************************************/
+/* FUNCTION NAME: automate_etat_ihm */
+/* DESCRIPTION : Automate de gestion de l'affichage */
+/****************************************************************************************/
void automate_etat_ihm(void)
{
int j;
@@ -329,7 +339,7 @@
ts.GetState(&TS_State);
switch (etat)
{
- case INIT :
+ case INIT : //intialise l'écran et passe à l'attente d'initialisation des cartes
ts.GetState(&TS_State);
canProcessRx();
@@ -357,7 +367,7 @@
etat=ATT;
break;
- case ATT :
+ case ATT : //Si les cartes sont présentes passe directement à choix sinon attente de force Launch (cette partie est encore buggée mais les cartes affichent bien leur présence donc faut juste force launch tout le temps...)
if (flag==1){
etat = CHOIX;
gameEtat = ETAT_CONFIG;
@@ -371,7 +381,7 @@
break;
- case CHOIX :
+ case CHOIX : //Match ou DEMO
lcd.SetBackColor(LCD_COLOR_WHITE);
lcd.SetTextColor(LCD_COLOR_BLACK);
lcd.Clear (LCD_COLOR_WHITE);
@@ -405,10 +415,10 @@
TEST_TIR_BALLE.Draw(VERT, 0);
TEST_IMMEUBLE.Draw(VERT,0);
TEST_TRIEUR.Draw(VERT,0);
- if(gameEtat == ETAT_CONFIG) {//C'est bon on a le droit de modifier les config //
- InversStrat = 0;//Pas d'inversion de la couleur // A changer , discussion avec l'ihm
+ if(gameEtat == ETAT_CONFIG) {//C'est bon on a le droit de modifier les config//
+ InversStrat = 0;//Pas d'inversion de la couleur
}
- while (etat == DEMO)
+ while (etat == DEMO) ////////////////////////////LISTE DES DIFFERENTES DEMOS POSSIBLES///////////////////////////////////////////
{
canProcessRx();
if(TEST_HERKULEX.Touched())
@@ -426,20 +436,20 @@
etat = TEST_SERVO;
lcd.Clear(LCD_COLOR_WHITE);
ModeDemo=1;
- }
-
+ }
else if(TEST_LASER.Touched())
{
//Strat = 0x11;
while(TEST_LASER.Touched());
TEST_LASER.Draw(0xFFF0F0F0, 0);
etat = TEST_TELEMETRE;
- }
+ }
else if (TEST_COULEURS.Touched()){
while(TEST_COULEURS.Touched());
TEST_LASER.Draw(0xFFF0F0F0, 0);
etat =TEST_CAPTEURS ;
}
+
else if (TEST_TIR_BALLE.Touched()){
while(TEST_TIR_BALLE.Touched());
TEST_TIR_BALLE.Draw(0xFFF0F0F0, 0);
@@ -453,7 +463,7 @@
trame_Tx.data[0]=0x2;
can2.write(trame_Tx);
ModeDemo=1;
- }
+ }
else if(TEST_IMMEUBLE.Touched()){
while(TEST_IMMEUBLE.Touched());
TEST_IMMEUBLE.Draw(0xFFF0F0F0, 0);
@@ -464,9 +474,7 @@
while(TEST_TRIEUR.Touched());
etat=DEMO_TRIEUR;
lcd.Clear(LCD_COLOR_WHITE);
- }
-
-
+ }
if(RETOUR.Touched())
{
etat = CHOIX;
@@ -474,20 +482,13 @@
}
if(gameEtat == ETAT_CONFIG) {//C'est bon on a le droit de modifier les config
- /*if (Strat< 0x10){ // Si la strat est une strat de match, on desactive le mode demo
- ModeDemo = 0;
- }
- else { // sinon, on active le mode demo, utile pour la fin de la demo
- ModeDemo = 1;
- }*/
Ack_strat = 1;
wait_ms(10);
- //tactile_printf("Strat %d, Asser desactive",Strat);
}
- //SelectionStrat(Strategie);
}
break;
- case DEMO_TRIEUR:
+ ///////////////////////////////TESTE LES SERVOS LIES AU TRI DES BALLES///////////////////////////////
+ case DEMO_TRIEUR:
lcd.SetBackColor(LCD_COLOR_WHITE);
lcd.DisplayStringAt(20, LINE(2), (uint8_t *)"DEMONSTRATION COURS", LEFT_MODE);
TRI.Draw(VERT, 0);
@@ -535,7 +536,7 @@
}
break;
- case DEMO_IMMEUBLE:
+ case DEMO_IMMEUBLE: //TESTE LE MONTE IMMEUBLE SUIVANT UN CODE COULEUR CHOISI
int color=0;
lcd.SetBackColor(LCD_COLOR_WHITE);
lcd.DisplayStringAt(20, LINE(2), (uint8_t *)"Choix du code couleur", LEFT_MODE);
@@ -698,7 +699,7 @@
- case TEST_SERVO:
+ case TEST_SERVO: //TEST DU RESTE DES SERVOS DISPO HORS TIR
lcd.SetBackColor(LCD_COLOR_WHITE);
lcd.DisplayStringAt(20, LINE(2), (uint8_t *)"DEMONSTRATION COURS", LEFT_MODE);
ABAISSE_BLOC.Draw(VERT, 0);
@@ -747,7 +748,7 @@
}
break;
- case TEST_TIR:
+ case TEST_TIR: // TEST DES FONCTIONS LIEES AUX TIRS
lcd.SetBackColor(LCD_COLOR_WHITE);
lcd.DisplayStringAt(20, LINE(2), (uint8_t *)"DEMONSTRATION COURS", LEFT_MODE);
TIR_CHATEAU.Draw(VERT, 0);
@@ -793,7 +794,7 @@
- case TEST_TELEMETRE:
+ case TEST_TELEMETRE: //AFFICHAGE DE LA VALEUR LUE PAR LES 4 TELEMETRES
ModeDemo=1;
lcd.Clear(LCD_COLOR_WHITE);
lcd.SetBackColor(LCD_COLOR_WHITE);
@@ -809,10 +810,10 @@
lcd.Clear(LCD_COLOR_WHITE);
}
}
- break;
+ break; ///////////////////////////////////////////FIN DES DEMOS/////////////////////////////////////////////////
- case SELECT_SIDE :
+ case SELECT_SIDE : // CHOIX DU COTE DU TERRAIN + INVERSION DE LA STRAT SI COTE ORANGE+ ENVOI DU COTE A LA CARTE CAPTEUR/ACTIONNEURS
lcd.Clear(LCD_COLOR_WHITE);
lcd.SetBackColor(LCD_COLOR_WHITE);
lcd.SetTextColor(LCD_COLOR_BLACK);
@@ -866,7 +867,7 @@
break;
- case TACTIQUE :
+ case TACTIQUE : //AFFICHE LA LISTE DES STRATS AFIN DE SELECTIONNER CELLE VOULUE
if (Cote == 0){
lcd.Clear(VERT);
lcd.SetBackColor(VERT);
@@ -896,14 +897,14 @@
wait(0.1);
break;
- case DETAILS :
+ case DETAILS : //SECONDE VALIDATION DE LA STRAT
lcd.Clear(LCD_COLOR_WHITE);
lcd.SetBackColor(LCD_COLOR_WHITE);
lcd.SetTextColor(LCD_COLOR_BLACK);
CHECK.Draw(VERT);
RETOUR.Draw(LCD_COLOR_RED);
- SelectionStrat(Strategie);
+ SelectionStrat(Strategie); //affiche la stratégie selectionnée
while (etat == DETAILS)
{
@@ -929,7 +930,7 @@
case LECTURE :
break;
- case AFF_WAIT_JACK :
+ case AFF_WAIT_JACK : //FONCTIONS D'AFFICHAGE DE L'ATTENTE DU JACK
lcd.Clear(BLANC);
lcd.SetBackColor(LCD_COLOR_WHITE);
lcd.SetTextColor(LCD_COLOR_BLACK);
@@ -951,10 +952,10 @@
etat=WAIT_JACK;
break;
- case WAIT_JACK:
+ case WAIT_JACK: //VERITABLE ATTENTE DU JACK
break;
- case COMPTEUR:
+ case COMPTEUR: //PEUT AFFICHER UN COMPTEUR DU TEMPS RESTANT AVANT LA FIN DE LA PARTIE OU BIEN TRES UTILE POUR PRINT DES VARIABLES CHAQUE SEC EX: gameEtat
cptf=gameTimer.read();
lcd.SetTextColor(LCD_COLOR_BLACK);
cpt=(int)cptf;
@@ -983,7 +984,7 @@
break;
- case FIN :
+ case FIN : //AFFICHAGE DE FIN AVEC LE SCORE FINAL
lcd.Clear (LCD_COLOR_WHITE);
lcd.SetBackColor(LCD_COLOR_WHITE);
#ifdef ROBOT_BIG
@@ -1149,12 +1150,12 @@
break;
case ETAT_GAME_WAIT_FOR_JACK:
if(instruction.order==POSITION_DEBUT){
- switch(etat_pos){
+ switch(etat_pos){ // AUTOMATE PERMETTANT AU ROBOT DE SE POSITIONNER TOUT SEUL AU DEBUT DE LA PARTIE (Ne PAS RETIRER LE JACK PENDANT CE TEMPS !!!)
case RECALAGE_1:
waitingAckID = ASSERVISSEMENT_RECALAGE;
waitingAckFrom = ACKNOWLEDGE_MOTEUR;
#ifdef ROBOT_SMALL
- GoStraight(3000, 1,MOITIEE_ROBOT-5, 0); //on se recale contre le mur donc il faut donner la valeur du centre du robot
+ GoStraight(3000, 1,MOITIEE_ROBOT-5, 0); //on se recale contre le mur donc il faut donner la valeur du centre du robot (les -5 qui trainent sont dus au tables pourraves sur place)
#else
GoStraight(-3000, 1,MOITIEE_ROBOT-5, 0);
#endif
@@ -1860,7 +1861,7 @@
if(FIFO_max_occupation<FIFO_occupation)
FIFO_max_occupation=FIFO_occupation;
if(FIFO_occupation!=0) {
- int identifiant=msgRxBuffer[FIFO_lecture].id;
+ int identifiant=msgRxBuffer[FIFO_lecture].id;
switch(identifiant) {
case ALIVE_MOTEUR:
@@ -1912,7 +1913,7 @@
/////////////////////////////////////Acknowledges de Reception de la demande d'action////////////////////////////////////////
case ACKNOWLEDGE_HERKULEX:
- case ACKNOWLEDGE_BALISE: //pas de break donc passe directement dans INSTRUCTION_END_AX12 mais conserve l'ident initial
+ case ACKNOWLEDGE_BALISE: //pas de break donc passe directement dans ACK_FIN_ACTION mais conserve l'ident initial
case ACKNOWLEDGE_TELEMETRE:
/////////////////////////////////////////////Acknowledges de la fin d'action/////////////////////////////////////////////////
@@ -2013,7 +2014,7 @@
}
break;
- case OBJET_SUR_TABLE:
+ /*case OBJET_SUR_TABLE:
if (msgRxBuffer[FIFO_lecture].data[1] == 0xff){
gameEtat = ETAT_WARNING_END_LAST_INSTRUCTION;
@@ -2027,7 +2028,7 @@
strat_instructions[actual_instruction+1].arg2 = returnY(strat_instructions[actual_instruction].arg2);
}
modeTelemetre = 0;
- break;
+ break;*/
case RECEPTION_DATA:
telemetreDistance=char_to_short_transformation(msgRxBuffer[FIFO_lecture].data[0], msgRxBuffer[FIFO_lecture].data[1]);
--- a/Telemetre/Telemetre.cpp Fri May 11 12:09:26 2018 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-# include "global.h"
-
-
-T_MODULE listeModules[NOMBRE_OBJETS];
-/*********************************************************************************************************/
-/* FUNCTION NAME: SendTelemetreID */
-/* DESCRIPTION : Envoie un message sans donnée, c'est-à-dire contenant uniquement un ID, sur le bus CAN */
-/*********************************************************************************************************/
-void SendTelemetreID (unsigned short id)
-{
- CANMessage msgTx=CANMessage();
- msgTx.id=id;
- msgTx.len=0;
- can1.write(msgTx);
- wait_us(200);
-}
-
-/*********************************************************************************************************/
-/* FUNCTION NAME: EspaceLibre */
-/* DESCRIPTION : Calcule si la place et libre pour poser un module */
-/*********************************************************************************************************/
-bool EspaceLibre (signed short xModule, signed short yModule, signed short xRobot, signed short yRobot){
- return true;
-
-}
-
-/*********************************************************************************************************/
-/* FUNCTION NAME: BonnePlace */
-/* DESCRIPTION : Calcule si le module est bien placé */
-/*********************************************************************************************************/
-bool BonnePlace(signed short xModule, signed short yModule, signed short xRobot, signed short yRobot){
- bool bienPlace = false;
- double distance = abs(xModule - xRobot)*abs(yModule - yRobot) + abs(yModule - yRobot)*abs(yModule - yRobot);
-
- distance = sqrt(distance);
-
-
- if ((TELEMETRE_PROFONDEUR - 10 < TELEMETRE_PROFONDEUR )||( TELEMETRE_PROFONDEUR + 10 > TELEMETRE_PROFONDEUR)){
- bienPlace = true;
- }
- return bienPlace;
-}
-
-void initModules(void){
-
- listeModules[0].x = 0;
- listeModules[0].y = 1100;
-
- listeModules[1].x = 200;
- listeModules[1].y = 950;
-
- listeModules[2].x = 600;
- listeModules[2].y = 200;
-
- listeModules[3].x = 600;
- listeModules[3].y = 1000;
-
- listeModules[4].x = 1100;
- listeModules[4].y = 500;
-
- listeModules[5].x = 1350;
- listeModules[5].y = 0;
-
- listeModules[6].x = 1400;
- listeModules[6].y = 900;
-
- listeModules[7].x = 1850;
- listeModules[7].y = 800;
-
- listeModules[8].x = 0;
- listeModules[8].y = 1850;
-
- listeModules[9].x = 200;
- listeModules[9].y = 2050;
-
- listeModules[10].x = 600;
- listeModules[10].y = 2000;
-
- listeModules[11].x = 600;
- listeModules[11].y = 2800;
-
- listeModules[12].x = 1100;
- listeModules[12].y = 2500;
-
- listeModules[13].x = 1350;
- listeModules[13].y = 0;
-
- listeModules[14].x = 1400;
- listeModules[14].y = 2100;
-
- listeModules[15].x = 1850;
- listeModules[15].y = 2200;
-}
-
-signed short returnX(int indiceTab){
- return listeModules[indiceTab].x;
- }
-
-signed short returnY(int indiceTab){
- return listeModules[indiceTab].y;
- }
-
-void processData(int objectType, signed short x, signed short y, int nb_module){
- switch(objectType){
- case CYLINDRE:
- //
- break;
-
- case MODULE:
- //
- /*if( (x == listeModules.module1.x) && (y == listeModules.module1.y) ){
- printf("module 1");
- listeModules.module1.timeout ++;
- } */
- break;
-
- case BALLE:
- //
- break;
- }
-
- }
--- a/Telemetre/Telemetre.h Fri May 11 12:09:26 2018 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#ifndef CRAC_TELEMETRE
-#define CRAC_TELEMETRE
-
-#include "global.h"
-
-#define TELEMETRE_PROFONDEUR 50
-
-
-
-struct T_MODULE{
- signed short x;
- signed short y;
- };
-
-/*********************************************************************************************************/
-/* FUNCTION NAME: SendTelemetreID */
-/* DESCRIPTION : Envoie un message sans donnée, c'est-à-dire contenant uniquement un ID, sur le bus CAN */
-/*********************************************************************************************************/
-void SendTelemetreID (unsigned short id);
-
-
-void TraitementBalle(signed short x_robot, signed short y_robot, signed short theta_robot);
-
-void TraitementCylindre(void);
-
-void TraitementCylindreMultiple(void);
-
-signed short returnX(int indiceTab);
-
-signed short returnY(int indiceTab);
-#endif
\ No newline at end of file
--- a/main.cpp Fri May 11 12:09:26 2018 +0000
+++ b/main.cpp Thu May 17 13:08:31 2018 +0000
@@ -89,7 +89,7 @@
rn42_pr.baud(115200);
pc.baud(115200);
pc.printf("ok1");
- /*while(1){
+ /*while(1){ // sert au paramètrage des module RN42
while(pc.readable()){
rn42_Tx.putc(pc.getc());
--- a/peripheriques_copy/actionneurs.cpp Fri May 11 12:09:26 2018 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,591 +0,0 @@
-#include "peripheriques.h"
-/* contient les fonctions qui servent à utiliser les AX12 et les moteurs sur le petit robot*/
-/*
-DigitalIn IO1(p23);
-DigitalIn IO2(p24);
-DigitalIn IO3(p25);
-DigitalIn IO4(p26);
-
-AnalogIn A_in1(p15);
-AnalogIn A_in2(p16);
-AnalogIn A_in3(p17);
-AnalogIn A_in4(p18);
-AnalogIn A_in5(p19);
-AnalogIn A_in6(p20);
-
-PwmOut IRL_1(p21);
-PwmOut IRL_2(p22);
-*/
-/*PwmOut motGauche(p21);
-PwmOut motDroit(p22);*/
-Timer t;
-
-unsigned char action_precedente = 0;
-
- /* DECLARATION VARIABLES */
-
-
-extern DigitalOut led2;
-extern Serial pc;
-extern Timer t;
-
-
-
-
-
-/****************************************************************************************/
-/* FUNCTION NAME: Tourner_module_gauche */
-/* DESCRIPTION : Fonction qui permet de tourner les modules a gauche */
-/****************************************************************************************/
-/*void Tourner_module_gauche(void){
- while(dataCouleurGauche() == false){
- printf("ici");
- moteurDroitPWM(0.2);
- }
- moteurDroitPWM(0);
-} */
-/****************************************************************************************/
-/* FUNCTION NAME: Tourner_module_droit */
-/* DESCRIPTION : Fonction qui permet de tourner les modules a gauche */
-/****************************************************************************************/
-/*void Tourner_module_droit(void){
- while(dataCouleurDroit() == false){
- printf("ici");
- moteurGauchePWM(0.2);
- }
- moteurGauchePWM(0);
-} */
-
-
-/********************************************************************************************************/
-
-
-/*********************************************************************************************************/
-/* FUNCTION NAME: moteurGauchePWM */
-/* DESCRIPTION : bouge le moteur gauche */
-/*********************************************************************************************************/
-/*void moteurGauchePWM(float pwm){
- motGauche.write(pwm);
-}*/
-
-/*********************************************************************************************************/
-/* FUNCTION NAME: moteurDroitPWM */
-/* DESCRIPTION : bouge le moteur gauche */
-/*********************************************************************************************************/
-/*void moteurDroitPWM(float pwm){
- motDroit.write(pwm);
-}*/
-
-/*********************************************************************************************************/
-/* FUNCTION NAME: initMoteurs */
-/* DESCRIPTION : init les moteurs des mains du petit robot */
-/*********************************************************************************************************/
-/*void initMoteurs(void){
- motGauche.period(T_MOT);
- motDroit.period(T_MOT);
- motGauche.write(0.0);
- motDroit.write(0.0);
-}
-
-void initialisation_AX12(void)
-{
- short vitesse=700;
-
- BaseBrasCentralPR = new AX12(p9, p10, 5, 1000000);
- CoudeBrasCentralPR = new AX12(p9, p10, 6, 1000000);
- PinceDBrasCentralPR = new AX12(p9, p10, 8, 1000000);
- PinceGBrasCentralPR = new AX12(p9, p10, 7, 1000000);
- DoigtBrasCentralPR = new AX12(p9, p10, 4, 1000000);
-
- CrocBrasGauchePR = new AX12(p13, p14, 3, 1000000);
- CoudeBrasGauchePR = new AX12(p13, p14, 2, 1000000);
- EpauleBrasGauchePR = new AX12(p13, p14, 1, 1000000);
-
- CrocBrasDroitPR = new AX12(p28, p27, 11, 1000000);
- CoudeBrasDroitPR = new AX12(p28, p27, 10, 1000000);
- EpauleBrasDroitPR = new AX12(p28, p27, 9, 1000000);
-
- BrasCentralPRAx12 = new AX12(p9,p10,0xFE,1000000);
- BrasGauchePRAx12 = new AX12(p13,p14,0xFE,1000000);
- BrasDroitPRAx12 = new AX12(p28,p27,0xFE,1000000);
-
- BaseBrasCentralPR->Set_Goal_speed(vitesse);
- CoudeBrasCentralPR->Set_Goal_speed(vitesse);
- PinceDBrasCentralPR->Set_Goal_speed(vitesse);
- PinceGBrasCentralPR->Set_Goal_speed(vitesse);
- DoigtBrasCentralPR->Set_Goal_speed(vitesse);
-
- CrocBrasGauchePR->Set_Goal_speed(vitesse);
- CoudeBrasGauchePR->Set_Goal_speed(vitesse);
- EpauleBrasGauchePR->Set_Goal_speed(vitesse);
-
- CrocBrasDroitPR->Set_Goal_speed(vitesse);
- CoudeBrasDroitPR->Set_Goal_speed(vitesse);
- EpauleBrasDroitPR->Set_Goal_speed(vitesse);
-
- BaseBrasCentralPR->Set_Mode(0);
- CoudeBrasCentralPR->Set_Mode(0);
- PinceDBrasCentralPR->Set_Mode(0);
- PinceGBrasCentralPR->Set_Mode(0);
- DoigtBrasCentralPR->Set_Mode(0);
-
- CrocBrasGauchePR->Set_Mode(0);
- CoudeBrasGauchePR->Set_Mode(0);
- EpauleBrasGauchePR->Set_Mode(0);
-
- CrocBrasDroitPR->Set_Mode(0);
- CoudeBrasDroitPR->Set_Mode(0);
- EpauleBrasDroitPR->Set_Mode(0);
-}
-
-void GetPositionAx12(void) {
-
- printf("\n\r ");
-
- printf("BaseC : %lf \n\r ", BaseBrasCentralPR->Get_Position() );
- printf("CoudeC : %lf \n\r ", CoudeBrasCentralPR->Get_Position() );
- printf("PinceCD : %lf \n\r ", PinceDBrasCentralPR->Get_Position());
- printf("PinceCG : %lf \n\r ", PinceGBrasCentralPR->Get_Position());
- printf("DoigtC : %lf \n\r ", DoigtBrasCentralPR->Get_Position() );
-
- printf("EpauleG : %lf \n\r ", EpauleBrasGauchePR->Get_Position());
- printf("CoudeG : %lf \n\r ", CoudeBrasGauchePR->Get_Position() );
- printf("CrocG : %lf \n\r ", CrocBrasGauchePR->Get_Position() );
-
- printf("EpauleD : %lf \n\r ", EpauleBrasDroitPR->Get_Position());
- printf("CoudeD : %lf \n\r ", CoudeBrasDroitPR->Get_Position() );
- printf("CrocD : %lf \n\r ", CrocBrasDroitPR->Get_Position() );
-}
-*/
-
-/****************************************************************************************/
-/* FUNCTION NAME: Automate_ax12 */
-/* DESCRIPTION : Fonction qui gère les différentes actions des AX12 */
-/****************************************************************************************/
-/*void AX12_automate(unsigned char etat_ax12){
-
- unsigned short speed;
- unsigned int GoalPosDoigt, GoalPosBase, GoalPosCoude, GoalPosPinceG, GoalPosPinceD,
- GoalPosEpauleTournanteG, GoalPosCoudeTournanteG,
- GoalPosEpauleTournanteD, GoalPosCoudeTournanteD;
-
- speed = 1000;
-
- switch(etat_ax12){
-
- case AX12_PINCE_CENTRALE_POSITION_INITIALE :
- wait_ms(TIME);
- speed = 511;
- GoalPosDoigt=1150;
- GoalPosBase=1490;
- GoalPosCoude=1470;
- GoalPosPinceG=1090;
- GoalPosPinceD=1930;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
- break;
-
- case AX12_PINCE_CENTRALE_PREPARATION_PRISE :
- wait_ms(TIME);
- GoalPosDoigt=90;
- GoalPosBase=170;
- GoalPosCoude=1000;
- GoalPosPinceG=1090;
- GoalPosPinceD=1930;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
- break;
-
- case AX12_PINCE_CENTRALE_PRISE_MODULE :
- wait_ms(TIME);
- GoalPosDoigt=90;
- GoalPosBase=170;
- GoalPosCoude=1000;
- GoalPosPinceG=500;
- GoalPosPinceD=2500;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
- break;
-
- case AX12_PINCE_CENTRALE_STOCKAGE_HAUT :
- wait(TIME);
- GoalPosDoigt=150;
- GoalPosBase=170;
- GoalPosCoude=1000;
- GoalPosPinceG=500;
- GoalPosPinceD=2500;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
- wait_ms(TIME*5);
- GoalPosDoigt=150; //90
- GoalPosBase=1300;
- GoalPosCoude=700;
- GoalPosPinceG=500;
- GoalPosPinceD=2500;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
- wait(TIME*5);
- GoalPosDoigt=150; //90
- GoalPosBase=1450;//1050;
- GoalPosCoude=700;//1528;
- GoalPosPinceG=500;
- GoalPosPinceD=2500;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
- wait(TIME*5);
- speed = 700;
- GoalPosDoigt=150; //90
- GoalPosBase=1200;//1050; //1450
- GoalPosCoude=1320;//1528;//1250
- GoalPosPinceG=500;
- GoalPosPinceD=2500;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
- wait(TIME*5);
- speed = 700;
- GoalPosDoigt=150; //90
- GoalPosBase=1200;//1050; //1450
- GoalPosCoude=1320;//1528;//1250
- GoalPosPinceG=1090;
- GoalPosPinceD=1930;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
- break;
-
- case AX12_PINCE_CENTRALE_STOCKAGE_BAS :
- wait_ms(TIME);
- GoalPosDoigt=90;
- GoalPosBase=1000;
- GoalPosCoude=443;
- GoalPosPinceG=500;
- GoalPosPinceD=2500;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
- break;
-
- case AX12_PINCE_CENTRALE_PREPARATION_DEPOT :
- wait_ms(TIME);
- GoalPosDoigt=90;
- GoalPosBase=639;
- GoalPosCoude=557;
- GoalPosPinceG=500;
- GoalPosPinceD=2500;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
- wait(TIME*10);
- GoalPosDoigt=90;
- GoalPosBase=400;
- GoalPosCoude=400;
- GoalPosPinceG=500;
- GoalPosPinceD=2500;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
-
- break;
-
- case AX12_PINCE_CENTRALE_DEPOSER :
- //DEPOSER
- wait_ms(TIME);
- GoalPosDoigt=90;
- GoalPosBase=440;
- GoalPosCoude=440;
- GoalPosPinceG=1090;
- GoalPosPinceD=1930;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
-
- break;
-
- case AX12_PINCE_CENTRALE_DEPOT_HAUT :
- wait(TIME*5);
- GoalPosDoigt=90;
- GoalPosBase=1050;
- GoalPosCoude=1528;
- GoalPosPinceG=1090;
- GoalPosPinceD=1930;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
- wait(TIME*10);
- GoalPosDoigt=90;
- GoalPosBase=1050;
- GoalPosCoude=1528;
- GoalPosPinceG=500;
- GoalPosPinceD=2500;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
- wait(TIME*10);
- GoalPosDoigt=90;
- GoalPosBase=1100;
- GoalPosCoude=700;
- GoalPosPinceG=500;
- GoalPosPinceD=2500;
- mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);
-
-
- break;
-
- case AX12_GAUCHE_CROC_OUVERT :
- wait_ms(TIME);
- CrocBrasGauchePR->Set_Secure_Goal(110);
- break;
-
- case AX12_GAUCHE_CROC_FERME :
- wait_ms(TIME);
- CrocBrasGauchePR->Set_Secure_Goal(147);
- break;
-
- case AX12_GAUCHE_CROC_INITIALE :
- wait_ms(TIME);
- CrocBrasGauchePR->Set_Secure_Goal(232);
- break;
-
- case AX12_TOURNANTE_GAUCHE_POSITION_INITIALE :
- wait_ms(TIME);
- speed = 511;
- GoalPosCoudeTournanteG=1450;
- GoalPosEpauleTournanteG=600;
- mvtBrasGauchePR(AX12_GAUCHE_EPAULE, speed, GoalPosEpauleTournanteG, AX12_GAUCHE_COUDE, speed, GoalPosCoudeTournanteG);
-
-
- break;
-
- case AX12_TOURNANTE_GAUCHE_PREPARATION :
- wait_ms(TIME);
- speed = 511;
- GoalPosCoudeTournanteG=930;
- GoalPosEpauleTournanteG=1962;
- mvtBrasGauchePR(AX12_GAUCHE_EPAULE, speed, GoalPosEpauleTournanteG, AX12_GAUCHE_COUDE, speed, GoalPosCoudeTournanteG);
-
-
- break;
-
- case AX12_TOURNANTE_GAUCHE_MODULE :
- wait_ms(TIME);
- speed = 511;
- GoalPosCoudeTournanteG=894;
- GoalPosEpauleTournanteG=2200;
- mvtBrasGauchePR(AX12_GAUCHE_EPAULE, speed, GoalPosEpauleTournanteG, AX12_GAUCHE_COUDE, speed, GoalPosCoudeTournanteG);
-
-
- break;
-
- case AX12_DROIT_CROC_OUVERT :
- wait_ms(TIME);
- CrocBrasDroitPR->Set_Secure_Goal(189);
-
- break;
-
- case AX12_DROIT_CROC_FERME :
- wait_ms(TIME);
- CrocBrasDroitPR->Set_Secure_Goal(149);
-
- break;
-
- case AX12_DROIT_CROC_INITIALE :
- wait_ms(TIME);
- CrocBrasDroitPR->Set_Secure_Goal(67);
- break;
-
- case AX12_TOURNANTE_DROIT_POSITION_INITIALE :
- wait_ms(TIME);
- speed = 511;
- GoalPosCoudeTournanteD=1610;
- GoalPosEpauleTournanteD=2337;
- mvtBrasDroitPR(AX12_DROIT_EPAULE, speed, GoalPosEpauleTournanteD, AX12_DROIT_COUDE, speed, GoalPosCoudeTournanteD);
-
-
- break;
-
- case AX12_TOURNANTE_DROIT_PREPARATION :
- wait_ms(TIME);
- speed = 511;
- GoalPosCoudeTournanteD=930;
- GoalPosEpauleTournanteD=1962;
- mvtBrasDroitPR(AX12_DROIT_EPAULE, speed, GoalPosEpauleTournanteD, AX12_DROIT_COUDE, speed, GoalPosCoudeTournanteD);
-
-
- break;
-
- case AX12_TOURNANTE_DROIT_MODULE :
- wait_ms(TIME);
- speed = 511;
- GoalPosCoudeTournanteD=894;
- GoalPosEpauleTournanteD=2200;
- mvtBrasDroitPR(AX12_DROIT_EPAULE, speed, GoalPosEpauleTournanteD, AX12_DROIT_COUDE, speed, GoalPosCoudeTournanteD);
-
-
- break;
-
- case AX12_DEFAUT :
- break;
-
- case AX12_POSITION :
- GetPositionAx12();
- break;
- }
-}
-
-void mvtBrasCentralPR(unsigned char ID1, unsigned short GSpeed1, unsigned short GPosition1,
- unsigned char ID2, unsigned short GSpeed2, unsigned short GPosition2,
- unsigned char ID3, unsigned short GSpeed3, unsigned short GPosition3,
- unsigned char ID4, unsigned short GSpeed4, unsigned short GPosition4,
- unsigned char ID5, unsigned short GSpeed5, unsigned short GPosition5)
-{
- char TabBrasCentralPR[25];
- unsigned short GPosition1_1, GPosition2_1, GPosition3_1, GPosition4_1, GPosition5_1;
- Timer timeOut;
-
- GPosition1_1=((unsigned long)GPosition1*341/1000);
- GPosition2_1=((unsigned long)GPosition2*341/1000);
- GPosition3_1=((unsigned long)GPosition3*341/1000);
- GPosition4_1=((unsigned long)GPosition4*341/1000);
- GPosition5_1=((unsigned long)GPosition5*341/1000);
-
- TabBrasCentralPR[0] = ID1;
- TabBrasCentralPR[1] = GPosition1_1;
- TabBrasCentralPR[2] = GPosition1_1>>8;
- TabBrasCentralPR[3] = GSpeed1;
- TabBrasCentralPR[4] = GSpeed1>>8;
-
- TabBrasCentralPR[5] = ID2;
- TabBrasCentralPR[6] = GPosition2_1;
- TabBrasCentralPR[7] = GPosition2_1>>8;
- TabBrasCentralPR[8] = GSpeed2;
- TabBrasCentralPR[9] = GSpeed2>>8;
-
- TabBrasCentralPR[10] = ID3;
- TabBrasCentralPR[11] = GPosition3_1;
- TabBrasCentralPR[12] = GPosition3_1>>8;
- TabBrasCentralPR[13] = GSpeed3;
- TabBrasCentralPR[14] = GSpeed3>>8 ;
-
- TabBrasCentralPR[15] = ID4;
- TabBrasCentralPR[16] = GPosition4_1;
- TabBrasCentralPR[17] = GPosition4_1>>8;
- TabBrasCentralPR[18] = GSpeed4;
- TabBrasCentralPR[19] = GSpeed4>>8 ;
-
- TabBrasCentralPR[20] = ID5;
- TabBrasCentralPR[21] = GPosition5_1;
- TabBrasCentralPR[22] = GPosition5_1>>8;
- TabBrasCentralPR[23] = GSpeed5;
- TabBrasCentralPR[24] = GSpeed5>>8 ;
-
-
- BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
- wait(TIME);
-
- timeOut.start();
- while (((unsigned short)(DoigtBrasCentralPR->Get_Position()*10)>GPosition1*110/100) || ((unsigned short)(DoigtBrasCentralPR->Get_Position()*10)<GPosition1*90/100) || (timeOut.read_ms() < 100)) {
- BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
- wait(TIME);
-
- }
-
- timeOut.reset();
- while (((unsigned short)(BaseBrasCentralPR->Get_Position()*10)>GPosition2*110/100) || ((unsigned short)(BaseBrasCentralPR->Get_Position()*10)<GPosition2*90/100) || (timeOut.read_ms() < 100)) {
- BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
- wait(TIME);
- }
-
- timeOut.reset();
- while (((unsigned short)(CoudeBrasCentralPR->Get_Position()*10)>GPosition3*110/100) || ((unsigned short)(CoudeBrasCentralPR->Get_Position()*10)<GPosition3*90/100) || (timeOut.read_ms() < 100)) {
- BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
- wait(TIME);
- }
-
- timeOut.reset();
- while (((unsigned short)(PinceGBrasCentralPR->Get_Position()*10)>GPosition4*110/100) || ((unsigned short)(PinceGBrasCentralPR->Get_Position()*10)<GPosition4*90/100) || (timeOut.read_ms() < 100)) {
- BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
- wait(TIME);
- }
-
- timeOut.reset();
- while (((unsigned short)(PinceDBrasCentralPR->Get_Position()*10)>GPosition5*110/100) || ((unsigned short)(PinceDBrasCentralPR->Get_Position()*10)<GPosition5*90/100) || (timeOut.read_ms() < 100)) {
- BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
- wait(TIME);
- }
-
-
-}
-
-
-void mvtBrasGauchePR(unsigned char ID1, unsigned short GSpeed1, unsigned short GPosition1,
- unsigned char ID2, unsigned short GSpeed2, unsigned short GPosition2)
-{
- char TabBrasGauchePR[10];
- unsigned short GPosition1_1, GPosition2_1;
- Timer timeOut;
-
- GPosition1_1=((unsigned long)GPosition1*341/1000);
- GPosition2_1=((unsigned long)GPosition2*341/1000);
-
- TabBrasGauchePR[0] = ID1;
- TabBrasGauchePR[1] = GPosition1_1;
- TabBrasGauchePR[2] = GPosition1_1>>8;
- TabBrasGauchePR[3] = GSpeed1;
- TabBrasGauchePR[4] = GSpeed1>>8;
-
- TabBrasGauchePR[5] = ID2;
- TabBrasGauchePR[6] = GPosition2_1;
- TabBrasGauchePR[7] = GPosition2_1>>8;
- TabBrasGauchePR[8] = GSpeed2;
- TabBrasGauchePR[9] = GSpeed2>>8;
-
-
- BrasGauchePRAx12->multiple_goal_and_speed(2,TabBrasGauchePR) ;
- wait(TIME);
-
- timeOut.start();
- while (((unsigned short)(EpauleBrasGauchePR->Get_Position()*10)>GPosition1*110/100) || ((unsigned short)(EpauleBrasGauchePR->Get_Position()*10)<GPosition1*90/100) || (timeOut.read_ms() < 100)) {
- BrasGauchePRAx12->multiple_goal_and_speed(2,TabBrasGauchePR) ;
- wait(TIME);
- }
- timeOut.reset();
-
- while (((unsigned short)(CoudeBrasGauchePR->Get_Position()*10)>GPosition2*110/100) || ((unsigned short)(CoudeBrasGauchePR->Get_Position()*10)<GPosition2*90/100) || (timeOut.read_ms() < 100)) {
- BrasGauchePRAx12->multiple_goal_and_speed(2,TabBrasGauchePR) ;
- wait(TIME);
- }
- timeOut.reset();
-}
-
-void mvtBrasDroitPR(unsigned char ID1, unsigned short GSpeed1, unsigned short GPosition1,
- unsigned char ID2, unsigned short GSpeed2, unsigned short GPosition2)
-{
- char TabBrasDroitPR[10];
- unsigned short GPosition1_1, GPosition2_1;
- Timer timeOut;
-
- GPosition1_1=((unsigned long)GPosition1*341/1000);
- GPosition2_1=((unsigned long)GPosition2*341/1000);
-
- TabBrasDroitPR[0] = ID1;
- TabBrasDroitPR[1] = GPosition1_1;
- TabBrasDroitPR[2] = GPosition1_1>>8;
- TabBrasDroitPR[3] = GSpeed1;
- TabBrasDroitPR[4] = GSpeed1>>8;
-
- TabBrasDroitPR[5] = ID2;
- TabBrasDroitPR[6] = GPosition2_1;
- TabBrasDroitPR[7] = GPosition2_1>>8;
- TabBrasDroitPR[8] = GSpeed2;
- TabBrasDroitPR[9] = GSpeed2>>8;
-
-
- BrasDroitPRAx12->multiple_goal_and_speed(2,TabBrasDroitPR) ;
- wait(TIME);
-
- timeOut.start();
- while (((unsigned short)(EpauleBrasDroitPR->Get_Position()*10)>GPosition1*110/100) || ((unsigned short)(EpauleBrasDroitPR->Get_Position()*10)<GPosition1*90/100) || (timeOut.read_ms() < 100)) {
- BrasDroitPRAx12->multiple_goal_and_speed(2,TabBrasDroitPR) ;
- wait(TIME);
- }
- timeOut.reset();
-
- while (((unsigned short)(CoudeBrasDroitPR->Get_Position()*10)>GPosition2*110/100) || ((unsigned short)(CoudeBrasDroitPR->Get_Position()*10)<GPosition2*90/100) || (timeOut.read_ms() < 100)) {
- BrasDroitPRAx12->multiple_goal_and_speed(2,TabBrasDroitPR) ;
- wait(TIME);
- }
- timeOut.reset();
-}
-
-*/
\ No newline at end of file
--- a/peripheriques_copy/capteurs.cpp Fri May 11 12:09:26 2018 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-#include "peripheriques.h"
-
-/*AnalogIn cptGauche(p20);
-AnalogIn cptDroit(p19);
-
-DigitalIn pressionGauche(p23);
-DigitalIn pressionDroit(p24);
-
-AnalogIn telemetre(p15);*/
-
-//DigitalIn jack(p25);
-
-
-/*bool dataCouleurGauche(void){
- bool couleurOK = false;
- if(cptGauche.read() < 0.3){
- couleurOK = true;
- }
- return couleurOK;
-}
-
-bool dataCouleurDroit(void){
- bool couleurOK = false;
- if(cptDroit.read() < 0.3){
- couleurOK = true;
- }
- return couleurOK;
-}
-
-unsigned short dataTelemetre(void){
- SendRawId(DATA_TELEMETRE);
- float distance = telemetre.read()*3.3*1159.6-687.5+98;
- return (unsigned short)distance;
-}
-
-bool dataPressionGauche(void){
- if(cptGauche.read())return true;
- else return false;
-}
-
-bool dataPressionDroit(void){
- if(cptDroit.read())return true;
- else return false;
-}*/
\ No newline at end of file
--- a/peripheriques_copy/peripheriques.h Fri May 11 12:09:26 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -#ifndef CRAC_PERIPHERIQUES -#define CRAC_PERIPHERIQUES - -#include "global.h" - -#define VITESSE 700 -#define TIME 0.01 -#define T_MOT 0.00005 - - -#define AX12_PINCE_CENTRALE_POSITION_INITIALE 1 -#define AX12_PINCE_CENTRALE_PREPARATION_PRISE 2 -#define AX12_PINCE_CENTRALE_PRISE_MODULE 3 -#define AX12_PINCE_CENTRALE_STOCKAGE_HAUT 4 -#define AX12_PINCE_CENTRALE_STOCKAGE_BAS 5 -#define AX12_PINCE_CENTRALE_PREPARATION_DEPOT 6 -#define AX12_PINCE_CENTRALE_DEPOSER 7 -#define AX12_PINCE_CENTRALE_DEPOT_HAUT 8 - -#define AX12_GAUCHE_CROC_OUVERT 11 -#define AX12_GAUCHE_CROC_FERME 12 -#define AX12_DROIT_CROC_INITIALE 13 - - -#define AX12_DROIT_CROC_OUVERT 14 -#define AX12_DROIT_CROC_FERME 15 -#define AX12_GAUCHE_CROC_INITIALE 16 - -#define AX12_TOURNANTE_GAUCHE_POSITION_INITIALE 21 -#define AX12_TOURNANTE_GAUCHE_PREPARATION 22 -#define AX12_TOURNANTE_GAUCHE_MODULE 23 - -#define AX12_TOURNANTE_DROIT_POSITION_INITIALE 24 -#define AX12_TOURNANTE_DROIT_PREPARATION 25 -#define AX12_TOURNANTE_DROIT_MODULE 26 - -#define AX12_POSITION 100 -#define AX12_DEFAUT 0 - -#define AX12_DOIGT 4 -#define AX12_BASE 5 -#define AX12_COUDE 6 -#define AX12_PINCEG 7 -#define AX12_PINCED 8 -#define AX12_GAUCHE_EPAULE 1 -#define AX12_GAUCHE_COUDE 2 -#define AX12_DROIT_EPAULE 9 -#define AX12_DROIT_COUDE 10 - -#define TOLERANCE_AX12 50 - - /* PROTOTYPES DE FONCTIONS ET POINTEURS */ - - - -/****************************************************************************************/ -/* FUNCTION NAME: Fin_action */ -/* DESCRIPTION : Fonction qui confirme la fin de mouvement des AX12 */ -/****************************************************************************************/ -void Fin_action(void); - - -/****************************************************************************************/ -/* FUNCTION NAME: Initialisation_position */ -/* DESCRIPTION : Fonction qui place les bras en position verticale */ -/****************************************************************************************/ -void Initialisation_position(unsigned char choix); - -void mvtBrasCentralPR(unsigned char ID1, unsigned short GSpeed1, unsigned short GPosition1, - unsigned char ID2, unsigned short GSpeed2, unsigned short GPosition2, - unsigned char ID3, unsigned short GSpeed3, unsigned short GPosition3, - unsigned char ID4, unsigned short GSpeed4, unsigned short GPosition4, - unsigned char ID5, unsigned short GSpeed5, unsigned short GPosition5); - -void mvtBrasGauchePR(unsigned char ID1, unsigned short GSpeed1, unsigned short GPosition1, - unsigned char ID2, unsigned short GSpeed2, unsigned short GPosition2); - -void mvtBrasDroitPR(unsigned char ID1, unsigned short GSpeed1, unsigned short GPosition1, - unsigned char ID2, unsigned short GSpeed2, unsigned short GPosition2); - -void initialisation_AX12(void); - -void AX12_automate(unsigned char etat_ax12); - -/*********************************************************************************************************/ -/* FUNCTION NAME: moteurGauchePWM */ -/* DESCRIPTION : bouge le moteur gauche */ -/*********************************************************************************************************/ -void moteurGauchePWM(float pwm); - -/*********************************************************************************************************/ -/* FUNCTION NAME: moteurDroitPWM */ -/* DESCRIPTION : bouge le moteur gauche */ -/*********************************************************************************************************/ -void moteurDroitPWM(float pwm); - -/*********************************************************************************************************/ -/* FUNCTION NAME: initMoteurs */ -/* DESCRIPTION : init les moteurs des mains du petit robot */ -/*********************************************************************************************************/ -void initMoteurs(void); - -/* PROTOTYPES DE FONCTIONS ET POINTEURS */ - -/****************************************************************************************/ -/* FUNCTION NAME: Tourner_module_gauche */ -/* DESCRIPTION : Fonction qui permet de tourner les modules a gauche */ -/****************************************************************************************/ -void Tourner_module_gauche(void); - -/****************************************************************************************/ -/* FUNCTION NAME: Tourner_module_droit */ -/* DESCRIPTION : Fonction qui permet de tourner les modules a gauche */ -/****************************************************************************************/ -void Tourner_module_droit(void); - - -bool dataCouleurGauche(void); -bool dataCouleurDroit(void); -unsigned short dataTelemetre(void); -bool dataPressionGauche(void); -bool dataPressionDroit(void); - -#endif