From e4f0bb4b61a136ed3a19da9ebe1daead07db86e5 Mon Sep 17 00:00:00 2001 From: Samuel Date: Sat, 18 Apr 2026 17:15:21 +0200 Subject: [PATCH] =?UTF-8?q?Renvoie=20de=20l'=C3=A9tat=20du=20trajet=20+=20?= =?UTF-8?q?Padding=20oubli=C3=A9=20dans=20la=20trajectoire=20dans=20le=20r?= =?UTF-8?q?eadme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Asser_Position.c | 4 +-- Geometrie_robot.h | 7 +++- Readme.md | 84 ++++++++++++++++++++++--------------------- Strategie.h | 6 ++-- main.c | 8 ++++- messages_propulsion.h | 1 + 6 files changed, 63 insertions(+), 47 deletions(-) diff --git a/Asser_Position.c b/Asser_Position.c index a6a8577..049a646 100644 --- a/Asser_Position.c +++ b/Asser_Position.c @@ -47,9 +47,9 @@ void Asser_Position(struct position_t position_consigne){ avance_mm_s = delta_avance_mm * GAIN_P_POSITION; rotation_radian_s = delta_orientation_radian * GAIN_P_ORIENTATION; - if(delta_avance_mm < 10){ + /*if(delta_avance_mm < 10){ rotation_radian_s=delta_avance_mm/10 * rotation_radian_s; - } + }*/ // Commande en vitesse commande_vitesse(avance_mm_s, rotation_radian_s); diff --git a/Geometrie_robot.h b/Geometrie_robot.h index 15e2a80..46d459c 100644 --- a/Geometrie_robot.h +++ b/Geometrie_robot.h @@ -1,4 +1,9 @@ #include "Geometrie.h" +#include "config_robot.h" -#define DISTANCE_ROUES_CENTRE_MM 52. +#ifdef ROBOT_PROPULSION_2026 + #define DISTANCE_ROUES_CENTRE_MM 104. +#else + #define DISTANCE_ROUES_CENTRE_MM 52. +#endif diff --git a/Readme.md b/Readme.md index 180f240..cc38e36 100644 --- a/Readme.md +++ b/Readme.md @@ -76,59 +76,62 @@ Les adresses en **gras** sont celles pour lesquelles des `#define` existent qui | 0x1F | RW | Flottant 32 bits | Consigne de rotation du robot | | 0x20 | RW | Flottant 32 bits | Consigne de rotation du robot | | 0x21 | RW | Flottant 32 bits | Consigne de rotation du robot | -| **0x22** | RW | Enum 8 bits | Trajectoire, type :
0 : Droite
1 : Circulaire
2 : Bézier
3 : Composée
4 : Rotation | -| 0x23 | RW | Flottant 32 bits | Point 1, X | -| 0x24 | RW | Flottant 32 bits | Point 1, X | -| 0x25 | RW | Flottant 32 bits | Point 1, X | +| **0x22** | RW | Enum 8 bits | Trajectoire, type :
0 : Droite
1 : Circulaire
2 : Bézier
3 : Composée
4 : Rotation| +| 0x23 | - | Padding | Padding | +| 0x24 | - | Padding | Padding | +| 0x25 | - | Padding | Padding | | 0x26 | RW | Flottant 32 bits | Point 1, X | -| 0x27 | RW | Flottant 32 bits | Point 1, Y | -| 0x28 | RW | Flottant 32 bits | Point 1, Y | -| 0x29 | RW | Flottant 32 bits | Point 1, Y | +| 0x27 | RW | Flottant 32 bits | Point 1, X | +| 0x28 | RW | Flottant 32 bits | Point 1, X | +| 0x29 | RW | Flottant 32 bits | Point 1, X | | 0x2A | RW | Flottant 32 bits | Point 1, Y | -| 0x2B | RW | Flottant 32 bits | Point 2, X | -| 0x2C | RW | Flottant 32 bits | Point 2, X | -| 0x2D | RW | Flottant 32 bits | Point 2, X | +| 0x2B | RW | Flottant 32 bits | Point 1, Y | +| 0x2C | RW | Flottant 32 bits | Point 1, Y | +| 0x2D | RW | Flottant 32 bits | Point 1, Y | | 0x2E | RW | Flottant 32 bits | Point 2, X | -| 0x2F | RW | Flottant 32 bits | Point 2, Y | -| 0x30 | RW | Flottant 32 bits | Point 2, Y | -| 0x31 | RW | Flottant 32 bits | Point 2, Y | +| 0x2F | RW | Flottant 32 bits | Point 2, X | +| 0x30 | RW | Flottant 32 bits | Point 2, X | +| 0x31 | RW | Flottant 32 bits | Point 2, X | | 0x32 | RW | Flottant 32 bits | Point 2, Y | -| 0x33 | RW | Flottant 32 bits | Point 3, X | -| 0x34 | RW | Flottant 32 bits | Point 3, X | -| 0x35 | RW | Flottant 32 bits | Point 3, X | +| 0x33 | RW | Flottant 32 bits | Point 2, Y | +| 0x34 | RW | Flottant 32 bits | Point 2, Y | +| 0x35 | RW | Flottant 32 bits | Point 2, Y | | 0x36 | RW | Flottant 32 bits | Point 3, X | -| 0x37 | RW | Flottant 32 bits | Point 3, Y | -| 0x38 | RW | Flottant 32 bits | Point 3, Y | -| 0x39 | RW | Flottant 32 bits | Point 3, Y | +| 0x37 | RW | Flottant 32 bits | Point 3, X | +| 0x38 | RW | Flottant 32 bits | Point 3, X | +| 0x39 | RW | Flottant 32 bits | Point 3, X | | 0x3A | RW | Flottant 32 bits | Point 3, Y | -| 0x3B | RW | Flottant 32 bits | Point 4, X | -| 0x3C | RW | Flottant 32 bits | Point 4, X | -| 0x3D | RW | Flottant 32 bits | Point 4, X | +| 0x3B | RW | Flottant 32 bits | Point 3, Y | +| 0x3C | RW | Flottant 32 bits | Point 3, Y | +| 0x3D | RW | Flottant 32 bits | Point 3, Y | | 0x3E | RW | Flottant 32 bits | Point 4, X | -| 0x3F | RW | Flottant 32 bits | Point 4, Y | -| 0x40 | RW | Flottant 32 bits | Point 4, Y | -| 0x41 | RW | Flottant 32 bits | Point 4, Y | +| 0x3F | RW | Flottant 32 bits | Point 4, X | +| 0x40 | RW | Flottant 32 bits | Point 4, X | +| 0x41 | RW | Flottant 32 bits | Point 4, X | | 0x42 | RW | Flottant 32 bits | Point 4, Y | -| 0x43 | RW | Flottant 32 bits | orientation_debut_rad | -| 0x44 | RW | Flottant 32 bits | orientation_debut_rad | -| 0x45 | RW | Flottant 32 bits | orientation_debut_rad | +| 0x43 | RW | Flottant 32 bits | Point 4, Y | +| 0x44 | RW | Flottant 32 bits | Point 4, Y | +| 0x45 | RW | Flottant 32 bits | Point 4, Y | | 0x46 | RW | Flottant 32 bits | orientation_debut_rad | -| 0x47 | RW | Flottant 32 bits | orientation_fin_rad | -| 0x48 | RW | Flottant 32 bits | orientation_fin_rad | -| 0x49 | RW | Flottant 32 bits | orientation_fin_rad | +| 0x47 | RW | Flottant 32 bits | orientation_debut_rad | +| 0x48 | RW | Flottant 32 bits | orientation_debut_rad | +| 0x49 | RW | Flottant 32 bits | orientation_debut_rad | | 0x4A | RW | Flottant 32 bits | orientation_fin_rad | -| 0x4B | RW | Flottant 32 bits | rayon mm | -| 0x4C | RW | Flottant 32 bits | rayon mm | -| 0x4D | RW | Flottant 32 bits | rayon mm | +| 0x4B | RW | Flottant 32 bits | orientation_fin_rad | +| 0x4C | RW | Flottant 32 bits | orientation_fin_rad | +| 0x4D | RW | Flottant 32 bits | orientation_fin_rad | | 0x4E | RW | Flottant 32 bits | rayon mm | -| 0x4F | RW | Flottant 32 bits | Angle début rad | -| 0x50 | RW | Flottant 32 bits | Angle début rad | -| 0x51 | RW | Flottant 32 bits | Angle début rad | +| 0x4F | RW | Flottant 32 bits | rayon mm | +| 0x50 | RW | Flottant 32 bits | rayon mm | +| 0x51 | RW | Flottant 32 bits | rayon mm | | 0x52 | RW | Flottant 32 bits | Angle début rad | -| 0x53 | RW | Flottant 32 bits | Angle fin rad | -| 0x54 | RW | Flottant 32 bits | Angle fin rad | -| 0x55 | RW | Flottant 32 bits | Angle fin rad | +| 0x53 | RW | Flottant 32 bits | Angle début rad | +| 0x54 | RW | Flottant 32 bits | Angle début rad | +| 0x55 | RW | Flottant 32 bits | Angle début rad | | 0x56 | RW | Flottant 32 bits | Angle fin rad | +| 0x57 | RW | Flottant 32 bits | Angle fin rad | +| 0x58 | RW | Flottant 32 bits | Angle fin rad | +| 0x59 | RW | Flottant 32 bits | Angle fin rad | | **0x80** | R | flottant 32 bits | Position X en mm | | 0x81 | R | flottant 32 bits | Position X en mm | | 0x82 | R | flottant 32 bits | Position X en mm | @@ -161,4 +164,5 @@ Les adresses en **gras** sont celles pour lesquelles des `#define` existent qui | 0x9D | R | flottant 32 bits | Vitesse roue droite en mm/s | | 0x9E | R | flottant 32 bits | Vitesse roue droite en mm/s | | 0x9F | R | flottant 32 bits | Vitesse roue droite en mm/s | +| 0xA0 | R | int_8 | État du trajet (ACTION_EN_COURS=0, ACTION_TERMINEE=1, ACTION_ECHEC=2) | | **0xFF** | R | int_8 | Identifiant de la carte : 'P' | \ No newline at end of file diff --git a/Strategie.h b/Strategie.h index eb11610..c84b697 100644 --- a/Strategie.h +++ b/Strategie.h @@ -15,9 +15,9 @@ #define CORR_ANGLE_DEPART_DEGREE (0) enum etat_action_t{ - ACTION_EN_COURS, - ACTION_TERMINEE, - ACTION_ECHEC + ACTION_EN_COURS=0, + ACTION_TERMINEE=1, + ACTION_ECHEC=2 }; enum longer_direction_t{ diff --git a/main.c b/main.c index 640be7e..9e47798 100644 --- a/main.c +++ b/main.c @@ -203,6 +203,8 @@ void main(void) msg_trajectoire.trajectoire.p4.x, msg_trajectoire.trajectoire.p4.y); trajectoire = msg_trajectoire.trajectoire; mode = 4; + enum etat_action_t etat_action = ACTION_EN_COURS; + mise_données_dans_échange((uint8_t*) &(etat_action), sizeof(etat_action), REG_PROPULSION_ETAT_TRJET); Trajet_config(200, 100); // Oh la la ! @@ -267,6 +269,7 @@ void main(void) } temps_ms = Temps_get_temps_ms(); if(temps_ms % step_ms == 0){ + enum etat_action_t etat_action; QEI_update(); Localisation_gestion(); @@ -286,7 +289,10 @@ void main(void) AsserMoteur_Gestion(step_ms); break; case 4: - if(Strategie_parcourir_trajet(trajectoire, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){ + etat_action = Strategie_parcourir_trajet(trajectoire, step_ms, EVITEMENT_SANS_EVITEMENT); + mise_données_dans_échange((uint8_t*) &(etat_action), sizeof(etat_action), REG_PROPULSION_ETAT_TRJET); + + if(etat_action == ACTION_TERMINEE){ mode = 0; } AsserMoteur_Gestion(step_ms); diff --git a/messages_propulsion.h b/messages_propulsion.h index 2e54596..5988db1 100644 --- a/messages_propulsion.h +++ b/messages_propulsion.h @@ -14,6 +14,7 @@ #define REG_PROPULSION_ABSCISSE 0x8C #define REG_PROPULSION_POSITION_CONSIGNE 0x90 #define REG_PROPULSION_VITESSE_ROUES_lecture 0x98 +#define REG_PROPULSION_ETAT_TRJET 0xA0 struct msg_propulsion_position_t{ float position_x_mm, position_y_mm, orientation_rad;