Amélioration stratégie

1 sursaut au rebroussement entre 1A et 1B et 1 sursaut au départ après le recalage
This commit is contained in:
Samuel 2026-05-06 15:46:36 +02:00
parent 2b1ea9f084
commit 3e5a8d0f4a
2 changed files with 67 additions and 11 deletions

View File

@ -139,7 +139,10 @@ enum etat_action_t Strategie_Ninja_2(uint32_t step_ms, enum couleur_t couleur){
NINJA_GRENIER1B_RECALE, NINJA_GRENIER1B_RECALE,
NINJA_GRENIER1C, NINJA_GRENIER1C,
NINJA_GRENIER1D, NINJA_GRENIER1D,
NINJA_GRENIER2, NINJA_GRENIER2A,
NINJA_GRENIER2A_RECALE,
NINJA_GRENIER2B,
NINJA_GRENIER2C,
NINJA_FIN NINJA_FIN
} etat_sss = NINJA_INIT; } etat_sss = NINJA_INIT;
static struct trajectoire_t trajectoire_composee; static struct trajectoire_t trajectoire_composee;
@ -203,28 +206,64 @@ enum etat_action_t Strategie_Ninja_2(uint32_t step_ms, enum couleur_t couleur){
Trajet_config(TRAJECT_CONFIG_STD); Trajet_config(TRAJECT_CONFIG_STD);
Trajectoire_droite(&trajectoire1, Trajectoire_droite(&trajectoire1,
1195, 1725, 1195, 1725,
900, 1725, 0., 0.); 1050, 1725, 0., 0.);
} }
} }
break; break;
case NINJA_GRENIER1D: case NINJA_GRENIER1D:
if(Strategie_parcourir_trajet(trajectoire1, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){ if(Strategie_parcourir_trajet(trajectoire1, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){
etat_sss = NINJA_GRENIER2; etat_sss = NINJA_GRENIER2A;
Trajectoire_droite(&trajectoire1, Trajectoire_bezier(&trajectoire1,
900, 1725, 1050, 1725,
1650, 1775, 0., 0.); 1170, 1725,
1200, 1820,
1200, 1950,
0., 0.);
} }
break; break;
case NINJA_GRENIER2: case NINJA_GRENIER2A:
if(Strategie_parcourir_trajet(trajectoire1, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){
etat_sss = NINJA_GRENIER2A_RECALE;
}
break;
case NINJA_GRENIER2A_RECALE:
if(Strategie_recale(RECALE_SENS_ARRIERE, step_ms) == ACTION_TERMINEE){
etat_sss = NINJA_GRENIER2B;
Trajet_config(100, 100);
Localisation_set(1200, 1975, -M_PI/2);
if(couleur == COULEUR_JAUNE){
Trajectoire_bezier(&trajectoire1,
1200, 1975,
1200, 1890,
1135, 1775,
1260, 1775, 0., 0.);
}
}
break;
case NINJA_GRENIER2B:
if(Strategie_parcourir_trajet(trajectoire1, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){
etat_sss = NINJA_GRENIER2C;
Trajectoire_droite(&trajectoire1,
1260, 1775,
1400, 1775,
0., 0.);
}
break;
case NINJA_GRENIER2C:
if(Strategie_parcourir_trajet(trajectoire1, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){ if(Strategie_parcourir_trajet(trajectoire1, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){
etat_sss = NINJA_FIN; etat_sss = NINJA_FIN;
Trajectoire_droite(&trajectoire1,
1260, 1775,
1400, 1775,
0., 0.);
} }
break; break;
case NINJA_FIN: case NINJA_FIN:
//Asser_Position_maintien(); //Asser_Position_maintien();
return ACTION_TERMINEE; return ACTION_TERMINEE;

21
main.c
View File

@ -127,6 +127,23 @@ void gestion_PAMI(uint32_t step_ms, int * asser_pos){
static uint32_t temps_tirette, temps_mouvement; static uint32_t temps_tirette, temps_mouvement;
enum etat_action_t etat_action=ACTION_EN_COURS; enum etat_action_t etat_action=ACTION_EN_COURS;
// Identifiant 0 : PAMI Ninja
// Tempo Demarrage : 0 s
// Tempo action : 100 s
uint32_t tempo_demarrage_ms, tempo_action_ms;
if(get_identifiant() == 0){
tempo_demarrage_ms = 0;
tempo_action_ms = 100000;
}else{
// Autres
// Tempo Demarrage : 85 s
// Tempo action : 15 s
tempo_demarrage_ms = 85000;
tempo_action_ms = 15000;
}
switch (etat_PAMI) switch (etat_PAMI)
{ {
case PAMI_ATTENTE_TIRETTE: case PAMI_ATTENTE_TIRETTE:
@ -140,7 +157,7 @@ void gestion_PAMI(uint32_t step_ms, int * asser_pos){
if(get_tirette() == 1 && (Temps_get_temps_ms() - temps_tirette > 1000)){ if(get_tirette() == 1 && (Temps_get_temps_ms() - temps_tirette > 1000)){
etat_PAMI = PAMI_FIN_TEMPO_MANUELLE; etat_PAMI = PAMI_FIN_TEMPO_MANUELLE;
} }
if (Temps_get_temps_ms() - temps_tirette > 85000){ if (Temps_get_temps_ms() - temps_tirette > tempo_demarrage_ms){
etat_PAMI = PAMI_TRAJECTOIRE; etat_PAMI = PAMI_TRAJECTOIRE;
temps_mouvement = Temps_get_temps_ms(); temps_mouvement = Temps_get_temps_ms();
} }
@ -154,7 +171,7 @@ void gestion_PAMI(uint32_t step_ms, int * asser_pos){
break; break;
case PAMI_TRAJECTOIRE: case PAMI_TRAJECTOIRE:
if(Temps_get_temps_ms() - temps_mouvement > 15000){ if(Temps_get_temps_ms() - temps_mouvement > tempo_action_ms){
etat_PAMI = PAMI_DANCE; etat_PAMI = PAMI_DANCE;
} }
if(etat_action == ACTION_EN_COURS){ if(etat_action == ACTION_EN_COURS){