From 8bdffe821dafbed3f768d1098eaeabd38fca2094 Mon Sep 17 00:00:00 2001 From: Samuel Date: Mon, 26 May 2025 23:03:54 +0200 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20de=20l'approche=20des=20gra?= =?UTF-8?q?dins=20-=20correction=20d'un=20vilain=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cerveau/Cerveau.ino | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Cerveau/Cerveau.ino b/Cerveau/Cerveau.ino index 026e183..b9f4362 100644 --- a/Cerveau/Cerveau.ino +++ b/Cerveau/Cerveau.ino @@ -624,10 +624,12 @@ enum etat_action_t gradin_approche(void){ // On se centre par rapport au gradin //translation_x = (detect_gradin.centre_y_mm + 150) * tan(fabs(detect_gradin.angle_rad)); //translation_y = -(detect_gradin.centre_y_mm + 150) * sin(detect_gradin.angle_rad) - detect_gradin.centre_x_mm; - translation_x = (detect_gradin.centre_y_mm + 150) * tan(fabs(detect_gradin.angle_rad)); - translation_y = -(detect_gradin.centre_y_mm + 150) * sin(detect_gradin.angle_rad) - detect_gradin.centre_x_mm; + /// Attention, réflection dans le repère des capteurs + translation_x = (detect_gradin.centre_y_mm + 75) * sin(detect_gradin.angle_rad) * cos(detect_gradin.angle_rad) + detect_gradin.centre_x_mm; + translation_y = (detect_gradin.centre_y_mm + 75) * sin(detect_gradin.angle_rad) * sin(detect_gradin.angle_rad) ; - while(deplacement_relatif(translation_x, translation_y, 0, 0) == ACTION_TERMINEE); + // Changement de repère : capteurs => Chassis + while(deplacement_relatif(translation_y, -translation_x, 0, 0) != ACTION_TERMINEE); statu_approche_gradin = GA_TOURNE_LARGE; angle_mem = detect_gradin.angle_rad; @@ -636,6 +638,10 @@ enum etat_action_t gradin_approche(void){ case GA_TOURNE_LARGE: while(deplacement_relatif(0, 0, -angle_mem, 0) != ACTION_TERMINEE); + /*//// !!! DEBUG + statu_approche_gradin = GA_INIT; + return ACTION_ECHEC; + /// FIN DEBUG*/ delay(150); Detect_gradin(&detect_gradin); if(detect_gradin.status != 2){