Stratégie d'homologation : sans évitement, sans tirette, sans gestion du côté.
This commit is contained in:
parent
30977bb4f1
commit
1bc1514b23
23
Strategie.c
23
Strategie.c
@ -1,5 +1,6 @@
|
||||
#include "hardware/gpio.h"
|
||||
#include "i2c_annexe.h"
|
||||
#include "Asser_Position.h"
|
||||
#include "Geometrie_robot.h"
|
||||
#include "Localisation.h"
|
||||
#include "Moteurs.h"
|
||||
@ -61,6 +62,16 @@ void Homologation(uint32_t step_ms){
|
||||
465,2830,
|
||||
+30. * DEGREE_EN_RADIAN, +120. * DEGREE_EN_RADIAN);
|
||||
|
||||
if(parcourt_trajet_simple(trajectoire, step_ms) == ACTION_TERMINEE){
|
||||
etat_strategie = CALAGE_PANIER_1;
|
||||
}
|
||||
break;
|
||||
|
||||
case APPROCHE_PANIER_2:
|
||||
Trajectoire_droite(&trajectoire,Localisation_get().x_mm, Localisation_get().y_mm,
|
||||
265,2830,
|
||||
+120. * DEGREE_EN_RADIAN, +120. * DEGREE_EN_RADIAN);
|
||||
|
||||
if(parcourt_trajet_simple(trajectoire, step_ms) == ACTION_TERMINEE){
|
||||
etat_strategie = CALAGE_PANIER_1;
|
||||
}
|
||||
@ -68,7 +79,7 @@ void Homologation(uint32_t step_ms){
|
||||
break;
|
||||
|
||||
case CALAGE_PANIER_1:
|
||||
if(calage_angle(LONGER_VERS_A, RAYON_ROBOT, 3000 - (RAYON_ROBOT/(RACINE_DE_3/2)), 120. *DEGREE_EN_RADIAN) == ACTION_TERMINEE){
|
||||
if(calage_angle(LONGER_VERS_A, RAYON_ROBOT, 3000 - (RAYON_ROBOT/(RACINE_DE_3/2.)), 120. *DEGREE_EN_RADIAN) == ACTION_TERMINEE){
|
||||
etat_strategie = RECULE_PANIER;
|
||||
}
|
||||
break;
|
||||
@ -76,8 +87,8 @@ void Homologation(uint32_t step_ms){
|
||||
case RECULE_PANIER:
|
||||
Trajet_config(250, 500);
|
||||
Trajectoire_droite(&trajectoire,Localisation_get().x_mm, Localisation_get().y_mm,
|
||||
225, 3000 - (RAYON_ROBOT/(RACINE_DE_3/2)) - 120,
|
||||
120. * DEGREE_EN_RADIAN, +240. * DEGREE_EN_RADIAN);
|
||||
180, 3000 - (RAYON_ROBOT/(RACINE_DE_3/2)) - 80,
|
||||
120. * DEGREE_EN_RADIAN, +270. * DEGREE_EN_RADIAN);
|
||||
|
||||
if(parcourt_trajet_simple(trajectoire, step_ms) == ACTION_TERMINEE){
|
||||
etat_strategie = LANCE_DANS_PANIER;
|
||||
@ -85,6 +96,7 @@ void Homologation(uint32_t step_ms){
|
||||
break;
|
||||
|
||||
case LANCE_DANS_PANIER:
|
||||
Asser_Position_maintien();
|
||||
if(lance_balles(step_ms) == ACTION_TERMINEE){
|
||||
etat_strategie = STRATEGIE_FIN;
|
||||
}
|
||||
@ -120,7 +132,8 @@ enum etat_action_t lance_balles(uint32_t step_ms){
|
||||
|
||||
case LANCE_TEMPO_PROP_ON:
|
||||
if (tempo_ms < step_ms){
|
||||
etat_lance_balle = LANCE_PORTE_OUVERTE;
|
||||
//etat_lance_balle = LANCE_PORTE_OUVERTE;
|
||||
etat_lance_balle = LANCE_TEMPO_PROP_ON;
|
||||
i2c_annexe_ouvre_porte();
|
||||
tempo_ms = 6000;
|
||||
}else{
|
||||
@ -133,6 +146,8 @@ enum etat_action_t lance_balles(uint32_t step_ms){
|
||||
etat_lance_balle = LANCE_PROPULSEUR_ON;
|
||||
i2c_annexe_desactive_propulseur();
|
||||
etat_action = ACTION_TERMINEE;
|
||||
}else{
|
||||
tempo_ms -= step_ms;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -27,9 +27,10 @@ extern enum etat_strategie_t{
|
||||
APPROCHE_CERISE_1_B=2,
|
||||
ATTRAPE_CERISE_1=3,
|
||||
APPROCHE_PANIER_1=4,
|
||||
CALAGE_PANIER_1=5,
|
||||
RECULE_PANIER=6,
|
||||
LANCE_DANS_PANIER=7,
|
||||
APPROCHE_PANIER_2=5,
|
||||
CALAGE_PANIER_1=6,
|
||||
RECULE_PANIER=7,
|
||||
LANCE_DANS_PANIER=8,
|
||||
STRATEGIE_FIN=254,
|
||||
}etat_strategie;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#define MAX_LONGE_MM 240
|
||||
|
||||
// Translation en mm/s pour aspirer les cerises
|
||||
#define TRANSLATION_CERISE 45
|
||||
#define TRANSLATION_CERISE 70
|
||||
|
||||
void commande_rotation_contacteur_longer_A();
|
||||
void commande_rotation_contacteur_longer_C();
|
||||
@ -58,10 +58,9 @@ enum etat_action_t cerise_attraper_bordure(enum longer_direction_t longer_direct
|
||||
|
||||
case TURBINE_DEMARRAGE:
|
||||
i2c_annexe_ferme_porte();
|
||||
//i2c_annexe_active_turbine();
|
||||
i2c_annexe_active_propulseur();
|
||||
i2c_annexe_active_turbine();
|
||||
commande_vitesse_stop();
|
||||
tempo_ms = 2000;
|
||||
tempo_ms = 1000;
|
||||
etat_attrape = TURBINE_DEMARRAGE_TEMPO;
|
||||
|
||||
break;
|
||||
@ -90,6 +89,7 @@ enum etat_action_t cerise_attraper_bordure(enum longer_direction_t longer_direct
|
||||
|
||||
case ASPIRE_LIBRE:
|
||||
commande_vitesse_stop();
|
||||
i2c_annexe_desactive_turbine();
|
||||
etat_action = ACTION_TERMINEE;
|
||||
break;
|
||||
}
|
||||
|
@ -103,11 +103,14 @@ int test_homologation(){
|
||||
i2c_maitre_init();
|
||||
Trajet_init();
|
||||
//printf("Init gyroscope\n");
|
||||
//Gyro_Init();
|
||||
set_position_avec_gyroscope(1);
|
||||
if(get_position_avec_gyroscope()){
|
||||
Gyro_Init();
|
||||
}
|
||||
|
||||
stdio_flush();
|
||||
|
||||
//set_position_avec_gyroscope(1);
|
||||
|
||||
|
||||
multicore_launch_core1(affichage_test_strategie);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user