Multi-sensor SLAM method based on Multi-Camera/Lidar/IMU
Technical Field
The invention relates to the technical fields of computer vision, robots and the like, in particular to a Multi-sensor SLAM method based on Multi-Camera/Lidar/IMU.
Background
In recent years, the unmanned industry is gradually going into the field of view of the public. SLAM can make the mobile vehicle realize the location under the unable normal environment of working of GPS to track and discern dynamic vehicle and pedestrian in order to realize intelligent obstacle avoidance, auxiliary driving and autonomous navigation provide probably.
In positioning and patterning, SLAM is mainly used to obtain raw data by means of sensors, with the assistance of IMU. In the case of existing developments, SLAM has two implementation forms: one is laser SLAM mainly using laser radar; the other is vision SLAM based on a camera. Laser SLAM is currently mainly used indoors and in a smaller range of environments. The visual SLAM is wide in range and can be more suitable for outdoor environments, but has strong light dependence and cannot work in dark-light or texture-free areas.
With the rapid development of unmanned, in order to adapt to market environment, unmanned use scenes are more and more abundant, and the unmanned is suitable for indoor environment and outdoor environment; the indoor structural environment is ideal; the outdoor illumination has severe variation, more dynamic targets such as vehicles and pedestrians, more repeated and disordered texture scenes and great challenges for unmanned mass production. Therefore, the method of using a single sensor to perform positioning composition cannot meet the construction requirement of a high-precision map in a complex scene.
Therefore, a new scheme is necessary to be provided for fusing various sensor data so as to solve the problem of building an environment map in an outdoor complex environment.
Disclosure of Invention
Aiming at the condition that the existing single sensor cannot meet the outdoor complex environment, the invention provides a Multi-sensor SLAM method based on Multi-camera/Lidar/IMU.
The invention provides a Multi-sensor SLAM method based on Multi-Camera/Lidar/IMU, which comprises the following steps:
s1: carrying out tight coupling joint initialization on a plurality of pieces of image data obtained by the multi-view camera and data obtained by the IMU inertial measurement unit to obtain an initial pose of the system;
s2, acquiring point cloud data of a laser radar frame by a laser radar sensor, preprocessing the point cloud data, and dividing the point cloud into strong angular points, weak angular points, jiang Ping plane points and weak plane points;
s3, optimizing the frame pose of the laser radar through the initial pose of the system;
s4: the frame pose of the laser radar is further optimized through closed loop detection;
s5: and performing map splicing by using the optimized laser radar frame pose.
Preferably, obtaining the initialization pose of the system comprises the following steps:
s11: performing hard synchronous triggering of the multi-camera through the raspberry group;
s12: obtaining multi-eye image and IMU data from a multi-eye camera, and aligning the multi-eye image data with the IMU data through a time stamp;
s13: multithreading is used for tracking visual characteristics of the multi-view images, and the tracked results are stored;
s14: preprocessing the multi-view image data and IMU data;
s15: carrying out joint initialization on the multi-view image data and the IMU data, respectively carrying out tight coupling processing on the multi-view image information obtained by the multi-view camera and the IMU data, and carrying out tight coupling processing on the processed data and the IMU data again to obtain a multi-view tight coupling visual inertial odometer;
s16: optimizing the multi-purpose tightly-coupled visual inertial odometer and performing marginalization treatment at the same time;
s17: and obtaining the optimized multi-vision inertial odometer, obtaining the initialized pose of the system and preparing for the next step.
Preferably, the multithreading performs visual feature tracking of the multi-view image, and mainly uses an optical flow tracking method in OpenCV.
Preferably, preprocessing the multi-view image data and IMU data includes the steps of:
s141: firstly, IMU data between two adjacent frames are taken out, system initialization pose estimation is carried out, and an initial yaw angle is set to be zero;
s142: pre-integrating IMU data among frames mainly in IMU data preprocessing, and simultaneously estimating a Jacobian matrix of a state variable of the integrated measurement variance and the pre-integrated value;
s143: preprocessing the multi-view image data: firstly, judging a key frame, judging whether to press the feature into a feature linked list according to the ID of the feature point, judging whether to set the frame as the key frame according to the average parallax of the front frame and the rear frame, and determining the optimized position of the rear sliding window.
Preferably, the step of optimizing the multi-objective close-coupled visual odometer comprises:
s161, based on the rear end optimization of a sliding window, optimizing state quantity by using an open-source optimization library Ceres, constructing a cost function by calculating the reprojection error of an image and IMU measurement residual error, and optimizing by using a nonlinear overall least squares method;
s162: and (3) marginalizing, namely determining a data frame in the marginalized sliding window according to whether the current frame is a key frame or not.
Preferably, the method for preprocessing the laser radar point cloud data comprises the following steps:
s21: receiving original 16-line point cloud data of a laser radar sensor;
s22: calculating a scanning start angle and a scanning end angle of each Scan, calculating a vertical angle and a line number of each point, and a horizontal angle and a column number of each point according to coordinate values of each point, and storing the vertical angle and the line number into a complete Scan;
s23: calculating the flatness between two adjacent upper and lower points according to the coordinates of the same column, so as to determine whether the point is a ground point;
s24: releasing the point cloud after segmentation and segmentation information;
s25: calculating the curvature of each point according to the segmented point cloud;
s26: and sorting the point clouds of each line by using curvature, dividing the point clouds into strong angular points, weak angular points, jiang Ping plane points and weak plane points according to the value of the curvature, and issuing.
Preferably, the step of optimizing the frame pose of the laser radar through the initial pose of the system comprises the following steps:
s31: receiving the optimized visual inertial odometer, the pose of a key frame, the preprocessed point cloud data and the IMU data, and storing the data into corresponding queues;
s32: aligning each data frame through each data time stamp, constructing a closed-loop detection key frame, processing the segmented point cloud data, aligning the data, changing a coordinate system, converting the coordinate system of the laser radar into a coordinate system of a plurality of cameras, and storing the coordinate system into a corresponding queuing container; meanwhile, index of a key frame is pressed in the opposite column of the laser radar data;
s33: and processing the laser radar frame data to obtain the pose of the optimized laser radar frame.
Preferably, the step of processing the lidar frame data includes:
s331: taking out the index of the key frame, and initializing the gesture of the key frame of the first frame, namely setting the Euler angles of the gesture to be zero;
s332: when the index is larger than 1, a previous frame of the current frame is taken out, and corresponding laser radar frame data and IMU frame data are obtained between time stamps of the current frame and the previous frame;
s333: acquiring the pose of a visual inertial odometer of a previous frame;
s334: only one frame of laser radar data participates in constructing a cloud map between the time stamps of the current frame and the previous frame, and because the time interval exists between the laser radar frame and the current frame, the pose is different, the IMU frame data is utilized for pushing the position, and the point cloud is converted into a world coordinate system by utilizing the more accurate pose obtained by pushing the position;
s335: and further optimizing the frame pose of the laser radar obtained by the position pushing.
Preferably, the method for further optimizing the pose of the laser radar frame comprises the following steps:
s3351: converting the point cloud data under the world coordinate system into the coordinate system of the previous frame, and simultaneously storing the point cloud data into a point cloud container;
s3352: when the capacity of the point cloud container is larger than 1, the point cloud of the laser radar of the current frame is taken out, meanwhile, the visual inertial odometer pose of the current frame is taken out, the pose is primarily corrected, and a relatively accurate initial value is provided for optimizing the follow-up current frame to the local map;
s3353: constructing a local map by utilizing point cloud data of 20 frames adjacent to the current frame;
s3354: and optimizing the current frame to the local map, constructing a cost function of the minimum distance between the points by utilizing two types of points in the current frame and the local map according to the corner points and the face points obtained by preprocessing the point cloud data of the laser radar frame, and performing Gaussian Newton iterative optimization to obtain the pose of the laser radar frame after optimization.
Preferably, the step of further optimizing the laser radar frame pose by closed loop detection includes:
s41: and detecting a closed-loop candidate frame which is more similar to the current frame by using a DBoW visual dictionary, calculating pose transformation from the current frame to the closed-loop candidate frame by using a RANSAC algorithm, simultaneously calculating a common view point between the two, and storing closed-loop information for closed-loop optimization when the number of the common view points is larger than a threshold value.
And S42, for the detected closed-loop information, performing pose adjustment in a pose chart optimization mode, and updating the optimized pose into the laser radar pose.
The beneficial effects of the invention are as follows:
the multi-view camera can obtain a plurality of pieces of image data, the image data are respectively and tightly coupled with the IMU data to obtain initial pose of a plurality of systems, then the initial pose of each system and the IMU data are tightly coupled again to obtain an initial pose of a more accurate system, the pose of a laser Lei Zhen frame is optimized by using the initial pose to obtain a pose of a more accurate laser radar frame, finally the pose of the laser radar frame is further optimized by using closed loop detection to obtain a final laser radar frame pose, and a high-precision map is constructed by using the pose of the laser radar frame; according to the invention, the data obtained by the three sensors are fused, so that the frame pose of the laser radar is more accurate, and the robustness and stability of a positioning system are effectively improved.
Drawings
FIG. 1 is a flow chart of a Multi-sensor SLAM method based on Multi-Camera/Lidar/IMU;
Detailed Description
The present invention will be described in detail below with reference to the specific embodiments shown in the drawings, but these embodiments are not limited to the present invention, and structural, method, or functional modifications made by those skilled in the art based on these embodiments are included in the scope of the present invention.
As shown in fig. 1, a Multi-sensor SLAM method based on Multi-Camera/Lidar/IMU includes the steps of:
s1: carrying out tight coupling joint initialization on a plurality of pieces of image data obtained by the multi-view camera and data obtained by the IMU inertial measurement unit to obtain an initial pose of the system;
the method for obtaining the system initialization pose comprises the following steps:
s11: performing hard synchronous triggering of the multi-camera through the raspberry group;
s12: obtaining multi-eye image data and IMU data from a multi-eye camera, and aligning the multi-eye image data and the IMU data through a time stamp;
in a specific embodiment, a plurality of cameras are arranged on the front, the back, the left and the right of the system, binocular cameras are arranged on the front, the back and the two sides, and monocular cameras are arranged on the left and the right sides; six pieces of different position image information can be obtained simultaneously when the system shoots, and surrounding environments can be shot in an omnibearing manner.
S13: the multithreading is used for visual feature tracking of the multi-view images, and an optical flow tracking method in OpenCV is mainly used.
S14: preprocessing the multi-view image data and IMU data;
preprocessing the multi-view image data and IMU data comprises the following steps:
s141: firstly, IMU data between two adjacent frames are taken out, system initialization pose estimation is carried out, and an initial yaw angle is set to be zero;
s142: pre-integrating IMU data among frames mainly in IMU data preprocessing, and simultaneously estimating a Jacobian matrix of a state variable of the integrated measurement variance and the pre-integrated value;
s143: preprocessing a multi-view image: firstly, judging a key frame, judging whether to press the feature into a feature linked list according to the ID of the feature point, judging whether to set the frame as the key frame according to the average parallax of the front frame and the rear frame, and determining the optimized position of the rear sliding window.
Because the IMU visual inertial measurement unit and the multi-camera acquire different types of signals and have large differences in sampling rates, the IMU data generally needs to be integrated between two frames of images in order to synchronize the data of the two. And simultaneously estimating the Jacobian matrix of the integrated measurement variance and the pre-integrated value to the state variable.
S15: carrying out joint initialization on the multi-view image and the IMU data, carrying out tight coupling processing on a plurality of pieces of image information obtained by the multi-view camera and the IMU data respectively, and carrying out tight coupling processing on the processed data and the IMU data again to obtain a multi-view tight coupling visual inertial odometer;
s16: optimizing the multi-purpose tightly-coupled visual inertial odometer and performing marginalization treatment at the same time;
based on the back-end optimization of the sliding window, optimizing the state quantity by using an open-source optimization library Ceres, constructing a cost function by calculating the reprojection error of the image and the IMU measurement residual error, and optimizing by using a nonlinear overall least squares method; the marginalizing process determines the data frames within the marginalized sliding window based on whether the current frame is a key frame.
S17: and obtaining the optimized multi-vision inertial odometer, obtaining the initialized pose of the system and preparing for the next step.
S2, acquiring point cloud data of a laser radar frame by a laser radar sensor, preprocessing the point cloud data, and dividing the point cloud into strong angular points, weak angular points, jiang Ping planar points and weak planar points;
the method for preprocessing the laser radar point cloud data comprises the following steps:
s21: receiving original 16-line point cloud data of a laser radar sensor;
s22: calculating a scanning start angle and a scanning end angle of each Scan, calculating a vertical angle and a line number of each point, and a horizontal angle and a column number of each point according to coordinate values of each point, and storing the vertical angle and the line number into a complete Scan;
s23: calculating the flatness between two adjacent upper and lower points according to the coordinates of the same column, so as to determine whether the point is a ground point;
s24: releasing the point cloud after segmentation and segmentation information;
s25: calculating the curvature of each point according to the segmented point cloud;
s26: and sorting the point clouds of each line by using curvature, dividing the point clouds into strong angular points, weak angular points, jiang Ping plane points and weak plane points according to the value of the curvature, and issuing.
S3, optimizing the frame pose of the laser radar through the initial pose of the system;
s31: receiving the optimized visual inertial odometer, the pose of a key frame, the preprocessed point cloud data and the IMU data, and storing the data into corresponding queues;
s32: aligning each data frame through each data time stamp, constructing a closed loop detection frame, processing the segmented point cloud data, aligning the data, changing a coordinate system, converting the coordinate system of the laser radar into a coordinate system of a plurality of cameras, and storing the coordinate system into a corresponding queuing container; meanwhile, pressing in the index of the key frame in the column of the laser radar data;
s33: and processing the laser radar frame data to obtain the pose of the optimized laser radar frame.
The step of processing the laser radar frame data comprises the following steps:
s331: taking out the index of the key frame, and initializing the gesture of the key frame of the first close frame, namely setting the Euler angles of the gesture to be zero;
s332: when the index is larger than 1, a previous frame of the current frame is taken out, and corresponding laser radar frame and IMU frame data are acquired between time stamps of the current frame and the previous frame;
s333: acquiring the pose of a visual inertial odometer of a previous frame;
s334: only one frame of laser radar data participates in constructing a cloud map between the time stamps of the current frame and the previous frame, and because the time interval exists between the laser radar frame and the current frame, the pose is different, the IMU frame data is utilized for pushing the position, and the point cloud is converted into a world coordinate system by utilizing the more accurate pose obtained by pushing the position;
s335: and further optimizing the frame pose of the laser radar obtained by the position pushing.
The method for further optimizing the pose of the laser radar frame comprises the following steps:
s3351: converting the point cloud data under the world coordinate system into the coordinate system of the previous frame, and simultaneously storing the point cloud data into a point cloud container;
s3352: when the capacity of the point cloud container is larger than 1, the point cloud of the laser radar of the current frame is taken out, meanwhile, the position and the posture of the visual inertial odometer of the current frame are corrected preliminarily, and a relatively accurate initial value is provided for optimizing the follow-up current frame to the local map;
s3353: constructing a local map by utilizing point cloud data of 20 frames adjacent to the current frame;
s3354: and optimizing the current frame to the local map, constructing a cost function of the minimum distance between the points by utilizing two types of points in the current frame and the local map according to the corner points and the face points obtained by preprocessing the point cloud data of the laser radar frame, and performing Gaussian Newton iterative optimization to obtain the pose of the laser radar frame after optimization.
S4: the frame pose of the laser radar is further optimized through closed loop detection;
the step of further optimizing the frame pose of the laser radar comprises the following steps:
s41: detecting a closed-loop candidate frame which is similar to the current frame by using a DBoW visual dictionary, calculating pose transformation from the current frame to the closed-loop candidate frame by using a RANSAC algorithm, and simultaneously calculating a common view point between the two, and storing closed-loop information for closed-loop optimization when the number of the common view points is larger than a threshold value;
and S42, for the detected closed-loop information, performing pose adjustment in a pose chart optimization mode, and updating the optimized pose into the laser radar pose.
S5: and performing map splicing by using the optimized laser radar frame pose.
The multi-view camera can obtain a plurality of pieces of image data, the image data are respectively and tightly coupled with the IMU data to obtain initial pose of a plurality of systems, then the initial pose of each system and the IMU data are tightly coupled again to obtain an initial pose of a more accurate system, the pose of a laser Lei Zhen frame is optimized by using the initial pose to obtain a pose of a more accurate laser radar frame, finally the pose of the laser radar frame is further optimized by using closed loop detection to obtain a final laser radar frame pose, and a high-precision map is constructed by using the pose of the laser radar frame; according to the invention, the data obtained by the three sensors are fused, so that the frame pose of the laser radar is more accurate, and the robustness and stability of a positioning system are effectively improved.
Although the preferred embodiments of the present invention have been disclosed for illustrative purposes, those skilled in the art will appreciate that various modifications, additions and substitutions are possible, without departing from the scope and spirit of the invention as disclosed in the accompanying claims.