Amélioration de l'envoie de données : abscisse et position consigne
This commit is contained in:
parent
bc7e947823
commit
71ccb57220
174
Readme.md
174
Readme.md
@ -45,24 +45,24 @@ Les adresses en **gras** sont celles pour lesquelles des `#define` existent qui
|
||||
|
||||
| Adresse | R/W | Type | Donnée |
|
||||
| ------- | --- | ---------------- | ------ |
|
||||
| **0x00** | RW | flottant 32 bits | Position X en mm |
|
||||
| 0x01 | RW | flottant 32 bits | Position X en mm |
|
||||
| 0x02 | RW | flottant 32 bits | Position X en mm |
|
||||
| 0x03 | RW | flottant 32 bits | Position X en mm |
|
||||
| 0x04 | RW | flottant 32 bits | Position Y en mm |
|
||||
| 0x05 | RW | flottant 32 bits | Position Y en mm |
|
||||
| 0x06 | RW | flottant 32 bits | Position Y en mm |
|
||||
| 0x07 | RW | flottant 32 bits | Position Y en mm |
|
||||
| 0x08 | RW | flottant 32 bits | Orientation en radian |
|
||||
| 0x09 | RW | flottant 32 bits | Orientation en radian |
|
||||
| 0x0A | RW | flottant 32 bits | Orientation en radian |
|
||||
| 0x0B | RW | flottant 32 bits | Orientation en radian |
|
||||
| **0x0C** | R | Boolean | Mouvement en cours : 1<br>Mouvement terminé : 0 |
|
||||
| **0x00** | RW | flottant 32 bits | Position X en mm |
|
||||
| 0x01 | RW | flottant 32 bits | Position X en mm |
|
||||
| 0x02 | RW | flottant 32 bits | Position X en mm |
|
||||
| 0x03 | RW | flottant 32 bits | Position X en mm |
|
||||
| 0x04 | RW | flottant 32 bits | Position Y en mm |
|
||||
| 0x05 | RW | flottant 32 bits | Position Y en mm |
|
||||
| 0x06 | RW | flottant 32 bits | Position Y en mm |
|
||||
| 0x07 | RW | flottant 32 bits | Position Y en mm |
|
||||
| 0x08 | RW | flottant 32 bits | Orientation en radian |
|
||||
| 0x09 | RW | flottant 32 bits | Orientation en radian |
|
||||
| 0x0A | RW | flottant 32 bits | Orientation en radian |
|
||||
| 0x0B | RW | flottant 32 bits | Orientation en radian |
|
||||
| **0x0C** | R | Boolean | Mouvement en cours : 1<br>Mouvement terminé : |
|
||||
| **0x0D** | RW | uint8_t | Mode<br>0 : arrêt des moteurs<br>1 : pilotage des moteurs PWM<br>2 : pilotage en vitesse des roues<br>3 : pilotage avec la loi de commande<br>4 : Trajectoire |
|
||||
| **0x0E** | RW | int_16 | Commande PWM moteur gauche |
|
||||
| 0x0F | RW | int_16 | Commande PWM moteur gauche |
|
||||
| 0x10 | RW | int_16 | Commande PWM moteur droit |
|
||||
| 0x11 | RW | int_16 | Commande PWM moteur droit |
|
||||
| **0x0E** | RW | int_16 | Commande PWM moteur gauche |
|
||||
| 0x0F | RW | int_16 | Commande PWM moteur gauche |
|
||||
| 0x10 | RW | int_16 | Commande PWM moteur droit |
|
||||
| 0x11 | RW | int_16 | Commande PWM moteur droit |
|
||||
| **0x12** | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
|
||||
| 0x13 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
|
||||
| 0x14 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
|
||||
@ -71,64 +71,92 @@ Les adresses en **gras** sont celles pour lesquelles des `#define` existent qui
|
||||
| 0x17 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
|
||||
| 0x18 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
|
||||
| 0x19 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
|
||||
| 0x1A | RW | Flottant 32 bits | Consigne d’avance du robot |
|
||||
| 0x1B | RW | Flottant 32 bits | Consigne d’avance du robot |
|
||||
| 0x1C | RW | Flottant 32 bits | Consigne d’avance du robot |
|
||||
| 0x1D | RW | Flottant 32 bits | Consigne d’avance du robot |
|
||||
| 0x1A | RW | Flottant 32 bits | Consigne d’avance du robot |
|
||||
| 0x1B | RW | Flottant 32 bits | Consigne d’avance du robot |
|
||||
| 0x1C | RW | Flottant 32 bits | Consigne d’avance du robot |
|
||||
| 0x1D | RW | Flottant 32 bits | Consigne d’avance du robot |
|
||||
| 0x1E | 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 |
|
||||
| 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 |
|
||||
| 0x23 | RW | Flottant 32 bits | Point 1, X |
|
||||
| 0x24 | RW | Flottant 32 bits | Point 1, X |
|
||||
| 0x25 | RW | Flottant 32 bits | Point 1, X |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 0x56 | RW | Flottant 32 bits | Angle fin rad |
|
||||
| 0x23 | RW | Flottant 32 bits | Point 1, X |
|
||||
| 0x24 | RW | Flottant 32 bits | Point 1, X |
|
||||
| 0x25 | RW | Flottant 32 bits | Point 1, X |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 0x56 | 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 |
|
||||
| 0x83 | R | flottant 32 bits | Position X en mm |
|
||||
| 0x84 | R | flottant 32 bits | Position Y en mm |
|
||||
| 0x85 | R | flottant 32 bits | Position Y en mm |
|
||||
| 0x86 | R | flottant 32 bits | Position Y en mm |
|
||||
| 0x87 | R | flottant 32 bits | Position Y en mm |
|
||||
| 0x88 | R | flottant 32 bits | Orientation en radian |
|
||||
| 0x89 | R | flottant 32 bits | Orientation en radian |
|
||||
| 0x8A | R | flottant 32 bits | Orientation en radian |
|
||||
| 0x8B | R | flottant 32 bits | Orientation en radian |
|
||||
| **0x8C** | R | Flottant 32 bits | abscisse |
|
||||
| 0x8D | R | Flottant 32 bits | abscisse |
|
||||
| 0x8E | R | Flottant 32 bits | abscisse |
|
||||
| 0x8F | R | Flottant 32 bits | abscisse |
|
||||
| **0x90** | R | flottant 32 bits | Position consigne X en mm |
|
||||
| 0x91 | R | flottant 32 bits | Position consigne X en mm |
|
||||
| 0x92 | R | flottant 32 bits | Position consigne X en mm |
|
||||
| 0x93 | R | flottant 32 bits | Position consigne X en mm |
|
||||
| 0x94 | R | flottant 32 bits | Position consigne Y en mm |
|
||||
| 0x95 | R | flottant 32 bits | Position consigne Y en mm |
|
||||
| 0x96 | R | flottant 32 bits | Position consigne Y en mm |
|
||||
| 0x97 | R | flottant 32 bits | Position consigne Y en mm |
|
||||
|
||||
| **0xFF** | R | int_8 | Identifiant de la carte : 'P' |
|
||||
@ -4,10 +4,10 @@
|
||||
#define NB_MAX_TRAJECTOIRE 10
|
||||
|
||||
enum trajectoire_type_t{
|
||||
TRAJECTOIRE_DROITE,
|
||||
TRAJECTOIRE_CIRCULAIRE,
|
||||
TRAJECTOIRE_BEZIER,
|
||||
TRAJECTOIRE_COMPOSEE
|
||||
TRAJECTOIRE_DROITE=0,
|
||||
TRAJECTOIRE_CIRCULAIRE=1,
|
||||
TRAJECTOIRE_BEZIER=2,
|
||||
TRAJECTOIRE_COMPOSEE=3
|
||||
};
|
||||
|
||||
struct point_xy_t{
|
||||
|
||||
2
Trajet.h
2
Trajet.h
@ -14,7 +14,7 @@ enum etat_trajet_t{
|
||||
#define TRAJECT_CONFIG_RAPIDE_ROUGE 500, 1200
|
||||
// Vitesse et acceleration pour un mouvement complexe (en mm et mm/s²)
|
||||
#define TRAJECT_CONFIG_AVANCE_ET_TOURNE 300, 500
|
||||
// Vitesse et acceleration - standard (en mm et mm/s²)
|
||||
// Vitesse et acceleration - standard (en mm/s et mm/s²)
|
||||
#define TRAJECT_CONFIG_STD 300, 300
|
||||
// Vitesse et acceleration pour une rotation (rad/s et rad/s²)
|
||||
#define TRAJECT_CONFIG_ROTATION_PURE 2, 2
|
||||
|
||||
57
main.c
57
main.c
@ -114,6 +114,7 @@ void main(void)
|
||||
|
||||
|
||||
enum etat_trajet_t etat_trajet=TRAJET_EN_COURS;
|
||||
struct trajectoire_t trajectoire;
|
||||
uint8_t mode=0;
|
||||
|
||||
while(1){
|
||||
@ -137,7 +138,7 @@ void main(void)
|
||||
struct message_applicatif_t message_applicatif;
|
||||
|
||||
memcpy(&message_applicatif, message.donnees, message.taille_donnees);
|
||||
printf("id_carte:%c %d\n", message_applicatif.id_carte, message_applicatif.id_carte);
|
||||
//printf("id_carte:%c %d\n", message_applicatif.id_carte, message_applicatif.id_carte);
|
||||
|
||||
|
||||
if(message_applicatif.id_carte == 'P'){
|
||||
@ -158,12 +159,12 @@ void main(void)
|
||||
if(mise_a_jour_position){
|
||||
struct msg_propulsion_position_t msg_propulsion_position;
|
||||
get_données_reçues((uint8_t *) &msg_propulsion_position, sizeof(msg_propulsion_position), REG_PROPULSION_POSITION);
|
||||
printf("mise à jour de la position, x:%2.2f, y:%2.2f, orientation: %2.2f\n", msg_propulsion_position.position_x_mm,
|
||||
msg_propulsion_position.position_y_mm, msg_propulsion_position.orientation_rad);
|
||||
//printf("mise à jour de la position, x:%2.2f, y:%2.2f, orientation: %2.2f\n", msg_propulsion_position.position_x_mm,
|
||||
// msg_propulsion_position.position_y_mm, msg_propulsion_position.orientation_rad);
|
||||
}
|
||||
if(mise_a_jour_mode){
|
||||
get_données_reçues(&mode, sizeof(mode), REG_PROPULSION_MODE);
|
||||
printf("mode:%d\n", mode);
|
||||
//rintf("mode:%d\n", mode);
|
||||
}
|
||||
if(mise_a_jour_pwm){
|
||||
struct msg_propulsion_pwm_t msg_propulsion_pwm;
|
||||
@ -171,29 +172,34 @@ void main(void)
|
||||
// Consigne
|
||||
Moteur_SetVitesse(MOTEUR_A, msg_propulsion_pwm.pwm_droit);
|
||||
Moteur_SetVitesse(MOTEUR_B, msg_propulsion_pwm.pwm_gauche);
|
||||
printf("pwm_gauche:%d, pwm_droit:%d\n", msg_propulsion_pwm.pwm_gauche, msg_propulsion_pwm.pwm_droit);
|
||||
//printf("pwm_gauche:%d, pwm_droit:%d\n", msg_propulsion_pwm.pwm_gauche, msg_propulsion_pwm.pwm_droit);
|
||||
}
|
||||
if(mise_a_jour_vitesse_roues){
|
||||
struct msg_propulsion_vitesse_roues_t msg_propulsion_vitesse_roues;
|
||||
get_données_reçues((uint8_t *) &msg_propulsion_vitesse_roues, sizeof(msg_propulsion_vitesse_roues), REG_PROPULSION_VITESSE_ROUES);
|
||||
printf("vitesse_roue_gauche:%f, vitesse_roue_droite:%f\n", msg_propulsion_vitesse_roues.vitesse_gauche_mm_s, msg_propulsion_vitesse_roues.vitesse_droite_mm_s);
|
||||
//printf("vitesse_roue_gauche:%f, vitesse_roue_droite:%f\n", msg_propulsion_vitesse_roues.vitesse_gauche_mm_s, msg_propulsion_vitesse_roues.vitesse_droite_mm_s);
|
||||
AsserMoteur_setConsigne_mm_s(MOTEUR_A, msg_propulsion_vitesse_roues.vitesse_droite_mm_s);
|
||||
AsserMoteur_setConsigne_mm_s(MOTEUR_B, msg_propulsion_vitesse_roues.vitesse_gauche_mm_s);
|
||||
}
|
||||
if(mise_a_jour_vitesse_robot){
|
||||
struct msg_propulsion_vitesse_robot_t msg_propulsion_vitesse_robot;
|
||||
get_données_reçues((uint8_t *) &msg_propulsion_vitesse_robot, sizeof(msg_propulsion_vitesse_robot), REG_PROPULSION_VITESSE_ROBOT);
|
||||
printf("avance_robot (mm/s) : %f, rotation (rad/s): %f\n", msg_propulsion_vitesse_robot.avance_mm_s,
|
||||
msg_propulsion_vitesse_robot.rotation_rad_s);
|
||||
//printf("avance_robot (mm/s) : %f, rotation (rad/s): %f\n", msg_propulsion_vitesse_robot.avance_mm_s,
|
||||
// msg_propulsion_vitesse_robot.rotation_rad_s);
|
||||
commande_vitesse(msg_propulsion_vitesse_robot.avance_mm_s, msg_propulsion_vitesse_robot.rotation_rad_s);
|
||||
|
||||
}
|
||||
if(mise_a_jour_trajectoire){
|
||||
struct msg_trajectoire_t msg_trajectoire;
|
||||
get_données_reçues((uint8_t *) &msg_trajectoire, sizeof(msg_trajectoire), REG_PROPULSION_TRAJECTOIRE);
|
||||
printf("trajectoire: type: %d, point1_x:%f, point1_y:%f, point2_x:%f, point2_y:%f\n",
|
||||
printf("trajectoire: type: %d,\n point1_x:%.2f, point1_y:%.2f,\n point2_x:%.2f, point2_y:%.2f,\n point3_x:%.2f, point3_y:%.2f\n point4_x:%.2f, point4_y:%.2f\n",
|
||||
msg_trajectoire.trajectoire.type, msg_trajectoire.trajectoire.p1.x, msg_trajectoire.trajectoire.p1.y,
|
||||
msg_trajectoire.trajectoire.p2.x, msg_trajectoire.trajectoire.p2.y);
|
||||
msg_trajectoire.trajectoire.p2.x, msg_trajectoire.trajectoire.p2.y,
|
||||
msg_trajectoire.trajectoire.p3.x, msg_trajectoire.trajectoire.p3.y,
|
||||
msg_trajectoire.trajectoire.p4.x, msg_trajectoire.trajectoire.p4.y);
|
||||
trajectoire = msg_trajectoire.trajectoire;
|
||||
mode = 4;
|
||||
Trajet_config(100, 100);
|
||||
|
||||
// Oh la la !
|
||||
}
|
||||
@ -215,7 +221,7 @@ void main(void)
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
printf("Demande donnees\n");
|
||||
//printf("Demande donnees\n");
|
||||
// Demande de données
|
||||
memcpy(&message_applicatif, message.donnees, message.taille_donnees);
|
||||
// printf("id_carte:%c %d\n", message_applicatif.id_carte, message_applicatif.id_carte);
|
||||
@ -232,7 +238,7 @@ void main(void)
|
||||
stdio_putchar_raw('\n');
|
||||
break;
|
||||
default:
|
||||
printf("Message inconnu: %d %c\n", message.donnees[0], message.donnees[0]);
|
||||
//printf("Message inconnu: %d %c\n", message.donnees[0], message.donnees[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -243,8 +249,20 @@ void main(void)
|
||||
// Fin du match
|
||||
|
||||
if(temps_ms != Temps_get_temps_ms()){
|
||||
if(Temps_get_temps_ms() - temps_ms > 20){
|
||||
/// PANIC
|
||||
struct msg_propulsion_position_t msg_propulsion_position;
|
||||
msg_propulsion_position.position_x_mm = 0;
|
||||
msg_propulsion_position.position_y_mm = 0;
|
||||
msg_propulsion_position.orientation_rad = 0;
|
||||
mise_données_dans_échange((uint8_t*) &msg_propulsion_position, sizeof(msg_propulsion_position), REG_PROPULSION_POSITION);
|
||||
Moteur_Stop();
|
||||
temps_ms = Temps_get_temps_ms();
|
||||
continue;
|
||||
|
||||
}
|
||||
temps_ms = Temps_get_temps_ms();
|
||||
if(temps_ms % step_ms == 0){
|
||||
//if(temps_ms % step_ms == 0){
|
||||
QEI_update();
|
||||
Localisation_gestion();
|
||||
|
||||
@ -261,7 +279,12 @@ void main(void)
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
AsserMoteur_Gestion(step_ms);
|
||||
break;
|
||||
case 4:
|
||||
if(Strategie_parcourir_trajet(trajectoire, step_ms, EVITEMENT_SANS_EVITEMENT) == ACTION_TERMINEE){
|
||||
mode = 0;
|
||||
}
|
||||
AsserMoteur_Gestion(step_ms);
|
||||
break;
|
||||
}
|
||||
@ -274,6 +297,12 @@ void main(void)
|
||||
msg_propulsion_position.position_y_mm = position.y_mm;
|
||||
msg_propulsion_position.orientation_rad = position.angle_radian;
|
||||
mise_données_dans_échange((uint8_t*) &msg_propulsion_position, sizeof(msg_propulsion_position), REG_PROPULSION_POSITION);
|
||||
mise_données_dans_échange((uint8_t*) &msg_propulsion_position, sizeof(msg_propulsion_position), REG_PROPULSION_POSITION_2);
|
||||
float abscisse = Trajet_get_abscisse();
|
||||
mise_données_dans_échange((uint8_t*) &abscisse, sizeof(abscisse), REG_PROPULSION_ABSCISSE);
|
||||
struct point_xyo_t position_consigne = Trajectoire_get_point(&trajectoire, abscisse);
|
||||
mise_données_dans_échange((uint8_t*) &(position_consigne.point_xy), sizeof(position_consigne.point_xy), REG_PROPULSION_POSITION_CONSIGNE);
|
||||
|
||||
//sleep_ms(1);
|
||||
//printf("x_mm:%.2f, y_mm:%.2f\n", position.x_mm, position.y_mm);
|
||||
|
||||
@ -283,7 +312,7 @@ void main(void)
|
||||
}*/
|
||||
// Récupération des valeurs pour les mettre dans la mémoire d'échange
|
||||
// TODO
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,11 +5,14 @@
|
||||
#define USB_ID_PROPULSION 'P'
|
||||
|
||||
#define REG_PROPULSION_POSITION 0x00
|
||||
#define REG_PROPULSION_POSITION_2 0x80
|
||||
#define REG_PROPULSION_MODE 0x0D
|
||||
#define REG_PROPULSION_PWM 0x0E
|
||||
#define REG_PROPULSION_VITESSE_ROUES 0x12
|
||||
#define REG_PROPULSION_VITESSE_ROBOT 0x1A
|
||||
#define REG_PROPULSION_TRAJECTOIRE 0x22
|
||||
#define REG_PROPULSION_ABSCISSE 0x8C
|
||||
#define REG_PROPULSION_POSITION_CONSIGNE 0x90
|
||||
|
||||
struct msg_propulsion_position_t{
|
||||
float position_x_mm, position_y_mm, orientation_rad;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user