Match 5
This commit is contained in:
		
							parent
							
								
									060fb3414a
								
							
						
					
					
						commit
						0e45582a6b
					
				
							
								
								
									
										8
									
								
								Score.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								Score.c
									
									
									
									
									
								
							| @ -7,6 +7,7 @@ | ||||
| uint32_t Score_nb_cerises=0; | ||||
| uint32_t Score_nb_points=0; | ||||
| uint32_t Score_funny_action=0; | ||||
| uint32_t Score_gateau=0; | ||||
| uint32_t Score_pieds_dans_plat=0; | ||||
| 
 | ||||
| void Score_recalcule(){ | ||||
| @ -16,6 +17,7 @@ void Score_recalcule(){ | ||||
|     } | ||||
|     Score_nb_points += Score_funny_action; | ||||
|     Score_nb_points += Score_pieds_dans_plat; | ||||
|     Score_nb_points += Score_gateau; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| @ -24,6 +26,12 @@ void Score_actualise(){ | ||||
|     i2c_annexe_envoie_score(Score_nb_points); | ||||
| } | ||||
| 
 | ||||
| void Score_ajout_gateau(uint32_t nb_gateau){ | ||||
|     Score_gateau += nb_gateau; | ||||
|     Score_actualise(); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void Score_set_funny_action(){ | ||||
|     Score_funny_action = 5; | ||||
|     Score_actualise(); | ||||
|  | ||||
							
								
								
									
										1
									
								
								Score.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								Score.h
									
									
									
									
									
								
							| @ -3,3 +3,4 @@ | ||||
| void Score_set_funny_action(); | ||||
| void Score_set_pieds_dans_plat(); | ||||
| void Score_ajout_cerise(uint32_t nb_cerises); | ||||
| void Score_ajout_gateau(uint32_t nb_gateau); | ||||
| @ -97,7 +97,7 @@ void Strategie(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms){ | ||||
|             if(couleur == COULEUR_BLEU){ | ||||
|                 Localisation_set(225., 3000 - PETIT_RAYON_ROBOT_MM, (120.+CORR_ANGLE_DEPART_DEGREE) * DEGRE_EN_RADIAN); | ||||
|                 struct objectif_t objectif_1 = { .priorite = 10, .etat = FAIT, .cible = CERISE_BAS}; | ||||
|                 struct objectif_t objectif_2 = { .priorite = 1, .etat = FAIT, .cible = CERISE_HAUT}; | ||||
|                 struct objectif_t objectif_2 = { .priorite = 1, .etat = A_FAIRE, .cible = CERISE_HAUT}; | ||||
|                 struct objectif_t objectif_3 = { .priorite = 2, .etat = A_FAIRE, .cible = CERISE_GAUCHE}; | ||||
|                 struct objectif_t objectif_4 = { .priorite = 5, .etat = FAIT, .cible = CERISE_DROITE}; | ||||
|                 objectifs[0]= objectif_1; | ||||
| @ -107,7 +107,7 @@ void Strategie(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms){ | ||||
|             }else{ | ||||
|                 Localisation_set(2000 - 225., 3000 - PETIT_RAYON_ROBOT_MM, (120.+CORR_ANGLE_DEPART_DEGREE) * DEGRE_EN_RADIAN); | ||||
|                 struct objectif_t objectif_1 = { .priorite = 10, .etat = FAIT, .cible = CERISE_BAS}; | ||||
|                 struct objectif_t objectif_2 = { .priorite = 1, .etat = FAIT, .cible = CERISE_HAUT}; | ||||
|                 struct objectif_t objectif_2 = { .priorite = 1, .etat = A_FAIRE, .cible = CERISE_HAUT}; | ||||
|                 struct objectif_t objectif_3 = { .priorite = 2, .etat = A_FAIRE | ||||
|                 , .cible = CERISE_DROITE}; | ||||
|                 struct objectif_t objectif_4 = { .priorite = 5, .etat = FAIT, .cible = CERISE_GAUCHE}; | ||||
| @ -201,6 +201,7 @@ void Strategie(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms){ | ||||
|             if(couleur == COULEUR_BLEU){ | ||||
|                 if(Strategie_aller_cerises_laterales_proches(couleur, step_ms)== ACTION_TERMINEE){ | ||||
|                     etat_strategie = ATTRAPER_CERISE_GAUCHE; | ||||
|                     Score_ajout_gateau(3); | ||||
|                 } | ||||
|             }else{ | ||||
|                 if(Strategie_aller_cerises_laterales_opposees(couleur, step_ms)== ACTION_TERMINEE){ | ||||
| @ -225,6 +226,7 @@ void Strategie(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms){ | ||||
|                 } | ||||
|             }else{ | ||||
|                 if(Strategie_aller_cerises_laterales_proches(couleur, step_ms)== ACTION_TERMINEE){ | ||||
|                     Score_ajout_gateau(3); | ||||
|                     etat_strategie = ATTRAPER_CERISE_DROITE; | ||||
|                 } | ||||
|             } | ||||
| @ -286,6 +288,7 @@ void Strategie(enum couleur_t couleur, uint32_t step_ms, uint32_t temps_ms){ | ||||
|             break; | ||||
|          | ||||
|         case RETOUR_MAISON: | ||||
|             i2c_annexe_plie_bras(); | ||||
|             if(Strategie_pieds_dans_plat(couleur, step_ms) == ACTION_TERMINEE){ | ||||
|                 // Si le robot est dans la zone du panier, jeter les cerises s'il en a
 | ||||
|                 if(Strategie_get_cerise_dans_robot() > 0 && Robot_est_dans_zone_depose_panier(couleur)){ | ||||
|  | ||||
| @ -23,7 +23,7 @@ enum etat_action_t Gateau_pousse_proche(enum couleur_t couleur, uint32_t step_ms | ||||
|                 angle_fin = 90. * DEGRE_EN_RADIAN; | ||||
|                 point_x = 310; | ||||
|             }else{ | ||||
|                 angle_fin = 195. * DEGRE_EN_RADIAN; | ||||
|                 angle_fin = 205. * DEGRE_EN_RADIAN; | ||||
|                 point_x = 1700; | ||||
|             } | ||||
|             angle_fin = Geometrie_get_angle_optimal(Localisation_get().angle_radian, angle_fin); | ||||
| @ -40,16 +40,16 @@ enum etat_action_t Gateau_pousse_proche(enum couleur_t couleur, uint32_t step_ms | ||||
|          | ||||
|         case ALLER_2: | ||||
|             if(couleur == COULEUR_BLEU){ | ||||
|                 angle_fin = 180. * DEGRE_EN_RADIAN; | ||||
|                 point_x = 225; | ||||
|                 angle_fin = 90. * DEGRE_EN_RADIAN; | ||||
|                 point_x = 310; | ||||
|             }else{ | ||||
|                 angle_fin = 180. * DEGRE_EN_RADIAN; | ||||
|                 point_x = 1775; | ||||
|                 angle_fin = 205. * DEGRE_EN_RADIAN; | ||||
|                 point_x = 1700; | ||||
|             } | ||||
|             angle_fin = Geometrie_get_angle_optimal(Localisation_get().angle_radian, angle_fin); | ||||
| 
 | ||||
|             Trajet_config(250, 250); | ||||
|             Trajectoire_droite(&trajectoire, Localisation_get().x_mm, Localisation_get().y_mm, point_x, 3000 - 1650, | ||||
|             Trajectoire_droite(&trajectoire, Localisation_get().x_mm, Localisation_get().y_mm, point_x, 3000 - 1700, | ||||
|                         Localisation_get().angle_radian, angle_fin); | ||||
| 
 | ||||
|             if(parcourt_trajet_simple(trajectoire, step_ms) == ACTION_TERMINEE){ | ||||
| @ -69,7 +69,7 @@ enum etat_action_t Gateau_pousse_proche(enum couleur_t couleur, uint32_t step_ms | ||||
|             angle_fin = Geometrie_get_angle_optimal(Localisation_get().angle_radian, angle_fin); | ||||
| 
 | ||||
|             Trajet_config(250, 250); | ||||
|             Trajectoire_droite(&trajectoire, Localisation_get().x_mm, Localisation_get().y_mm, point_x, 3000 - 1500, | ||||
|             Trajectoire_droite(&trajectoire, Localisation_get().x_mm, Localisation_get().y_mm, point_x, 3000 - 1600, | ||||
|                         Localisation_get().angle_radian, angle_fin); | ||||
| 
 | ||||
|             if(parcourt_trajet_simple(trajectoire, step_ms) == ACTION_TERMINEE){ | ||||
|  | ||||
| @ -43,7 +43,7 @@ enum etat_action_t cerises_attraper_cerises_droite(uint32_t step_ms){ | ||||
|     }etat_attrappe_cerises_droite = ATTRAPE_CERISE_DEMI_BAS; | ||||
|     struct trajectoire_t trajectoire; | ||||
|     float angle_fin; | ||||
|     float pos_recal_x_mm = PETIT_RAYON_ROBOT_MM + 30; | ||||
|     float pos_recal_x_mm = 2000 - (PETIT_RAYON_ROBOT_MM + 30); | ||||
| 
 | ||||
|     switch (etat_attrappe_cerises_droite){ | ||||
|         case ATTRAPE_CERISE_DEMI_BAS: | ||||
| @ -56,7 +56,7 @@ enum etat_action_t cerises_attraper_cerises_droite(uint32_t step_ms){ | ||||
|             angle_fin = Geometrie_get_angle_optimal(Localisation_get().angle_radian, 30 * DEGRE_EN_RADIAN); | ||||
| 
 | ||||
|             Trajectoire_droite(&trajectoire, Localisation_get().x_mm, Localisation_get().y_mm, | ||||
|                     2000 - 180, 1500 - 75, Localisation_get().angle_radian, angle_fin); | ||||
|                     2000 - 180, 3000 - 1600, Localisation_get().angle_radian, angle_fin); | ||||
|                      | ||||
|             if(parcourt_trajet_simple(trajectoire, step_ms) == ACTION_TERMINEE){ | ||||
|                 etat_attrappe_cerises_droite = ATTRAPE_CERISE_DEMI_HAUT; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user