trajets pour les robot 1 à 3 + détection de l'adversaire plus souple
This commit is contained in:
parent
d68fa90724
commit
15c58d0db4
@ -3,7 +3,7 @@
|
|||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
#define GAIN_P_POSITION 15
|
#define GAIN_P_POSITION 15
|
||||||
#define GAIN_P_ORIENTATION 2
|
#define GAIN_P_ORIENTATION 10
|
||||||
|
|
||||||
struct position_t position_maintien;
|
struct position_t position_maintien;
|
||||||
|
|
||||||
|
6
Trajet.c
6
Trajet.c
@ -141,16 +141,16 @@ float Trajet_calcul_vitesse(float pas_de_temps_s){
|
|||||||
vitesse_max_contrainte = 0;
|
vitesse_max_contrainte = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*distance_contrainte_obstacle = Trajet_get_obstacle_mm();
|
distance_contrainte_obstacle = Trajet_get_obstacle_mm();
|
||||||
if(distance_contrainte_obstacle != DISTANCE_INVALIDE){
|
if(distance_contrainte_obstacle != DISTANCE_INVALIDE){
|
||||||
vitesse_max_contrainte_obstacle = sqrtf(2 * acceleration_mm_ss_obstacle * distance_contrainte_obstacle);
|
vitesse_max_contrainte_obstacle = sqrtf(2 * acceleration_mm_ss_obstacle * distance_contrainte_obstacle);
|
||||||
if(vitesse_max_contrainte_obstacle < vitesse_max_contrainte){
|
if(vitesse_max_contrainte_obstacle < vitesse_max_contrainte){
|
||||||
vitesse_max_contrainte = vitesse_max_contrainte_obstacle;
|
vitesse_max_contrainte = vitesse_max_contrainte_obstacle;
|
||||||
}
|
}
|
||||||
}*/
|
}/*
|
||||||
if((Trajet_get_obstacle_mm() != DISTANCE_INVALIDE) && (Trajet_get_obstacle_mm() < 50)){
|
if((Trajet_get_obstacle_mm() != DISTANCE_INVALIDE) && (Trajet_get_obstacle_mm() < 50)){
|
||||||
vitesse = 0;
|
vitesse = 0;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// Selection de la vitesse la plus faible
|
// Selection de la vitesse la plus faible
|
||||||
|
@ -14,6 +14,8 @@ int masque[64]={
|
|||||||
195,200,202,206,213,200,200,202
|
195,200,202,206,213,200,200,202
|
||||||
};
|
};
|
||||||
|
|
||||||
|
float old_min_distance;
|
||||||
|
|
||||||
void VL53L8_init(VL53L8CX_Configuration * Dev){
|
void VL53L8_init(VL53L8CX_Configuration * Dev){
|
||||||
uint8_t status, isAlive, isReady, i;
|
uint8_t status, isAlive, isReady, i;
|
||||||
|
|
||||||
@ -162,7 +164,12 @@ int VL53L8_min_distance(VL53L8CX_ResultsData Results, float *distance){
|
|||||||
if(min_distance-50 > 0){
|
if(min_distance-50 > 0){
|
||||||
*distance = min_distance-50;
|
*distance = min_distance-50;
|
||||||
}
|
}
|
||||||
|
old_min_distance = *distance;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float VL53L8_get_old_min_distance(){
|
||||||
|
return old_min_distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
36
main.c
36
main.c
@ -82,7 +82,7 @@ void main(void)
|
|||||||
|
|
||||||
//multicore_launch_core1(gestion_affichage);
|
//multicore_launch_core1(gestion_affichage);
|
||||||
multicore_launch_core1(gestion_VL53L8CX);
|
multicore_launch_core1(gestion_VL53L8CX);
|
||||||
sleep_ms(3000);
|
sleep_ms(5000);
|
||||||
printf("Demarrage...\n");
|
printf("Demarrage...\n");
|
||||||
|
|
||||||
|
|
||||||
@ -113,16 +113,13 @@ void main(void)
|
|||||||
if(temps_ms % step_ms == 0){
|
if(temps_ms % step_ms == 0){
|
||||||
QEI_update();
|
QEI_update();
|
||||||
Localisation_gestion();
|
Localisation_gestion();
|
||||||
if(Trajet_get_obstacle_mm() < 50){
|
|
||||||
Moteur_Stop();
|
if(etat_trajet != TRAJET_TERMINE){
|
||||||
|
etat_trajet = Trajet_avance((float)step_ms/1000.);
|
||||||
}else{
|
}else{
|
||||||
if(etat_trajet != TRAJET_TERMINE){
|
Asser_Position_maintien();
|
||||||
etat_trajet = Trajet_avance((float)step_ms/1000.);
|
|
||||||
}else{
|
|
||||||
Asser_Position_maintien();
|
|
||||||
}
|
|
||||||
AsserMoteur_Gestion(step_ms);
|
|
||||||
}
|
}
|
||||||
|
AsserMoteur_Gestion(step_ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,16 +236,19 @@ void configure_trajet(int identifiant, int couleur){
|
|||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
Localisation_set(1465, 2000-63, M_PI);
|
Localisation_set(3000-1249, 2000-63, 0);
|
||||||
Trajectoire_bezier(&trajectoire, 3000-1465, 2000-63, 3000-1260, 2000-63,
|
Trajectoire_bezier(&trajectoire, 3000-1250, 2000-63, 3000-1050, 2000-63,
|
||||||
3000-600, 1400, 3000-0, 2000, M_PI, M_PI);
|
3000-750, 1400, 3000-750, 2100, 0, 0);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
Localisation_set(3000-1117, 2000-63, 0);
|
||||||
|
Trajectoire_bezier(&trajectoire, 3000-1116, 2000-63, 3000-975, 2000-63,
|
||||||
|
3000-540, 1400, 3000+60, 1400, -M_PI, -M_PI);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Localisation_set(3000 - 1130, 2000-63, 0);
|
Localisation_set(1121-1130, 2000-63, 0);
|
||||||
Trajectoire_bezier(&trajectoire, 3000-1122, 2000-63, 3000-905, 2000-63,
|
Trajectoire_bezier(&trajectoire, 3000-1122, 2000-63, 3000-905, 2000-63,
|
||||||
3000-606, 2000-590, 3000-225, 2000-225, 0, 0);
|
3000-606, 2000-590, 3000-225, 2000-225, -M_PI, -M_PI);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
break;
|
break;
|
||||||
@ -270,9 +270,9 @@ void configure_trajet(int identifiant, int couleur){
|
|||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
Localisation_set(1465, 2000-63, M_PI);
|
Localisation_set(1249, 2000-63, M_PI);
|
||||||
Trajectoire_bezier(&trajectoire, 1465, 2000-63, 1260, 2000-63,
|
Trajectoire_bezier(&trajectoire, 1250, 2000-63, 1050, 2000-63,
|
||||||
600, 1400, 0, 2000, M_PI, M_PI);
|
750, 1400, 750, 2100, M_PI, M_PI);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Localisation_set(1117, 2000-63, M_PI);
|
Localisation_set(1117, 2000-63, M_PI);
|
||||||
@ -280,7 +280,7 @@ void configure_trajet(int identifiant, int couleur){
|
|||||||
540, 1400, -60, 1400, M_PI, M_PI);
|
540, 1400, -60, 1400, M_PI, M_PI);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Localisation_set(1130, 2000-63, M_PI);
|
Localisation_set(1121, 2000-63, M_PI);
|
||||||
Trajectoire_bezier(&trajectoire, 1122, 2000-63, 905, 2000-63,
|
Trajectoire_bezier(&trajectoire, 1122, 2000-63, 905, 2000-63,
|
||||||
606, 2000-590, 225, 2000-225, M_PI, M_PI);
|
606, 2000-590, 225, 2000-225, M_PI, M_PI);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user