Strategie Ninja1 + Code de calibration sur 1m
This commit is contained in:
parent
e78062d992
commit
869ab64e3f
71
Strategie.c
71
Strategie.c
@ -10,8 +10,11 @@ enum etat_action_t Strategie_Ninja(uint32_t step_ms, enum couleur_t couleur){
|
|||||||
NINJA_INIT,
|
NINJA_INIT,
|
||||||
NINJA_GRENIER1,
|
NINJA_GRENIER1,
|
||||||
NINJA_GRENIER2A,
|
NINJA_GRENIER2A,
|
||||||
|
NINJA_GRENIER2A_CALAGE,
|
||||||
NINJA_GRENIER2B,
|
NINJA_GRENIER2B,
|
||||||
NINJA_GRENIER2C,
|
NINJA_GRENIER2C,
|
||||||
|
NINJA_GRENIER2C_CALAGE,
|
||||||
|
NINJA_GRENIER2D,
|
||||||
NINJA_FIN
|
NINJA_FIN
|
||||||
} etat_sss = NINJA_INIT;
|
} etat_sss = NINJA_INIT;
|
||||||
static struct trajectoire_t trajectoire_composee;
|
static struct trajectoire_t trajectoire_composee;
|
||||||
@ -45,7 +48,7 @@ enum etat_action_t Strategie_Ninja(uint32_t step_ms, enum couleur_t couleur){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NINJA_GRENIER1:
|
case NINJA_GRENIER1:
|
||||||
Trajet_config(TRAJECT_CONFIG_RAPIDE);
|
Trajet_config(TRAJECT_CONFIG_STD);
|
||||||
if(Strategie_parcourir_trajet(trajectoire_composee, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){
|
if(Strategie_parcourir_trajet(trajectoire_composee, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){
|
||||||
etat_sss = NINJA_GRENIER2A;
|
etat_sss = NINJA_GRENIER2A;
|
||||||
if(couleur == COULEUR_JAUNE){
|
if(couleur == COULEUR_JAUNE){
|
||||||
@ -55,27 +58,38 @@ enum etat_action_t Strategie_Ninja(uint32_t step_ms, enum couleur_t couleur){
|
|||||||
980, 1850,
|
980, 1850,
|
||||||
980, 1970, 0., 0.);
|
980, 1970, 0., 0.);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NINJA_GRENIER2A:
|
case NINJA_GRENIER2A:
|
||||||
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_GRENIER2A_CALAGE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NINJA_GRENIER2A_CALAGE:
|
||||||
|
if(Strategie_recale(RECALE_SENS_ARRIERE, step_ms) == ACTION_TERMINEE){
|
||||||
etat_sss = NINJA_GRENIER2B;
|
etat_sss = NINJA_GRENIER2B;
|
||||||
|
Localisation_set_y(1975);
|
||||||
|
Localisation_set_x(980);
|
||||||
|
Localisation_set_angle(-M_PI/2);
|
||||||
if(couleur == COULEUR_JAUNE){
|
if(couleur == COULEUR_JAUNE){
|
||||||
Trajectoire_bezier(&trajectoire1,
|
Trajectoire_bezier(&trajectoire1,
|
||||||
980, 1970,
|
980, 1975,
|
||||||
980, 1850,
|
980, 1850,
|
||||||
1160, 1925,
|
1160, 1925,
|
||||||
1420, 1925, 0., 0.);
|
1420, 1925, 0., 0.);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case NINJA_GRENIER2B:
|
case NINJA_GRENIER2B:
|
||||||
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_GRENIER2C;
|
etat_sss = NINJA_GRENIER2C;
|
||||||
if(couleur == COULEUR_JAUNE){
|
if(couleur == COULEUR_JAUNE){
|
||||||
Trajet_config(TRAJECT_CONFIG_STD);
|
|
||||||
Trajectoire_bezier(&trajectoire1,
|
Trajectoire_bezier(&trajectoire1,
|
||||||
1420, 1925,
|
1420, 1925,
|
||||||
1377, 1925,
|
1377, 1925,
|
||||||
@ -87,7 +101,25 @@ enum etat_action_t Strategie_Ninja(uint32_t step_ms, enum couleur_t couleur){
|
|||||||
|
|
||||||
case NINJA_GRENIER2C:
|
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_GRENIER2C_CALAGE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NINJA_GRENIER2C_CALAGE:
|
||||||
|
if(Strategie_recale(RECALE_SENS_ARRIERE, step_ms) == ACTION_TERMINEE){
|
||||||
|
etat_sss = NINJA_GRENIER2D;
|
||||||
|
Localisation_set_y(1975);
|
||||||
|
Localisation_set_x(1354);
|
||||||
|
Localisation_set_angle(-M_PI/2);
|
||||||
|
Trajectoire_droite(&trajectoire1,
|
||||||
|
1354, 1975,
|
||||||
|
1354, 1630., 0., 0.);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NINJA_GRENIER2D:
|
||||||
|
if(Strategie_parcourir_trajet(trajectoire1, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){
|
||||||
|
etat_sss = ACTION_TERMINEE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -121,6 +153,37 @@ enum etat_action_t Strategie_test(uint32_t step_ms){
|
|||||||
return ACTION_EN_COURS;
|
return ACTION_EN_COURS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum etat_action_t Strategie_1_metre(uint32_t step_ms){
|
||||||
|
static enum{
|
||||||
|
TEST_INIT,
|
||||||
|
TEST_EN_COURS,
|
||||||
|
TEST_TERMINE
|
||||||
|
} etat_test = TEST_INIT;
|
||||||
|
static struct trajectoire_t trajectoire1;
|
||||||
|
Trajet_config(TRAJECT_CONFIG_STD);
|
||||||
|
|
||||||
|
|
||||||
|
switch(etat_test){
|
||||||
|
case TEST_INIT:
|
||||||
|
Localisation_set(0, 0, 0);
|
||||||
|
Trajectoire_droite(&trajectoire1,
|
||||||
|
0, 0,
|
||||||
|
1000, 0, 0., 0.);
|
||||||
|
etat_test = TEST_EN_COURS;
|
||||||
|
break;
|
||||||
|
case TEST_EN_COURS:
|
||||||
|
if(Strategie_parcourir_trajet(trajectoire1, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){
|
||||||
|
etat_test = TEST_TERMINE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TEST_TERMINE:
|
||||||
|
return ACTION_TERMINEE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ACTION_EN_COURS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PAMI_dance(int identifiant){
|
void PAMI_dance(int identifiant){
|
||||||
|
|||||||
@ -50,6 +50,7 @@ struct objectif_t{
|
|||||||
|
|
||||||
enum etat_action_t Strategie_Ninja(uint32_t step_ms, enum couleur_t);
|
enum etat_action_t Strategie_Ninja(uint32_t step_ms, enum couleur_t);
|
||||||
enum etat_action_t Strategie_test(uint32_t step_ms);
|
enum etat_action_t Strategie_test(uint32_t step_ms);
|
||||||
|
enum etat_action_t Strategie_1_metre(uint32_t step_ms);
|
||||||
|
|
||||||
void PAMI_dance(int);
|
void PAMI_dance(int);
|
||||||
|
|
||||||
|
|||||||
1
main.c
1
main.c
@ -161,6 +161,7 @@ void gestion_PAMI(uint32_t step_ms, int * asser_pos){
|
|||||||
switch (get_identifiant())
|
switch (get_identifiant())
|
||||||
{
|
{
|
||||||
case 0: etat_action = Strategie_Ninja(step_ms, get_couleur()); break;
|
case 0: etat_action = Strategie_Ninja(step_ms, get_couleur()); break;
|
||||||
|
case 1: etat_action = Strategie_1_metre(step_ms); break;
|
||||||
case 7: etat_action = Strategie_test(step_ms); break;
|
case 7: etat_action = Strategie_test(step_ms); break;
|
||||||
default: etat_action = ACTION_TERMINEE; break;
|
default: etat_action = ACTION_TERMINEE; break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user