code avec modifs, programme mit dans les robots pour les derniers matchs

Dependencies:   mbed SerialHalfDuplex SDFileSystem liaison_Bluetooth ident_crac DISCO-F469NI_portrait

Revision:
37:ee2c72e76d9c
Parent:
36:c37dbe2be916
--- a/Compteur_points/Compteur.cpp	Mon May 31 13:36:03 2021 +0000
+++ b/Compteur_points/Compteur.cpp	Sat Jul 17 16:19:46 2021 +0000
@@ -1,24 +1,31 @@
 #include "global.h"
 
-#define M_PI 3.14159265358979323846
-#define DEMI_GOBELET 30
+#define M_PI 3.14159265358979323846f
+#define MARGE_VENT 72.0f
+#define MARGE_BRAS 54.0f
+#define ECART 100.0f
 
-int Ventouse_coord[6][2]={{145,-75},{145,0},{145,75},{-145,75},{-145,0},{-145,-75}};
-int Bras_coord[6][2];
-int Manche_air_coord[6][2];
+float Ventouse_coord[6][2]={{150,-80},{150,0},{150,80},{-150,80},{-150,0},{-150,-80}};
+float Bras_coord[6][2]={{232,-75},{232,0},{232,75},{-232,75},{-232,0},{-232,-75}};
+
+float Position_de_pose[6][2];
 
 int score_final=0;
 int score_ventouse=0,gobelet_vert=0,gobelet_rouge=0,gobelet_port=0;
 int score_manche=0,manche_releve=0;
-int score_bon_port=0;
-int score_phare=0;
-int score_pavillon=0;
+int score_bon_port=0, port_lu = 0;
+int score_phare=0, phare_active=0;
+int score_pavillon=0, pavillon=0;
+int offset_score=0;
 
-int etat_groupe, gobelet_en_place=0, old_gobelet=0;
+int etat_groupe[6], gobelet_en_place=0, old_gobelet=0;
 unsigned char num_groupe;
 
 CompteurGameEtat VentEtat[6] = {ETAT_ATTENDRE, ETAT_ATTENDRE, ETAT_ATTENDRE, ETAT_ATTENDRE, ETAT_ATTENDRE, ETAT_ATTENDRE};
-int deja_compter[6] = {0, 0, 0, 0, 0, 0};
+
+int old_gobelet_vert=0;
+int old_gobelet_rouge=0;
+int old_gobelet_port=0;
 
 /********************************************************************************************************************/
 /* FUNCTION NAME: gestion_Message_CAN                                                                               */
