From 3e5a8d0f4a5ea8fbef35d0b3b92bc1c28162e1be Mon Sep 17 00:00:00 2001 From: Samuel Date: Wed, 6 May 2026 15:46:36 +0200 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20strat=C3=A9gie=201=20sursau?= =?UTF-8?q?t=20au=20rebroussement=20entre=201A=20et=201B=20et=201=20sursau?= =?UTF-8?q?t=20au=20d=C3=A9part=20apr=C3=A8s=20le=20recalage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Strategie.c | 57 ++++++++++++++++++++++++++++++++++++++++++++--------- main.c | 21 ++++++++++++++++++-- 2 files changed, 67 insertions(+), 11 deletions(-) diff --git a/Strategie.c b/Strategie.c index f00f0a2..2cd6a35 100644 --- a/Strategie.c +++ b/Strategie.c @@ -139,7 +139,10 @@ enum etat_action_t Strategie_Ninja_2(uint32_t step_ms, enum couleur_t couleur){ NINJA_GRENIER1B_RECALE, NINJA_GRENIER1C, NINJA_GRENIER1D, - NINJA_GRENIER2, + NINJA_GRENIER2A, + NINJA_GRENIER2A_RECALE, + NINJA_GRENIER2B, + NINJA_GRENIER2C, NINJA_FIN } etat_sss = NINJA_INIT; static struct trajectoire_t trajectoire_composee; @@ -203,27 +206,63 @@ enum etat_action_t Strategie_Ninja_2(uint32_t step_ms, enum couleur_t couleur){ Trajet_config(TRAJECT_CONFIG_STD); Trajectoire_droite(&trajectoire1, 1195, 1725, - 900, 1725, 0., 0.); + 1050, 1725, 0., 0.); } } break; case NINJA_GRENIER1D: if(Strategie_parcourir_trajet(trajectoire1, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){ - etat_sss = NINJA_GRENIER2; - Trajectoire_droite(&trajectoire1, - 900, 1725, - 1650, 1775, 0., 0.); + etat_sss = NINJA_GRENIER2A; + Trajectoire_bezier(&trajectoire1, + 1050, 1725, + 1170, 1725, + 1200, 1820, + 1200, 1950, + 0., 0.); } 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){ etat_sss = NINJA_FIN; + Trajectoire_droite(&trajectoire1, + 1260, 1775, + 1400, 1775, + 0., 0.); } break; - - case NINJA_FIN: //Asser_Position_maintien(); diff --git a/main.c b/main.c index 3059ff1..3835de1 100644 --- a/main.c +++ b/main.c @@ -127,6 +127,23 @@ void gestion_PAMI(uint32_t step_ms, int * asser_pos){ static uint32_t temps_tirette, temps_mouvement; 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) { 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)){ 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; temps_mouvement = Temps_get_temps_ms(); } @@ -154,7 +171,7 @@ void gestion_PAMI(uint32_t step_ms, int * asser_pos){ break; 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; } if(etat_action == ACTION_EN_COURS){