A multi-scale adaptive laser radar SLAM method and device
By adaptively adjusting the voxel filter and keyframe distance threshold, combined with improved point cloud matching and factor graph optimization algorithm, the problem of positioning accuracy and efficiency of traditional lidar SLAM methods in spatial scale changes is solved, and more efficient lidar SLAM positioning is achieved.
Patent Information
- Application Number
- CN202410271042.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-11
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-03-11
AI Technical Summary
Traditional lidar SLAM methods are difficult to take into account both positioning accuracy and efficiency in scenarios where spatial scale changes.
The spatial scale evaluation algorithm adaptively adjusts the grid size and keyframe distance threshold of the voxel filter, combines the improved point-to-face ICP point cloud matching algorithm and factor graph fusion optimization algorithm to realize lidar odometer and loopback detection, and optimize keyframe poses.
Under different spatial scale environments, the positioning accuracy and computing efficiency of lidar SLAM are improved, and it can better adapt to scene changes.
Smart Images

Figure CN117930279B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of laser radar, and in particular relates to a multi-scale adaptive laser radar SLAM method and device. Background Art
[0002] The simultaneous localization and mapping (SLAM) method of LiDAR can combine the observation data of LiDAR with the motion information of unmanned systems to realize the positioning and mapping of unmanned systems in unknown environments. The LiDAR SLAM method consists of two parts: front-end odometer and back-end optimization. The front-end odometer includes three parts: point cloud preprocessing, point cloud matching, and loop detection. The back-end optimization obtains the global optimal pose by fusing the front-end odometer, loop information, and absolute position measurement (such as the position provided by satellites). At the same time, the LiDAR point cloud is projected into the global coordinate system using the optimized pose to obtain a point cloud map.
[0003] There are many single-frame LiDAR point clouds. If all point clouds are used for point cloud matching, a lot of computing resources will be consumed. Therefore, the original point cloud is usually downsampled using a voxel filter before point cloud matching. In addition, backend optimization is usually implemented using factor graphs. If the poses of all LiDAR frames are optimized, the scale of the factor graph will become too large, thus affecting the efficiency of the algorithm. Therefore, some key frames are usually selected from all LiDAR frames for optimization. Traditional LiDAR SLAM algorithms (such as LIO-SAM) set the voxel size of the voxel filter and the distance threshold for key frame selection to fixed values. If a larger voxel and key frame distance threshold is used in a scene with a smaller spatial scale (such as a narrow indoor scene), the positioning accuracy will be reduced; if a smaller voxel size and key frame distance are used in a scene with a larger spatial scale (such as an open outdoor environment), the amount of calculation will increase. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a multi-scale adaptive laser radar SLAM method and device, which can take into account both positioning accuracy and efficiency in scenarios with varying spatial scales.
[0005] To achieve the above object, the present invention adopts the following technical solution:
[0006] A multi-scale adaptive laser radar SLAM method comprises the following steps:
[0007] Step 1: adaptively adjust the grid size and keyframe distance threshold of the voxel filter according to the spatial scale;
[0008] Step 2: According to the grid size of the voxel filter and the key frame distance threshold, the improved point-to-surface ICP point cloud matching algorithm is used to obtain the lidar odometer, and loop detection is implemented based on distance search;
[0009] Step 3: Optimize all key frame poses by fusing the lidar odometry and loop constraints through the factor graph, and use the optimized key frame poses to project the key frame point cloud into the global coordinate system to obtain the point cloud map.
[0010] Preferably, in step 1, the spatial scale of the environment in which the carrier is located is evaluated based on the real-time point cloud of the lidar through a spatial scale evaluation algorithm, and the voxel filter grid size and the key frame distance threshold are adaptively adjusted according to the spatial scale of the environment.
[0011] Preferably, in step 2, on the point-to-surface ICP algorithm, the parameters of the plane fitting are adaptively adjusted according to the laser point distance; the downsampled real-time point cloud is matched with the local map point cloud to minimize the point-to-surface distance residual, thereby obtaining the lidar odometer.
[0012] Preferably, in step 2, for the latest key frame, a key frame satisfying the loop relationship is searched in the historical key frames, and the relative pose between frames is calculated to achieve loop detection.
[0013] The present invention also provides a multi-scale adaptive laser radar SLAM device, comprising:
[0014] An evaluation module for adaptively adjusting the grid size and keyframe distance threshold of the voxel filter according to the spatial scale;
[0015] The calculation module is used to obtain the lidar odometer based on the grid size of the voxel filter and the key frame distance threshold using the point cloud matching algorithm of the improved point-to-surface ICP, and realize loop detection based on distance search;
[0016] The optimization module is used to optimize all key frame poses by fusing the lidar odometry and loop constraints through factor graphs, and use the optimized key frame poses to project the key frame point cloud into the global coordinate system to obtain a point cloud map.
[0017] Preferably, the evaluation module evaluates the spatial scale of the environment in which the carrier is located based on the real-time point cloud of the lidar through a spatial scale evaluation algorithm, and adaptively adjusts the voxel filter grid size and the key frame distance threshold according to the spatial scale of the environment.
[0018] Preferably, the calculation module adaptively adjusts the parameters of the plane fitting according to the laser point distance based on the point-to-plane ICP algorithm; the downsampled real-time point cloud is matched with the local map point cloud to minimize the point-to-plane distance residual to obtain the lidar odometer.
[0019] Preferably, the calculation module searches for a key frame that satisfies the loop relationship among historical key frames for the latest key frame, and calculates the relative pose between frames to achieve loop detection.
[0020] The present invention firstly evaluates the spatial scale of the environment in which the carrier is located through the real-time point cloud of the laser radar, and adaptively adjusts the voxel size of the voxel filter and the distance threshold of the key frame selection according to the spatial scale of the environment; then the laser radar odometer is obtained through the point-to-surface ICP matching algorithm, and the laser radar odometer and loop information are fused through the factor graph to optimize the key frame pose; the real-time point cloud is projected into the global coordinate system by using the key frame pose and accumulated to obtain a point cloud map. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0022] Figure 1 1 is a flow chart of a multi-scale adaptive laser radar SLAM method according to an embodiment of the present invention;
[0023] Figure 2 This is a schematic diagram of the principle of ground point removal;
[0024] Figure 3 It is a structural schematic diagram of a factor graph fusion framework according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0027] Embodiment 1:
[0028] The embodiment of the present invention provides a multi-scale adaptive laser radar SLAM method, comprising the following steps:
[0029] Step 1: adaptively adjust the grid size and keyframe distance threshold of the voxel filter according to the spatial scale;
[0030] Step 2: According to the grid size of the voxel filter and the key frame distance threshold, the improved point-to-surface ICP point cloud matching algorithm is used to obtain the lidar odometer, and loop detection is implemented based on distance search;
[0031] Step 3: The back-end optimization algorithm based on the factor graph fuses the lidar odometry and loop constraints through the factor graph to optimize all key frame poses, and uses the optimized key frame poses to project the key frame point cloud into the global coordinate system to obtain the point cloud map.
[0032] As an implementation method of an embodiment of the present invention, in step 1, the spatial scale of the environment in which the carrier is located is evaluated according to the real-time point cloud of the laser radar through a spatial scale evaluation algorithm, and the voxel filter grid size and the key frame distance threshold are adaptively adjusted according to the spatial scale of the environment to balance the accuracy and efficiency of subsequent positioning;
[0033] As an implementation method of an embodiment of the present invention, in step 2, an improved point-to-surface ICP point cloud matching algorithm is adopted. On the point-to-surface ICP algorithm, the parameters of the plane fitting are adaptively adjusted according to the laser point distance; the downsampled real-time point cloud is matched with the local map point cloud, with the goal of minimizing the point-to-surface distance residual, to obtain a lidar odometer.
[0034] As an implementation method of an embodiment of the present invention, in step 2, a loop detection algorithm based on distance search searches for a key frame that satisfies the loop relationship in the historical key frames for the latest key frame, and calculates the relative position between frames to implement loop detection. Loop detection can effectively reduce the cumulative error of the laser radar odometer and improve positioning accuracy.
[0035] Embodiment 2:
[0036] The traditional LiDAR SLAM algorithm has difficulty in balancing positioning accuracy and efficiency in scenarios with varying spatial scales. Figure 1 As shown, an embodiment of the present invention provides a multi-scale adaptive laser radar SLAM method, comprising the following steps:
[0037] Step S1: Spatial scale assessment algorithm
[0038] The spatial scale factor χ is designed to evaluate the spatial scale of the environment in which the carrier is located. Assume that the original lidar point cloud is P k , remove Pk The ground points in the radar point cloud The spatial scale factor χ is defined as follows:
[0039]
[0040] Among them, N s represent The number of laser points in the i represent The larger the χ is, the larger the spatial scale of the environment in which the current carrier is located is.
[0041] In the original point cloud of the LiDAR, some point clouds will scan the ground close to the carrier. If this part of the point cloud is introduced into the calculation of the spatial scale factor, the size of the spatial scale factor will be reduced, thus affecting the accurate judgment of the spatial scale. Therefore, it is necessary to remove the ground points in the original point cloud of the LiDAR. The principle of ground point removal is as follows: Figure 2 As shown, G A , G B are two laser points on adjacent scan lines of a frame of laser radar point cloud, and the laser radar Z axis is perpendicular to the horizontal plane. Ideally, if G A , G B belongs to a ground point, then the vector Angle θ with the horizontal plane G It should be zero. Considering the existence of potholes on the ground, when θ G Satisfy |θ G |<T θ When G A , G B belongs to the ground point, where T θ Represents the angle threshold set. Assume G A , G B The corresponding coordinates are (x i ,y i ,z i ) and (x j ,y j ,z j ), calculate θ G :
[0042]
[0043] When |θ G |<T θ And |z i -h L |<T h When G A is a ground point, where T h The height threshold to set.
[0044] Step S2: Adaptive voxel and keyframe selection algorithm based on spatial scale
[0045] Adaptively adjust the voxel grid size V according to the spatial scale factor χ calculated in step S1 s and keyframe distance threshold d key , the specific method is as follows:
[0046] Set the maximum spatial scale factor threshold χ max , maximum voxel grid threshold Maximum keyframe distance threshold Exponential decay coefficients α, β, γ.
[0047] Case 1: When χ max When ≤χ,
[0048] Case 2: When αχ max ≤χ≤χ max hour,
[0049] Case 3: When α 2 χ max ≤χ≤αχ max hour,
[0050] Case 4: When α 3 χ max ≤χ≤α 2 χ max ,
[0051] Case 5: When χ≤α 3 χ max hour,
[0052] Step S3: Point cloud matching algorithm based on improved point-to-surface ICP
[0053] The number of original point clouds in a frame of LiDAR is as high as tens of thousands. Using all point clouds for point cloud matching will consume a lot of computing resources. In order to reduce the number of point clouds while retaining the spatial structure of the point clouds as much as possible, the present invention uses a voxel filter to downsample the original point cloud. The size of the voxel grid is obtained by step S2. Based on the traditional point-to-plane ICP algorithm, the present invention adaptively adjusts the parameters of the plane fitting according to the distance of the laser point. Assume that the real-time point cloud of the LiDAR after downsampling by the voxel filter is P′ k , the local map point cloud composed of the first n key frame point clouds is P m For P′ k A little bit of q l , in Pm Find k distances q in l The closest point, denoted as Ps l ={p l1 ,p l2 ,...,p lk The present invention adaptively adjusts the number of closest points to be found according to the distance of the laser point:
[0054] k=α-[βD i ]
[0055] Where [·] represents the integer symbol, α and β represent the set linear parameters, and D i Represents the distance of the i-th laser point.
[0056] Calculate Ps l Center And the covariance matrix Q:
[0057]
[0058]
[0059] in, For p li Assume that the eigenvalues of Q are λ1, λ2, and λ3 (λ1<λ2<λ3), and the flatness of the fitting plane is ε p Defined as:
[0060]
[0061] ε p The larger the value, the higher the Ps l The more consistent with the plane assumption, the present invention uses a dynamic flatness threshold χ p To screen the fitted plane, χ p is defined as follows:
[0062] χ p =1-γD i
[0063] Among them, γ represents the linear parameter of the setting. When ε p > p When , the fitted plane is considered valid. Let the unit eigenvector corresponding to λ1 be v l , v l That is Ps l Construct the normal vector of the plane. Construct the distance function from point to surface
[0064]
[0065] Apply the pose transformation T to Pk After that, q l The coordinate transformation is:
[0066] T(q l )=Rq l +t
[0067] becomes:
[0068]
[0069] Objective function f(T,P s ,P t ) is defined as:
[0070]
[0071] in
[0072]
[0073] The objective function is solved using the Gauss-Newton method to obtain the pose transformation T, that is, the laser radar odometer. When the distance from the carrier position to the previous key frame position is greater than the set distance threshold (obtained from step S2), the current frame is set as the key frame.
[0074] Step S4: Loop detection algorithm based on distance search
[0075] In step S3, the laser radar odometer is obtained. However, during the long-term operation of the carrier, the laser radar odometer will produce cumulative errors. The present invention reduces the cumulative errors produced by the laser radar odometer by adding loop constraints. The specific steps are as follows:
[0076] a) For the latest key frame k i , find the key frame with the closest Euclidean distance in the historical key frames. At the same time, in order to avoid false loops, the distance between key frames should be smaller than the set threshold, and the time interval should be larger than the set threshold.
[0077] b) Assume that the key frame that meets the requirements is k j , search for k j The 30 adjacent key frames are used to project the key frame point cloud into the global coordinate system, and the local map point cloud M is constructed by accumulating the key frame poses. t .
[0078] c) Set key frame k i The corresponding point cloud is projected into the global coordinate system and is consistent with the local map point cloud M t Perform ICP matching. When the point cloud matching score is less than the set threshold, the loop is considered valid and the key frame k is calculated. i and k jThe relative position between .
[0079] Step S5: Backend optimization algorithm based on factor graph
[0080] Step S3 obtains the laser radar odometer, and step S4 detects the loops in the carrier operation process. The present invention uses factor graphs to fuse the laser radar odometer and loop constraints to optimize the poses of all key frames. The factor graph fusion framework is as follows: Figure 3 The present invention selects the poses of all key frames as variables to be optimized:
[0081] χ=[x1,x2,...,x k ,...x n ]
[0082]
[0083] Among them, x k represents the pose of the kth key frame, and Represent the rotation matrix and translation corresponding to the kth key frame respectively. Construct the objective function of factor graph optimization:
[0084]
[0085] in, represents the Mahalanobis distance, ||r p -H p X|| 2 represents the system prior residual, represents the residual error of the LiDAR odometer measurement, represents the loop closure measurement residual, P L represents the covariance matrix of the LiDAR odometry observation noise, P l Represents the covariance matrix of the loop observation noise. The optimal pose of all key frames can be obtained by solving the objective function through the Gauss-Newton method. The point cloud of the key frames is projected into the global coordinate system using the key frame poses and accumulated to construct a point cloud map.
[0086] The laser radar SLAM method of the embodiment of the present invention uses a spatial scale evaluation algorithm to adaptively adjust the voxel filter grid size and the key frame distance threshold according to the spatial scale. The laser radar odometer is obtained by a point cloud matching algorithm based on an improved point-to-surface ICP, and loop detection is achieved through distance search. Finally, the laser radar odometer and loop constraints are fused through a factor graph. The present invention can take into account the positioning accuracy and efficiency of laser radar SLAM in different spatial scale environments.
[0087] Embodiment 3:
[0088] The embodiment of the present invention further provides a multi-scale adaptive laser radar SLAM device, comprising:
[0089] An evaluation module for adaptively adjusting the grid size and keyframe distance threshold of the voxel filter according to the spatial scale;
[0090] The calculation module is used to obtain the lidar odometer based on the grid size of the voxel filter and the key frame distance threshold using the point cloud matching algorithm of the improved point-to-surface ICP, and realize loop detection based on distance search;
[0091] The optimization module is used to optimize all key frame poses by fusing the lidar odometer and loop constraints through factor graphs, and use the optimized key frame poses to project the key frame point cloud into the global coordinate system to obtain a point cloud map.
[0092] As an implementation method of an embodiment of the present invention, the evaluation module evaluates the spatial scale of the environment in which the carrier is located based on the real-time point cloud of the lidar through a spatial scale evaluation algorithm, and adaptively adjusts the voxel filter grid size and the key frame distance threshold according to the spatial scale of the environment.
[0093] As an implementation method of an embodiment of the present invention, the calculation module adaptively adjusts the parameters of the plane fitting according to the laser point distance based on the point-to-plane ICP algorithm; the real-time point cloud after downsampling is matched with the local map point cloud to minimize the point-to-plane distance residual, thereby obtaining a lidar odometer.
[0094] As an implementation method of an embodiment of the present invention, the calculation module searches for a key frame that satisfies a loop relationship in historical key frames for the latest key frame, and calculates the relative pose between frames to achieve loop detection.
[0095] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.
Claims
1. A multi-scale adaptive laser radar SLAM method, characterized in that: The following steps are involved: Step 1: adaptively adjust the grid size and keyframe distance threshold of the voxel filter according to the spatial scale; Step 2: According to the grid size of the voxel filter and the key frame distance threshold, the improved point-to-surface ICP point cloud matching algorithm is used to obtain the lidar odometer, and loop detection is implemented based on distance search; Step 3: Optimize all key frame poses by fusing the lidar odometer and loop constraints through the factor graph, and use the optimized key frame poses to project the key frame point cloud into the global coordinate system to obtain a point cloud map; In step 1, the spatial scale of the environment in which the carrier is located is evaluated according to the real-time point cloud of the lidar through the spatial scale evaluation algorithm, and the voxel filter grid size and the key frame distance threshold are adaptively adjusted according to the spatial scale of the environment; In step 2, in the point-to-plane ICP algorithm, the parameters of the plane fitting are adaptively adjusted according to the laser point distance; the downsampled real-time point cloud is matched with the local map point cloud to minimize the point-to-plane distance residual to obtain the lidar odometer; In step 2, for the latest key frame, find the key frame that satisfies the loop relationship in the historical key frames, and calculate the relative pose between frames to achieve loop detection.
2. A multi-scale adaptive laser radar SLAM device, characterized in that: include: An evaluation module for adaptively adjusting the grid size and keyframe distance threshold of the voxel filter according to the spatial scale; The calculation module is used to obtain the lidar odometer based on the grid size of the voxel filter and the key frame distance threshold using the point cloud matching algorithm of the improved point-to-surface ICP, and realize loop detection based on distance search; The optimization module is used to optimize all key frame poses by fusing the lidar odometer and loop constraints through factor graphs, and use the optimized key frame poses to project the key frame point cloud into the global coordinate system to obtain a point cloud map; The evaluation module uses a spatial scale evaluation algorithm to evaluate the spatial scale of the environment in which the carrier is located based on the real-time point cloud of the lidar, and adaptively adjusts the voxel filter grid size and key frame distance threshold according to the spatial scale of the environment; The calculation module is based on the point-to-plane ICP algorithm, and the parameters of the plane fitting are adaptively adjusted according to the laser point distance. The downsampled real-time point cloud is matched with the local map point cloud to minimize the point-to-plane distance residual to obtain the laser radar odometer. For the latest key frame, the calculation module searches for the key frame that satisfies the loop relationship in the historical key frames, and calculates the relative pose between frames to realize loop detection.
Citation Information
Patent Citations
Tight coupling laser SLAM method and device based on redundant key frame removal
CN117053779A
Multi-machine cooperative online mapping method and system based on laser radar, and terminal equipment
CN117289298A
