Here's the next milestone for the LIDAR compass: verifying that my office is "correct" given the static measurements I made with a laser tape measure of 2.663m floor to ceiling, and 3.901m wall to wall.
It turns out, the office is NOT "correct" - the ceiling slopes up a little from the outer wall of the house to the center, which is actually captured in the LIDAR feedback by the top-left corner being out of spec. For this test, I actually relaxed the pass/fail criteria to +/- 5cm instead of 2cm. Note: this isn't 5cm orthogonal to the wall, it's radial to the LIDAR. So a 5cm error where the wall is perpendicular to the laser radius is huge, whereas 5cm in the corners might not be much wall displacement from "straight" at all.
At this point, a significant source of error may be that the program "bins" LIDAR samples into the closest whole-degree, then just assumes the distance measured is EXACTLY that angle. Again - when the sampling laser is normal to the wall, this doesn't make much difference. But in the corners where the laser hits the wall at a steep angle, a slight angular misalignment will result in a more substantially erroneous radius.
I theorize that this angular-rounding is why there are almost no "out of spec" points in the middle of each wall, but some points are "bad" in the corners even when further-displaced points are "correct" again. The binning scheme is effectively introducing noise to the radius measurements.For now, I have no intention to rework the code and correct this issue, as it involves substantial complexity and isn't yet critical. Eventually, I'd like to move to a system of, instead of storing 360 samples, one for each "degree" and each with some discrete angular error, storing a list of "all samples from the last 5 sweeps" including all of the actual angles at which they were taken. This sacrifices the convenience of being able to pick out angles from their position in the list, but should add almost arbitrary angular resolution, which we may eventually need to get better feedback laser performance.
Note: The code corresponding to this milestone is in the Git repo as lidar_mpl_blit.py, at tag rectanguar-room-milestone https://github.com/alexwhittemore/CalEarth-LIDAR-Compass/blob/rectangular-room-milestone/lidar_mpl_blit.py