Julien VILLEMEJANE
/
ProTIS_Lidar_mbed5
Lidar RPLidar A2M8 - Testing program on L476RG
Revision 1:cce1f1fab87f, committed 2021-12-12
- Comitter:
- villemejane
- Date:
- Sun Dec 12 12:36:57 2021 +0000
- Parent:
- 0:b57a1ecda8dd
- Commit message:
- RP Lidar Testing program
Changed in this revision
--- a/main.cpp Tue Apr 13 12:42:42 2021 +0000 +++ b/main.cpp Sun Dec 12 12:36:57 2021 +0000 @@ -30,7 +30,7 @@ DigitalOut data_ok_q(D4); Serial lidar(A0, A1, 115200); -PwmOut rotation(D14); +PwmOut rotation(PB_9); struct lidar_data ld_current; @@ -60,10 +60,10 @@ debug_tour = !debug_tour; } - if(tour_ok == 4){ + if(tour_ok == 6){ int maxDistance, maxAngle; tour_ok = 0; - findMax(distance_scan_old, 360, &maxDistance, &maxAngle); + findMax(distance_scan_old, 0, 360, &maxDistance, &maxAngle); print_int("A", maxAngle); } /*
--- a/rplidar.cpp Tue Apr 13 12:42:42 2021 +0000 +++ b/rplidar.cpp Sun Dec 12 12:36:57 2021 +0000 @@ -18,10 +18,10 @@ wait_us(sec*1000000); } -void findMax(int *int_data, int size_data, int *value, int *indice){ +void findMax(int *int_data, int angle_min, int angle_max, int *value, int *indice){ *value = 0; *indice = 0; - for(int k = 0; k < size_data; k++){ + for(int k = angle_min; k < angle_max; k++){ if(int_data[k] > *value){ *value = int_data[k]; *indice = k;
--- a/rplidar.h Tue Apr 13 12:42:42 2021 +0000 +++ b/rplidar.h Sun Dec 12 12:36:57 2021 +0000 @@ -60,7 +60,7 @@ /** Find max in an integer array */ -void findMax(int *int_data, int size, int *value, int *indice); +void findMax(int *int_data, int angle_min, int angle_max, int *value, int *indice); /************************************************************************* LIDAR FUNCTIONS */