@@ -28,133 +35,254 @@
 {
     int identifiant = msgRxBuffer[FIFO_ecriture].id;
     
-    switch(identifiant)
+    if(identifiant==0x220)
     {
-        case 0x220:
-            for(int num_vent=0;num_vent<6;num_vent++)
-            {        
-                switch(VentEtat[num_vent])
+        for(int num_vent=0;num_vent<6;num_vent++)
+        {        
+            switch(VentEtat[num_vent])
+            {
+                case ETAT_ATTENDRE:
+                etat_groupe[num_vent] = msgRxBuffer[FIFO_ecriture].data[num_vent];
+                if(etat_groupe[num_vent] == 5) //Pompe et capteur
+                {
+                    VentEtat[num_vent] = ETAT_RECUP;
+                }
+                break;
+                
+                case ETAT_RECUP:
+                etat_groupe[num_vent] = msgRxBuffer[FIFO_ecriture].data[num_vent];
+                if(etat_groupe[num_vent] == 2) //Electrovane
                 {
-                    case ETAT_ATTENDRE:
-                    etat_groupe = msgRxBuffer[FIFO_ecriture].data[num_vent];
-                    if(etat_groupe == 5) //Pompe et capteur
-                    {
-                        VentEtat[num_vent] = ETAT_RECUP;
-                    }
-                    break;
-                    
-                    case ETAT_RECUP:
-                    etat_groupe = msgRxBuffer[FIFO_ecriture].data[num_vent];
-                    if(etat_groupe == 2) //Electrovane
-                    {
-                        VentEtat[num_vent] = ETAT_COMPTER;
-                    }
-                    break;
-                    
-                    case ETAT_COMPTER:
-                        verif_position_ventouse(num_vent);
-                        compteur_de_points();
-                        VentEtat[num_vent] = ETAT_ATTENDRE;
-                    break;
+                    VentEtat[num_vent] = ETAT_COMPTER;
                 }
-            }   
-        break;
+                break;
                 
-        case BRAS_RE:
-            num_groupe = msgRxBuffer[FIFO_ecriture].data[0];
-            verif_position_bras(num_groupe);
-            compteur_de_points();
-        break;
-                
-        case AUTOMATE_MANCHE_BAS:
-            num_groupe = msgRxBuffer[FIFO_ecriture].data[0];
-            verif_position_manche(num_groupe);
-            compteur_de_points();
-        break;
+                case ETAT_COMPTER:
+                    verif_position_ventouse(num_vent);
+                    compteur_de_points();
+                    VentEtat[num_vent] = ETAT_ATTENDRE;
+                break;
+            }
+        } 
+    }   
+        
+    if(Flag_Bras_Re == 1)
+    {
+        num_groupe = Flag_num_bras;
+        if(num_groupe <6) verif_position_bras(num_groupe);
+        else if(num_groupe == 10) {verif_position_bras(1); verif_position_bras(0);}
+        else if(num_groupe == 20) {verif_position_bras(2); verif_position_bras(0);}
+        else if(num_groupe == 21) {verif_position_bras(2); verif_position_bras(1);}
+        else if(num_groupe == 210){verif_position_bras(2); verif_position_bras(1); verif_position_bras(0);}
+        else if(num_groupe == 43) {verif_position_bras(4); verif_position_bras(3);}
+        else if(num_groupe == 53) {verif_position_bras(5); verif_position_bras(3);}
+        else if(num_groupe == 54) {verif_position_bras(5); verif_position_bras(4);}
+        else if(num_groupe == 66) {verif_position_bras(5); verif_position_bras(4); verif_position_bras(3);}
+        compteur_de_points();
+        Flag_Bras_Re = 0;
+    }
+    
+    if(Flag_Manche_Bas == 1)
+    {
+        verif_position_manche();
+        compteur_de_points();
+        Flag_Manche_Bas = 0;
     } 
+    
+    if(Flag_Manche_Moy == 1)
+    {
+        verif_position_phare();
+        compteur_de_points();
+        Flag_Manche_Moy = 0;    
+    }
+    
+    if(Flag_pavillon == 1)
+    {
+        pavillon = 1;
+        compteur_de_points();
+        Flag_pavillon = 0; 
+    }
+    
 }
 
 void compteur_de_points(void)
 {
+    if(Hauteur == 1) score_phare = 2; 
+    else if(Hauteur == 0) offset_score = 10;
+    
+    //Points gobelets
     int paire_ventouse = abs(gobelet_vert - gobelet_rouge);
     
-    //Points gobelets
-    score_ventouse = (gobelet_vert*2 + gobelet_rouge*2)*2 - (paire_ventouse)*2 + gobelet_port;
+    score_ventouse = (gobelet_vert + gobelet_rouge - paire_ventouse)*3 + paire_ventouse*2 + gobelet_port;
     
     //Points manche à air
     if(manche_releve == 1) score_manche = 5;
-    else if(manche_releve == 2) score_manche = 15;
+    else if(manche_releve >= 2) score_manche = 15;
     
     //Points phare
+    if(phare_active == 1) score_phare = 15;
     
     //Points pavillons
+    if(pavillon == 1) score_pavillon = 5;
     
     //Points d'arrivée à bon port
+    score_bon_port = 10;
     
     //Points totaux
-    score_final = score_ventouse; //+ score_manche + score_phare + score_pavillon + score_bon_port;
+    score_final = score_ventouse + score_manche + score_pavillon + score_phare + score_bon_port;//+ offset_score;
 }
 
 
