Ajustement de l'asservissement pour un truc plus doux

This commit is contained in:
Samuel 2024-05-09 08:36:35 +02:00
parent f08edb590e
commit d68fa90724
3 changed files with 12 additions and 8 deletions

View File

@ -2,8 +2,8 @@
#include "Commande_vitesse.h"
#include "math.h"
#define GAIN_P_POSITION 1
#define GAIN_P_ORIENTATION 10
#define GAIN_P_POSITION 15
#define GAIN_P_ORIENTATION 2
struct position_t position_maintien;
@ -30,14 +30,14 @@ void Asser_Position(struct position_t position_consigne){
delta_orientation_radian = Geometrie_get_angle_optimal(0. , delta_orientation_radian_tmp);
// On asservi sur +PI/2 / -PI/2
/*if(delta_orientation_radian > (M_PI/2)){
if(delta_orientation_radian > (M_PI/2)){
delta_orientation_radian -= M_PI;
delta_avance_mm = -delta_avance_mm;
}
if(delta_orientation_radian < -(M_PI/2)){
delta_orientation_radian += M_PI;
delta_avance_mm = -delta_avance_mm;
}*/
}

View File

@ -148,7 +148,7 @@ float Trajet_calcul_vitesse(float pas_de_temps_s){
vitesse_max_contrainte = vitesse_max_contrainte_obstacle;
}
}*/
if(Trajet_get_obstacle_mm() < 50){
if((Trajet_get_obstacle_mm() != DISTANCE_INVALIDE) && (Trajet_get_obstacle_mm() < 50)){
vitesse = 0;
}

8
main.c
View File

@ -43,7 +43,7 @@ void configure_trajet(int identifiant, int couleur);
void gestion_VL53L8CX(void);
uint32_t step_ms=1;
const uint32_t step_ms=1;
float distance1_mm=0, distance2_mm=0;
// DEBUG
@ -82,7 +82,8 @@ void main(void)
//multicore_launch_core1(gestion_affichage);
multicore_launch_core1(gestion_VL53L8CX);
sleep_ms(4000);
sleep_ms(3000);
printf("Demarrage...\n");
@ -274,6 +275,9 @@ void configure_trajet(int identifiant, int couleur){
600, 1400, 0, 2000, M_PI, M_PI);
break;
case 2:
Localisation_set(1117, 2000-63, M_PI);
Trajectoire_bezier(&trajectoire, 1116, 2000-63, 975, 2000-63,
540, 1400, -60, 1400, M_PI, M_PI);
break;
case 3:
Localisation_set(1130, 2000-63, M_PI);