carte_strategie_2019
Dependencies: mbed SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac
Diff: Strategie/Strategie.cpp
- Revision:
- 77:641c7f1a827c
- Parent:
- 76:b5eb99354389
- Child:
- 78:c0533a36da8f
--- a/Strategie/Strategie.cpp Mon May 27 18:51:34 2019 +0000 +++ b/Strategie/Strategie.cpp Tue May 28 10:20:59 2019 +0000 @@ -2049,32 +2049,25 @@ angle_moyen_balise_IR = debut_angle_detection + (fin_angle_detection-debut_angle_detection)/2; #ifdef ROBOT_BIG - SendRawId(0x663); float seuil_bas_avant = 12.0; // >= float seuil_haut_avant = 0.0; // <= float seuil_bas_arriere = 4.0; float seuil_haut_arriere = 8.0; - /*float seuil_bas_avant = 13.0; - float seuil_haut_avant = 15.0; - float seuil_bas_arriere = 5.0; - float seuil_haut_arriere = 7.0;*/ -#else - SendRawId(0x664); +#else float seuil_bas_avant = 13.0; float seuil_haut_avant = 15.0; float seuil_bas_arriere = 5.0; float seuil_haut_arriere = 7.0; -#endif - SendRawId(0x665); +#endif if (instruction.order == MV_LINE && instruction.direction == FORWARD && angle_moyen_balise_IR >= seuil_bas_avant && angle_moyen_balise_IR <= seuil_haut_avant || instruction.order == MV_LINE && instruction.direction == BACKWARD && angle_moyen_balise_IR >= seuil_bas_arriere && angle_moyen_balise_IR <= seuil_haut_arriere || instruction.order == MV_COURBURE && direction == 1 && angle_moyen_balise_IR >= seuil_bas_avant && angle_moyen_balise_IR <= seuil_haut_avant || instruction.order == MV_COURBURE && direction == -1 && angle_moyen_balise_IR >= seuil_bas_arriere && angle_moyen_balise_IR <= seuil_haut_arriere || instruction.order == MV_XYT && instruction.direction == FORWARD && angle_moyen_balise_IR >= seuil_bas_avant && angle_moyen_balise_IR <= seuil_haut_avant || instruction.order == MV_XYT && instruction.direction == BACKWARD && angle_moyen_balise_IR >= seuil_bas_arriere && angle_moyen_balise_IR <= seuil_haut_arriere ) { //J'ai rajouté cette ligne mais il faut tester avec et sans pour voir le comportement du robot, - SendRawId(0x666); + if(needToStop() != 0 && ingnorBaliseOnce ==0 && ingnorBalise==0) { - SendRawId(0x667); + if(gameEtat > ETAT_GAME_START && gameEtat != ETAT_WARNING_TIMEOUT) { SendRawId(ASSERVISSEMENT_STOP); /*waitingAckID_FIN = ASSERVISSEMENT_STOP; @@ -2090,7 +2083,6 @@ } } } - SendRawId(0x668); ingnorBaliseOnce = 0; break; @@ -2560,8 +2552,6 @@ angleRecalage = moyennageTelemetre/nombresDeMesuresAuxTelemetresQuiSontCoherentes; - - if(nombresDeMesuresAuxTelemetresQuiSontCoherentes) { if(orientationArrondie == 0) { angleRecalage -= 900; @@ -2586,6 +2576,10 @@ { unsigned char nombresDeMesuresAuxTelemetresQuiSontCoherentes = 0; unsigned int moyennageTelemetre = 0; + + unsigned short tempo= telemetreDistance_arriere_gauche; + telemetreDistance_arriere_gauche=telemetreDistance_arriere_droite; + telemetreDistance_arriere_droite=tempo; telemetreDistance_avant_gauche = ((theta_robot < 900 && theta_robot > -900)?2000:0) + ((theta_robot < 900 && theta_robot > -900)?-1:1)*telemetreDistance_avant_gauche; telemetreDistance_avant_droite = ((theta_robot < 900 && theta_robot > -900)?2000:0) + ((theta_robot < 900 && theta_robot > -900)?-1:1)*telemetreDistance_avant_droite; @@ -2618,6 +2612,10 @@ { unsigned char nombresDeMesuresAuxTelemetresQuiSontCoherentes = 0; unsigned int moyennageTelemetre = 0; + + unsigned short tempo= telemetreDistance_arriere_gauche; + telemetreDistance_arriere_gauche=telemetreDistance_arriere_droite; + telemetreDistance_arriere_droite=tempo; telemetreDistance_avant_gauche = (((theta_robot < 1800 && theta_robot > 0) || (theta_robot < -1800 && theta_robot > -3600))?3000:0) + (((theta_robot < 1800 && theta_robot > 0) || (theta_robot < -1800 && theta_robot > -3600))?-1:1)*telemetreDistance_avant_gauche; telemetreDistance_avant_droite = (((theta_robot < 1800 && theta_robot > 0) || (theta_robot < -1800 && theta_robot > -3600))?3000:0) + (((theta_robot < 1800 && theta_robot > 0) || (theta_robot < -1800 && theta_robot > -3600))?-1:1)*telemetreDistance_avant_droite;