WIP
This commit is contained in:
		
							parent
							
								
									a656d62d41
								
							
						
					
					
						commit
						374da66a5e
					
				| @ -29,6 +29,7 @@ Robot_config.c | |||||||
| Score.c | Score.c | ||||||
| Servomoteur.c | Servomoteur.c | ||||||
| Strategie.c | Strategie.c | ||||||
|  | Strategie_deplacement.c | ||||||
| Strategie_prise_cerises.c | Strategie_prise_cerises.c | ||||||
| Temps.c | Temps.c | ||||||
| Test.c | Test.c | ||||||
|  | |||||||
| @ -82,7 +82,7 @@ int main() { | |||||||
|     AsserMoteur_Init(); |     AsserMoteur_Init(); | ||||||
|     Localisation_init(); |     Localisation_init(); | ||||||
| 
 | 
 | ||||||
|     //while(mode_test());
 |     while(mode_test()); | ||||||
|     i2c_maitre_init(); |     i2c_maitre_init(); | ||||||
|     Trajet_init(); |     Trajet_init(); | ||||||
|     Balise_VL53L1X_init(); |     Balise_VL53L1X_init(); | ||||||
|  | |||||||
							
								
								
									
										63
									
								
								Strategie.c
									
									
									
									
									
								
							
							
						
						
									
										63
									
								
								Strategie.c
									
									
									
									
									
								
							| @ -1,7 +1,6 @@ | |||||||
| #include "hardware/gpio.h" | #include "hardware/gpio.h" | ||||||
| #include "i2c_annexe.h" | #include "i2c_annexe.h" | ||||||
| #include "Asser_Position.h" | #include "Asser_Position.h" | ||||||
| #include "Balise_VL53L1X.h" |  | ||||||
| #include "Commande_vitesse.h" | #include "Commande_vitesse.h" | ||||||
| #include "Geometrie_robot.h" | #include "Geometrie_robot.h" | ||||||
| #include "Localisation.h" | #include "Localisation.h" | ||||||
| @ -484,7 +483,7 @@ enum etat_action_t lance_balles(uint32_t step_ms, uint32_t nb_cerises){ | |||||||
|             if(temporisation_terminee(&tempo_ms, step_ms)){ |             if(temporisation_terminee(&tempo_ms, step_ms)){ | ||||||
|                 i2c_annexe_mi_ferme_porte(); |                 i2c_annexe_mi_ferme_porte(); | ||||||
|                 etat_lance_balle = LANCE_TEMPO_PROP_ON; |                 etat_lance_balle = LANCE_TEMPO_PROP_ON; | ||||||
|                 tempo_ms = 750; |                 tempo_ms = 500; | ||||||
|             } |             } | ||||||
|             break; |             break; | ||||||
| 
 | 
 | ||||||
| @ -559,66 +558,6 @@ enum etat_action_t calage_angle(enum longer_direction_t longer_direction, float | |||||||
|     return etat_action; |     return etat_action; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| enum etat_action_t parcourt_trajet_simple(struct trajectoire_t trajectoire, uint32_t step_ms){ |  | ||||||
|     enum etat_action_t etat_action = ACTION_EN_COURS; |  | ||||||
|     enum etat_trajet_t etat_trajet; |  | ||||||
|     float angle_avancement; |  | ||||||
|      |  | ||||||
|     static enum { |  | ||||||
|         PARCOURS_INIT, |  | ||||||
|         PARCOURS_AVANCE, |  | ||||||
|     } etat_parcourt=PARCOURS_INIT; |  | ||||||
| 
 |  | ||||||
|     switch (etat_parcourt){ |  | ||||||
|         case PARCOURS_INIT: |  | ||||||
|             Trajet_debut_trajectoire(trajectoire); |  | ||||||
|             etat_parcourt = PARCOURS_AVANCE; |  | ||||||
|             break; |  | ||||||
|          |  | ||||||
|         case PARCOURS_AVANCE: |  | ||||||
|             angle_avancement = Trajet_get_orientation_avance(); |  | ||||||
|             distance_obstacle = Balise_VL53L1X_get_distance_obstacle_mm(angle_avancement); |  | ||||||
|             Trajet_set_obstacle_mm(distance_obstacle); |  | ||||||
| 
 |  | ||||||
|             etat_trajet = Trajet_avance(step_ms/1000.); |  | ||||||
|             if(etat_trajet == TRAJET_TERMINE){ |  | ||||||
|                 Trajet_set_obstacle_mm(DISTANCE_INVALIDE); |  | ||||||
|                 etat_action = ACTION_TERMINEE; |  | ||||||
|                 etat_parcourt = PARCOURS_INIT; |  | ||||||
|             } |  | ||||||
|             break; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     return etat_action; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| enum etat_action_t parcourt_trajet_simple_sans_evitement(struct trajectoire_t trajectoire, uint32_t step_ms){ |  | ||||||
|     enum etat_action_t etat_action = ACTION_EN_COURS; |  | ||||||
|     enum etat_trajet_t etat_trajet; |  | ||||||
|     static enum { |  | ||||||
|         PARCOURS_INIT, |  | ||||||
|         PARCOURS_AVANCE, |  | ||||||
|     } etat_parcourt=PARCOURS_INIT; |  | ||||||
| 
 |  | ||||||
|     switch (etat_parcourt){ |  | ||||||
|         case PARCOURS_INIT: |  | ||||||
|             Trajet_debut_trajectoire(trajectoire); |  | ||||||
|             Trajet_set_obstacle_mm(distance_pas_obstacle); |  | ||||||
|             etat_parcourt = PARCOURS_AVANCE; |  | ||||||
|             break; |  | ||||||
|          |  | ||||||
|         case PARCOURS_AVANCE: |  | ||||||
|             etat_trajet = Trajet_avance(step_ms/1000.); |  | ||||||
|             if(etat_trajet == TRAJET_TERMINE){ |  | ||||||
|                 etat_action = ACTION_TERMINEE; |  | ||||||
|                 etat_parcourt = PARCOURS_INIT; |  | ||||||
|             } |  | ||||||
|             break; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     return etat_action; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// @brief Renvoi 1 si on doit attendre le déclenchement de la tirette
 | /// @brief Renvoi 1 si on doit attendre le déclenchement de la tirette
 | ||||||
| uint attente_tirette(void){ | uint attente_tirette(void){ | ||||||
|     return !gpio_get(TIRETTE); |     return !gpio_get(TIRETTE); | ||||||
|  | |||||||
							
								
								
									
										70
									
								
								Strategie_deplacement.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								Strategie_deplacement.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,70 @@ | |||||||
|  | #include "Strategie.h" | ||||||
|  | #include "Trajet.h" | ||||||
|  | #include "Evitement.h" | ||||||
|  | #include "Geometrie.h" | ||||||
|  | #include "Balise_VL53L1X.h" | ||||||
|  | 
 | ||||||
|  | enum etat_action_t Strategie_parcourir_trajet(){ | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | enum etat_action_t parcourt_trajet_simple(struct trajectoire_t trajectoire, uint32_t step_ms){ | ||||||
|  |     enum etat_action_t etat_action = ACTION_EN_COURS; | ||||||
|  |     enum etat_trajet_t etat_trajet; | ||||||
|  |     float angle_avancement; | ||||||
|  |      | ||||||
|  |     static enum { | ||||||
|  |         PARCOURS_INIT, | ||||||
|  |         PARCOURS_AVANCE, | ||||||
|  |     } etat_parcourt=PARCOURS_INIT; | ||||||
|  | 
 | ||||||
|  |     switch (etat_parcourt){ | ||||||
|  |         case PARCOURS_INIT: | ||||||
|  |             Trajet_debut_trajectoire(trajectoire); | ||||||
|  |             etat_parcourt = PARCOURS_AVANCE; | ||||||
|  |             break; | ||||||
|  |          | ||||||
|  |         case PARCOURS_AVANCE: | ||||||
|  |             angle_avancement = Trajet_get_orientation_avance(); | ||||||
|  |             distance_obstacle = Balise_VL53L1X_get_distance_obstacle_mm(angle_avancement); | ||||||
|  |             Trajet_set_obstacle_mm(distance_obstacle); | ||||||
|  | 
 | ||||||
|  |             etat_trajet = Trajet_avance(step_ms/1000.); | ||||||
|  |             if(etat_trajet == TRAJET_TERMINE){ | ||||||
|  |                 Trajet_set_obstacle_mm(DISTANCE_INVALIDE); | ||||||
|  |                 etat_action = ACTION_TERMINEE; | ||||||
|  |                 etat_parcourt = PARCOURS_INIT; | ||||||
|  |             } | ||||||
|  |             break; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return etat_action; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | enum etat_action_t parcourt_trajet_simple_sans_evitement(struct trajectoire_t trajectoire, uint32_t step_ms){ | ||||||
|  |     enum etat_action_t etat_action = ACTION_EN_COURS; | ||||||
|  |     enum etat_trajet_t etat_trajet; | ||||||
|  |     static enum { | ||||||
|  |         PARCOURS_INIT, | ||||||
|  |         PARCOURS_AVANCE, | ||||||
|  |     } etat_parcourt=PARCOURS_INIT; | ||||||
|  | 
 | ||||||
|  |     switch (etat_parcourt){ | ||||||
|  |         case PARCOURS_INIT: | ||||||
|  |             Trajet_debut_trajectoire(trajectoire); | ||||||
|  |             Trajet_set_obstacle_mm(distance_pas_obstacle); | ||||||
|  |             etat_parcourt = PARCOURS_AVANCE; | ||||||
|  |             break; | ||||||
|  |          | ||||||
|  |         case PARCOURS_AVANCE: | ||||||
|  |             etat_trajet = Trajet_avance(step_ms/1000.); | ||||||
|  |             if(etat_trajet == TRAJET_TERMINE){ | ||||||
|  |                 etat_action = ACTION_TERMINEE; | ||||||
|  |                 etat_parcourt = PARCOURS_INIT; | ||||||
|  |             } | ||||||
|  |             break; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return etat_action; | ||||||
|  | } | ||||||
							
								
								
									
										0
									
								
								Strategie_deplacement.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								Strategie_deplacement.h
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										9
									
								
								Trajet.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								Trajet.c
									
									
									
									
									
								
							| @ -186,6 +186,15 @@ float Trajet_get_orientation_avance(){ | |||||||
|     return angle; |     return angle; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void Trajet_inverse(){ | ||||||
|  |     float old_abscisse = abscisse; | ||||||
|  |     float old_position_mm = position_mm; | ||||||
|  |     Trajectoire_inverse(&trajet_trajectoire); | ||||||
|  |     Trajet_debut_trajectoire(trajet_trajectoire); | ||||||
|  |     abscisse = 1 - old_abscisse; | ||||||
|  |     position_mm = Trajectoire_get_longueur_mm(&trajet_trajectoire) - old_position_mm; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| float Trajet_get_abscisse(){ | float Trajet_get_abscisse(){ | ||||||
|     return abscisse; |     return abscisse; | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user