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_ROBOT by
Revision 2:8d8e2cf798a3, committed 2016-04-15
- Comitter:
- antbig
- Date:
- Fri Apr 15 16:43:35 2016 +0000
- Parent:
- 1:116040d14164
- Child:
- 3:19f2285a4757
- Commit message:
- Version utiliser pour la demo devant prof
Changed in this revision
--- a/Globals/ident_crac.h Fri Apr 15 10:49:40 2016 +0000 +++ b/Globals/ident_crac.h Fri Apr 15 16:43:35 2016 +0000 @@ -49,10 +49,10 @@ #define INSTRUCTION_END_IHM 0x112 // Fin instruction ecran tactile (Indique que l'instruction est terminée) #define ECRAN_CHOICE_STRAT 0x601 // Choix d'une stratégie (n° strat (1-4)) -#define ECRAN_CHOICE_COLOR 0x602 // Couleur (0-> green; 1->Purple) +#define ECRAN_CHOICE_COLOR 0x602 // Couleur (0->Purple;1->green) #define ECRAN_START_MATCH 0x603 // Match (Indique que l'on souhaite commencer le match) #define ECRAN_ACK_STRAT 0x611 // Acknowledge stratégie (si 0 erreur, sinon n°strat) -#define ECRAN_ACK_COLOR 0x612 // Acknowledge couleur (0-> green; 1->Purple) +#define ECRAN_ACK_COLOR 0x612 // Acknowledge couleur (0->Purple;1->green) #define ECRAN_ACK_START_MATCH 0x613 // Acknowledge Match (Indique que l'on a bien reçu le debut du match) #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) #define ECRAN_TIME 0x621 // Time match (Indication de moment cle du temps (10,30,60,70,80,85,90)) @@ -80,3 +80,4 @@ #define SERVO_AX12_DONE 0x092 // AX12 done (Indique q'un AX12 a terminé son déplacement) #define SERVO_XL320 0x093 // XL320 +
--- a/Robots/Strategie_big.cpp Fri Apr 15 10:49:40 2016 +0000
+++ b/Robots/Strategie_big.cpp Fri Apr 15 16:43:35 2016 +0000
@@ -19,22 +19,41 @@
led2 = 1;
switch(id) {
case 101://Descendre le bras pour les poissons
- AX12_setGoal(1,190,0x0FF);
- AX12_processChange();
+ if(InversStrat == 1) {//Si c'est inversé
+ AX12_setGoal(1,200,0x0FF);
+ AX12_processChange();
+ } else {
+
+ }
break;
case 102://Remonter bras moiter
- AX12_setGoal(1,260,0x0FF);
- AX12_processChange();
+ if(InversStrat == 1) {//Si c'est inversé
+ AX12_setGoal(1,270,0x0FF);
+ AX12_processChange();
+ } else {
+
+ }
break;
case 103://Lacher les poissons
- AX12_setGoal(1,230,0x0FF);
- AX12_setGoal(2,60);//Ouverture du bras
- AX12_processChange();
+ if(InversStrat == 1) {//Si c'est inversé
+
+ AX12_setGoal(1,210,0x0FF);
+ AX12_processChange();
+ wait_ms(500);
+ AX12_setGoal(2,90);//Ouverture du bras
+ AX12_processChange();
+ } else {
+
+ }
break;
case 104://Rentrer le bras
- AX12_setGoal(1,280,0x0FF);
- AX12_setGoal(2,160);//fermer le bras
- AX12_processChange();
+ if(InversStrat == 1) {//Si c'est inversé
+ AX12_setGoal(1,278,0x0FF);
+ AX12_setGoal(2,160);//fermer le bras
+ AX12_processChange();
+ } else {
+
+ }
break;
default:
return 0;//L'action n'existe pas, il faut utiliser le CAN
--- a/Strategie/Strategie.cpp Fri Apr 15 10:49:40 2016 +0000
+++ b/Strategie/Strategie.cpp Fri Apr 15 16:43:35 2016 +0000
@@ -1,6 +1,6 @@
#include "Strategie.h"
-E_stratGameEtat gameEtat = ETAT_CHECK_CARTE_SCREEN;
+E_stratGameEtat gameEtat = ETAT_GAME_INIT;//ETAT_CHECK_CARTE_SCREEN;
E_stratGameEtat lastEtat = ETAT_CHECK_CARTE_SCREEN;
unsigned char screenChecktry = 0;
Timer cartesCheker;//Le timer pour le timeout de la vérification des cartes
@@ -21,7 +21,7 @@
unsigned char checkCurrent = 0;
unsigned char countAliveCard = 0;
-unsigned char InversStrat = 0;//Si à 1, indique que l'on part de l'autre cote de la table(inversion des Y)
+unsigned char InversStrat = 1;//Si à 1, indique que l'on part de l'autre cote de la table(inversion des Y)
void chronometre_ISR (void)
@@ -239,6 +239,9 @@
localData2 = instruction.arg3 - theta_robot;
}
}
+ if(InversStrat == 1) {
+ localData2 = -localData2;
+ }
Rotate(localData2);
waitingAckID = ASSERVISSEMENT_ROTATION;
waitingAckFrom = ACKNOWLEDGE_MOTEUR;
@@ -249,7 +252,14 @@
} else {
localData1 = 1;
}
- GoToPosition(instruction.arg1,instruction.arg2,instruction.arg3,localData1);
+
+ if(InversStrat == 1) {
+ //localData2 = 360 - instruction.arg3
+ localData3 = 3000 - instruction.arg2;//Inversion du Y
+ } else {
+ localData3 = instruction.arg2;
+ }
+ GoToPosition(instruction.arg1,localData3,instruction.arg3,localData1);
waitingAckID = ASSERVISSEMENT_XYT;
waitingAckFrom = ACKNOWLEDGE_MOTEUR;
break;
@@ -263,7 +273,7 @@
//L'action est spécifique
} else {
//C'est un AX12 qu'il faut bouger
- AX12_setGoal(instruction.arg1,instruction.arg3,instruction.arg2);
+ AX12_setGoal(instruction.arg1,instruction.arg3/10,instruction.arg2);
AX12_enchainement++;
}
waitingAckFrom = 0;
@@ -454,6 +464,19 @@
case SERVO_AX12_DONE:
AX12_notifyCANEnd(((unsigned short)(msgRxBuffer[FIFO_lecture].data[0])));
break;
+ case ECRAN_CHOICE_COLOR://Choix de la couleur
+ if(gameEtat == ETAT_CONFIG) {
+ if(msgRxBuffer[FIFO_lecture].data[0] == 0)
+ InversStrat = 0;//Pas d'inversion de la couleur
+ else
+ InversStrat = 1;//Inversion de la couleur
+ }
+ break;
+ case ECRAN_CHOICE_STRAT://Choix du fichier de stratégie à utiliser
+ if(gameEtat == ETAT_CONFIG) {
+
+ }
+ break;
}
FIFO_lecture=(FIFO_lecture+1)%SIZE_FIFO;
--- a/main.cpp Fri Apr 15 10:49:40 2016 +0000
+++ b/main.cpp Fri Apr 15 16:43:35 2016 +0000
@@ -40,7 +40,7 @@
tactile_printf("Initialisation cartes...");
initRobot();//Initialisation du robot
- wait_ms(9000);//Attente pour que toutes les cartes se lancent et surtout le CANBlue
+ wait_ms(2000);//Attente pour que toutes les cartes se lancent et surtout le CANBlue
/**
A retirer lors de l'utilisation avec selecteur de stratégie sur IHM
