From 3de890a72049a8413939eaa58f7fa3beb927a04f Mon Sep 17 00:00:00 2001
From: Samuel <samuel.kay@poivron-robotique.fr>
Date: Thu, 9 May 2024 18:31:50 +0200
Subject: [PATCH] Code pour 4 PAMIs

---
 Trajet.h      |  1 +
 VL53L8_2024.c |  2 +-
 main.c        | 15 ++++++++++-----
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Trajet.h b/Trajet.h
index 1e074f9..84438ac 100644
--- a/Trajet.h
+++ b/Trajet.h
@@ -11,6 +11,7 @@ enum etat_trajet_t{
 
 // Vitesse et acceleration pour translation pure (en mm/s et mm/s²)
 #define TRAJECT_CONFIG_RAPIDE 300, 1200
+#define TRAJECT_CONFIG_RAPIDE_ROUGE 500, 1200
 // Vitesse et acceleration pour un mouvement complexe (en mm et mm/s²)
 #define TRAJECT_CONFIG_AVANCE_ET_TOURNE 300, 500
 // Vitesse et acceleration - standard (en mm et mm/s²)
diff --git a/VL53L8_2024.c b/VL53L8_2024.c
index ab1921a..b394914 100644
--- a/VL53L8_2024.c
+++ b/VL53L8_2024.c
@@ -154,7 +154,7 @@ int VL53L8_min_distance(VL53L8CX_ResultsData Results, float *distance){
 	int min_distance = 2000;
 	int col, row;
 	for(col=0; col<8; col++){
-		for(row=4; row<=6; row++){
+		for(row=0; row<=1; row++){
 			if(min_distance >  Results.distance_mm[col + 8*row]){
 				min_distance = Results.distance_mm[col + 8*row];
 			}
diff --git a/main.c b/main.c
index 7366f46..5b1bf0c 100644
--- a/main.c
+++ b/main.c
@@ -228,6 +228,7 @@ uint identifiant_lire(){
 void configure_trajet(int identifiant, int couleur){
 	
 	struct trajectoire_t trajectoire;
+	Trajet_config(TRAJECT_CONFIG_RAPIDE);
 
 	switch(couleur){
 		case COULEUR_JAUNE:
@@ -249,11 +250,15 @@ void configure_trajet(int identifiant, int couleur){
 					3000-540, 1400, 3000+60, 1400, -M_PI, -M_PI);
 					break;
 				case 3:
-					Localisation_set(1121-1130, 2000-63, 0);
+					Localisation_set(3000-1130, 2000-63, 0);
 					Trajectoire_bezier(&trajectoire, 3000-1122, 2000-63, 3000-905, 2000-63, 
 					3000-606, 2000-590, 3000-225, 2000-225, -M_PI, -M_PI);
 					break;
 				case 4:
+					Trajet_config(TRAJECT_CONFIG_RAPIDE_ROUGE);
+					Localisation_set(3000-1364, 2000-63, 0);
+					Trajectoire_bezier(&trajectoire, 3000-1363, 2000-63, 3000-550, 2000-63, 
+					3000-900, 600, 3000-0, 0, 0, 0);
 					break;
 				case 5:
 					break;
@@ -291,6 +296,10 @@ void configure_trajet(int identifiant, int couleur){
 					606, 2000-590, 225, 2000-225, M_PI, M_PI);
 					break;
 				case 4:
+					Trajet_config(TRAJECT_CONFIG_RAPIDE_ROUGE);
+					Localisation_set(1364, 2000-63, M_PI);
+					Trajectoire_bezier(&trajectoire, 1363, 2000-63, 550, 2000-63, 
+					900, 600, 0, 0, -M_PI / 2., M_PI);
 					break;
 				case 5:
 					break;
@@ -305,10 +314,6 @@ void configure_trajet(int identifiant, int couleur){
 			break;
 	}
 	
-	
-	
-
-	Trajet_config(TRAJECT_CONFIG_RAPIDE);
 	Trajet_debut_trajectoire(trajectoire);
 
 }
\ No newline at end of file