Renvoie de l'état du trajet + Padding oublié dans la trajectoire dans le readme

This commit is contained in:
Samuel 2026-04-18 17:15:21 +02:00
parent 85a08715f0
commit e4f0bb4b61
6 changed files with 63 additions and 47 deletions

View File

@ -47,9 +47,9 @@ void Asser_Position(struct position_t position_consigne){
avance_mm_s = delta_avance_mm * GAIN_P_POSITION; avance_mm_s = delta_avance_mm * GAIN_P_POSITION;
rotation_radian_s = delta_orientation_radian * GAIN_P_ORIENTATION; 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; rotation_radian_s=delta_avance_mm/10 * rotation_radian_s;
} }*/
// Commande en vitesse // Commande en vitesse
commande_vitesse(avance_mm_s, rotation_radian_s); commande_vitesse(avance_mm_s, rotation_radian_s);

View File

@ -1,4 +1,9 @@
#include "Geometrie.h" #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

View File

@ -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 | | 0x1F | RW | Flottant 32 bits | Consigne de rotation du robot |
| 0x20 | 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 | | 0x21 | RW | Flottant 32 bits | Consigne de rotation du robot |
| **0x22** | RW | Enum 8 bits | Trajectoire, type :<br>0 : Droite<br>1 : Circulaire<br>2 : Bézier<br>3 : Composée<br>4 : Rotation | | **0x22** | RW | Enum 8 bits | Trajectoire, type :<br>0 : Droite<br>1 : Circulaire<br>2 : Bézier<br>3 : Composée<br>4 : Rotation|
| 0x23 | RW | Flottant 32 bits | Point 1, X | | 0x23 | - | Padding | Padding |
| 0x24 | RW | Flottant 32 bits | Point 1, X | | 0x24 | - | Padding | Padding |
| 0x25 | RW | Flottant 32 bits | Point 1, X | | 0x25 | - | Padding | Padding |
| 0x26 | RW | Flottant 32 bits | Point 1, X | | 0x26 | RW | Flottant 32 bits | Point 1, X |
| 0x27 | RW | Flottant 32 bits | Point 1, Y | | 0x27 | RW | Flottant 32 bits | Point 1, X |
| 0x28 | RW | Flottant 32 bits | Point 1, Y | | 0x28 | RW | Flottant 32 bits | Point 1, X |
| 0x29 | RW | Flottant 32 bits | Point 1, Y | | 0x29 | RW | Flottant 32 bits | Point 1, X |
| 0x2A | RW | Flottant 32 bits | Point 1, Y | | 0x2A | RW | Flottant 32 bits | Point 1, Y |
| 0x2B | RW | Flottant 32 bits | Point 2, X | | 0x2B | RW | Flottant 32 bits | Point 1, Y |
| 0x2C | RW | Flottant 32 bits | Point 2, X | | 0x2C | RW | Flottant 32 bits | Point 1, Y |
| 0x2D | RW | Flottant 32 bits | Point 2, X | | 0x2D | RW | Flottant 32 bits | Point 1, Y |
| 0x2E | RW | Flottant 32 bits | Point 2, X | | 0x2E | RW | Flottant 32 bits | Point 2, X |
| 0x2F | RW | Flottant 32 bits | Point 2, Y | | 0x2F | RW | Flottant 32 bits | Point 2, X |
| 0x30 | RW | Flottant 32 bits | Point 2, Y | | 0x30 | RW | Flottant 32 bits | Point 2, X |
| 0x31 | RW | Flottant 32 bits | Point 2, Y | | 0x31 | RW | Flottant 32 bits | Point 2, X |
| 0x32 | RW | Flottant 32 bits | Point 2, Y | | 0x32 | RW | Flottant 32 bits | Point 2, Y |
| 0x33 | RW | Flottant 32 bits | Point 3, X | | 0x33 | RW | Flottant 32 bits | Point 2, Y |
| 0x34 | RW | Flottant 32 bits | Point 3, X | | 0x34 | RW | Flottant 32 bits | Point 2, Y |
| 0x35 | RW | Flottant 32 bits | Point 3, X | | 0x35 | RW | Flottant 32 bits | Point 2, Y |
| 0x36 | RW | Flottant 32 bits | Point 3, X | | 0x36 | RW | Flottant 32 bits | Point 3, X |
| 0x37 | RW | Flottant 32 bits | Point 3, Y | | 0x37 | RW | Flottant 32 bits | Point 3, X |
| 0x38 | RW | Flottant 32 bits | Point 3, Y | | 0x38 | RW | Flottant 32 bits | Point 3, X |
| 0x39 | RW | Flottant 32 bits | Point 3, Y | | 0x39 | RW | Flottant 32 bits | Point 3, X |
| 0x3A | RW | Flottant 32 bits | Point 3, Y | | 0x3A | RW | Flottant 32 bits | Point 3, Y |
| 0x3B | RW | Flottant 32 bits | Point 4, X | | 0x3B | RW | Flottant 32 bits | Point 3, Y |
| 0x3C | RW | Flottant 32 bits | Point 4, X | | 0x3C | RW | Flottant 32 bits | Point 3, Y |
| 0x3D | RW | Flottant 32 bits | Point 4, X | | 0x3D | RW | Flottant 32 bits | Point 3, Y |
| 0x3E | RW | Flottant 32 bits | Point 4, X | | 0x3E | RW | Flottant 32 bits | Point 4, X |
| 0x3F | RW | Flottant 32 bits | Point 4, Y | | 0x3F | RW | Flottant 32 bits | Point 4, X |
| 0x40 | RW | Flottant 32 bits | Point 4, Y | | 0x40 | RW | Flottant 32 bits | Point 4, X |
| 0x41 | RW | Flottant 32 bits | Point 4, Y | | 0x41 | RW | Flottant 32 bits | Point 4, X |
| 0x42 | RW | Flottant 32 bits | Point 4, Y | | 0x42 | RW | Flottant 32 bits | Point 4, Y |
| 0x43 | RW | Flottant 32 bits | orientation_debut_rad | | 0x43 | RW | Flottant 32 bits | Point 4, Y |
| 0x44 | RW | Flottant 32 bits | orientation_debut_rad | | 0x44 | RW | Flottant 32 bits | Point 4, Y |
| 0x45 | RW | Flottant 32 bits | orientation_debut_rad | | 0x45 | RW | Flottant 32 bits | Point 4, Y |
| 0x46 | RW | Flottant 32 bits | orientation_debut_rad | | 0x46 | RW | Flottant 32 bits | orientation_debut_rad |
| 0x47 | RW | Flottant 32 bits | orientation_fin_rad | | 0x47 | RW | Flottant 32 bits | orientation_debut_rad |
| 0x48 | RW | Flottant 32 bits | orientation_fin_rad | | 0x48 | RW | Flottant 32 bits | orientation_debut_rad |
| 0x49 | RW | Flottant 32 bits | orientation_fin_rad | | 0x49 | RW | Flottant 32 bits | orientation_debut_rad |
| 0x4A | RW | Flottant 32 bits | orientation_fin_rad | | 0x4A | RW | Flottant 32 bits | orientation_fin_rad |
| 0x4B | RW | Flottant 32 bits | rayon mm | | 0x4B | RW | Flottant 32 bits | orientation_fin_rad |
| 0x4C | RW | Flottant 32 bits | rayon mm | | 0x4C | RW | Flottant 32 bits | orientation_fin_rad |
| 0x4D | RW | Flottant 32 bits | rayon mm | | 0x4D | RW | Flottant 32 bits | orientation_fin_rad |
| 0x4E | RW | Flottant 32 bits | rayon mm | | 0x4E | RW | Flottant 32 bits | rayon mm |
| 0x4F | RW | Flottant 32 bits | Angle début rad | | 0x4F | RW | Flottant 32 bits | rayon mm |
| 0x50 | RW | Flottant 32 bits | Angle début rad | | 0x50 | RW | Flottant 32 bits | rayon mm |
| 0x51 | RW | Flottant 32 bits | Angle début rad | | 0x51 | RW | Flottant 32 bits | rayon mm |
| 0x52 | RW | Flottant 32 bits | Angle début rad | | 0x52 | RW | Flottant 32 bits | Angle début rad |
| 0x53 | RW | Flottant 32 bits | Angle fin rad | | 0x53 | RW | Flottant 32 bits | Angle début rad |
| 0x54 | RW | Flottant 32 bits | Angle fin rad | | 0x54 | RW | Flottant 32 bits | Angle début rad |
| 0x55 | RW | Flottant 32 bits | Angle fin rad | | 0x55 | RW | Flottant 32 bits | Angle début rad |
| 0x56 | RW | Flottant 32 bits | Angle fin 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 | | **0x80** | R | flottant 32 bits | Position X en mm |
| 0x81 | 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 | | 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 | | 0x9D | R | flottant 32 bits | Vitesse roue droite en mm/s |
| 0x9E | 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 | | 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' | | **0xFF** | R | int_8 | Identifiant de la carte : 'P' |

