2023-03-26 19:28:13 +00:00
|
|
|
#include "pico/stdlib.h"
|
2023-04-01 08:40:30 +00:00
|
|
|
#include "Trajectoire.h"
|
2023-03-26 19:28:13 +00:00
|
|
|
|
|
|
|
#ifndef STRATEGIE_H
|
|
|
|
#define STRATEGIE_H
|
|
|
|
|
2023-03-28 21:03:35 +00:00
|
|
|
#define COULEUR 15
|
|
|
|
#define TIRETTE 14
|
2023-04-28 21:51:43 +00:00
|
|
|
//#define CORR_ANGLE_DEPART_DEGREE (-1.145)
|
|
|
|
#define CORR_ANGLE_DEPART_DEGREE (0)
|
2023-03-28 21:03:35 +00:00
|
|
|
|
2023-03-03 18:50:44 +00:00
|
|
|
enum etat_action_t{
|
|
|
|
ACTION_EN_COURS,
|
2023-05-19 14:43:33 +00:00
|
|
|
ACTION_TERMINEE,
|
|
|
|
ACTION_ECHEC
|
2023-03-18 16:59:15 +00:00
|
|
|
};
|
|
|
|
|
2023-03-26 14:34:06 +00:00
|
|
|
enum longer_direction_t{
|
|
|
|
LONGER_VERS_A,
|
|
|
|
LONGER_VERS_C
|
|
|
|
};
|
|
|
|
|
2023-03-28 21:03:35 +00:00
|
|
|
enum couleur_t{
|
|
|
|
COULEUR_BLEU=0,
|
2023-04-17 14:36:35 +00:00
|
|
|
COULEUR_VERT,
|
|
|
|
COULEUR_INCONNUE,
|
2023-03-28 21:03:35 +00:00
|
|
|
};
|
|
|
|
|
2023-05-13 21:03:23 +00:00
|
|
|
enum evitement_t{
|
|
|
|
SANS_EVITEMENT,
|
|
|
|
PAUSE_DEVANT_OBSTACLE,
|
|
|
|
ARRET_DEVANT_OBSTACLE,
|
|
|
|
RETOUR_SI_OBSTABLE,
|
|
|
|
CONTOURNEMENT
|
|
|
|
};
|
|
|
|
|
2023-05-19 14:43:33 +00:00
|
|
|
struct objectif_t{
|
|
|
|
int priorite;
|
|
|
|
enum {A_FAIRE, EN_COURS, BLOQUE, FAIT} etat;
|
|
|
|
enum {CERISE_BAS, CERISE_HAUT, CERISE_GAUCHE, CERISE_DROITE,
|
|
|
|
ZONE_1, ZONE_2, ZONE_3, ZONE_4, ZONE_5} cible;
|
|
|
|
};
|
|
|
|
|
2023-03-26 14:34:06 +00:00
|
|
|
enum etat_action_t cerise_accostage(void);
|
2023-03-28 21:03:35 +00:00
|
|
|
enum etat_action_t avance_puis_longe_bordure(enum longer_direction_t longer_direction);
|
2023-04-01 08:40:30 +00:00
|
|
|
enum etat_action_t parcourt_trajet_simple(struct trajectoire_t trajectoire, uint32_t step_ms);
|
2023-04-01 14:44:08 +00:00
|
|
|
enum etat_action_t parcourt_trajet_simple_sans_evitement(struct trajectoire_t trajectoire, uint32_t step_ms);
|
|
|
|
enum etat_action_t depose_cerises(uint32_t step_ms);
|
2023-03-26 19:28:13 +00:00
|
|
|
void Homologation(uint32_t step_ms);
|
2023-03-28 21:03:35 +00:00
|
|
|
enum couleur_t lire_couleur(void);
|
|
|
|
uint attente_tirette(void);
|
2023-05-08 15:47:39 +00:00
|
|
|
enum etat_action_t lance_balles(uint32_t step_ms, uint32_t nb_cerises);
|
2023-04-13 17:43:35 +00:00
|
|
|
int test_panier(void);
|
2023-05-11 19:04:02 +00:00
|
|
|
void Strategie(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms);
|
2023-04-13 17:43:35 +00:00
|
|
|
|
|
|
|
int temporisation_terminee(uint32_t * tempo_ms, uint32_t step_ms);
|
2023-05-08 09:51:54 +00:00
|
|
|
enum etat_action_t Strategie_aller_panier(enum couleur_t couleur, uint32_t step_ms);
|
2023-05-13 21:03:23 +00:00
|
|
|
enum etat_action_t Strategie_parcourir_trajet(struct trajectoire_t trajectoire, uint32_t step_ms, enum evitement_t evitement);
|
2023-05-17 14:54:59 +00:00
|
|
|
int Robot_est_dans_zone_depose(enum couleur_t couleur);
|
2023-05-19 21:40:07 +00:00
|
|
|
int Robot_est_dans_zone_depose_panier(enum couleur_t couleur);
|
2023-05-17 21:35:11 +00:00
|
|
|
enum etat_action_t Strategie_preparation();
|
2023-03-28 21:03:35 +00:00
|
|
|
|
2023-05-19 14:43:33 +00:00
|
|
|
enum etat_action_t Strategie_pieds_dans_plat_trajet(struct objectif_t *objectif_plat_courant, enum couleur_t couleur, uint32_t step_ms);
|
|
|
|
enum etat_action_t Strategie_pieds_dans_plat(enum couleur_t couleur, uint32_t step_ms);
|
2023-05-20 00:19:41 +00:00
|
|
|
enum etat_action_t Strategie_aller_a(float pos_x, float pos_y, uint32_t step_ms);
|
2023-05-19 14:43:33 +00:00
|
|
|
|
2023-04-28 21:51:43 +00:00
|
|
|
extern float distance_obstacle;
|
2023-03-26 19:28:13 +00:00
|
|
|
|
|
|
|
// STRATEGIE_H
|
2023-05-19 14:43:33 +00:00
|
|
|
#endif
|