-
-
 /********************************************************************************************************************/
 /* FUNCTION NAME: verif_position_ventouse                                                                           */
 /* DESCRIPTION  : Vérifie si les gobelets posés par les ventouses sont dans un chenal/un port et augmente le score  */
 /********************************************************************************************************************/
 void verif_position_ventouse(int num_groupe)
 {   
-    int x_offset = Ventouse_coord[num_groupe][0]*cos(theta_robot*M_PI/1800) - Ventouse_coord[num_groupe][1]*sin(theta_robot*M_PI*1800);
-    int y_offset = Ventouse_coord[num_groupe][0]*sin(theta_robot*M_PI/1800) + Ventouse_coord[num_groupe][1]*cos(theta_robot*M_PI*1800);
+    float x_offset = Ventouse_coord[num_groupe][0]*cos((float)theta_robot*M_PI/1800.0f) - Ventouse_coord[num_groupe][1]*sin((float)theta_robot*M_PI/1800.0f);
+    float y_offset = Ventouse_coord[num_groupe][0]*sin((float)theta_robot*M_PI/1800.0f) + Ventouse_coord[num_groupe][1]*cos((float)theta_robot*M_PI/1800.0f);
     
     //chenal vert port départ bleu
-    if((x_robot+x_offset <= 530+DEMI_GOBELET)&&(x_robot+x_offset >= 500-DEMI_GOBELET)
-        && (y_robot+y_offset <= 400+DEMI_GOBELET)&&(y_robot+y_offset >= 0)) gobelet_vert++;
+    if(((float)x_robot+x_offset <= 530.0f+MARGE_VENT+ECART)&&((float)x_robot+x_offset >= 500.0f-MARGE_VENT-ECART)
+        && ((float)y_robot+y_offset <= 400.0f+MARGE_VENT)&&((float)y_robot+y_offset >= 0)) 
+        
+        {gobelet_vert++; Position_de_pose[num_groupe][0] = (float)x_robot+x_offset; Position_de_pose[num_groupe][1] = (float)y_robot+y_offset;}
+        
     //chenal rouge port départ bleu
-    else if((x_robot+x_offset <= 1100+DEMI_GOBELET)&&(x_robot+x_offset >= 1070-DEMI_GOBELET)
-            && (y_robot+y_offset <= 400+DEMI_GOBELET)&&(y_robot+y_offset >= 0)) gobelet_rouge++;
+    else if(((float)x_robot+x_offset <= 1100.0f+MARGE_VENT+ECART)&&((float)x_robot+x_offset >= 1070.0f-MARGE_VENT-ECART)
+            && ((float)y_robot+y_offset <= 400.0f+MARGE_VENT)&&((float)y_robot+y_offset >= 0))
+            
+        {gobelet_rouge++; Position_de_pose[num_groupe][0] = (float)x_robot+x_offset; Position_de_pose[num_groupe][1] = (float)y_robot+y_offset;}
+            
     //port départ bleu
-    else if((x_robot+x_offset > 530+DEMI_GOBELET)&&(x_robot+x_offset < 1070-DEMI_GOBELET)
-            && (y_robot+y_offset <= 400+DEMI_GOBELET)&&(y_robot+y_offset >= 0)) gobelet_port++;
+    else if(((float)x_robot+x_offset > 530.0f+MARGE_VENT+ECART)&&((float)x_robot+x_offset < 1070.0f-MARGE_VENT-ECART)
+            && ((float)y_robot+y_offset <= 400.0f+MARGE_VENT)&&((float)y_robot+y_offset >= 0)) 
+            
+            {gobelet_port++; Position_de_pose[num_groupe][0] = (float)x_robot+x_offset; Position_de_pose[num_groupe][1] = (float)y_robot+y_offset;}
             
     //chenal vert port ext bleu  
-    else if((x_robot+x_offset >= 1700-DEMI_GOBELET)&&(x_robot+x_offset <= 2000+DEMI_GOBELET)
-            && (y_robot+y_offset >= 1650-DEMI_GOBELET)&&(y_robot+y_offset <= 1750+DEMI_GOBELET)) gobelet_vert++;         
+    else if(((float)x_robot+x_offset >= 1700.0f-MARGE_VENT)&&((float)x_robot+x_offset <= 2000.0f+MARGE_VENT)
+            && ((float)y_robot+y_offset >= 1650.0f-MARGE_VENT)&&((float)y_robot+y_offset < 1800.0f)) 
+            
+            {gobelet_vert++; Position_de_pose[num_groupe][0] = (float)x_robot+x_offset; Position_de_pose[num_groupe][1] = (float)y_robot+y_offset;}
+                     
     //chenal rouge port ext bleu  
-    else if((x_robot+x_offset >= 1700-DEMI_GOBELET)&&(x_robot+x_offset <= 2000+DEMI_GOBELET)
-            && (y_robot+y_offset >= 1850-DEMI_GOBELET)&&(y_robot+y_offset <= 1950+DEMI_GOBELET)) gobelet_rouge++;
-    //port ext bleu  
-    else if((x_robot+x_offset >= 1700-DEMI_GOBELET)&&(x_robot+x_offset <= 2000+DEMI_GOBELET)
-            && (y_robot+y_offset > 1750+DEMI_GOBELET)&&(y_robot+y_offset < 1850-DEMI_GOBELET)) gobelet_port++;
+    else if(((float)x_robot+x_offset >= 1700.0f-MARGE_VENT)&&((float)x_robot+x_offset <= 2000.0f+MARGE_VENT)
+            && ((float)y_robot+y_offset >= 1800.0f)&&((float)y_robot+y_offset <= 1950.0f+MARGE_VENT)) 
+            
+            {gobelet_rouge++; Position_de_pose[num_groupe][0] = (float)x_robot+x_offset; Position_de_pose[num_groupe][1] = (float)y_robot+y_offset;}
             
             
     //chenal vert port départ jaune
-    else if((x_robot+x_offset <= 530+DEMI_GOBELET)&&(x_robot+x_offset >= 500-DEMI_GOBELET)
-            && (y_robot+y_offset <= 3000+DEMI_GOBELET)&&(y_robot+y_offset >= 2600-DEMI_GOBELET)) gobelet_vert++;
+    else if(((float)x_robot+x_offset <= 530.0f+MARGE_VENT+ECART)&&((float)x_robot+x_offset >= 500.0f-MARGE_VENT-ECART)
+            && ((float)y_robot+y_offset <= 3000.0f+MARGE_VENT)&&((float)y_robot+y_offset >= 2600.0f-MARGE_VENT)) 
+            
+            {gobelet_rouge++; Position_de_pose[num_groupe][0] = (float)x_robot+x_offset; Position_de_pose[num_groupe][1] = (float)y_robot+y_offset;}
+            
     //chenal rouge port départ jaune
-    else if((x_robot+x_offset <= 1100+DEMI_GOBELET)&&(x_robot+x_offset >= 1070-DEMI_GOBELET)
-            && (y_robot+y_offset <= 3000+DEMI_GOBELET)&&(y_robot+y_offset >= 2600-DEMI_GOBELET)) gobelet_rouge++;
+    else if(((float)x_robot+x_offset <= 1100.0f+MARGE_VENT+ECART)&&((float)x_robot+x_offset >= 1070.0f-MARGE_VENT-ECART)
+            && ((float)y_robot+y_offset <= 3000.0f+MARGE_VENT)&&((float)y_robot+y_offset >= 2600.0f-MARGE_VENT)) 
+            
+            {gobelet_vert++; Position_de_pose[num_groupe][0] = (float)x_robot+x_offset; Position_de_pose[num_groupe][1] = (float)y_robot+y_offset;}
+            
     //port départ jaune
-    else if((x_robot+x_offset > 530+DEMI_GOBELET)&&(x_robot+x_offset < 1070-DEMI_GOBELET)
-            && (y_robot+y_offset <= 3000+DEMI_GOBELET)&&(y_robot+y_offset >= 2600-DEMI_GOBELET)) gobelet_port++;
+    else if(((float)x_robot+x_offset > 530.0f+MARGE_VENT+ECART)&&((float)x_robot+x_offset < 1070.0f-MARGE_VENT-ECART)
+            && ((float)y_robot+y_offset <= 3000.0f+MARGE_VENT)&&((float)y_robot+y_offset >= 2600.0f-MARGE_VENT)) 
+            
+            {gobelet_port++; Position_de_pose[num_groupe][0] = (float)x_robot+x_offset; Position_de_pose[num_groupe][1] = (float)y_robot+y_offset;}
             
     //chenal vert port ext jaune  
-    else if((x_robot+x_offset >= 1700-DEMI_GOBELET)&&(x_robot+x_offset <= 2000+DEMI_GOBELET)
-            && (y_robot+y_offset >= 1050-DEMI_GOBELET)&&(y_robot+y_offset <= 1150+DEMI_GOBELET)) gobelet_vert++;               
+    else if(((float)x_robot+x_offset >= 1700.0f-MARGE_VENT)&&((float)x_robot+x_offset <= 2000.0f+MARGE_VENT)
+            && ((float)y_robot+y_offset >= 1050.0f-MARGE_VENT)&&((float)y_robot+y_offset < 1200.0f)) 
+            
+            {gobelet_vert++; Position_de_pose[num_groupe][0] = (float)x_robot+x_offset; Position_de_pose[num_groupe][1] = (float)y_robot+y_offset;}
+                           
     //chenal rouge port ext jaune  
-    else if((x_robot+x_offset >= 1700-DEMI_GOBELET)&&(x_robot+x_offset <= 2000+DEMI_GOBELET)
-            && (y_robot+y_offset >= 1250-DEMI_GOBELET)&&(y_robot+y_offset <= 1350+DEMI_GOBELET)) gobelet_rouge++;
-    //port ext jaune  
-    else if((x_robot+x_offset >= 1700-DEMI_GOBELET)&&(x_robot+x_offset <= 2000+DEMI_GOBELET)
-            && (y_robot+y_offset > 1150+DEMI_GOBELET)&&(y_robot+y_offset < 1250-DEMI_GOBELET)) gobelet_port++;
+    else if(((float)x_robot+x_offset >= 1700.0f-MARGE_VENT)&&((float)x_robot+x_offset <= 2000.0f+MARGE_VENT)
+            && ((float)y_robot+y_offset >= 1200.0f)&&((float)y_robot+y_offset <= 1350.0f+MARGE_VENT)) 
+            
+            {gobelet_rouge++; Position_de_pose[num_groupe][0] = (float)x_robot+x_offset; Position_de_pose[num_groupe][1] = (float)y_robot+y_offset;}
 }
 
