Laser SLAM mapping method based on self-adaptive filter and GNSS factors
Technical Field
The invention relates to the technical field of laser radar positioning and map construction, in particular to a laser SLAM map construction method based on a self-adaptive filter and GNSS factors.
Background
With the rapid development of three-dimensional laser scanning technology, laser SLAM (Simultaneous Localization AND MAPPING, SLAM) technology has been widely used in the fields of robots, automated driving vehicles, and the like. Through a laser SLAM algorithm, an automatic driving vehicle can realize incremental construction of a map by sequentially registering point cloud data collected at different positions, and then the aim of optimizing current pose estimation and a map is fulfilled by matching an environment scanned in real time at the position of the automatic driving vehicle with map information provided by a GNSS.
During data acquisition, the lidar scans the surrounding environment and generates a large number of data points, which constitute a so-called point cloud. Since lidar has a wide scanning range and high resolution, it can capture very detailed information in the environment, but this also means that a large amount of data is generated, which data needs to be processed by a computer. The process of processing such large amounts of data consumes a significant amount of computing resources, thereby reducing processing speed.
To address this problem, it is often desirable to downsample the point cloud data, i.e., select a portion of the data points from the raw data for processing, to reduce the amount of data and thereby increase the processing speed. However, conventional voxel filters (a common downsampling method) typically have a fixed grid size and cannot adaptively adjust the filtering parameters according to the density of the current point cloud. This means that even in the case where the point cloud data is already sparse, the filter may still filter using the same grid size, which may result in important feature points being incorrectly filtered out, thereby losing important information in the point cloud data.
In addition, when the lidar data is optimized using Global Navigation Satellite System (GNSS) factors, the GNSS factors represent positioning information of a robot or vehicle at a particular moment. If there is a large time difference between the time of acquisition of the GNSS factor and the time of the laser radar key frame, this GNSS factor may not accurately reflect the pose of the key frame time. Because the robot or vehicle may have moved a distance during this time, the GNSS factors may not match the pose of the key frames. Such a mismatch can affect the accuracy of pose estimation during the optimization process, thereby affecting the overall accuracy of the vehicle trajectory.
Disclosure of Invention
The invention aims to provide a laser SLAM mapping method based on an adaptive filter and GNSS factors, which has small calculation amount and high mapping precision.
In order to achieve the above purpose, the laser SLAM mapping method based on the adaptive filter and the GNSS factors comprises the following steps:
step 1, acquiring multi-frame three-dimensional laser radar point cloud data generated by a laser radar in a scanning area;
Step 2, dividing the point cloud data into a grounding point set and a non-grounding point set after ground segmentation;
step 3, respectively preprocessing point cloud data of the grounding point set and the non-grounding point set;
Step 4, selecting a plane point set and an angle point set from the non-grounding point set from the preprocessed grounding point set;
step 5, recursively solving the pose between adjacent frames by utilizing an LOAM algorithm based on the plane point set and the corner set to obtain laser radar odometer data;
And 6, integrating the laser radar odometer data and the map information data provided by the GNSS to generate a factor graph, optimizing the factor graph by using a graph optimization method to obtain final pose estimation, and generating a three-dimensional point cloud map of the scanning area based on the final pose estimation.
The method for dividing the ground into a grounding point set and a non-grounding point set in the step 2 comprises the steps of calculating a horizontal included angle between two points according to a height difference Hz and a plane Euclidean distance D ab between the point A and the point B on two adjacent three-dimensional laser radar scanning lines, calculating the horizontal included angle from small to large according to the vertical angle of laser radar beams, if the horizontal included angle is larger than a set value, the point cloud data within the current vertical angle belong to the grounding point, otherwise belong to the non-grounding point, and finally realizing the ground division.
The preprocessing in step 3 is to perform adaptive voxel filtering on the ground point concentrated point cloud data, and the non-ground point concentrated point cloud data is first subjected to point cloud clustering segmentation processing based on Euclidean distance, and then subjected to adaptive voxel filtering after being divided into different point sets.
The method for performing self-adaptive voxel filtering on the point cloud data comprises the following steps:
step 301, calculating an initial voxel side length Step 1 and a grid voxel length Step n after iterative growth according to a maximum distance D max of the input point cloud;
302, substituting a parameter Step 1,Stepn into a voxel filter for filtering processing to obtain a point number P n after downsampling, and if the point cloud number P n is more than or equal to P g and the iteration number is less than n max, recalculating the current grid voxel side length Step n and substituting the current grid voxel side length Step into the voxel filter again;
step 303, repeating the above steps until the current point cloud number P n is smaller than P g or the iteration number is larger than n max;
Step 304, based on step 303, if the current point cloud number P n is smaller than the downsampled minimum point cloud number P min, using P n-1 to replace P n as the current point cloud number, and simultaneously using the point cloud obtained through n-1 times of filtering to replace the point cloud obtained through n times of filtering and output as the target point cloud, and if P n is larger than P min, outputting the target point cloud obtained through n times of filtering to ensure that the output target point cloud number is always larger than P min.
The calculation process of the maximum distance D max in step 301 is as follows:
solving the maximum value x max,ymax,zmax and the minimum value x min,ymin,zmin of the point cloud data x, y and z on three coordinate axes, and calculating the side length of the point cloud bounding box to :Ix=xmax-xmin,Iy=ymax-ymin,Iz=zmax-zmin;
The method for calculating the initial voxel side length Step 1 and the iteratively-increased grid voxel length Step n comprises the following steps:
Wherein D max is the maximum distance in the point cloud set, step 1 is the grid voxel side length of initial downsampling, step n is the grid voxel length after n-th iteration growth, n is the current iteration number, n max is the maximum iteration number, P g is the target point number after downsampling, P min is the minimum point number after downsampling, P n is the point number after n-time filtering, f (·) represents a filter, and K is the Step size coefficient.
The process of substituting the parameter Step 1、Stepn into the voxel filter for filtering in Step 302 is as follows:
Step 3021, setting the side length of each grid voxel as r, and dividing the point cloud data into a D x×Dy×Dz voxel grid:
Wherein, I x、Iy、Iz is the side length of the point cloud bounding box on three coordinate axes of x, y and z, and x max、ymax、zmax and x min、ymin、zmin are the maximum value and the minimum value of the point cloud data of x, y and z on the three coordinate axes respectively;
step 3022, calculating an Index for each point within the voxel grid:
Step 3023, sorting the points in the Index from small to large to calculate the barycentric point of each voxel grid, and replacing all the points in the voxel grid with the barycentric point, wherein the calculation process of the barycentric point is as follows:
Wherein X, Y, Z is the center of gravity point coordinate, m is the number of point clouds in the grid, x i、yi、zi is the point cloud coordinate in the grid, and i is the point cloud sequence number in the grid.
The method for recursively solving the pose between adjacent frames by using the LOAM algorithm in the step 5 comprises the steps of performing feature matching between continuous frames by taking corner points and plane points as feature points, namely, matching the feature points of the current frame with the feature points in historical frames to obtain feature point pairs, constructing a nonlinear optimization problem about the pose by using the feature point pairs, solving the problem to obtain the pose between the adjacent frames, and forming laser radar odometry data by pose data of all the adjacent frames, wherein the laser radar odometry data describe the position and the orientation change of the three-dimensional laser radar in a map coordinate system along with time.
In step 6, integrating the laser radar odometer data and the map information data provided by the GNSS to generate a factor graph, and optimizing the factor graph by using a graph optimization method to obtain a final pose estimation method, which comprises the following steps:
Step 601, data integration, namely performing timestamp matching on laser radar odometer data and GNSS data;
Step 602, constructing a factor graph, wherein each laser radar measurement data point and GNSS data point corresponds to a factor, the factors represent different types of observation information, and edges in the factor graph represent the dependency relationship among different observation information;
and 603, minimizing the observation error in the factor graph by using a graph optimization method, wherein in the optimization process, the pose in the laser radar measurement data is adjusted according to the dependency relationship between the observation information in the factor graph and different observation information until the convergence condition is met, and outputting final pose estimation.
In the optimizing process in step 603, the GNSS data are optimized by screening and interpolating GNSS factors to reduce errors in acquiring the GNSS data, i.e. a frame of image is selected as a key frame at intervals, wherein each key frame should include longitude, latitude and altitude information of the GNSS factors before and after the GNSS factors, if no GNSS factor is selected after the key frame is selected, waiting for the next new GNSS data input, otherwise comparing the timestamp of the key frame with the timestamp of the previous and next GNSS factors, if the difference between the timestamps is smaller than the set value, linearly interpolating the longitude, latitude and altitude of the previous and next GNSS factors, taking the longitude, latitude and altitude obtained by interpolation as the optimized GNSS factors, otherwise waiting for the new GNSS data input, and after the interpolation is finished, transferring the optimized GNSS factors under the current map coordinate system and inserting the optimized GNSS factors into the global factor map.
The method for generating the three-dimensional point cloud map of the scanning area in the step 6 includes the steps of constructing a pose map according to pose estimation, wherein nodes in the pose map represent laser radar poses of different frames, edges represent transformation relations between adjacent frames, and the pose map is used for matching point cloud data of different frames, so that the point cloud data of different frames are integrated, and a continuous three-dimensional point cloud map is generated.
The self-adaptive voxel filter has the advantages that 1, the self-adaptive voxel filter adopted by the method can dynamically adjust the grid size according to the local density of point cloud data, in a region with denser point cloud, smaller grid size can be used for reserving more details, in a region with sparser point cloud, larger grid size can be used for reducing the calculated amount and filtering noise, and the self-adaptive adjustment is beneficial to reducing unnecessary data processing and reducing the calculated amount while reserving characteristic points in important point cloud data;
2. The method firstly compares the GNSS factors with the time stamps of the laser radar key frames, ensures that the time difference between the GNSS factors and the key frame time is in an acceptable range, ensures that the GNSS factors can accurately reflect the pose of the key frame time, processes the GNSS factors with larger time difference between the time stamps and the key frame time by adopting a linear interpolation technology, and can obtain an approximate GNSS pose at the key frame time by adopting the method, thereby reducing the problem of pose mismatch caused by the time difference and improving the accuracy of vehicle tracks.
Drawings
FIG. 1 is a schematic flow chart of the method of the present invention;
FIG. 2 is a schematic diagram of points A and B on two adjacent three-dimensional lidar scan lines;
FIG. 3 is a flow chart of adaptive voxel filtering;
FIG. 4 is a flow chart for optimizing GNSS data by screening and interpolating GNSS factors;
Fig. 5 is a graph of point cloud data before and after filtering using an adaptive voxel filter.
Detailed Description
The technical scheme of the present invention will be described in detail with reference to the following examples and the accompanying drawings.
As shown in fig. 1, a laser SLAM mapping method based on an adaptive filter and GNSS factors includes the following steps:
step 1, acquiring multi-frame three-dimensional laser radar point cloud data generated by a laser radar in a scanning area;
The method comprises the steps of dividing point cloud data into a grounding point set and a non-grounding point set after ground segmentation, calculating a horizontal included angle between two points according to a height difference Hz and a plane Euclidean distance D ab between the point A and the point B respectively positioned on two adjacent three-dimensional laser radar scanning lines, calculating the horizontal included angle according to laser radar beam vertical angles from small to large and point cloud data, wherein if the horizontal included angle is larger than a set value, the point cloud data belong to the grounding point within the current vertical angle, otherwise belong to the non-grounding point, and finally realizing ground segmentation, as shown in figure 2.
And 3, respectively preprocessing point cloud data of a grounding point set and a non-grounding point set, wherein the preprocessing refers to self-adaptive voxel filtering of the point cloud data obtained by scanning each frame of the laser radar, the self-adaptive voxel filtering is directly carried out on the grounding point set point cloud data, the non-grounding point set point cloud data is subjected to point cloud clustering segmentation processing based on Euclidean distance, and the point cloud data is divided into different point sets and then subjected to self-adaptive voxel filtering.
As shown in fig. 3, the method for performing adaptive voxel filtering on the point cloud data includes:
step 301, calculating an initial voxel side length Step 1 and a grid voxel length Step n after iterative growth according to a maximum distance D max of the input point cloud;
302, substituting a parameter Step 1,Stepn into a voxel filter for filtering processing to obtain a point number P n after downsampling, and if the point cloud number P n is more than or equal to P g and the iteration number is less than n max, recalculating the current grid voxel side length Step n and substituting the current grid voxel side length Step into the voxel filter again;
step 303, repeating the above steps until the current point cloud number P n is smaller than P g or the iteration number is larger than n max;
Step 304, based on step 303, if the current point cloud number P n is smaller than the downsampled minimum point cloud number P min, using P n-1 to replace P n as the current point cloud number, and simultaneously using the point cloud obtained through n-1 times of filtering to replace the point cloud obtained through n times of filtering and output as the target point cloud, and if P n is larger than P min, outputting the target point cloud obtained through n times of filtering to ensure that the output target point cloud number is always larger than P min.
The calculation process of the maximum distance D max in step 301 is as follows:
solving the maximum value x max,ymax,zmax and the minimum value x min,ymin,zmin of the point cloud data x, y and z on three coordinate axes, and calculating the side length of the point cloud bounding box to :Ix=xmax-xmin,Iy=ymax-ymin,Iz=zmax-zmin;
The method for calculating the initial voxel side length Step 1 and the iteratively-increased grid voxel length Step n comprises the following steps:
Wherein D max is the maximum distance in the point cloud set, step 1 is the grid voxel side length of initial downsampling, step n is the grid voxel length after n-th iteration growth, n is the current iteration number, n max is the maximum iteration number, P g is the target point number after downsampling, P min is the minimum point number after downsampling, P n is the point number after n-time filtering, f (·) represents a filter, and K is the Step size coefficient.
The process of substituting the parameter Step 1、Stepn into the voxel filter for filtering in Step 302 is as follows:
Step 3021, setting the side length of each grid voxel as r, and dividing the point cloud data into a D x×Dy×Dz voxel grid:
Wherein, I x、Iy、Iz is the side length of the point cloud bounding box on three coordinate axes of x, y and z, and x max、ymax、zmax and x min、ymin、zmin are the maximum value and the minimum value of the point cloud data of x, y and z on the three coordinate axes respectively;
step 3022, calculating an Index for each point within the voxel grid:
Step 3023, sorting the points in the Index from small to large to calculate the barycentric point of each voxel grid, and replacing all the points in the voxel grid with the barycentric point, wherein the calculation process of the barycentric point is as follows:
Wherein X, Y, Z is the center of gravity point coordinate, m is the number of point clouds in the grid, x i、yi、zi is the point cloud coordinate in the grid, and i is the point cloud sequence number in the grid.
And 4, selecting a plane point set and an angle point set from the non-grounding point set from the preprocessed grounding point set.
The method comprises the steps of carrying out feature matching between continuous frames by using corner points and plane points as feature points, namely matching the feature points of the current frame with the feature points in historical frames to obtain feature point pairs, constructing a nonlinear optimization problem about pose by using the feature point pairs, solving the problem to obtain pose between adjacent frames, and constructing laser radar odometer data by pose data of all adjacent frames, wherein the position and orientation of the laser radar odometer data describe the change of a three-dimensional laser radar in a map coordinate system along with time.
Step 6, integrating laser radar odometer data and map information data provided by GNSS to generate a factor graph, optimizing the factor graph by using a graph optimization method to obtain final pose estimation, and generating a three-dimensional point cloud map of the scanning area based on the final pose estimation;
The method for integrating the laser radar odometer data and the map information data provided by the GNSS to generate a factor graph, and optimizing the factor graph by using a graph optimization method comprises the following steps of:
Step 601, data integration, namely performing timestamp matching on laser radar odometer data and GNSS data;
Step 602, constructing a factor graph, wherein each laser radar measurement data point and GNSS data point corresponds to a factor, the factors represent different types of observation information, and edges in the factor graph represent the dependency relationship among different observation information;
and 603, minimizing the observation error in the factor graph by using a graph optimization method, wherein in the optimization process, the pose in the laser radar measurement data is adjusted according to the dependency relationship between the observation information in the factor graph and different observation information until the convergence condition is met, and outputting final pose estimation.
In the optimization process, the GNSS data are optimized by screening and interpolating GNSS factors to reduce errors of acquired GNSS data, as shown in fig. 4, namely, a frame of image is selected at intervals to serve as a key frame, wherein each key frame is provided with longitude, latitude and altitude information of the GNSS factors, if no GNSS factors exist after the selected key frame, the next new GNSS data input is waited, otherwise, the timestamp of the key frame is compared with the timestamp of the front GNSS factor and the timestamp of the rear GNSS factor, if the difference value of the timestamp is smaller than a set value, such as 0.5 seconds, the longitude, latitude and altitude of the front GNSS factor and the rear GNSS factor are linearly interpolated, the obtained longitude, latitude and altitude are used as optimized GNSS factors, otherwise, the new GNSS data input is waited, and after the interpolation is finished, the optimized GNSS factors are transferred to a current map coordinate system and are inserted into a global factor graph.
The method for generating the three-dimensional point cloud map of the scanning area comprises the steps of constructing a pose map according to pose estimation, wherein nodes in the pose map represent laser radar poses of different frames, edges represent transformation relations between adjacent frames, and the pose map is used for matching point cloud data of different frames, so that the point cloud data of different frames are integrated, and a continuous three-dimensional point cloud map is generated.
To verify the effectiveness of the method of the present invention, systematic evaluations were performed in this example using sequences 00 and 07 in the KITTI dataset, all tests were performed based on the Robot Operating System (ROS). Specifically, the parameter P g is set to 11,000, P min is set to 10000, and K is set to 0.2. And meanwhile, the accuracy of the vehicle track obtained by the method is compared by using a classical LEGO-LOAM algorithm.
As shown in fig. 4, as a result of downsampling a frame of point cloud in KITTI data sets by an adaptive voxel filter, the downsampled point cloud greatly reduces the data amount while still retaining most of key points capable of describing the form of the original point cloud.
The vehicle track error results based on sequences 00 and 07 are shown in tables 1 and 2. Therefore, the method provided by the invention adopts the self-adaptive voxel filter, and can effectively reduce the error of the obtained track after optimizing the GNSS data by screening and interpolating GNSS factors.
Table 1 shows an error comparison based on KITTI dataset 01 sequence
Table 2 shows an error comparison based on KITTI dataset 07 sequences