Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 9:a15fc52284ff
- Parent:
- 8:2ce9493549e8
- Child:
- 10:c8d93dc5993c
--- a/main.cpp Tue Jun 04 16:04:52 2019 +0000 +++ b/main.cpp Wed Jun 05 10:30:39 2019 +0000 @@ -33,7 +33,14 @@ direction[0] = 0; direction[1] = 1; float avg_x, avg_y, sum_inv_dist; - list_lidar[180] = 50; // [mm], point fictif qui pousse la voiture + //list_lidar[180] = 50; // [mm], point fictif qui pousse la voiture + int liste_fictifs[360]; + for (int i=0; i<360; i++){ + liste_fictifs[i] = 0; + } + for (int i=90; i<271; i++){ + liste_fictifs[i] = 1; + } int i; avg_x = 0; avg_y = 0; @@ -44,11 +51,16 @@ int theta; float r, x, y; theta = i; - r = list_lidar[360-theta]; + if (liste_fictifs[theta] == 1){ + r = 50; + } + else{ + r = list_lidar[360-theta]; + } //theta = 360 - theta; //pc.printf("Salut 1\n\r"); //pc.printf("%f\n\r",r); - if (r == 0 && theta != 180) break; // non calcul en cas de distance nul (donnée non captée) + //if (r == 0 && theta != 180) break; // non calcul en cas de distance nul (donnée non captée) //pc.printf("Salut 2\n\r"); //x = 0; //y = 0; @@ -84,6 +96,17 @@ //if (pwm < 1115) printf("trop petit\n\r"); //if (pwm > 1625) printf("trop grand\n\r"); + //if (angle > 5*3.14/180){ + // pwm = 1745; + //} + //else{ + // if (angle < -5*3.14/180){ + // pwm = 1080; + // } + // else{ + // pwm = 1453; + // } + //} return pwm; } @@ -138,7 +161,7 @@ while (1){ //printf("pwm_moteur = %f, pwm_direction = %f", pwm_moteur, pwm_direction); if(1){ - afficher_lidar(tableau_distance); + //afficher_lidar(tableau_distance); affiche_lidar = 0;