Real-time visualization and clustering of data from the YDLidar G2 using the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) algorithm.. The visualization is implemented with pygame
, while the data processing and clustering are handled using numpy
and scikit-learn
. By clustering objects around with lidar, we can develop further algorithms to control robots in the environment.
Two critical values for DBSCAN to work well. Epsilon (eps) is the maximum distance between two points for them to be considered as in the same neighborhood. min_samples is the minimum number of points required to form a dense region (i.e., a cluster). To optimize them we generate the K-distance graph and silhouette score.
The YDLidar G2 is a 2D triangular lidar sensor with the following features:
- Frequency: Operates between 5-12 Hz
- Range: Up to 16 meters
- For more information YDLidar G2 product page
Before getting started, make sure to review the following resources:
- YDLidar SDK: Includes the SDK, LiDAR viewer, and USB driver.
- How to Build and Run SDK: Step-by-step guide to building the SDK.
- User Manual: Detailed user guide.
To use this project with Python, you will need the following tools:
- vcpkg: to manage C++ libraries.
- CMake: to control the software compilation process.
- SWIG: to connect C/C++ code with various high-level programming languages.
- Visual Studio is recommended by manufacturer. But I used VS Code, no problem.
- Step 1: Build the YDLidar SDK and Python API
- Follow the instructions in the YDLidar SDK repository to build the C++ library using CMake and generate the Python bindings using SWIG.
- Step 2: Install the USB Driver
- Download and install USB adapter board driver from the YDLidar service support page. After installation, verify the device in the Device Manager.
- Step 3: Set Up a Python Virtual Environment to avoid compatibility issues
TODO:
- Improve plotting, add data assosiation
- Extend it to all lidars for YD Lidar by implementing lidar setup class
- Enable choice either detect standing objects or not detect them.