A robot map construction method, robot positioning method and device
By collecting images and IMU data in real time, determining key frames and performing closed-loop detection and sliding window optimization, the problem of balancing mapping and positioning in AMR is solved, a high-precision globally consistent map is constructed, and the accuracy of robot positioning is improved.
Patent Information
- Application Number
- CN202010427965.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-20
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-05-20
AI Technical Summary
It is difficult for the existing technology to take into account the needs of the two stages of mapping and positioning in autonomous mobile robots (AMR), and it is impossible to build a high-precision and globally consistent map.
By synchronously collecting image data and inertial measurement unit (IMU) data in real time, we determine the key frame data, including pose information and feature point data, perform closed-loop detection and sliding window optimization processing, build a high-precision map, and conduct pose and pose measurements in the subsequent positioning process. Graph optimization processing.
It achieves high-precision, globally consistent map construction, provides an effective global map for robot positioning, eliminates cumulative errors, and improves map accuracy and positioning accuracy.
Smart Images

Figure CN113701766B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of robot technology, and in particular to a method for constructing a robot map, and a method and device for positioning a robot. Background Art
[0002] With the increasing demand for manufacturing flexibility, shortened and accelerated product cycles, rising labor costs, and the increasing demand for human safety trends, the global mobile robot market is developing rapidly, and the technical requirements are getting higher and higher. For example, Automated Guided Vehicles (AGV) have been widely used in automated warehouses, factory material transmission systems, logistics picking systems, flexible assembly systems and other intelligent transportation sites. Compared with AGVs based on magnetic strips, reflectors, QR codes, etc., autonomous mobile robots (AMRs) are more technically difficult and have wider application scenarios. The core technology of AMR navigation is SLAM (Simultaneous Localization and Mapping), which enables the robot to know the environmental map and its real-time location. This is the basis for efficient and intelligent mobile arrival at the target without human intervention throughout the process.
[0003] In practical applications, AMR may include a mapping phase, in which the main consideration is to use as much information as possible to build a high-precision and globally consistent map, while the real-time positioning, real-time positioning accuracy and frequency can be ignored.
[0004] Therefore, how to construct a map with high precision and global consistency is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0005] The embodiments of the present invention provide a method for constructing a robot map, a method and a device for positioning a robot, so as to construct a map with high precision and global consistency.
[0006] In a first aspect, an embodiment of the present invention provides a method for constructing a robot map, comprising:
[0007] According to the image data and the inertial measurement unit IMU data collected by the robot in real time and synchronously, the key frame data is determined according to the preset key frame data determination rule; wherein the key frame data includes: the posture information of the key frame, and the feature point data in the image corresponding to the key frame, and the feature point is a corner point in the image, and a corner point that matches the corner point in an adjacent frame image;
[0008] Determine, according to the key frame data, a closed-loop key frame corresponding to the key frame, and a closed-loop feature point pair; wherein the closed-loop feature point pair includes: a first feature point located in an image corresponding to the key frame, and a second feature point located in an image corresponding to the closed-loop key frame, and the image information described by the first feature point matches the image information described by the second feature point;
[0009] When it is determined that the key frame and the corresponding closed-loop key frame meet the preset closed-loop condition, a map for representing the environment of the robot is obtained after performing a first bundle adjustment BA optimization process on the feature point data corresponding to all the key frames, the closed-loop feature point pairs, and the IMU data pairs;
[0010] Among them, when determining the matching status of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between the two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, the key frame is determined according to the number of sliding window optimization processing and the reprojection error of the feature point, and the posture information of the key frame and the feature point data in the image corresponding to the key frame are determined; the state increment information includes: position increment information, angle increment information and speed increment information.
[0011] Optionally, in an embodiment of the present invention, the closed-loop condition includes:
[0012] When determining the forward PNP relative posture and the backward PNP relative posture between the key frame and the corresponding closed-loop key frame according to the closed-loop feature point pair and the preset PNP algorithm, the difference between the forward PNP relative posture and the backward PNP relative posture is less than a preset first threshold;
[0013] Wherein, the forward PNP relative posture includes:
[0014] The relative posture between the three-dimensional position information of the second feature point in the image corresponding to the closed-loop key frame and the two-dimensional position information of the first feature point corresponding to the image corresponding to the key frame;
[0015] The backward PNP relative posture includes:
[0016] The relative posture between the three-dimensional position information of the first feature point in the image corresponding to any of the key frames and the two-dimensional position information of the corresponding second feature point in the image corresponding to the closed-loop key frame.
[0017] Optionally, in the embodiment of the present invention, when it is determined that the key frame and the corresponding closed-loop key frame do not satisfy the closed-loop condition, the method further includes:
[0018] After performing the first BA optimization processing on the feature point data corresponding to the key frame and the IMU data, the map is obtained.
[0019] Optionally, in the embodiment of the present invention, performing the first BA optimization processing on the feature point data corresponding to the key frame and the IMU data pair specifically includes:
[0020] According to the following formula, the first BA optimization process is performed on the feature point data corresponding to the key frame and the IMU data pair:
[0021]
[0022] Wherein, k represents the kth key frame, B represents a list of key frames for which pre-integration has been performed when determining the state increment information, Represents the observed value of the feature point on the collected left image, represents the observed value of the feature point on the right image collected, j represents the jth key frame, P l represents the coordinates of feature point l in the world coordinate system, represents the pre-integration result of the IMU data when determining the state increment information, χ represents the state of the sliding window to be optimized, Represents the Jacobian matrix corresponding to the state increment information, represents the variance matrix of the left image, represents the variance matrix of the right image, represents the residual of the IMU data, represents the residual of the left eye image in the image corresponding to the key frame, Represents the residual of the right eye image in the image corresponding to the key frame.
[0023] Optionally, in an embodiment of the present invention, performing a first bundle adjustment BA optimization process on the feature point data corresponding to all the key frames, the closed-loop feature point pairs, and the IMU data pairs specifically includes:
[0024] According to the following formula, the first bundle adjustment BA optimization processing is performed on the feature point data corresponding to all the key frames, the closed-loop feature point pairs, and the IMU data pairs:
[0025]
[0026] Wherein, k represents the kth key frame, B represents a list of key frames for which pre-integration has been performed when determining the state increment information, Represents the observed value of the feature point on the collected left image, represents the observed value of the feature point on the right image collected, j represents the jth key frame, P l represents the coordinates of feature point l in the world coordinate system, represents the pre-integration result of the IMU data when determining the state increment information, χ represents the state of the sliding window that needs to be optimized, Represents the Jacobian matrix corresponding to the state increment information, represents the variance matrix of the left image, Represents the variance matrix of the right image, C loopL Represents the list of left-eye closed-loop frame images that accept closed-loop, C loopR Represents a list of right-eye closed-loop frame images that accept closed-loop. represents the residual of the IMU data, represents the residual of the left eye image in the image corresponding to the key frame, represents the residual of the right eye image in the image corresponding to the key frame, represents the residual of the left eye image in the image of the closed-loop frame corresponding to the key frame, Represents the residual of the right eye image in the image of the closed-loop frame corresponding to the key frame.
[0027] Optionally, in the embodiment of the present invention, determining a closed-loop key frame and a closed-loop feature point pair corresponding to any key frame according to the key frame data specifically includes:
[0028] Extracting feature point data and descriptor data from the key frame and constructing a bag-of-words data set;
[0029] According to the bag-of-words data set, the similarity between the first key frame and each second key frame is calculated, and the second key frame corresponding to the similarity greater than a preset second threshold is determined as the closed-loop key frame corresponding to the first key frame; wherein the first key frame is: any of the key frames, and the second key frame is: the key frame in all the key frames except the first key frame;
[0030] According to the bag-of-words data set, determine the feature point pairs that match the feature points of the image corresponding to the first key frame and the feature points of the image corresponding to the closed-loop key frame, calculate the Hamming distance between the matched feature point pairs, and determine the matched feature point pairs whose Hamming distance is less than a preset third threshold as the closed-loop feature point pairs.
[0031] Optionally, in the embodiment of the present invention, the sliding window optimization process specifically includes:
[0032] According to the determined matching status of the corner points in each frame of the image and the state increment information between two consecutive frames of the image, the N+1 frame of the image and the IMU data corresponding to the N+1 frame of the image are subjected to the second BA optimization processing to determine the pose information of the N+1 frame of the image and the coordinate information of the corner points in the N+1 frame of the image; N is an integer greater than 0;
[0033] When it is determined that the N+1th frame image needs to be input into a preset sliding window according to the posture information of the N+1 frame image and the coordinate information of the corner points in the N+1 frame image, the i-th frame image with the earliest acquisition time in the current sliding window is determined as a pending frame image and is removed from the sliding window; wherein the sliding window includes N frame images, and i is an integer greater than 0;
[0034] Determining the key frame according to the number of times the sliding window optimization process is performed and the reprojection error of the feature point specifically includes:
[0035] The pending frame corresponding to the sliding window optimization processing being performed for a number of times not less than a first preset value and the reprojection error of the feature point included therein being not greater than a second preset value is determined as the key frame.
[0036] Optionally, in an embodiment of the present invention, according to the determined matching status of the corner points in each frame of the image and the state increment information between two consecutive frames of the image, the second BA optimization processing is performed on the N+1 frame of the image and the IMU data corresponding to the N+1 frame of the image, specifically including:
[0037] The following formula is used to perform the second BA optimization processing on the N+1 frame image and the IMU data corresponding to the N+1 frame image according to the determined matching of the corner points in each frame image and the state increment information between two consecutive frames of images:
[0038]
[0039] in, represents the residual of the IMU data, represents the residual of the image data, represents the pre-integration result of the IMU data when determining the state increment information, represents the image data, Represents the Jacobian matrix corresponding to the state increment information, represents the variance matrix corresponding to the state increment information, χ represents the state of the sliding window to be optimized, r p -H pχ represents the marginalized prior residual of the pending frame, k represents the kth frame, B represents the list of images that have been pre-integrated when determining the state increment information, l represents feature point l, j represents the jth frame, and C represents the list of the acquired images.
[0040] In a second aspect, an embodiment of the present invention provides a robot positioning method, comprising:
[0041] Obtaining a pre-constructed map, wherein the map is constructed using the construction method provided in the embodiment of the present invention;
[0042] According to the image data and the inertial measurement unit IMU data collected by the robot in real time and synchronously, the key frame data is determined according to the preset key frame data determination rule; wherein the key frame data includes: the posture information of the key frame, and the feature point data in the image corresponding to the key frame, and the feature point is a corner point in the image, and a corner point that matches the corner point in an adjacent frame image;
[0043] Determine a closed-loop key frame corresponding to any key frame according to the map and the key frame data;
[0044] When it is determined that the key frame and the corresponding closed-loop key frame meet a preset closed-loop condition, the robot is positioned after performing pose graph optimization processing on the closed-loop key frame;
[0045] Among them, when determining the matching status of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, the posture information of the key frame and the feature point data in the image corresponding to the key frame are determined; the state increment information includes: position increment information, angle increment information and speed increment information.
[0046] Optionally, in an embodiment of the present invention, the closed-loop condition includes:
[0047] If the image corresponding to the closed-loop key frame is one of the frames of the image for constructing the map, when a first PNP relative posture between the key frame and the corresponding closed-loop key frame is determined according to the closed-loop feature point pair and a preset PNP algorithm, the first PNP relative posture is less than a preset fourth threshold;
[0048] Or, if the image corresponding to the closed-loop key frame is an image collected by the robot after acquiring the map, when a second PNP relative posture between the key frame and the corresponding closed-loop key frame is determined based on the closed-loop feature point pair and the PNP algorithm, the second PNP relative posture is less than a preset fifth threshold.
[0049] Optionally, in an embodiment of the present invention, performing pose graph optimization processing on the closed-loop key frame specifically includes:
[0050] The following formula is used to optimize the pose graph of all the determined closed-loop key frames:
[0051]
[0052] Among them, S represents the key frame list with sliding window constraint, L represents the key frame list with closed loop constraint, i represents the i-th key frame, j represents the j-th key frame, r i,j represents the residual between the i-th key frame and the j-th key frame, ρ(.) represents the robust kernel function, P represents the pose of all the optimized key frames, and ψ represents the angle information of all the optimized key frames.
[0053] In a third aspect, an embodiment of the present invention provides a device for constructing a robot map, comprising:
[0054] The first unit is used to determine key frame data according to the image data and inertial measurement unit IMU data collected by the robot in real time and synchronously according to a preset key frame data determination rule; wherein the key frame data includes: posture information of the key frame, and feature point data in the image corresponding to the key frame, wherein the feature point is a corner point in the image and matches a corner point in an adjacent frame of the image;
[0055] A second unit is used to determine, according to the key frame data, a closed-loop key frame corresponding to the key frame, and a closed-loop feature point pair; wherein the closed-loop feature point pair includes: a first feature point located in an image corresponding to the key frame, and a second feature point located in an image corresponding to the closed-loop key frame, and the image information described by the first feature point and the second feature point matches;
[0056] A third unit is used for performing a first bundle adjustment BA optimization process on the feature point data corresponding to all the key frames, the closed-loop feature point pairs, and the IMU data pairs when it is determined that the key frame and the corresponding closed-loop key frame meet a preset closed-loop condition, so as to obtain a map for representing the environment in which the robot is located;
[0057] Among them, when determining the matching status of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between the two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, the key frame is determined according to the number of sliding window optimization processing and the reprojection error of the feature point, and the posture information of the key frame and the feature point data in the image corresponding to the key frame are determined; the state increment information includes: position increment information, angle increment information and speed increment information.
[0058] In a fourth aspect, an embodiment of the present invention provides a positioning device for a robot, comprising:
[0059] The first unit is used to obtain a pre-built map, where the map is built using the above-mentioned construction method provided in the embodiment of the present invention;
[0060] The second unit is used to determine key frame data according to the image data and inertial measurement unit IMU data collected by the robot in real time and synchronously according to a preset key frame data determination rule; wherein the key frame data includes: posture information of the key frame, and feature point data in the image corresponding to the key frame, wherein the feature point is a corner point in the image and matches a corner point in an adjacent frame of image;
[0061] A third unit is used to determine a closed-loop key frame corresponding to any key frame according to the map and the key frame data;
[0062] A fourth unit is used for positioning the robot after performing pose graph optimization processing on the closed-loop key frame when it is determined that the key frame and the corresponding closed-loop key frame meet a preset closed-loop condition;
[0063] Among them, when determining the matching status of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, the posture information of the key frame and the feature point data in the image corresponding to the key frame are determined; the state increment information includes: position increment information, angle increment information and speed increment information.
[0064] In a fifth aspect, an embodiment of the present invention provides a robot, comprising: the above-mentioned construction device provided by the embodiment of the present invention, the above-mentioned positioning device provided by the embodiment of the present invention, and an image acquisition device;
[0065] Wherein, the image acquisition device is used for:
[0066] An image representing the environment in which the robot is located is acquired in real time, and the acquired image is sent to the construction device and the positioning device, so that the construction device constructs a map according to the acquired image, and the positioning device performs positioning according to the acquired image and the constructed map.
[0067] The beneficial effects of the present invention are as follows:
[0068] The embodiments of the present invention provide a method for constructing a robot map, a method for positioning a robot and a device. When determining key frame data, the matching of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between two consecutive frames of the collected image can be determined, and after each frame of the image is subjected to sliding window optimization processing, the key frame is determined according to the number of sliding window optimization processing and the reprojection error of the feature point, and the position information of the key frame and the feature point data in the image corresponding to the key frame are determined, so that the closed-loop key frame and the closed-loop feature point pair corresponding to any key frame can be determined according to the key frame data, and then the feature point data, the closed-loop feature point pair and the IMU data corresponding to the key frame can be subjected to the first BA optimization processing to obtain a map for representing the environment in which the robot is located; in this way, the obtained map is more in line with the actual situation, so that a high-precision and globally consistent map can be generated, providing an effective global map for the positioning of the robot in the later stage. Furthermore, by determining the closed-loop keyframes and closed-loop feature point pairs, that is, performing the closed-loop detection process, the feature points can be associated through closed-loop detection, and the reprojection errors of the closed-loop points can be constructed, thereby effectively eliminating the accumulated errors and making the constructed map more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 A flowchart of a method for constructing a robot map provided in an embodiment of the present invention;
[0070] Figure 2 A flowchart of another method for constructing a robot map provided in an embodiment of the present invention;
[0071] Figure 3 A flowchart of a robot positioning method provided in an embodiment of the present invention;
[0072] Figure 4 A schematic diagram of the structure of a robot map construction device provided in an embodiment of the present invention;
[0073] Figure 5 A schematic diagram of the structure of a positioning device of a robot provided in an embodiment of the present invention;
[0074] Figure 6 The figure is a schematic diagram of the structure of a robot provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0075] The following will be combined with the accompanying drawings to describe in detail the specific implementation of a robot map construction method, a robot positioning method and a device provided by an embodiment of the present invention. It should be noted that 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 making creative work are within the scope of protection of the present invention.
[0076] The inventors found in their research that currently, the main SLAM technologies include: laser SLAM and visual SLAM. Among them, laser SLAM is relatively mature and widely used. Compared with laser SLAM, the advantages of visual SLAM are mainly reflected in two aspects: on the one hand, the camera cost is much lower than that of laser sensors; on the other hand, compared with 2D laser SLAM, visual SLAM can obtain 6DOF posture, so the relatively low-cost visual SLAM technology has been rapidly developed in AMR.
[0077] In practical applications, AMR mainly includes the mapping stage and the positioning stage (or it can also be called the map reuse stage). The goals of these two stages are different, and thus the requirements for visual SLAM technology are different. Among them, in the mapping stage, the main consideration is to use as much information as possible to build a high-precision and globally consistent map, while the real-time positioning, real-time positioning accuracy and frequency can be ignored; in the positioning stage, AMR mainly considers obtaining real-time, high-precision and high-frequency global positioning accuracy after loading the offline global map, and generally does not need to rebuild the high-precision map, and the posture of the past moment in the current trajectory can also be ignored.
[0078] However, when visual SLAM technology is currently applied to AMRs, it is unable to take into account the requirements of both mapping and positioning stages, making it impossible to effectively control AMRs.
[0079] Based on this, an embodiment of the present invention provides a robot map construction method and a positioning method for constructing a map with high precision and global consistency. In the subsequent robot positioning process, when using visual SLAM technology, the needs of both the mapping and positioning stages can be taken into account.
[0080] Specifically, an embodiment of the present invention provides a method for constructing a robot map, such as Figure 1 As shown, it may include:
[0081] S101, determining key frame data according to the image data and inertial measurement unit IMU data collected by the robot in real time and synchronously according to the preset key frame data determination rules; wherein the key frame data includes: posture information of the key frame, and feature point data in the image corresponding to the key frame, the feature point is a corner point in the image, and a corner point that matches a corner point in an adjacent frame of the image;
[0082] Among them, the key frame data determination rules include: when determining the matching of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between the two consecutive frames of the collected image, and after each frame of the image is subjected to sliding window optimization processing, the key frame is determined according to the number of sliding window optimization processing and the reprojection error of the feature points, and the posture information of the key frame and the feature point data in the image corresponding to the key frame are determined; the state increment information includes: position increment information, angle increment information and speed increment information.
[0083] Specifically, when determining the key frame data, the following process may be used:
[0084] Process 1: Obtain image data and IMU data collected by the robot in real time;
[0085] Among them, the image data can be understood as multiple frames of images, the IMU data is also frame by frame, and one frame of IMU data can be understood as: IMU data corresponding to one frame of image.
[0086] And, if Figure 2 As shown, each frame of the collected image may include a left eye image (such as Figure 2 The "left image" in Figure 2 The left-eye image and the right-eye image in one frame of image have the same timestamp information.
[0087] Process 2: According to the matching of the corner points in the left eye image and the right eye image included in each frame of the collected image, the feature point matching information in each frame of the image is determined;
[0088] The feature point matching information may include: the number of the feature point and the position information of the feature point.
[0089] When determining the feature point matching information in each frame of the image, the following steps can be used:
[0090] Step 2.1: Figure 2 As shown, feature point matching is performed on the left eye image in each frame image and the left eye image in the adjacent previous frame image (such as Figure 2 ), and feature point matching processing of the right eye image in each frame image and the right eye image in the adjacent previous frame image (such as Figure 2 , obtain the feature points in the left image of each frame and the feature points in the right image of each frame;
[0091] Step 2.2, performing feature point supplementation processing on the left image or the right image;
[0092] To illustrate, the purpose of executing step 2.2 is to:
[0093] Taking the left eye image as an example, for the i-th frame image, before executing the above step 2.1, it is assumed that there are 150 corner points in the left eye image in the i-th frame image, and after executing the above step 2.1, it is assumed that there are 100 feature points in the left eye image in the i-th frame image;
[0094] Then, for the i+1th frame image, if the left eye image in the i-th frame image with 100 feature points is matched with the left eye image in the i+1th frame image for feature point matching, after executing the above step 2.1, the number of feature points in the left eye image in the i+1th frame image determined is likely to be less than 100, assuming it is 50. Then for the i+2th frame image, after the feature point matching process, the number of feature points in the left eye image in the i+2th frame image determined will be even smaller, that is, less than 50. In this cycle, in the subsequently acquired images, the number of determined feature points will be smaller, and as the number of acquired images increases, the number of determined feature points may be zero. Obviously, this is inconsistent with the actual situation.
[0095] Therefore, in order to avoid the above situation, it is necessary to execute step 2.2, that is, to supplement the feature points. That is, based on the determination that the number of feature points in the left eye image in the i-th frame image is 100, the feature points in the left eye image in the i-th frame image after executing the above step 2.1 can be supplemented. Assuming that 50 feature points can be supplemented, that is, supplemented to 150, to ensure that a sufficient number of feature points can be determined in the subsequently acquired images.
[0096] Among them, the supplementary feature points can be re-extracted from the left eye image in the i-th frame image after executing the above step 2.1, and the extraction process can adopt existing technology as long as the feature points can be extracted. The extraction process is not limited here.
[0097] Step 2.3, if Figure 2 As shown, feature point matching is performed on the left and right images of each frame of image after executing the above steps 2.1 and 2.2 (such as Figure 2 The matching relationship between the feature points in the left and right images of each frame is obtained;
[0098] Step 2.4: According to the obtained matching relationship, the matching information of the feature points in each frame image is determined and output to the sliding window.
[0099] Process 3: Determine the state increment information between two consecutive frames of images acquired;
[0100] The state increment information includes: position increment information, angle increment information and speed increment information.
[0101] To clarify, the state increment information represents the relationship between two frames of images, not the relationship between two frames of IMU data.
[0102] Optionally, when specifically executing process 3, the following steps may be specifically adopted:
[0103] Step 3.1: Determine the inertial measurement unit (IMU) data between two consecutive frames of images (e.g. Figure 2 ) and store it in the preset cache list;
[0104] Step 3.2, align the integration start time and end time of the IMU data with the time information of a corresponding frame of image;
[0105] Step 3.3: According to the median method, the aligned IMU data is iteratively integrated (e.g. Figure 2 "IMU pre-integration" in the image processing module) to obtain the state increment information between two consecutive frames of images;
[0106] Step 3.4: According to the determined state increment information, determine the corresponding Jacobian matrix and variance matrix, and output them to the sliding window.
[0107] Specifically, the specific implementation process of the above steps 3.1 to 3.4 can be referred to the prior art and is not specifically limited here.
[0108] Process 4: Perform sliding window optimization processing on each frame of image and select the pending frames from the collected frames of image;
[0109] Among them, when screening the pending frames, the following factors can be specifically considered:
[0110] The number of feature point matches between frames;
[0111] The average disparity between frames;
[0112] The acquisition time interval between frames;
[0113] The number of new feature points added between frames.
[0114] In this process 4, when screening the pending frames, it is necessary to ensure that the subsequent sliding window processing process has the characteristics of rapidity and robustness, so as to improve the effectiveness of the sliding window processing results.
[0115] Process 5: According to the number of sliding window optimization processing and the reprojection error of the feature points, the key frame is determined from the pending frames, and the pose information of the key frame and the feature point data in the key frame are determined, such as Figure 2 "Sliding window optimization processing" and "whether it is a key frame" judgment.
[0116] It should be noted that the key frame data mentioned in process 5 can be understood as: some data corresponding to relatively important images found from the collected multiple frames of images.
[0117] Among them, for the sliding window, marginalization of old frames can be used.
[0118] For example, assuming that the sliding window contains K1 frames of pending frame images, and according to the acquisition order of each pending frame image, the pending frame image with the earliest acquisition time is determined to be the i-th pending frame image; if the robot acquires a new frame of image (assuming it is the i+a-th frame image), and after being processed by process 1 to process 4, it is determined that the i+a-th frame image needs to be input into the sliding window, the i-th frame image can be determined as the pending frame image.
[0119] In this way, the sliding window always contains K1 frames of pending frame images, and the images in the sliding window are all the latest pending frame images, which is conducive to ensuring that the subsequent constructed map is more accurate; and it can also reduce the amount of calculation and reduce the calculation cost.
[0120] Optionally, in the sliding window, the state of the K1 frame to be determined frame image and the K2 feature points contained in the K1 frame to be determined frame image, that is, the state of the sliding window to be optimized, can be expressed as:
[0121]
[0122]
[0123]
[0124] Among them, χ K1 represents the pose information of the K1th key frame, w represents the world coordinate system, Represents the displacement of the i-th key frame in the world coordinate system, Represents the velocity information of the i-th key frame in the world coordinate system, represents the angle information (or rotation information) of the i-th key frame in the world coordinate system, b a represents the acceleration bias, b grepresents the bias of the gyroscope, represents an external parameter vector, that is, the conversion amount between the coordinate system of the image acquisition device (such as a camera) and the IMU coordinate system, λ K2 represents the K2th feature point, Indicates the position conversion relationship between the left camera's coordinate system and the IMU coordinate system. Indicates the relative rotation relationship between the left camera's coordinate system and the IMU coordinate system. Indicates the position conversion relationship between the right camera's coordinate system and the IMU coordinate system. Indicates the relative rotation relationship between the right camera's coordinate system and the IMU coordinate system.
[0125] Optionally, in the embodiment of the present invention, the process of sliding window optimization processing specifically includes:
[0126] According to the determined matching of the corner points in each frame of the image and the state increment information between two consecutive frames of the image, the second BA optimization processing is performed on the N+1 frame of the image and the IMU data corresponding to the N+1 frame of the image to determine the pose information of the N+1 frame of the image and the coordinate information of the corner points in the N+1 frame of the image; N is an integer greater than 0;
[0127] When it is determined that the N+1th frame image needs to be input into a preset sliding window according to the position information of the N+1th frame image and the coordinate information of the corner points in the N+1th frame image, the i-th frame image with the earliest acquisition time in the current sliding window is determined as the pending frame image and is removed from the sliding window; wherein the sliding window includes N frames of images, and i is an integer greater than 0;
[0128] Therefore, according to the number of sliding window optimization processes and the reprojection error of the feature points, the key frame is determined, specifically including:
[0129] The pending frame corresponding to a number of sliding window optimization processes of not less than a first preset value and a reprojection error of a feature point included therein being not greater than a second preset value is determined as a key frame.
[0130] According to the pose information of the N+1 frame image and the coordinate information of the corner points in the N+1 frame image, it is determined that the N+1 frame image needs to be input into the preset sliding window, which can be specifically understood as:
[0131] If the pose information of the N+1th frame image is close to that of the Nth frame image, it means that the pose information of the N+1th frame image and the Nth frame image has not changed significantly. In this case, there is no need to input the N+1th frame image into the sliding window;
[0132] If the posture information difference between the N+1th frame image and the Nth frame image is large, it means that the posture of the N+1th frame image and the Nth frame image has changed significantly. At this time, the N+1th frame image needs to be input into the sliding window.
[0133] Since the number of images included in the sliding window is fixed, when it is determined that the N+1th frame image is input into the sliding window, the earliest frame image input into the sliding window (such as the i-th frame image) needs to be deleted from the sliding window. At this time, the i-th frame image can be determined as the pending frame image.
[0134] Furthermore, taking the sliding window including 10 frames of images as an example, then:
[0135] The second BA optimization process can be performed on the first to eleventh frames of images, and then when it is determined that the eleventh frame of images does not need to be input into the sliding window, and the first to tenth frames of images can be input into the sliding window, the first sliding window optimization process is completed for the first frame of images in the sliding window;
[0136] The second BA optimization process is performed on the first to tenth frames of images and the twelfth frame of image, and then when it is determined that the twelfth frame of image does not need to be input into the sliding window, the images included in the sliding window remain unchanged, and for the first frame of image in the sliding window, the second sliding window optimization process is completed;
[0137] The second BA optimization process is performed on the first to tenth frames and the thirteenth frame, and then when it is determined that the thirteenth frame needs to be input into the sliding window, the images included in the sliding window become the second to tenth frames and the thirteenth frame, and the first frame is removed from the sliding window; at this time, for the first frame in the sliding window, the third sliding window optimization process is completed;
[0138] Therefore, for the first frame image, three sliding window optimization processes are performed, and the first frame image is a pending frame image.
[0139] If it is assumed that the first preset value is 3, and it is determined that the reprojection error of the feature points included in the first frame image is not greater than the second preset value, the first frame image can be determined as a key frame image.
[0140] Of course, the specific values of the first preset value and the second preset value can be set according to actual conditions and are not limited here.
[0141] In this way, a more accurate key frame can be selected based on the number of processing times and reprojection errors of the sliding window optimization process, so that a high-precision and globally consistent map can be constructed in the subsequent back-end processing process.
[0142] Optionally, in an embodiment of the present invention, according to the determined matching status of the corner points in each frame of the image and the state increment information between two consecutive frames of the image, a second BA optimization process is performed on the N+1 frame of the image and the IMU data corresponding to the N+1 frame of the image, specifically including:
[0143] The following formula is used to perform the second BA optimization process on the N+1 frame image and the IMU data corresponding to the N+1 frame image according to the matching of the corner points in each frame image and the state increment information between two consecutive frames of images:
[0144]
[0145] in, represents the residual of IMU data, represents the residual of the image data, Indicates the pre-integration result of IMU data when determining the state increment information, represents image data, Represents the Jacobian matrix corresponding to the state increment information, represents the variance matrix corresponding to the state increment information, χ represents the state of the sliding window to be optimized, r p -H p χ represents the prior residual of the marginalized pending frame, k represents the kth frame, B represents the list of images that have been pre-integrated when determining the state increment information, l represents feature point l, j represents the jth frame, and C represents the list of acquired images.
[0146] To clarify, the “residual of IMU data” mentioned in the above content can be understood as: the error between the IMU pre-integration result of the observation value and the state to be optimized.
[0147] That is to say, in the second BA optimization process (also referred to as the local BA optimization process), optimization is performed in combination with the nonlinear least squares algorithm to determine the pose information of the key frame and the feature point data in the image corresponding to the key frame (for example, but not limited to the depth information of the feature point).
[0148] One thing to note is that when selecting feature points from the images corresponding to the key frames, after the pending frames are subjected to sliding window optimization processing, they can be selected from the 3D corner points in the sliding window, and the selection principle can be: the average reprojection error of each key frame image in the sliding window is small enough, the number of observations is sufficient, and the depth estimation is sufficiently convergent, etc. Of course, feature points can also be determined and selected according to other principles, as long as feature points can be selected to facilitate subsequent map construction, and no specific limitation is made here.
[0149] S102, determining a closed-loop key frame and a closed-loop feature point pair corresponding to any key frame according to the key frame data; wherein the closed-loop feature point pair includes: a first feature point located in an image corresponding to the key frame, and a second feature point located in an image corresponding to the corresponding closed-loop key frame, and image information described by the first feature point matches that described by the second feature point;
[0150] It should be noted that there is a one-to-one correspondence between a key frame and a key frame image, and the key frame and closed-loop key frame mentioned in step S102 can both be understood as key frame data and closed-loop key frame data.
[0151] The process of determining the closed-loop key frame and the closed-loop feature point pair in S102 can be understood as closed-loop detection. The specific determination process can be found in the following content.
[0152] S103. When it is determined that the key frame and the corresponding closed-loop key frame meet the preset closed-loop condition, a first BA optimization process is performed on the feature point data, closed-loop feature point pairs, and IMU data corresponding to all key frames to obtain a map for representing the environment in which the robot is located.
[0153] Among them, Figure 2 As shown in the figure, the “global BA optimization based on external parameter evaluation” is the first BA optimization process. After the optimization process, the map (such as Figure 2 ), and the obtained map may be, but is not limited to, a three-dimensional point cloud map.
[0154] In an embodiment of the present invention, first, when determining the matching of the corner points in the left-eye image and the right-eye image included in each frame of the collected image, and the state increment information between two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, a key frame is determined from the pending frame according to the number of sliding window optimization processing and the reprojection error of the feature point, and the position information of the key frame and the feature point data in the image corresponding to the key frame are determined, so as to determine the closed-loop key frame and the closed-loop feature point pair corresponding to any key frame according to the key frame data, and then the feature point data, the closed-loop feature point pair and the IMU data corresponding to the key frame can be subjected to the first BA optimization processing to obtain a map for representing the environment in which the robot is located; in this way, the obtained map is more in line with the actual situation, so that a high-precision and globally consistent map can be generated, providing an effective global map for the positioning of the robot in the later stage.
[0155] Secondly, by determining the closed-loop keyframes and closed-loop feature point pairs, that is, performing the closed-loop detection process, the feature points can be associated through closed-loop detection, and the reprojection error of the closed-loop points can be constructed, thereby effectively eliminating the accumulated errors and making the constructed map more accurate.
[0156] It should be noted that the processing process of S101 above can be understood as a front-end processing process (such as Figure 2 The above-mentioned processing steps S102 and S103 can be understood as the back-end processing steps (such as Figure 2 That is, the key frame data can be determined through front-end processing, and then the key frame data is sent to the back-end. In the back-end processing, the map is constructed by processing the key frame data, and the powerful binocular visual inertial odometer based on tightly coupled sliding window optimization is combined with the first BA optimization processing of the back-end to construct a high-precision and globally consistent map.
[0157] Optionally, in the embodiment of the present invention, determining the closed-loop key frame and the closed-loop feature point pair corresponding to the key frame according to the key frame data specifically includes the following process:
[0158] Process 1: Extract feature point data and descriptor data from key frames and construct a bag-of-words data set;
[0159] Among them, the key frame is determined by the above S101, and the key frame data determined by the above S101 not only includes the posture information of the key frame and the feature point data in the image corresponding to the key frame, but also includes the three-dimensional position information of the feature point and the matching information of the feature point in the sliding window, so as to facilitate the subsequent determination of the closed-loop key frame and the closed-loop feature point pair.
[0160] Furthermore, when extracting feature point data and descriptor data, feature point data may be extracted based on an existing fast algorithm, and descriptor data may be extracted based on a brief algorithm. Of course, feature point data and descriptor data may also be extracted based on other algorithms, which are not limited here.
[0161] Process 2: Calculate the similarity between the first key frame and each second key frame according to the bag-of-words data set, and determine the second key frame corresponding to the similarity greater than the preset second threshold as the closed-loop key frame corresponding to the first key frame; wherein the first key frame is: any key frame, and the second key frame is: a key frame other than the first key frame in all key frames;
[0162] The second threshold value may be set according to actual needs and is not limited here.
[0163] Furthermore, when determining the closed-loop key frame, it can be determined based on the bag-of-words data set of the DBoW model, but it is certainly not limited thereto. As long as the closed-loop key frame can be determined, the model based thereon is not limited here.
[0164] Process 3: According to the bag-of-words data set, determine the feature point pairs in the feature points of the image corresponding to the first key frame that match the feature points in the image corresponding to the corresponding closed-loop key frame, calculate the Hamming distance between the matched feature point pairs, and determine the matched feature point pairs corresponding to the Hamming distance less than the preset third threshold as the closed-loop feature point pairs.
[0165] The third threshold value may be set according to actual needs and is not limited here.
[0166] Furthermore, when calculating the Hamming distance between the matching feature point pairs, the calculation may be performed based on the Brief descriptor. The specific calculation process may be referred to in the prior art and will not be described in detail here.
[0167] In this way, the closed-loop key frame and closed-loop feature point pair corresponding to any key frame can be determined through the above process, which is conducive to the execution of subsequent processes and ensures the effective construction of the map.
[0168] Optionally, in the embodiment of the present invention, when it is determined that the key frame and the corresponding closed-loop key frame do not satisfy the closed-loop condition, the method further includes:
[0169] After performing the first BA optimization processing on the feature point data corresponding to the key frame and the IMU data, a map is obtained.
[0170] In this way, when the closed-loop conditions are not met, only the feature point data and IMU data corresponding to the key frame can be processed by the first BA, so as to achieve optimized processing according to different situations. This can not only improve the accuracy of the constructed map, but also help to reduce the amount of computing power of the equipment and improve the efficiency of map construction.
[0171] Specifically, in the embodiment of the present invention, the closed-loop conditions include:
[0172] When determining the forward PNP relative posture and the backward PNP relative posture between the key frame and the corresponding closed-loop key frame according to the closed-loop feature point pair and the preset PNP algorithm, the difference between the forward PNP relative posture and the backward PNP relative posture is less than a preset first threshold;
[0173] Among them, the forward PNP relative posture includes:
[0174] The relative posture between the three-dimensional position information of the second feature point in the image corresponding to the closed-loop key frame and the two-dimensional position information of the corresponding first feature point in the image corresponding to the corresponding key frame;
[0175] The backward PNP relative posture includes:
[0176] The relative posture between the three-dimensional position information of the first feature point in the corresponding image of any key frame and the two-dimensional position information of the corresponding second feature point in the corresponding image of the corresponding closed-loop key frame.
[0177] Among them, the feature points in the image corresponding to the closed-loop key frame are all called second feature points, and the feature points in the image corresponding to the key frame are all called first feature points, so as to distinguish the feature points in the image corresponding to the key frame from the feature points in the image corresponding to the closed-loop key frame.
[0178] In addition, when calculating the forward PNP relative posture and the backward PNP relative posture, the specific calculation process can be referred to the prior art and will not be described in detail here.
[0179] Furthermore, the setting of the first threshold can be set according to actual needs and is not limited here.
[0180] In this way, the PNP RANSAC algorithm can be used to determine whether the key frame and the corresponding closed-loop key frame accept the closed loop (such as Figure 2 If the loop is closed, then the closed loop feature point pair can be considered to be the same corner point, and the matched feature points can be used for the subsequent first BA optimization process to calculate the reprojection error (such as Figure 2 The “reprojection error of closed-loop points in closed-loop key frames” in the figure is helpful for map construction; moreover, it can also eliminate mismatching during closed-loop detection, which is helpful for improving the accuracy of the constructed map.
[0181] Specifically, in an embodiment of the present invention, the first bundle adjustment BA optimization processing is performed on the feature point data corresponding to all key frames, the closed-loop feature point pairs, and the IMU data pairs, specifically including:
[0182] According to the following formula, the first bundle adjustment BA optimization processing is performed on the feature point data corresponding to all key frames, closed-loop feature point pairs, and IMU data pairs:
[0183]
[0184] Where k represents the kth key frame, B represents the list of key frames that have been pre-integrated when determining the state increment information, Represents the observed value of the feature point on the collected left image, represents the observed value of the feature point on the right image collected, j represents the jth key frame, P l represents the coordinates of feature point l in the world coordinate system, represents the pre-integration result of IMU data when determining the state increment information, χ represents the state of the sliding window that needs to be optimized, Represents the Jacobian matrix corresponding to the state increment information, represents the variance matrix of the left image, Represents the variance matrix of the right image, C loopL Represents the list of left-eye closed-loop frame images that accept closed-loop, C loopR Represents a list of right-eye closed-loop frame images that accept closed-loop. represents the residual of IMU data, Represents the residual of the left eye image in the key frame corresponding image, Represents the residual of the right eye image in the key frame corresponding image, Represents the residual of the left eye image in the closed-loop frame image corresponding to the key frame, Represents the residual of the right eye image in the image of the closed-loop frame corresponding to the key frame.
[0185] That is to say, when the first bundle adjustment BA optimization processing is performed on the feature point data corresponding to all key frames, the closed-loop feature point pairs, and the IMU data pairs:
[0186] 1. Considering the instability of estimating external parameters in front-end processing, external parameters (i.e., there is a constant conversion relationship between IMU and camera) optimization is added in the first BA optimization process;
[0187] 2. At the same time, in order to further utilize more information to improve the accuracy of mapping, IMU constraints (or, IMU time domain constraints, i.e. );
[0188] 3. The key frames obtained after front-end processing are used for the first BA optimization process to build a high-precision map.
[0189] Among them, in the above-mentioned first BA optimization process, five parts of residuals are mainly considered, namely:
[0190] The three-dimensional coordinate information of the feature points observed in the key frame corresponds to the projection residual of the left image (that is, the error between the actual observation result of the left image) and the projection residual of the right image, such as Figure 2 "Reprojection error of observed feature points" in;
[0191] The closed-loop point (i.e., the feature point in the closed-loop feature point pair in the case of receiving the closed loop (see the above content for details)) is the projection residual of the left eye image and the projection residual of the right eye image in the corresponding image of the closed-loop key frame, such as Figure 2 "Reprojection error of closed-loop points on closed-loop keyframes" in
[0192] The IMU constraint residual between frames, such as Figure 2 "IMU constraints between frames" in;
[0193] Among them, the IMU constraint residual between frames is mainly used to reflect the timing constraints and can also be used to constrain the scale.
[0194] Moreover, since the time interval between key frames is relatively long during the backend processing, the pose difference within the sliding window can be used to approximate the IMU constraint residual.
[0195] In addition, since it has been determined that the key frame and the corresponding closed-loop key frame meet the preset closed-loop conditions when performing the first bundle adjustment BA optimization processing on the key frame, closed-loop feature point pair, and IMU data pair, that is, the key frame and the corresponding closed-loop key frame accept the closed loop, the above five parts of the residual need to be considered when performing the first BA optimization processing.
[0196] Optionally, in the embodiment of the present invention, the feature point data corresponding to the key frame and the IMU data pair are subjected to a first BA optimization process, specifically including:
[0197] According to the following formula, the first BA optimization process is performed on the feature point data corresponding to the key frame and the IMU data pair:
[0198]
[0199] Where k represents the kth key frame, B represents the list of key frames that have been pre-integrated when determining the state increment information, Represents the observed value of the feature point on the collected left image, represents the observed value of the feature point on the right image collected, j represents the jth key frame, P l represents the coordinates of feature point l in the world coordinate system, represents the pre-integration result of IMU data when determining the state increment information, χ represents the state of the sliding window that needs to be optimized, Represents the Jacobian matrix corresponding to the state increment information, represents the variance matrix of the left image, represents the variance matrix of the right image, represents the residual of IMU data, Represents the residual of the left eye image in the key frame corresponding image, Represents the residual of the right eye image in the key frame corresponding image.
[0200] Since when the first BA optimization processing is performed on the feature point data corresponding to the key frame and the IMU data pair, it has been determined that the key frame and the corresponding closed-loop key frame do not meet the preset closed-loop condition, that is, the key frame and the corresponding closed-loop key frame do not accept the closed loop, so when performing the first BA optimization processing, only the following three parts of the residual need to be considered, namely:
[0201] The three-dimensional coordinate information of the feature points observed in the key frame corresponding to the image, the projection residual in the left image (that is, the error between the actual observation result of the left image) and the projection residual in the right image;
[0202] IMU constraint residuals between frames.
[0203] Moreover, no matter which data is subjected to the first BA optimization process, the first BA optimization process is constructed as a nonlinear least square method for optimization, and the χ mentioned in the above formula can be expressed as:
[0204]
[0205]
[0206]
[0207] Among them, x k represents the pose information of the kth key frame, w represents the world coordinate system, represents the displacement of the kth key frame in the world coordinate system, Represents the angle information (or rotation information) of the kth key frame in the world coordinate system. represents an external parameter vector, that is, the conversion amount between the coordinate system of the image acquisition device (such as a camera) and the IMU coordinate system, P m represents the position of the mth feature point in the world coordinate system, Indicates the position conversion relationship between the left camera's coordinate system and the IMU coordinate system. Indicates the relative rotation relationship between the left camera's coordinate system and the IMU coordinate system. Indicates the position conversion relationship between the right camera's coordinate system and the IMU coordinate system. Indicates the relative rotation relationship between the right camera's coordinate system and the IMU coordinate system.
[0208] Optionally, in the embodiment of the present invention, after obtaining the map for representing the environment where the robot is located, the method further includes:
[0209] Save the obtained map.
[0210] When a map is saved, information related to the map is also saved, which may include:
[0211] 1. The pose information of all key frames after the first BA optimization process;
[0212] 2. The position information of the feature points that can be observed in the image corresponding to each key frame in the three-dimensional world coordinate system, the position information of each feature point in the normalized two-dimensional coordinate system, and the Brief descriptor corresponding to each feature point;
[0213] 3. The position information of the feature points extracted from the corresponding image of each key frame and used to construct the word bag data set in the normalized two-dimensional coordinate system, as well as the corresponding Brief descriptor;
[0214] 4. External parameters after the first BA optimization process (i.e., the external parameters of the left eye image and IMU, the right eye image and IMU).
[0215] It should be noted that the first BA optimization process needs to be executed when the mapping thread is completed, that is, the first BA optimization process is performed after S101 and S102 are executed, so the obtained map is an optimized map, which makes the obtained map more accurate and has the advantage of global consistency.
[0216] Furthermore, in order to reduce the amount of calculation, downsampling processing can be performed before executing the first BA optimization processing to delete certain key frames, that is, to delete key frames whose adjacent key frames are too close to each other or whose directions are very similar. The spatial density between adjacent key frames determines whether some of the key frames need to be deleted, thereby reducing the number of key frames. When executing the first BA optimization processing, the processing amount of the first BA optimization processing is reduced, thereby improving processing efficiency.
[0217] Based on the same inventive concept, an embodiment of the present invention provides a robot positioning method, such as Figure 3 As shown, it may include:
[0218] S301, obtaining a pre-constructed map, where the map is constructed using the construction method provided in the embodiment of the present invention;
[0219] When obtaining the map, it can be obtained by, but not limited to, loading, and the format of the obtained map is the same as the format of the map saved after the map is previously constructed.
[0220] In addition, in the subsequent processing process, all states related to the map are considered constant in the subsequent processing process, and when the same sensor suite is used, the optimized external parameters can be loaded as initial values in the positioning stage of the AMR, thereby ensuring the accuracy of positioning while implementing subsequent positioning processing.
[0221] S302, determining key frame data according to the image data and inertial measurement unit IMU data collected by the robot in real time and synchronously according to the preset key frame data determination rules; wherein the key frame data includes: posture information of the key frame, and feature point data in the image corresponding to the key frame, the feature point is a corner point in the image, and a corner point that matches a corner point in an adjacent frame of image;
[0222] Among them, when determining the matching status of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between the two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, the posture information of the key frame and the feature point data in the image corresponding to the key frame are determined; the state increment information includes: position increment information, angle increment information and speed increment information.
[0223] To illustrate, optionally, when performing the sliding window optimization process, the sliding window optimization process may be performed only once to obtain the global pose of the AMR and eliminate the accumulated error of the current trajectory as quickly as possible.
[0224] For the specific implementation of S302, reference may be made to the specific implementation of S102 described above, and the repeated parts will not be repeated here.
[0225] S303, determining a closed-loop key frame corresponding to any key frame according to the map and the key frame data;
[0226] S304: When it is determined that the key frame and the corresponding closed-loop key frame meet the preset closed-loop condition, the robot is positioned after the closed-loop key frame is optimized.
[0227] To clarify, the processing process of S302 mentioned above can be understood as the front-end processing process, and the processing processes of S303 and S304 mentioned above can be understood as the back-end processing process, that is, the key frame data can be determined through the front-end processing, and then the key frame data and the map are sent to the back-end, and the positioning is performed by processing the key frame data and the map in the back-end processing, and the powerful binocular visual inertial odometer based on the tightly coupled sliding window optimization is combined with the back-end pose graph optimization processing, so as to achieve real-time and high-precision positioning.
[0228] Furthermore, after the key frame data is determined in S302, the front end will still perform multiple sliding window optimization processing on the key frame, similar to the front end processing process in building the map. After the key frame is subjected to multiple sliding window optimization processing, the newly acquired image and the key frame that has been subjected to the sliding window optimization processing are processed to determine whether the newly acquired image is a key frame. That is, after the key frame data corresponding to the i-th key frame is determined, the front end processing process for the i-th key frame is not terminated and is still executed.
[0229] Optionally, in the embodiment of the present invention, when it is determined that the key frame and the corresponding closed-loop key frame do not meet the preset closed-loop condition, the method further includes:
[0230] Stop pose graph optimization for closed-loop keyframe pairs.
[0231] In this way, unnecessary operations can be reduced, positioning efficiency can be improved, and the amount of computing power of the device can be reduced.
[0232] Specifically, in the embodiment of the present invention, the closed-loop conditions include:
[0233] If the image corresponding to the closed-loop key frame is one of the frames of the map, when a first PNP relative posture between the key frame and the corresponding closed-loop key frame is determined according to the closed-loop feature point pair and the preset PNP algorithm, the first PNP relative posture is less than a preset fourth threshold;
[0234] Or, if the image corresponding to the closed-loop key frame is an image collected by the robot after acquiring the map, when the second PNP relative posture between the key frame and the corresponding closed-loop key frame is determined based on the closed-loop feature point pair and the PNP algorithm, the second PNP relative posture is less than the preset fifth threshold.
[0235] Among them, if the image corresponding to the closed-loop key frame is one of the frames of the constructed map, it means that the image corresponding to the closed-loop key frame comes from a frame of the pre-constructed map. At this time: the calculation of the closed-loop constraint is independent of the state in the front-end processing process (that is, the posture can be directly determined, making the calculation process simpler and more accurate); and because the posture of the current key frame mainly depends on the high-precision map, it will not be affected by the accumulated errors in the front-end processing process.
[0236] It should be noted that the calculation process and specific meaning of the PNP relative posture mentioned in the second condition can be found in the prior art and will not be repeated here.
[0237] In this way, through the PNP RANSAC algorithm, it can be determined whether the key frame and the corresponding closed-loop key frame accept the closed loop. If the closed loop is accepted, the closed-loop feature point pair can be considered to be the same corner point, and the matched feature points can be used for subsequent pose graph optimization processing and calculation of reprojection errors, which is beneficial to the positioning of the robot; and it can also eliminate the false matching that occurs during closed-loop detection, which is beneficial to improve the accuracy of positioning.
[0238] Optionally, in an embodiment of the present invention, performing pose graph optimization processing on the closed-loop key frame specifically includes:
[0239] The following formula is used to optimize the pose graph of all the determined closed-loop key frames:
[0240]
[0241] Among them, S represents the key frame list with sliding window constraint, L represents the key frame list with closed loop constraint, i represents the i-th key frame, j represents the j-th key frame, r i,j represents the residual between the i-th key frame and the j-th key frame, ρ(.) represents the robust kernel function, P represents the pose of all optimized key frames, and ψ represents the angle information of all optimized key frames.
[0242] That is to say, in order to achieve the stability of the output pose, a small-scale pose graph is maintained during the back-end processing to constrain and smooth the global pose, thereby effectively avoiding pose jumps caused by mismatching closed-loop detection.
[0243] Specifically, a key frame can be regarded as a vertex in the posture graph. Every two vertices (consisting of key frames) are connected by a constraint edge. There are two main types of constraint edges: sequential constraint edges and closed-loop constraint edges. The sequential constraint edge can represent the relative transformation constraint between two vertices in the front-end processing results, and the key frame can be connected to several adjacent key frames that have been determined using the sequential constraint edge; the closed-loop constraint edge can represent the relative transformation constraint between the key frame and the corresponding closed-loop key frame, and the closed-loop key frame can be connected to the corresponding key frame through the closed-loop constraint edge.
[0244] Therefore, when it is determined that the key frame and the corresponding closed-loop key frame meet the preset closed-loop conditions, it means that the key frame and the corresponding closed-loop key frame accept a closed loop. Therefore, when optimizing the pose graph of the closed-loop key frame, it is necessary to consider the two factors of the residual of the closed-loop constraint edge and the residual of the order constraint edge.
[0245] One thing to note is that if the closed-loop key frame corresponding to the key frame's image comes from an already constructed map, then there is no need to perform the above-mentioned pose graph optimization processing and positioning can be performed directly; if the closed-loop key frame corresponding to the key frame's image does not come from an already constructed map, then the above-mentioned pose graph optimization processing is required to achieve robot positioning.
[0246] Moreover, as the AMR moves, the size of the pose graph will gradually increase, which will affect the real-time positioning. Therefore, before or after the pose graph optimization process is performed, when the motion trajectory of the AMR is still within the range of the constructed map, only the N latest key frames can be retained to reduce the amount of calculation; if the motion trajectory of the AMR exceeds the range of the constructed map, it is necessary to perform downsampling processing based on the distance between the two adjacent key frames, that is, to delete the key frames whose distances between adjacent key frames are too close or whose directions are very similar, and the spatial density between adjacent key frames determines whether some of the key frames need to be deleted, thereby reducing the number of key frames. When the pose graph optimization process is performed, the processing amount of the pose graph optimization process is reduced, thereby improving the processing efficiency.
[0247] Based on the same inventive concept, an embodiment of the present invention provides a device for constructing a robot map. The implementation principle of the device is similar to the implementation principle of the aforementioned method for constructing a robot map. Therefore, the implementation method of the device can refer to the specific embodiment of the aforementioned method, and the repeated parts will not be repeated.
[0248] Specifically, an embodiment of the present invention provides a robot map construction device, such as Figure 4 As shown, it may include:
[0249] The first unit 401 is used to determine key frame data according to the image data and inertial measurement unit IMU data collected by the robot in real time and synchronously according to the preset key frame data determination rule; wherein the key frame data includes: posture information of the key frame, and feature point data in the image corresponding to the key frame, where the feature point is a corner point in the image and matches the corner point in an adjacent frame image;
[0250] The second unit 402 is used to determine the closed-loop key frame corresponding to the key frame and the closed-loop feature point pair according to the key frame data; wherein the closed-loop feature point pair includes: a first feature point located in the image corresponding to the key frame, and a second feature point located in the image corresponding to the corresponding closed-loop key frame, and the image information described by the first feature point and the second feature point matches;
[0251] The third unit 403 is used to perform a first bundle adjustment BA optimization process on the feature point data, closed-loop feature point pairs, and IMU data pairs corresponding to all key frames when it is determined that the key frame and the corresponding closed-loop key frame meet the preset closed-loop condition, so as to obtain a map for representing the environment where the robot is located;
[0252] Among them, when determining the matching of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between the two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, the key frame is determined according to the number of sliding window optimization processing and the reprojection error of the feature point, and the posture information of the key frame and the feature point data in the image corresponding to the key frame are determined; the state increment information includes: position increment information, angle increment information and speed increment information.
[0253] Based on the same inventive concept, an embodiment of the present invention provides a robot positioning device. The implementation principle of the positioning device is similar to the implementation principle of the aforementioned robot positioning method, so the implementation method of the positioning device can refer to the specific embodiment of the aforementioned positioning method, and the repeated parts will not be repeated.
[0254] Specifically, an embodiment of the present invention provides a robot positioning device, such as Figure 5 As shown, it may include:
[0255] The first unit 501 is used to obtain a pre-built map, where the map is built using the above-mentioned construction method provided in the embodiment of the present invention;
[0256] The second unit 502 is used to determine the key frame data according to the image data and the inertial measurement unit IMU data collected by the robot in real time and synchronously according to the preset key frame data determination rule; wherein the key frame data includes: the posture information of the key frame, and the feature point data in the image corresponding to the key frame, the feature point is the corner point in the image, and the corner point matches the corner point in the adjacent frame image;
[0257] The third unit 503 is used to determine a closed-loop key frame corresponding to any key frame according to the map and the key frame data;
[0258] The fourth unit 504 is used to position the robot after performing pose graph optimization processing on the closed-loop key frame when it is determined that the key frame and the corresponding closed-loop key frame meet the preset closed-loop condition;
[0259] Among them, when determining the matching status of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between the two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, the posture information of the key frame and the feature point data in the image corresponding to the key frame are determined; the state increment information includes: position increment information, angle increment information and speed increment information.
[0260] Based on the same inventive concept, an embodiment of the present invention provides a robot, such as Figure 6As shown, it may include: the above-mentioned construction device 601 provided in the embodiment of the present invention, the above-mentioned positioning device 602 provided in the embodiment of the present invention, and an image acquisition device 603;
[0261] The image acquisition device 603 is used for:
[0262] Images representing the environment in which the robot is located are collected in real time, and the collected images are sent to the construction device 601 and the positioning device 602, so that the construction device 601 constructs a map according to the collected images, and the positioning device 602 performs positioning according to the collected images and the constructed map.
[0263] Optionally, in the embodiment of the present invention, the image acquisition device may be, but is not limited to, a camera, and may also be other forms of vision-based image acquisition devices, which are not limited herein.
[0264] Optionally, in the embodiment of the present invention, in addition to the construction device, the positioning device and the image acquisition device, the robot may also include other structures for realizing the functions of the robot. For details, please refer to the prior art and it is not limited here.
[0265] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for constructing a robot map, characterized in that: include: Determine key frame data according to the image data and inertial measurement unit (IMU) data collected by the robot in real time and synchronously according to a preset key frame data determination rule; The key frame data includes: the position information of the key frame, and the feature point data in the image corresponding to the key frame, wherein the feature point is a corner point in the image and matches the corner point in an adjacent frame image; Determine, according to the key frame data, a closed-loop key frame corresponding to the key frame, and a closed-loop feature point pair; wherein the closed-loop feature point pair includes: a first feature point located in an image corresponding to the key frame, and a second feature point located in an image corresponding to the closed-loop key frame, and the image information described by the first feature point matches the image information described by the second feature point; When it is determined that the key frame and the corresponding closed-loop key frame meet the preset closed-loop condition, a first bundle adjustment BA optimization process is performed on the feature point data corresponding to all the key frames, the closed-loop feature point pairs, and the IMU data pairs to obtain a map for representing the environment in which the robot is located; The key frame data determination rule includes: when determining the matching of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, the key frame is determined according to the number of sliding window optimization processing and the reprojection error of the feature point, and the posture information of the key frame and the feature point data in the image corresponding to the key frame are determined; the state increment information includes: position increment information, angle increment information and speed increment information; Determining, according to the key frame data, a closed-loop key frame and a closed-loop feature point pair corresponding to the key frame, specifically includes: Extracting feature point data and descriptor data from the key frame and constructing a bag-of-words data set; According to the bag-of-words data set, the similarity between the first key frame and each second key frame is calculated, and the second key frame corresponding to the similarity greater than a preset second threshold is determined as the closed-loop key frame corresponding to the first key frame; wherein the first key frame is: any of the key frames, and the second key frame is: the key frame in all the key frames except the first key frame; According to the bag-of-words data set, determine the feature point pairs that match the feature points of the image corresponding to the first key frame and the feature points of the image corresponding to the closed-loop key frame, calculate the Hamming distance between the matched feature point pairs, and determine the matched feature point pairs whose Hamming distance is less than a preset third threshold as the closed-loop feature point pairs.
2. The construction method according to claim 1, characterized in that: The closed-loop conditions include: When determining the forward PNP relative posture and the backward PNP relative posture between the key frame and the corresponding closed-loop key frame according to the closed-loop feature point pair and the preset PNP algorithm, the difference between the forward PNP relative posture and the backward PNP relative posture is less than a preset first threshold; Wherein, the forward PNP relative posture includes: The relative posture between the three-dimensional position information of the second feature point in the image corresponding to the closed-loop key frame and the two-dimensional position information of the first feature point corresponding to the image corresponding to the key frame; The backward PNP relative posture includes: The relative posture between the three-dimensional position information of the first feature point in the image corresponding to any of the key frames and the two-dimensional position information of the corresponding second feature point in the image corresponding to the closed-loop key frame.
3. The construction method according to claim 1, characterized in that: When it is determined that the key frame and the corresponding closed-loop key frame do not satisfy the closed-loop condition, the method further includes: After performing the first bundle adjustment BA optimization processing on the feature point data corresponding to the key frame and the IMU data, the map is obtained.
4. The construction method according to claim 3, characterized in that: The first bundle adjustment BA optimization process is performed on the feature point data corresponding to the key frame and the IMU data pair, specifically including: According to the following formula, the first bundle adjustment BA optimization process is performed on the feature point data corresponding to the key frame and the IMU data pair: Wherein, k represents the kth key frame, B represents a list of key frames for which pre-integration has been performed when determining the state increment information, Represents the observed value of the feature point on the collected left image, represents the observed value of the feature point on the right image collected, j represents the jth key frame, P l represents the coordinates of feature point l in the world coordinate system, represents the pre-integration result of the IMU data when determining the state increment information, χ represents the state of the sliding window to be optimized, Represents the Jacobian matrix corresponding to the state increment information, represents the variance matrix of the left image, represents the variance matrix of the right image, represents the residual of the IMU data, represents the residual of the left eye image in the image corresponding to the key frame, represents the residual of the right eye image in the image corresponding to the key frame, CSeqL Indicates the left eye image in the key frame corresponding image, CSeqR represents the right eye image in the key frame corresponding image, and ρ(.) represents the robust kernel function.
5. The construction method according to claim 1, characterized in that: Performing a first bundle adjustment BA optimization process on the feature point data corresponding to all the key frames, the closed-loop feature point pairs, and the IMU data pairs, specifically including: According to the following formula, the first bundle adjustment BA optimization processing is performed on the feature point data corresponding to all the key frames, the closed-loop feature point pairs, and the IMU data pairs: Wherein, k represents the kth key frame, B represents a list of key frames for which pre-integration has been performed when determining the state increment information, Represents the observed value of the feature point on the collected left image, represents the observed value of the feature point on the right image collected, j represents the jth key frame, P l represents the coordinates of feature point l in the world coordinate system, represents the pre-integration result of the IMU data when determining the state increment information, χ represents the state of the sliding window that needs to be optimized, Represents the Jacobian matrix corresponding to the state increment information, represents the variance matrix of the left image, Represents the variance matrix of the right image, C loopL Represents the list of left-eye closed-loop frame images that accept closed-loop, C loopR Represents a list of right-eye closed-loop frame images that accept closed-loop. represents the residual of the IMU data, represents the residual of the left eye image in the image corresponding to the key frame, represents the residual of the right eye image in the image corresponding to the key frame, represents the residual of the left eye image in the image of the closed-loop frame corresponding to the key frame, represents the residual of the right eye image in the image of the closed-loop frame corresponding to the key frame, CSeqL Indicates the left eye image in the key frame corresponding image, CSeqR represents the right eye image in the key frame corresponding image, and ρ(.) represents the robust kernel function.
6. The construction method according to claim 1, characterized in that: The sliding window optimization process specifically includes: According to the determined matching status of the corner points in each frame of the image and the state increment information between two consecutive frames of the image, the N+1 frame of the image and the IMU data corresponding to the N+1 frame of the image are subjected to the second BA optimization processing to determine the pose information of the N+1 frame of the image and the coordinate information of the corner points in the N+1 frame of the image; N is an integer greater than 0; When it is determined that the N+1th frame image needs to be input into a preset sliding window according to the posture information of the N+1 frame image and the coordinate information of the corner points in the N+1 frame image, the i-th frame image with the earliest acquisition time in the current sliding window is determined as a pending frame image and is removed from the sliding window; wherein the sliding window includes N frame images, and i is an integer greater than 0; Determining the key frame according to the number of times the sliding window optimization process is performed and the reprojection error of the feature point specifically includes: The pending frame corresponding to the sliding window optimization processing being performed for a number of times not less than a first preset value and the reprojection error of the feature point included therein being not greater than a second preset value is determined as the key frame.
7. The construction method according to claim 6, characterized in that: According to the determined matching of the corner points in each frame of the image and the state increment information between two consecutive frames of the image, the second BA optimization processing is performed on the N+1 frame of the image and the IMU data corresponding to the N+1 frame of the image, specifically including: The following formula is used to perform the second BA optimization processing on the N+1 frame image and the IMU data corresponding to the N+1 frame image according to the determined matching of the corner points in each frame image and the state increment information between two consecutive frames of images: in, represents the residual of the IMU data, represents the residual of the image data, r Β represents the IMU factor residual, represents the pre-integration result of the IMU data when determining the state increment information, represents the image data, Represents the Jacobian matrix corresponding to the state increment information, represents the variance matrix corresponding to the state increment information, χ represents the state of the sliding window to be optimized, r p -H p χ represents the marginalized prior residual of the pending frame, k represents the kth frame, B represents the list of images that have been pre-integrated when determining the state increment information, l represents feature point l, j represents the jth frame, C represents the list of the collected images, and ρ(.) represents the robust kernel function.
8. A robot positioning method, characterized in that: include: Obtaining a pre-constructed map, wherein the map is constructed using the construction method according to any one of claims 1 to 7; Determine key frame data according to the image data and inertial measurement unit (IMU) data collected by the robot in real time and synchronously according to a preset key frame data determination rule; The key frame data includes: the position information of the key frame, and the feature point data in the image corresponding to the key frame, wherein the feature point is a corner point in the image and matches the corner point in an adjacent frame image; Determine a closed-loop key frame corresponding to any key frame according to the map and the key frame data; When it is determined that the key frame and the corresponding closed-loop key frame meet a preset closed-loop condition, the robot is positioned after performing pose graph optimization processing on the closed-loop key frame; Among them, the key frame data determination rule includes: when determining the matching status of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, determine the posture information of the key frame and the feature point data in the image corresponding to the key frame; the state increment information includes: position increment information, angle increment information and speed increment information.
9. The positioning method according to claim 8, characterized in that: The closed-loop conditions include: If the image corresponding to the closed-loop key frame is one of the frames of the image for constructing the map, when a first PNP relative posture between the key frame and the corresponding closed-loop key frame is determined according to the closed-loop feature point pair and a preset PNP algorithm, the first PNP relative posture is less than a preset fourth threshold; Or, if the image corresponding to the closed-loop key frame is an image collected by the robot after acquiring the map, when a second PNP relative posture between the key frame and the corresponding closed-loop key frame is determined based on the closed-loop feature point pair and the PNP algorithm, the second PNP relative posture is less than a preset fifth threshold.
10. The positioning method according to claim 8, characterized in that: Performing pose graph optimization processing on the closed-loop key frame specifically includes: The following formula is used to optimize the pose graph of all the determined closed-loop key frames: Among them, S represents the key frame list with sliding window constraint, L represents the key frame list with closed loop constraint, i represents the i-th key frame, j represents the j-th key frame, r i,j represents the residual between the i-th key frame and the j-th key frame, ρ(.) represents the robust kernel function, P represents the pose of all the optimized key frames, and ψ represents the angle information of all the optimized key frames.
11. A robot map construction device, characterized in that: include: The first unit is used to determine the key frame data according to the image data and the inertial measurement unit IMU data collected by the robot in real time and synchronously according to the preset key frame data determination rule; The key frame data includes: the position information of the key frame, and the feature point data in the image corresponding to the key frame, wherein the feature point is a corner point in the image and matches the corner point in an adjacent frame image; A second unit is configured to determine, according to the key frame data, a closed-loop key frame corresponding to the key frame, and a closed-loop feature point pair; wherein the closed-loop feature point pair includes: a first feature point located in an image corresponding to the key frame, and a second feature point located in an image corresponding to the closed-loop key frame, and the image information described by the first feature point matches the image information described by the second feature point; A third unit is used for, when it is determined that the key frame and the corresponding closed-loop key frame meet a preset closed-loop condition, performing a bundle adjustment BA optimization process on the feature point data corresponding to all the key frames, the closed-loop feature point pairs, and the IMU data pairs, to obtain a map for representing the environment where the robot is located; Wherein, when determining the matching of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between the two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, the key frame is determined according to the number of sliding window optimization processing and the reprojection error of the feature point, and the position information of the key frame and the feature point data in the image corresponding to the key frame are determined; the state increment information includes: position increment information, angle increment information and speed increment information; Determining, according to the key frame data, a closed-loop key frame and a closed-loop feature point pair corresponding to the key frame, specifically includes: Extracting feature point data and descriptor data from the key frame and constructing a bag-of-words data set; According to the bag-of-words data set, the similarity between the first key frame and each second key frame is calculated, and the second key frame corresponding to the similarity greater than a preset second threshold is determined as the closed-loop key frame corresponding to the first key frame; wherein the first key frame is: any of the key frames, and the second key frame is: the key frame in all the key frames except the first key frame; According to the bag-of-words data set, determine the feature point pairs that match the feature points of the image corresponding to the first key frame and the feature points of the image corresponding to the closed-loop key frame, calculate the Hamming distance between the matched feature point pairs, and determine the matched feature point pairs whose Hamming distance is less than a preset third threshold as the closed-loop feature point pairs.
12. A robot positioning device, characterized in that: include: A first unit is used to obtain a pre-constructed map, wherein the map is constructed by using the construction method according to any one of claims 1 to 6; The second unit is used to determine the key frame data according to the image data and the inertial measurement unit IMU data collected by the robot in real time and synchronously according to the preset key frame data determination rule; The key frame data includes: the position information of the key frame, and the feature point data in the image corresponding to the key frame, wherein the feature point is a corner point in the image and matches the corner point in an adjacent frame image; A third unit is used to determine a closed-loop key frame corresponding to any key frame according to the map and the key frame data; A fourth unit is used for positioning the robot after performing pose graph optimization processing on the closed-loop key frame when it is determined that the key frame and the corresponding closed-loop key frame meet a preset closed-loop condition; Among them, when determining the matching status of the corner points in the left eye image and the right eye image included in each frame of the collected image, and the state increment information between two consecutive frames of the collected image, and after performing sliding window optimization processing on each frame of the image, the posture information of the key frame and the feature point data in the image corresponding to the key frame are determined; the state increment information includes: position increment information, angle increment information and speed increment information.
13. A robot, characterized in that: include: The construction device as claimed in claim 11, the positioning device as claimed in claim 12, and the image acquisition device; Wherein, the image acquisition device is used for: An image representing the environment in which the robot is located is acquired in real time, and the acquired image is sent to the construction device and the positioning device, so that the construction device constructs a map according to the acquired image, and the positioning device performs positioning according to the acquired image and the constructed map.
