Implement LIDAR functions
Problem
We would like to enable the quad to obtain location data independently of the camera system.
Solution
Implement functions for a LIDAR sensor to allow on-board determination of height.
Tests
No automated tests were written, since this functionality is hardware specific, but the following code was added at the beginning of the main function to serve as a manual test (with a breakpoint placed at iic0_lidarlite_read_distance(&lidar)
).
lidar_t lidar = { };
iic0_init();
iic0_lidarlite_init(); // puts LIDAR free-running mode
unsigned short x;
while (1) {
iic0_lidarlite_read_distance(&lidar);
x = lidar.distance_cm;
}
return 0;
Realistic distance measurements were obtained. A test consisting of the LIDAR sensor pointing at a wall 1m away gave 103 cm.
Other Notes
The original iic_mpu9150_utils.c
was refactored to make room for LIDAR, since many of the functions are almost identical (mostly just renaming and reorganizing).