3: Usage - Grantham00/rplidar_detection GitHub Wiki
There are two files in this project: RPLidar_Scan.py is the main script, while RPLFucntions.py contains a set of functions. We want to run the the main script.
python RPLidar_Scan.py
Our script will open a plot in a new window. Detected points are plotted as stars. Our script attempts to divide the data into segments, indicated by alternating colors, and attempts to find lines and corners from the intersection of lines. These landmarks could be used for localization.
This script accepts the passing of an argument for segment threshold. This script attempts to segment points by checking the distance from each point to the next as it sweeps across the arc. The segthreshold variable, defaulted at 150, tells the script to start a new segment if the next point is more than 150mm from the previous. This variable should be tuned to better segment features in different environments.
Quickly change the segthreshold variable by running the script with an argument:
python RPLidar_Scan.py --s 200
This sets the segmenting threshold to 200mm. Observe the colors in the plot when the script runs. The goal of segmentation is to accurately separate features from each other in order to build an understanding of the environment. Are the physical objects in the room properly being separated from each other or the walls?
This segmentation algorithm is rudimentary - it simply looks for a sudden change in points' locations. There are many more robust segmentation algorithms with varying complexity. Research 2D Lidar Segmentation!