+/********************************************************************************************************************/
+/* FUNCTION NAME: verif_position_bras                                                                               */
+/* DESCRIPTION  : Vérifie si les gobelets posés par les bras sont dans un chenal/un port et augmente le score       */
+/********************************************************************************************************************/
 void verif_position_bras(int num_groupe)
-{   
+{
+    float x_offset = Bras_coord[num_groupe][0]*cos((float)theta_robot*M_PI/1800.0f) - Bras_coord[num_groupe][1]*sin((float)theta_robot*M_PI/1800.0f);
+    float y_offset = Bras_coord[num_groupe][0]*sin((float)theta_robot*M_PI/1800.0f) + Bras_coord[num_groupe][1]*cos((float)theta_robot*M_PI/1800.0f);
+    
+    
+    //chenal vert port départ bleu
+    if(((float)x_robot+x_offset <= 530.0f+MARGE_BRAS+ECART)&&((float)x_robot+x_offset >= 500.0f-MARGE_BRAS-ECART)
+        && ((float)y_robot+y_offset <= 400.0f+MARGE_BRAS)&&((float)y_robot+y_offset >= 0)) gobelet_vert++;
+    //chenal rouge port départ bleu
+    else if(((float)x_robot+x_offset <= 1100.0f+MARGE_BRAS+ECART)&&((float)x_robot+x_offset >= 1070.0f-MARGE_BRAS-ECART)
+            && ((float)y_robot+y_offset <= 400.0f+MARGE_BRAS)&&((float)y_robot+y_offset >= 0)) gobelet_rouge++;
+    //port départ bleu
+    else if(((float)x_robot+x_offset > 530.0f+MARGE_BRAS+ECART)&&((float)x_robot+x_offset < 1070.0f-MARGE_BRAS-ECART)
+            && ((float)y_robot+y_offset <= 400.0f+MARGE_BRAS)&&((float)y_robot+y_offset >= 0)) gobelet_port++;
+            
+    //chenal vert port ext bleu  
+    else if(((float)x_robot+x_offset >= 1700.0f-MARGE_BRAS)&&((float)x_robot+x_offset <= 2000.0f+MARGE_BRAS)
+            && ((float)y_robot+y_offset >= 1650.0f-MARGE_BRAS)&&((float)y_robot+y_offset <= 1780.0f)) gobelet_vert++;         
+    //chenal rouge port ext bleu  
+    else if(((float)x_robot+x_offset >= 1700.0f-MARGE_BRAS)&&((float)x_robot+x_offset <= 2000.0f+MARGE_BRAS)
+            && ((float)y_robot+y_offset >= 1820.0f)&&((float)y_robot+y_offset <= 1950.0f+MARGE_BRAS)) gobelet_rouge++;
+    //Port ext bleu
+    else if((x_robot+x_offset >= 1700.0f-MARGE_BRAS)&&(x_robot+x_offset <= 2000.0f+MARGE_BRAS)
+            && (y_robot+y_offset > 1780.0f)&&(y_robot+y_offset < 1820.0f)) gobelet_port++;
+            
+            
+    //chenal vert port départ jaune
+    else if(((float)x_robot+x_offset <= 530.0f+MARGE_BRAS+ECART)&&((float)x_robot+x_offset >= 500.0f-MARGE_BRAS-ECART)
+            && ((float)y_robot+y_offset <= 3000.0f+MARGE_BRAS)&&((float)y_robot+y_offset >= 2600.0f-MARGE_BRAS)) gobelet_rouge++;
+    //chenal rouge port départ jaune
+    else if(((float)x_robot+x_offset <= 1100.0f+MARGE_BRAS+ECART)&&((float)x_robot+x_offset >= 1070.0f-MARGE_BRAS-ECART)
+            && ((float)y_robot+y_offset <= 3000.0f+MARGE_BRAS)&&((float)y_robot+y_offset >= 2600.0f-MARGE_BRAS)) gobelet_vert++;
+    //port départ jaune
+    else if(((float)x_robot+x_offset > 530.0f+MARGE_BRAS+ECART)&&((float)x_robot+x_offset < 1070.0f-MARGE_BRAS-ECART)
+            && ((float)y_robot+y_offset <= 3000.0f+MARGE_BRAS)&&((float)y_robot+y_offset >= 2600.0f-MARGE_BRAS)) gobelet_port++;
+            
+    //chenal vert port ext jaune  
+    else if(((float)x_robot+x_offset >= 1700.0f-MARGE_BRAS)&&((float)x_robot+x_offset <= 2000.0f+MARGE_BRAS)
+            && ((float)y_robot+y_offset >= 1050.0f-MARGE_BRAS)&&((float)y_robot+y_offset <= 1180.0f)) gobelet_vert++;               
+    //chenal rouge port ext jaune  
+    else if(((float)x_robot+x_offset >= 1700.0f-MARGE_BRAS)&&((float)x_robot+x_offset <= 2000.0f+MARGE_BRAS)
+            && ((float)y_robot+y_offset >= 1220.0f)&&((float)y_robot+y_offset <= 1350.0f+MARGE_BRAS)) gobelet_rouge++;
+    //Port ext jaune
+    else if((float)(x_robot+x_offset >= 1700.0f-MARGE_BRAS)&&((float)x_robot+x_offset <= 2000.0f+MARGE_BRAS)
+            && ((float)y_robot+y_offset > 1180.0f)&&((float)y_robot+y_offset < 1220.0f)) gobelet_port++;
 
 }
 
-void verif_position_manche(int num_groupe)
-{    
+/********************************************************************************************************************/
+/* FUNCTION NAME: verif_position_manche                                                                             */
+/* DESCRIPTION  : Vérifie si les bras des manches à air sont déployés au bon enroit et augmente le score            */
+/********************************************************************************************************************/
+void verif_position_manche(void)
+{
+    //Manches Bleus
+    if((x_robot <= 2000+MARGE_VENT)&&(x_robot >= 1700-MARGE_VENT)
+        && (y_robot <= 890+MARGE_VENT)&&(y_robot >= 0)) manche_releve++;
+        
+    //Manches Jaunes 
+    else if((x_robot <= 2000+MARGE_VENT)&&(x_robot >= 1700-MARGE_VENT)
+            && (y_robot <= 3000)&&(y_robot >= 2090-MARGE_VENT)) manche_releve++;
+}
 
+/********************************************************************************************************************/
+/* FUNCTION NAME: verif_position_phare                                                                            */
+/* DESCRIPTION  : Vérifie si les bras des manches à air sont déployés au bon enroit et augmente le score            */
+/********************************************************************************************************************/
+void verif_position_phare(void)
+{
+    //Phare Bleu
+    if((x_robot <= 300+MARGE_VENT)&&(x_robot >= 0-MARGE_VENT)
+        && (y_robot <= 890+MARGE_VENT)&&(y_robot >= 0)) phare_active=1;
+    
+    //Phare Jaune
+    else if((x_robot <= 300+MARGE_VENT)&&(x_robot >= 0-MARGE_VENT)
+            && (y_robot <= 3000)&&(y_robot >= 2090-MARGE_VENT)) phare_active=1;
 }
\ No newline at end of file