ⒹⒺⓈⒸⓇⒾⓅⓉⒾⓄⓃ
MATLAB simulation experiment using LiDAR data to find ground plane and obstacles around vehicles
1、 Introduction
With the rapid development of autopilot technology, laser radar, as an important environment sensing sensor, plays a vital role in the auto drive system. Lidar can obtain real-time three-dimensional point cloud data of the surrounding environment of vehicles, providing accurate environmental information for decision-making of autonomous vehicles. The purpose of this paper is to discuss how to use MATLAB software to process the existing laser radar data, so as to identify the obstacles on the ground plane and around the vehicle, and provide a strong guarantee for the safe driving of the auto drive system.
2、 Experimental Principles and Methods
Experimental Principles
Lidar data typically exists in the form of a three-dimensional point cloud, with each point representing a spatial coordinate and a reflection intensity value. In order to identify ground planes and obstacles from point cloud data, we need to process and analyze the point cloud data. Firstly, point cloud data is visualized through color mapping for easy observation and analysis. Then, use the RANSAC algorithm to fit the ground plane and remove the point cloud data on the ground plane. Finally, the remaining point cloud data is divided into different obstacles using clustering algorithms to achieve obstacle recognition.
Experimental methods
(1) Reading LiDAR data
Use the velodyneFileReader function in MATLAB to read LiDAR data and store it as a point cloud object.
(2) Color mapping
For the convenience of observing and analyzing point cloud data, we can use color mapping to visualize point cloud data. In MATLAB, color mapping can be set using the colormap function.
(3) Fit ground plane
Fit the ground plane from point cloud data using the RANSAC algorithm. The RANSAC algorithm is a robust model fitting method that can estimate the parameters of a mathematical model from a dataset containing noise and outliers. When fitting the ground plane, we assume that it is a planar model and use the RANSAC algorithm to estimate the parameters of the plane from point cloud data.
(4) Remove point cloud data on the ground plane
Remove the point cloud data located on the ground plane based on the fitted ground plane parameters. This can be achieved by calculating the distance between each point and the ground plane, treating points with a distance less than a certain threshold as located on the ground plane.
(5) Cluster analysis
Cluster analysis will be performed on the point cloud data after removing the ground plane, and point cloud data belonging to the same obstacle will be classified into the same category. In MATLAB, clustering algorithms such as k-means can be used for implementation.
(6) Obstacle recognition
Based on the clustering results, we can identify obstacles around the vehicle. Based on the shape, size, and other characteristics of obstacles, they can be further classified and recognized.
3、 Experimental process and results
Experimental process
(1) Reading LiDAR data
Firstly, we use the velodyneFileReader function to read LiDAR data and store it as a point cloud object. In this experiment, we used a LiDAR data file called 'lidarData-ConstructionRoad. pcap', which records the vehicle's driving process on the construction road.
(2) Color mapping
In order to facilitate observation and analysis of point cloud data, we set up color mapping using the colormap function. In this experiment, we used four colors to represent unlabeled point clouds, ground planes, main vehicles, and obstacles, respectively.
Next, we use the RANSAC algorithm to fit the ground plane from the point cloud data. In this experiment, we assume that the normal vector of the ground plane roughly points in the positive Z-axis direction and set an appropriate distance threshold to remove point cloud data located on the ground plane.
(4) Remove point cloud data on the ground plane
Based on the fitted ground plane parameters, we remove the point cloud data located on the ground plane. In this experiment, we calculated the distance from each point to the ground plane and considered points with a distance less than 0.2 meters to be located on the ground plane.
(5) Cluster analysis
Then, we perform cluster analysis on the point cloud data after removing the ground plane. In this experiment, we used the k-means clustering algorithm and set an appropriate number of clusters and iterations.
(6) Obstacle recognition
Finally, based on the clustering results, we identified obstacles around the vehicle. In this experiment, we classified obstacles into pedestrians, vehicles, and other obstacles based on their shape, size, and other characteristics.
experimental result
Through experiments, we successfully identified the ground level and obstacles around the vehicle. In the visualization results, we can see that point clouds of different colors represent unlabeled point clouds, ground planes, main vehicles, and obstacles, respectively. At the same time, we also get the location, shape and size of each obstacle, which provides a strong guarantee for the safe driving of the auto drive system.
4、 Conclusion and Outlook
This article uses MATLAB software to process and analyze existing LiDAR data, successfully identifying obstacles around the ground plane and vehicles. We obtained accurate environmental perception results through color mapping, RANSAC algorithm fitting ground plane, cluster analysis, and other methods. The experimental results show that the method proposed in this article can effectively process LiDAR data and accurately identify ground planes and obstacles. This provides a strong guarantee for the safe driving of the auto drive system.
In the future, we will further optimize algorithms and models to improve the accuracy and robustness of obstacle recognition. At the same time, we will also explore multi-sensor fusion technology to fuse LiDAR data with other sensor data (such as cameras, millimeter wave radars, etc.) to improve the accuracy and reliability of environmental perception. In addition, we will also study how to use advanced technologies such as deep learning to classify obstacles more finely