En cours, attrappe pots côté bleu
This commit is contained in:
parent
f0d6c72ece
commit
c53180ab39
20
Strategie.c
20
Strategie.c
@ -584,22 +584,24 @@ enum etat_action_t Strategie_calage_debut_manuel(enum couleur_t couleur, uint32_
|
||||
switch(etat_calage_debut){
|
||||
case CD_ENVOI_CDE_BORDURE:
|
||||
i2c_annexe_set_mode_VL53L8(VL53L8_BORDURE);
|
||||
etat_calage_debut = CD_LECTURE_BORDURE_X;
|
||||
etat_calage_debut = CD_LECTURE_BORDURE_Y;
|
||||
break;
|
||||
|
||||
case CD_LECTURE_BORDURE_X:
|
||||
case CD_LECTURE_BORDURE_Y:
|
||||
i2c_annexe_get_VL53L8(&validite, &angle, &distance);
|
||||
if(validite == VL53L8_BORDURE){
|
||||
i2c_annexe_set_mode_VL53L8(VL53L8_INVALIDE);
|
||||
commande_vitesse_stop();
|
||||
Localisation_set_y(215.);
|
||||
if(angle < 0){
|
||||
Localisation_set_x(distance + DISTANCE_CENTRE_CAPTEUR);
|
||||
Localisation_set_angle((-180. * DEGRE_EN_RADIAN) - ANGLE_PINCE + angle);
|
||||
Localisation_set_angle((-60. * DEGRE_EN_RADIAN));
|
||||
|
||||
if(couleur == COULEUR_BLEU){
|
||||
Localisation_set_x(215.);
|
||||
Localisation_set_y(2000 - (distance + DISTANCE_CENTRE_CAPTEUR));
|
||||
//Localisation_set_angle((90. * DEGRE_EN_RADIAN) - ANGLE_PINCE + angle);
|
||||
Localisation_set_angle((210. * DEGRE_EN_RADIAN));
|
||||
}else{
|
||||
Localisation_set_x(3025 - (distance + DISTANCE_CENTRE_CAPTEUR));
|
||||
Localisation_set_angle((-3. * DEGRE_EN_RADIAN) - ANGLE_PINCE + angle);
|
||||
Localisation_set_x(3000 - 215.);
|
||||
Localisation_set_y(2000 - (distance + DISTANCE_CENTRE_CAPTEUR));
|
||||
Localisation_set_angle((270. * DEGRE_EN_RADIAN));
|
||||
}
|
||||
|
||||
etat_calage_debut = CD_ALLER_POSITION_INIT;
|
||||
|
@ -34,16 +34,27 @@ enum etat_groupe_plante_t etat_groupe_plante[6]={
|
||||
GROUPE_PLANTE_DISPO
|
||||
};
|
||||
|
||||
struct position_t approche_groupe_plante[6]={
|
||||
{.x_mm= 0, .y_mm=0, .angle_radian = 0},
|
||||
{.x_mm= 580, .y_mm=1530, .angle_radian = 0},
|
||||
{.x_mm= 580, .y_mm=530, .angle_radian = 0},
|
||||
{.x_mm= 580, .y_mm=530, .angle_radian = 0},
|
||||
{.x_mm= 1220, .y_mm=360, .angle_radian = 0}, // ATTENTION- spécifique bleu
|
||||
{.x_mm= 3000 - 580, .y_mm=530, .angle_radian = 0},
|
||||
|
||||
|
||||
}
|
||||
|
||||
int ordre_groupe_pot[6];
|
||||
|
||||
unsigned int get_groupe_pot(enum couleur_t couleur){
|
||||
if(couleur == COULEUR_BLEU){
|
||||
return GROUPE_POT_B1;
|
||||
return GROUPE_POT_L1;
|
||||
}
|
||||
return GROUPE_POT_B2;
|
||||
return GROUPE_POT_R2;
|
||||
}
|
||||
enum zone_plante_t get_zone_plante(enum couleur_t couleur){
|
||||
enum zone_plante_t ordre_groupe_plante_bleu[6] = { ZONE_PLANTE_3, ZONE_PLANTE_2, ZONE_PLANTE_4, ZONE_PLANTE_5, ZONE_PLANTE_6, ZONE_PLANTE_1};
|
||||
enum zone_plante_t ordre_groupe_plante_bleu[6] = { ZONE_PLANTE_2, ZONE_PLANTE_3, ZONE_PLANTE_4, ZONE_PLANTE_5, ZONE_PLANTE_6, ZONE_PLANTE_1};
|
||||
enum zone_plante_t ordre_groupe_plante_jaune[6] = { ZONE_PLANTE_5, ZONE_PLANTE_6, ZONE_PLANTE_4, ZONE_PLANTE_3, ZONE_PLANTE_2, ZONE_PLANTE_1};
|
||||
enum zone_plante_t *ordre_groupe_plante;
|
||||
int i;
|
||||
@ -79,6 +90,7 @@ void Strategie_2024(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms)
|
||||
TAP_ECHANGE_POT,
|
||||
TAP_PLANTE_ATTRAPE_3,
|
||||
TAP_PLANTE_ATTRAPE_4,
|
||||
TAP_PLANTE_TERMINEE,
|
||||
TAP_RENTRE,
|
||||
TAP_RENTRE_RECALE,
|
||||
TAP_DEPOSE_0,
|
||||
@ -98,7 +110,7 @@ void Strategie_2024(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms)
|
||||
break;
|
||||
case TAP_POT:
|
||||
if(Strat_2024_attrape_pot(get_groupe_pot(couleur), _step_ms) == ACTION_TERMINEE){
|
||||
etat_test=TAP_PANNEAUX_SOLAIRES;
|
||||
etat_test=TAP_ALLER_PLANTE;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -131,7 +143,7 @@ void Strategie_2024(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms)
|
||||
etat_test=TAP_PLANTE_ATTRAPE_2;
|
||||
etat_action = ACTION_EN_COURS;
|
||||
}else if( etat_action == ACTION_ECHEC){
|
||||
etat_test=TAP_RENTRE;
|
||||
etat_test=TAP_PLANTE_TERMINEE;
|
||||
etat_action = ACTION_EN_COURS;
|
||||
}
|
||||
break;
|
||||
@ -142,7 +154,7 @@ void Strategie_2024(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms)
|
||||
etat_test=TAP_ECHANGE_POT;
|
||||
etat_action = ACTION_EN_COURS;
|
||||
}else if( etat_action == ACTION_ECHEC){
|
||||
etat_test=TAP_RENTRE;
|
||||
etat_test=TAP_PLANTE_TERMINEE;
|
||||
etat_action = ACTION_EN_COURS;
|
||||
}
|
||||
break;
|
||||
@ -159,7 +171,7 @@ void Strategie_2024(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms)
|
||||
etat_test=TAP_PLANTE_ATTRAPE_4;
|
||||
etat_action = ACTION_EN_COURS;
|
||||
}else if( etat_action == ACTION_ECHEC){
|
||||
etat_test=TAP_RENTRE;
|
||||
etat_test=TAP_PLANTE_TERMINEE;
|
||||
etat_action = ACTION_EN_COURS;
|
||||
}
|
||||
break;
|
||||
@ -167,14 +179,18 @@ void Strategie_2024(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms)
|
||||
case TAP_PLANTE_ATTRAPE_4:
|
||||
etat_action = Strat_2024_plante_dans_pot(_step_ms, PLANTE_BRAS_1, get_zone_plante(couleur));
|
||||
if( etat_action == ACTION_TERMINEE){
|
||||
etat_test=TAP_RENTRE;
|
||||
etat_test=TAP_PLANTE_TERMINEE;
|
||||
etat_action = ACTION_EN_COURS;
|
||||
}else if( etat_action == ACTION_ECHEC){
|
||||
etat_test=TAP_RENTRE;
|
||||
etat_test=TAP_PLANTE_TERMINEE;
|
||||
etat_action = ACTION_EN_COURS;
|
||||
}
|
||||
break;
|
||||
|
||||
case TAP_PLANTE_TERMINEE:
|
||||
etat_test=TAP_RENTRE;
|
||||
|
||||
|
||||
case TAP_RENTRE:
|
||||
if(couleur == COULEUR_BLEU){
|
||||
angle_destination = 60 * DEGRE_EN_RADIAN;
|
||||
|
@ -141,7 +141,7 @@ enum etat_action_t Strat_2024_attrape_pot(unsigned int groupe_pot, uint32_t step
|
||||
/*etat_action = Strategie_tourner_et_aller_a(
|
||||
position_approche_pot.x_mm, position_approche_pot.y_mm, position_approche_pot.angle_radian - angle_bras[0],
|
||||
SANS_EVITEMENT, step_ms);*/
|
||||
etat_action = Strategie_tourner_et_aller_a(
|
||||
etat_action = Strategie_aller_a_puis_tourner(
|
||||
position_approche_pot.x_mm, position_approche_pot.y_mm, (-30. *DEGRE_EN_RADIAN),
|
||||
EVITEMENT_PAUSE_DEVANT_OBSTACLE, step_ms);
|
||||
if (etat_action == ACTION_TERMINEE){
|
||||
|
Loading…
Reference in New Issue
Block a user