Grouper les informations d'un pas de temps à la même milliseconde pour simplifier l'analyse
This commit is contained in:
parent
9f4a0b7523
commit
1b5171290b
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
||||
build/
|
||||
build/
|
||||
wifi_settings.h
|
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -9,6 +9,8 @@
|
||||
"trajet.h": "c",
|
||||
"trajectoire.h": "c",
|
||||
"compare": "c",
|
||||
"asser_position.h": "c"
|
||||
"asser_position.h": "c",
|
||||
"cyw43_arch.h": "c",
|
||||
"teleplot.h": "c"
|
||||
}
|
||||
}
|
38
Teleplot.c
38
Teleplot.c
@ -11,6 +11,9 @@ char teleplot_tampon[BEACON_MSG_LEN_MAX]="";
|
||||
struct udp_pcb* pcb;
|
||||
ip_addr_t addr;
|
||||
|
||||
long teleplote_temps_ms;
|
||||
bool teleplot_temps_fige;
|
||||
|
||||
int Teleplot_init(void){
|
||||
if (cyw43_arch_init()) {
|
||||
printf("failed to initialise\n");
|
||||
@ -26,9 +29,10 @@ int Teleplot_init(void){
|
||||
} else {
|
||||
printf("Connected.\n");
|
||||
}
|
||||
|
||||
|
||||
pcb = udp_new();
|
||||
ipaddr_aton(BEACON_TARGET, &addr);
|
||||
teleplot_temps_fige = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -66,13 +70,39 @@ void teleplot_udp_send_string(char * message){
|
||||
#endif
|
||||
}
|
||||
|
||||
/// @brief Renvoi le temps en milliseconde, le temps réel ou le temps figé
|
||||
/// @param
|
||||
/// @return temps en millisecondes
|
||||
long Teleplot_get_temps(void){
|
||||
if(teleplot_temps_fige){
|
||||
return teleplote_temps_ms;
|
||||
}
|
||||
return (long) (time_us_64()/1000);
|
||||
}
|
||||
|
||||
/// @brief Permet de "bloquer le temps" pour recevoir toutes les données datées à la même milliseconde
|
||||
/// Simplifie beaucoup le traitement des données en CSV lors d'un import dans un tableur.
|
||||
void Teleplot_fige_temps(void){
|
||||
teleplot_temps_fige = false;
|
||||
teleplote_temps_ms = Teleplot_get_temps();
|
||||
teleplot_temps_fige = true;
|
||||
}
|
||||
void Teleplot_relache_temps(void){
|
||||
teleplot_temps_fige = false;
|
||||
}
|
||||
|
||||
|
||||
void Teleplot_envoie_tampon(void){
|
||||
teleplot_udp_send_string(teleplot_tampon);
|
||||
teleplot_tampon[0]='\0'; // On "vide" le tampon
|
||||
}
|
||||
|
||||
|
||||
void Teleplot_ajout_ou_envoie_tampon(char * message){
|
||||
// Si le tampon ne peut pas accueillir le prochain message
|
||||
// On envoie et on vide le tampon
|
||||
if(strlen(message) + strlen(teleplot_tampon) > BEACON_MSG_LEN_MAX){
|
||||
teleplot_udp_send_string(teleplot_tampon);
|
||||
teleplot_tampon[0]='\0'; // On "vide" le tampon
|
||||
Teleplot_envoie_tampon();
|
||||
}
|
||||
// On ajoute le message au tampon
|
||||
strcat(teleplot_tampon, message);
|
||||
@ -81,7 +111,7 @@ void Teleplot_ajout_ou_envoie_tampon(char * message){
|
||||
|
||||
void Teleplot_add_variable_float_2decimal(char * nom_variable, float valeur){
|
||||
char tampon[100];
|
||||
sprintf(tampon, "%s:%lu:%.2f\n", nom_variable, (long)time_us_64()/1000, valeur);
|
||||
sprintf(tampon, "%s:%lu:%.2f\n", nom_variable, Teleplot_get_temps(), valeur);
|
||||
Teleplot_ajout_ou_envoie_tampon(tampon);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
int Teleplot_init(void);
|
||||
void teleplot_udp_send_string(char * message);
|
||||
void Teleplot_envoie_tampon(void);
|
||||
void Teleplot_add_variable_float_2decimal(char * nom_variable, float valeur);
|
||||
void Teleplot_add_variable_int(char * nom_variable, int valeur);
|
||||
|
||||
void Teleplot_fige_temps(void);
|
||||
void Teleplot_relache_temps(void);
|
||||
|
||||
|
32
main.c
32
main.c
@ -31,6 +31,7 @@
|
||||
#define COULEUR_JAUNE 0
|
||||
|
||||
void affichage(void);
|
||||
void affichage_udp(void);
|
||||
void gestion_affichage(void);
|
||||
void tension_batterie_init(void);
|
||||
uint16_t tension_batterie_lire(void);
|
||||
@ -86,7 +87,6 @@ void main(void)
|
||||
//multicore_launch_core1(gestion_affichage);
|
||||
multicore_launch_core1(gestion_VL53L8CX);
|
||||
|
||||
sleep_ms(5000);
|
||||
printf("Demarrage...\n");
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ void gestion_VL53L8CX(void){
|
||||
VL53L8_min_distance(Results, &distance_obstacle);
|
||||
Trajet_set_obstacle_mm(distance_obstacle);
|
||||
}
|
||||
affichage();
|
||||
affichage_udp();
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,15 +168,39 @@ void gestion_affichage(void){
|
||||
}
|
||||
}
|
||||
|
||||
void affichage_udp(void){
|
||||
struct position_t position_actuelle;
|
||||
position_actuelle = Localisation_get();
|
||||
Teleplot_fige_temps();
|
||||
Teleplot_add_variable_float_2decimal("dist", Trajet_get_obstacle_mm());
|
||||
Teleplot_add_variable_float_2decimal("abs", abscisse);
|
||||
Teleplot_add_variable_float_2decimal("pos_x", position_actuelle.x_mm);
|
||||
Teleplot_add_variable_float_2decimal("pos_y", position_actuelle.y_mm);
|
||||
Teleplot_add_variable_float_2decimal("pos_angle", position_actuelle.angle_radian);
|
||||
|
||||
Teleplot_add_variable_float_2decimal("con_x", point.point_xy.x);
|
||||
Teleplot_add_variable_float_2decimal("con_y", point.point_xy.y);
|
||||
Teleplot_add_variable_float_2decimal("con_angle", point.orientation);
|
||||
|
||||
Teleplot_add_variable_float_2decimal("m1", AsserMoteur_getVitesse_mm_s(MOTEUR_A, step_ms));
|
||||
Teleplot_add_variable_float_2decimal("m2", AsserMoteur_getVitesse_mm_s(MOTEUR_B, step_ms));
|
||||
|
||||
Teleplot_add_variable_float_2decimal("m1_c", AsserMoteur_getConsigne_mm_s(MOTEUR_A));
|
||||
Teleplot_add_variable_float_2decimal("m2_c", AsserMoteur_getConsigne_mm_s(MOTEUR_B));
|
||||
|
||||
|
||||
Teleplot_envoie_tampon();
|
||||
}
|
||||
|
||||
void affichage(void){
|
||||
/*printf(">m1:%f\n>m2:%f\n", AsserMoteur_getVitesse_mm_s(MOTEUR_A, step_ms), AsserMoteur_getVitesse_mm_s(MOTEUR_B, step_ms) );
|
||||
printf(">m1_c:%f\n>m2_c:%f\n", AsserMoteur_getConsigne_mm_s(MOTEUR_A), AsserMoteur_getConsigne_mm_s(MOTEUR_B) );*/
|
||||
printf(">pos_x:%.1f\n>pos_y:%.1f\n>pos_angle:%.1f\n", Localisation_get().x_mm, Localisation_get().y_mm, Localisation_get().angle_radian);
|
||||
printf(">distance_obstacle:%f\n",Trajet_get_obstacle_mm());
|
||||
Teleplot_add_variable_float_2decimal("dist", Trajet_get_obstacle_mm());
|
||||
|
||||
|
||||
printf(">abscisse:%f\n",abscisse);
|
||||
Teleplot_add_variable_float_2decimal("abs", abscisse);
|
||||
|
||||
|
||||
struct position_t position_actuelle;
|
||||
position_actuelle = Localisation_get();
|
||||
|
Loading…
Reference in New Issue
Block a user