View File

@ -15,9 +15,9 @@
#define CORR_ANGLE_DEPART_DEGREE (0) #define CORR_ANGLE_DEPART_DEGREE (0)
enum etat_action_t{ enum etat_action_t{
ACTION_EN_COURS, ACTION_EN_COURS=0,
ACTION_TERMINEE, ACTION_TERMINEE=1,
ACTION_ECHEC ACTION_ECHEC=2
}; };
enum longer_direction_t{ enum longer_direction_t{

8
main.c
View File

@ -203,6 +203,8 @@ void main(void)
msg_trajectoire.trajectoire.p4.x, msg_trajectoire.trajectoire.p4.y); msg_trajectoire.trajectoire.p4.x, msg_trajectoire.trajectoire.p4.y);
trajectoire = msg_trajectoire.trajectoire; trajectoire = msg_trajectoire.trajectoire;
mode = 4; 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); Trajet_config(200, 100);
// Oh la la ! // Oh la la !
@ -267,6 +269,7 @@ void main(void)
} }
temps_ms = Temps_get_temps_ms(); temps_ms = Temps_get_temps_ms();
if(temps_ms % step_ms == 0){ if(temps_ms % step_ms == 0){
enum etat_action_t etat_action;
QEI_update(); QEI_update();
Localisation_gestion(); Localisation_gestion();
@ -286,7 +289,10 @@ void main(void)
AsserMoteur_Gestion(step_ms); AsserMoteur_Gestion(step_ms);
break; break;
case 4: 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; mode = 0;
} }
AsserMoteur_Gestion(step_ms); AsserMoteur_Gestion(step_ms);

View File

@ -14,6 +14,7 @@
#define REG_PROPULSION_ABSCISSE 0x8C #define REG_PROPULSION_ABSCISSE 0x8C
#define REG_PROPULSION_POSITION_CONSIGNE 0x90 #define REG_PROPULSION_POSITION_CONSIGNE 0x90
#define REG_PROPULSION_VITESSE_ROUES_lecture 0x98 #define REG_PROPULSION_VITESSE_ROUES_lecture 0x98
#define REG_PROPULSION_ETAT_TRJET 0xA0
struct msg_propulsion_position_t{ struct msg_propulsion_position_t{
float position_x_mm, position_y_mm, orientation_rad; float position_x_mm, position_y_mm, orientation_rad;