A robot repositioning method, chip and robot

By calculating the cross-correlation between the local map and the global map and accelerating the convolution by discrete Fourier transform, combined with the double traversal detection algorithm, the problem of inaccurate robot relocalization is solved, and fast and accurate relocalization and overlap avoidance are achieved.

CN116202539BActive Publication Date: 2025-10-03AMICRO SEMICONDUCTOR CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111450874.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-01
Publication Date
2025-10-03
Estimated Expiration
2041-12-01

AI Technical Summary

Technical Problem

In the prior art, it is difficult for indoor intelligent mobile robots to relocate quickly and accurately when there are few features in the grid map, resulting in incorrect positioning results and prone to overlapping images.

Method used

By calculating the cross-correlation between the local map and the global map, the optimal rotation angle and translation vector are obtained, the discrete Fourier transform is used to accelerate the convolution operation, and the double traversal detection algorithm is combined to calculate the map similarity, thus achieving fast and accurate conversion from the local map to the global map.

Benefits of technology

It improves the accuracy and efficiency of robot repositioning, avoids image overlap, and ensures that the robot can reposition quickly and accurately when feature information is lost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116202539B_ABST
    Figure CN116202539B_ABST
Patent Text Reader

Abstract

The present invention discloses a robot repositioning method, chip and robot. The technical solution described in the present invention is used to obtain the optimal rotation angle and optimal translation vector between the local map and the global map based on the mutual correlation between the local map constructed in real time and the corresponding global map, to form an optimal transformation matrix, and then transform a local map into each global map through the corresponding optimal transformation matrix. Then, the map similarity between each rotated local map and the corresponding global map is calculated, and the robot repositioning result is obtained by comparing the size of the map similarity. This overcomes the problem that the robot easily loses relevant feature information during the repositioning process, resulting in inaccurate repositioning, and the problem that the traditional method of calculating map similarity has low accuracy and efficiency. The accuracy and efficiency of the robot repositioning using the limited information of the local map are improved, and the occurrence of overlapping maps is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of robot positioning, and in particular to a robot repositioning method, a chip and a robot. Background Art

[0002] At present, most indoor intelligent mobile robots have the ability of autonomous positioning and navigation, that is, they locate their own position and posture according to the existing map data during the execution of the task, and then realize autonomous navigation. When the robot has a map but does not know where it is located on the map, it needs to be relocated. However, due to the small number of features in the raster map, the mobile robot can easily lose relevant feature information when it relies on extracting features from the raster map for relocation, making it impossible to find its own position quickly and accurately. When the positioning result is incorrect, the abnormal phenomenon of overlapping maps will occur. In the patent application number CN202110575423.6, a positioning control method based on map matching is disclosed. This method uses covariance calculation to calculate the correlation coefficient of multiple local maps and the corresponding global map to determine the most matching coordinate position, which is used as the positioning position of the robot. However, the correlation coefficient is only a rough way to judge the degree of matching, and it has failed to produce satisfactory results in practical applications. Summary of the Invention

[0003] To address the above issues, the present invention provides a robot relocalization method, chip, and robot. By calculating the matching results between multiple global maps and a local map through similarity evaluation, the robot can quickly and accurately convert the instantly constructed local map into the corresponding global map to achieve relocalization. The specific technical solutions of the present invention are as follows:

[0004] A robot repositioning method, the method comprising the following steps: step A, according to the cross-correlation between a local map and a global map, calculating a second preset number of optimal rotation angles, calling each optimal rotation angle to rotate a local map respectively, and obtaining a second preset number of first local optimized maps; wherein the robot pre-stores a first preset number of global maps; step B, controlling the second preset number of first local optimized maps to perform pairwise accelerated convolution with the first preset number of global maps respectively, and obtaining a cross-correlation parameter matrix between each first local optimized map and each corresponding global map; step C, according to an optimal transformation matrix composed of an element with the largest value in the same cross-correlation parameter matrix and an optimal rotation angle corresponding to the first local optimized map, the local The local map is converted into the corresponding global map, and is determined to be converted into a second local optimized map; step D, controlling the global map to divide the global block map corresponding to the second local optimized map, calculating the directed distance fields of the second local optimized map and the corresponding global block map respectively through the double traversal detection algorithm, and then calculating the average distance between the second local optimized map and the corresponding global block map according to the directed distance field, summing the average distances to obtain the map similarity between the second local optimized map and the corresponding global map, and then selecting the global map corresponding to the map similarity with the largest value, and then selecting the matching coordinate position in the currently selected global map as the relocation position of the robot according to the optimal transformation matrix corresponding to the map similarity with the largest value.

[0005] Furthermore, in step D, the method for obtaining the map similarity between the second local optimized map and the corresponding global map includes: step D1, in the global map participating in the map similarity calculation, dividing the global block map consisting of positions matching the second local optimized map and having the same size as the second local optimized map; step D2, defining a set, the set including all matrix elements in the second local optimized map and the corresponding global block map, and the values ​​in the set are not repeated; step D3, calculating the average distance between the matrix elements with preset values ​​on the second local optimized map and the nearest matrix elements with the same values ​​on the corresponding global block map. Distance, and calculate the average distance between the matrix element with a preset value on the global block map and the nearest matrix element with the same value on the corresponding second local optimized map; wherein the preset value belongs to the set; step D4, define a value in the set that does not participate in the calculation as the preset value, return to step D3 to calculate until all values ​​in the set participate in the calculation, and then enter step D5; step D5, calculate the sum of all average distances obtained in step D3 to obtain the map similarity between the second local optimized map and the corresponding global block map; wherein each map similarity matches a corresponding global map and matches a corresponding optimal rotation angle.

[0006] Furthermore, in step D3, the method for calculating the average distance between the matrix element with a preset value on the second local optimization map and the nearest matrix element with the same value on the corresponding global block map specifically includes the following steps: step D31, calculating the signed distance field of the global block map; step D32, calculating the distance between the matrix element with a preset value on the second local optimization map and all matrix elements originally having the same value on the signed distance field of the global block map, and taking the minimum value therebetween; step D33, searching for the next matrix element with a preset value on the second local optimization map, returning to step D32 for calculation until all matrix elements with preset values ​​on the second local optimization map are calculated, and then entering step D34; step D34, calculating the sum of all minimum values ​​obtained in step D32, and then averaging them to obtain the average distance between the matrix element with a preset value on the second local optimization map and the nearest matrix element with the same value on the global block map.

[0007] Furthermore, in step D31, the method for calculating the signed distance field of the global block map specifically includes: step D311, initializing the matrix elements in the global block map; step D312, performing a first traversal on the matrix elements in the initialized global block map according to the first traversal direction, updating the current matrix elements to values ​​that satisfy the first condition during the traversal process, and entering step D313 after the first traversal is completed; step D313, performing a second traversal on the matrix elements in the global block map that has been traversed for the first time according to the second traversal direction, updating the current matrix elements to values ​​that satisfy the second condition during the traversal process, and obtaining the signed distance field corresponding to the global block map after the second traversal is completed.

[0008] Furthermore, in step D311, the method of initializing the matrix elements in the global block map specifically includes: initializing the matrix elements in the global block map whose values ​​are preset values ​​to 0, and then initializing the other matrix elements to infinity.

[0009] Furthermore, the first traversal direction in step D312 specifically refers to: starting from the first matrix element in the first row of the global block map, traversing from left to right, after traversing the last matrix element in the first row, continue traversing from the first matrix element in the second row from left to right, and so on, until all matrix elements are traversed.

[0010] Furthermore, the value satisfying the first condition in step D312 specifically refers to: during the traversal process, taking the matrix element values ​​to the left and above the current matrix element and adding 1 respectively, and then comparing the values ​​with the current matrix element value, where the minimum value among the three is the value satisfying the first condition.

[0011] Furthermore, the second traversal direction in step D313 specifically refers to: starting from the last matrix element in the last row of the global block map, traversing from right to left, after traversing the first matrix element in the last row, continue traversing from the last matrix element in the second to last row from right to left, and so on, until all matrix elements are traversed.

[0012] Furthermore, the value satisfying the second condition in step D313 specifically refers to: during the traversal process, taking the matrix element values ​​to the right and below the current matrix element and adding 1 respectively, and then comparing the values ​​with the current matrix element value, where the minimum value among the three is the value satisfying the second condition.

[0013] Furthermore, the traversal starting point of the second traversal direction is the traversal end point of the first traversal direction.

[0014] A chip is used to store a program, and the program is the robot repositioning method.

[0015] A robot equipped with the chip.

[0016] The beneficial effects of the present invention are as follows: the technical solution of the present invention is used to obtain the optimal rotation angle and the optimal translation vector between the local map and the global map according to the mutual correlation between the instantly constructed local map and the corresponding global map, to form an optimal transformation matrix, and then transform a local map into each global map through the corresponding optimal transformation matrix, and then calculate the map similarity between each rotated local map and the corresponding global map, and obtain the robot's repositioning result by comparing the size of the map similarity, thereby overcoming the problem that the robot easily loses relevant feature information during the repositioning process, resulting in inaccurate repositioning, and the problem that the traditional method of calculating map similarity is low in accuracy and efficiency, thereby improving the accuracy and efficiency of the robot's repositioning using the limited information of the local map, and avoiding the occurrence of overlapping maps. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 The figure is a flow chart of a robot repositioning method according to an embodiment of the present invention.

[0018] Figure 2 The figure is a flow chart of a method for obtaining a rotation angle based on Hough transform according to an embodiment of the present invention.

[0019] Figure 3 The figure is a flowchart of a method for calculating map similarity according to an embodiment of the present invention.

[0020] Figure 4 FIG. 1 is a schematic diagram of a signed distance field calculation process according to an embodiment of the present invention.

[0021] Figure 5 This is an example diagram of the calculation results of the signed distance field according to an embodiment of the present invention. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solutions and advantages of this application more clear, the present application is described and illustrated below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely used to explain the present invention and are not intended to limit this application. Based on the embodiments provided in this application, all other embodiments obtained by those of ordinary skill in the art without making any creative work are within the scope of protection of this application.

[0023] In order to quickly and accurately calculate the offset and rotation angle of the local map constructed by the robot in real time relative to the pre-set global map (collectively referred to as the posture transformation of the local map), and then control the robot to quickly and accurately reposition itself in abnormal situations such as failure of its own posture due to loss of feature information, restart or manual movement, Figure 1A robot repositioning method is disclosed, specifically comprising:

[0024] Step A: Calculate a second preset number of optimal rotation angles based on the correlation between a local map and a global map, call each optimal rotation angle to rotate a local map respectively, and obtain a second preset number of first local optimized maps; wherein the robot pre-stores a first preset number of global maps. Figure 2As shown, step A specifically includes: step A1, obtaining first frequency statistics in a reference coordinate mapping space from the global map using a Hough transform, and simultaneously obtaining second frequency statistics in a reference coordinate mapping space from the local map using a Hough transform, and setting a reference rotation angle applicable to all reference coordinate mapping spaces; wherein the reference coordinate mapping space belongs to the Hough space; then proceeding to step A2. Step A2, periodically convolving the second frequency statistics with the first frequency statistics using a trigonometric function of the reference rotation angle to obtain a cross-correlation signal sequence between a line in the local map and a line corresponding to the global map, which is expressed as the correlation between a line in the local map and a line in the global map at a rotation angle; then proceeding to step A3. Step A3, calculating and obtaining a second preset number of local maxima from the cross-correlation signal sequence, and then setting the rotation angles corresponding to the second preset number of local maxima currently obtained as a second preset number of optimal rotation angles of the local map relative to the global map, i.e., a second preset number of optimal rotation angles of the same local map relative to the corresponding global map. In this embodiment, the optimal rotation angles corresponding to the second preset number of local maxima can be obtained by performing partial derivative operations on the cross-correlated signal sequence. Each optimal rotation angle can be used as the rotation angle of the X-axis of the robot coordinate system of the same local map relative to the X'-axis of the global coordinate system of the corresponding global map. It should be added that, within the local map constructed in real time, these optimal rotation angles may be the rotation angles of the straight lines extracted in the corresponding directions relative to a reference navigation direction. At the same time, the similarity of the straight lines extracted in these corresponding directions to the corresponding straight lines in the same global map is the greatest. Among them, a reference coordinate mapping space corresponding to the global map and a reference coordinate mapping space corresponding to the local map are both used to represent the same environmental area. The local map is constructed in real time by the robot in the current motion area, and the global map is constructed in advance by the robot in the same motion area.By executing steps A1 to A3, a reference coordinate mapping space of the same size and relative distribution area is mapped from the global map and the local map using the Hough transform to timely save the line feature information, which can both accelerate line detection and avoid the loss of map information. Statistical information associated with the lines is then extracted from the respective reference coordinate mapping spaces and a convolution operation is performed with the rotation angle as a period to obtain the strength of the cross-correlation between the rotation angle of the line in the local map and the rotation angle of the corresponding line in the global map, and a matching operation is performed on the line in the local map with the line in the global map. On this basis, the rotation angle corresponding to the convolution value of the local maximum is selected as the optimal rotation angle between the local map and the global map, making the optimal rotation angle as a candidate object more accurate. The cross-correlation is only evaluated for the distribution frequency characteristics of the corresponding lines in the reference coordinate mapping space at specific locations, which speeds up the processing of the rotation angle and thereby accelerates the subsequent conversion of the local map to the global map.

[0025] In step A, each optimal rotation angle is called to rotate a local map respectively, to obtain a second preset number of first local optimized maps, i.e., a second preset number of first local optimized maps are obtained; then step B is entered. Each first local optimized map has a corresponding optimal rotation angle. Preferably, the first local optimized map can be obtained by rotating the same local map by a corresponding optimal rotation angle in chronological order, thereby sequentially calling the second preset number of optimal rotation angles to obtain the second preset number of first local optimized maps. Alternatively, the same local map can be simultaneously rotated by a corresponding optimal rotation angle to obtain first local optimized maps after different rotation operations, thereby synchronously calling the second preset number of optimal rotation angles to simultaneously obtain the second preset number of first local optimized maps.

[0026] In step A, the posture of the straight line in the first local optimized map is obtained by rotating the corresponding straight line in the local map in a specific direction according to the optimal rotation angle, so that the local posture obtained after the rotation of the corresponding straight line or the corresponding linear feature is the same as the global posture of the corresponding straight line in the global map in terms of the direction posture. The direction posture of the straight line in the first local optimized map is equivalent to the direction posture of the corresponding straight line in the global map, which can be regarded as directional matching of the straight line in the local map with the straight line in the global map. In order to perform the conversion between the robot coordinate system of the local map and the global coordinate system of the global map and complete the precise positioning of the robot in the map (overcoming the robot coordinate system positioning error caused by the sensor installation error), this embodiment also requires a translation vector and a rotation matrix composed of the trigonometric function values ​​of the optimal rotation angle to complete the conversion between the robot coordinate system of the local map and the global coordinate system of the global map (converted to the same map plane). Therefore, it is necessary to calculate the displacement posture. In this embodiment, a cross-correlation calculation is performed on the local map and the global map, and the position coordinate with the highest correlation is obtained as the coordinate offset that is most likely to match at the corresponding angle, including the offset of the origin of the robot coordinate system relative to the origin of the global coordinate system of the global map. Among them, the global coordinate system of the global map can be the reference navigation coordinate system during the robot's mapping and navigation process, used for positioning and ranging.

[0027] It should be noted that the formation of a rotation matrix from the trigonometric function values ​​of the optimal rotation angle is achieved using conventional technical means. As known to those skilled in the art, a rotation matrix is ​​multiplied by the coordinates in the local map and then added to a translation vector to obtain the coordinates in the local map, which are converted to coordinates in the global map. Specifically, by introducing the homogeneous coordinate form and based on the conversion relationship between plane rectangular coordinate systems, a rotation matrix and a translation vector can be combined into a conversion matrix, which facilitates the conversion calculation between coordinate systems.

[0028] Step B, control the second preset number of first local optimization maps to perform accelerated convolution with the first preset number of global maps, obtain the cross-correlation parameter matrix between each first local optimization map and each corresponding global map, and then enter step C. Specifically, when the map sizes of the global map and the first local optimization map are relatively large, in order to reduce the huge computational cost brought by the traditional convolution operation, this embodiment uses discrete Fourier transform to convert each first local optimization map and a corresponding global map participating in the convolution from the time domain space to the frequency domain space, and then multiply the transformation value of the first local optimization map at the frequency domain space position with the transformation value of the corresponding global map participating in the convolution at the corresponding frequency domain space position, and then obtain a cross-correlation parameter matrix through inverse discrete Fourier transform to complete the accelerated convolution to achieve convolution with two column elements. Replace the convolution between a first local optimization map and a global map and obtain the same operation result; wherein, in the second preset number of first local optimization maps, each first local optimization map is set to perform the accelerated convolution with any global map, and obtain a cross-correlation parameter matrix whose number is the product of the first preset number and the second preset number, so as to realize the pairwise accelerated convolution; wherein, the number of columns of the cross-correlation parameter matrix is ​​equal to the number of grids in the horizontal axis direction of the corresponding first local optimization map, and the number of rows of the cross-correlation parameter matrix is ​​equal to the number of grids in the vertical axis direction of the corresponding first local optimization map. Therefore, this embodiment uses discrete Fourier transform to accelerate the convolution calculation of the above-mentioned two maps, and converts the multiplication calculation of the small window item by item of the convolution calculation into two column convolutions, thereby reducing the number of calculations and the amount of memory occupied. In particular, the more discrete data of the map being transformed, the more significant the degree of computational savings of this embodiment, especially the order of magnitude reduction of the computational amount is more obvious.

[0029] It should be added that this embodiment controls the first local optimized map (values ​​taken at the map coordinate position or the map image at the corresponding matrix element point) and a global map (values ​​taken at the map coordinate position or the map image at the corresponding matrix element point) to perform discrete convolution, and sets the offset amplitude of one of the operable maps in the horizontal axis direction to be the length of a row of grids of the first local optimized map, and sets the offset amplitude of the operable map in the vertical axis direction to be the length of a column of grids of the first local optimized map. For example, taking the global map as the map data item that can be translated, the integer values ​​included in the integer length from 1 to the first local optimized map are set as the translation parameters in the horizontal axis direction, and the integer values ​​included in the integer width from 1 to the first local optimized map are set as the translation parameters in the vertical axis direction. When the corresponding position elements are multiplied after conversion to the frequency domain, the specific positions involved in the multiplication can be mastered by those skilled in the art who understand discrete Fourier transform, and will not be repeated here. The matrices that make up the two maps are involved in the map convolution operation. The matrix elements of the map matrix are values ​​at the map coordinate positions or the map image is valued at the corresponding matrix element points. The specific values ​​of the matrix elements involved include but are not limited to the number of times the straight line falls into the corresponding position, the frequency, and the brightness value of the map image. The specific value type has a negligible impact on the evaluation results of the cross-correlation between each first local optimized map and each corresponding global map.

[0030] In this embodiment, in the process of using discrete Fourier transform to process the discrete convolution of each first local optimization map and a corresponding global map, in the frequency domain, only the discrete Fourier transform result of the matrix element sequence of the grid map corresponding to the current front half is calculated each time backtracking, and the discrete Fourier transform result of the matrix element sequence of the grid map corresponding to the back half can be inferred, thereby reducing the computational complexity, so that the order of magnitude of the computational amount before and after the transformation is reduced from the order of power to the order of logarithm, and the difference is obvious.

[0031] Step C, based on the optimal transformation matrix composed of an element with the largest value in the same mutual correlation parameter matrix and an optimal rotation angle corresponding to the first local optimization map, the local map is transformed into the corresponding global map, and the transformation into the second local optimization map is determined. Specifically, an element with the largest value is obtained from the same mutual correlation parameter matrix, and then the horizontal axis coordinate and the vertical axis coordinate corresponding to the currently obtained element with the largest value and an optimal rotation angle corresponding to the first local optimization map are used to form the optimal transformation matrix between the corresponding global map and the local map, wherein the horizontal axis coordinate and the vertical axis coordinate corresponding to the currently obtained element with the largest value are the coordinate offsets that best match the local map relative to the global map, which are equivalent to the horizontal and vertical axis offsets of the origin of the robot coordinate system of the local map relative to the origin of the global coordinate system of the global map, which can form the translation vector and accurately position the robot in combination with the corresponding optimal rotation angle. The local map is then transformed into the corresponding global map using the optimal transformation matrix. The transformation into a second local optimized map is determined, including rotating and translating the robot coordinate system into the global map to facilitate robot positioning within the global map. The cross-correlation between the local map and the corresponding global map is matched, and the second local optimized map is used as the map matching result of the two maps at the corresponding optimal rotation angle. The process then proceeds to step D.

[0032] It can be seen from the above steps that: based on the second preset number of local maps and a global map, the pairwise accelerated convolution can be used to obtain the second preset number of optimal transformation matrices based on a global map, thereby converting the second preset number of coordinate offsets relative to the origin of the global coordinate system of this global map, and the second preset number of positioning positions can be located in the same global map; on this basis, based on the second preset number of local maps and the first preset number of global maps, the pairwise accelerated convolution can be used to obtain the second preset number of optimal transformation matrices based on a global map to obtain coordinate offsets that are the product of the first preset number and the second preset number, and the positioning positions that are the product of the first preset number and the second preset number can be accumulated in all global maps.

[0033] Step D: Control the global map to divide the global block map corresponding to the second local optimized map, calculate the directed distance field of the second local optimized map and the corresponding global block map respectively through the double traversal detection algorithm, and then calculate the average distance between the second local optimized map and the corresponding global block map based on the directed distance field. The average distance is summed to obtain the map similarity between the second local optimized map and the corresponding global map, and then the global map corresponding to the largest map similarity is selected. Then, according to the optimal transformation matrix corresponding to the largest map similarity, the matching coordinate position in the currently selected global map is selected as the robot's relocation position. Each global map can obtain a second preset number of relocation results based on the corresponding optimal transformation matrix of the second preset number, where each optimal rotation angle corresponds to a relocation result. At this time, it is necessary to evaluate which relocation result is the most matching and accurate among all global maps.

[0034] Specifically, if Figure 3 As shown, in this embodiment, the method for obtaining the map similarity between the second local optimized map and the corresponding global map includes: step D1, within the global map participating in the map similarity calculation, segmenting a global block map consisting of positions matching the second local optimized map and having the same size as the second local optimized map, that is, segmenting block maps of equal size (equal length and width) from the global map to facilitate similarity calculation of each matrix element, and then proceeding to step D2. In step D2, a set P is first defined, and all matrix elements in the second local optimized map and the corresponding global block map are counted. It should be noted that the map described in the present invention is a grid map, and free and occupancy are generally used to represent the occupancy status of the grid. Therefore, in the case of non-repeated values, the set P contains free and / or occupancy, and then proceeds to step D3. Step D3, calculating the average distance between the matrix elements with preset values ​​on the second local optimized map and the nearest matrix elements with the same values ​​on the corresponding global block map, and calculating the average distance between the matrix elements with preset values ​​on the global block map and the nearest matrix elements with the same values ​​on the corresponding second local optimized map, and then proceeding to step D4. The preset values ​​belong to the set P.

[0035] The process of executing step D3 further includes the following steps:

[0036] Step D31, calculate the signed distance field of the global block map, and then enter step D32. It should be noted that the signed distance field (SDF) is a data set that identifies the distance parameter to the specified location, and the direction can also be identified by a positive or negative sign. SDF was originally used to replace the traditional alpha-test (transparency test) to render text. It can use smaller text textures and will not be severely distorted when enlarged. It can be seamlessly integrated with the traditional alpha-test method, and has great advantages in text rendering. However, it is necessary to pre-calculate a smaller signed distance field texture from a larger text image. Finite distance fields are usually calculated using a recursive algorithm with a time complexity of O(nlogn), which cannot reach the linear time O(n), and the calculation speed is slow. Therefore, this embodiment uses a double traversal detection algorithm to optimize the calculation process of SDF to increase the calculation speed. Figure 4 Schematic diagram of the signed distance field calculation process, see Figure 4 , the method for calculating the directed distance field of the global block map specifically includes:

[0037] Step D311: Initialize the matrix elements in the global block map. Figure 4 The left panel, Init, shows the initialized global tile map. Initializing the matrix elements in the global tile map involves initializing the matrix elements in the global tile map with preset values ​​to 0, and then initializing the remaining matrix elements to infinity. The 0s in Init denote zero boundaries, where the preset values ​​are values ​​in the set P. This initialization process prepares for the subsequent minimum value extraction.

[0038] Step D312, perform the first traversal of the matrix elements in the initialized global block map according to the first traversal direction, update the current matrix element to a value that satisfies the first condition during the traversal process, and enter step D313 after the first traversal. In this embodiment, the first traversal direction specifically refers to: starting from the first matrix element in the first row of the global block map, traverse from left to right, and after traversing the last matrix element in the first row, continue traversing from left to right from the first matrix element in the second row, and so on, until all matrix elements are traversed, that is, all matrix elements of the global block map are traversed according to the rules from left to right and from top to bottom. During the traversal process, the traversed matrix element (called the current matrix element) needs to be updated, specifically, the matrix element values ​​to the left and above the current matrix element are taken and added by 1 respectively, and then compared with the current matrix element value, and the minimum value of the three is assigned to the current matrix element. Reference Figure 4, the middle figure Relaxation Step 1 shows the process of the first traversal of the global block map, where the black matrix element point is the visited position, that is, the current matrix element, and the gray matrix element point is the neighbor, that is, the adjacent matrix element (in this embodiment, the matrix elements to the left and above the current matrix element are taken). Assuming that the current matrix element is infinite, the left matrix element is 0, and the above matrix element is infinite, then the matrix elements to the left and above are added by 1 to become 1 and infinity respectively. The minimum value of the three is 1, so the current matrix element is updated to 1. As mentioned above, the position of 0 is the boundary, so 1 means that the distance between the current matrix element and the boundary is 1. It should be noted that because the first traversal direction is from the upper left corner to the lower right corner of the global block map, taking the matrix element values ​​to the left and above the current matrix element can avoid taking the matrix elements that have not been traversed, that is, the matrix elements that have not been updated. Such values ​​have no computational meaning.

[0039] Optionally, the first traversal direction can be to start from the last matrix element in the first row of the global block map and traverse from right to left. After traversing the first matrix element in the first row, continue traversing from right to left from the last matrix element in the second row, and so on, until all matrix elements are traversed, that is, all matrix elements of the global block map are traversed according to the rules from right to left and from top to bottom. In addition, the traversal starting point of the first traversal direction can also be the matrix element where other vertices of the global block map are located, and traverse in the diagonal direction according to similar rules as mentioned above, which will not be repeated. It should be noted that when the first traversal direction is from the upper right corner to the lower left corner of the global block map, when taking values ​​for comparison, it is necessary to take the matrix elements to the right and above the current matrix element, also to avoid taking matrix elements that have not been traversed. When the first traversal direction changes, the value needs to be adaptively changed, which will not be repeated.

[0040] Step D313, perform a second traversal on the matrix elements in the global block map that have been traversed for the first time according to the second traversal direction, update the current matrix element to a value that satisfies the second condition during the traversal process, and obtain the signed distance field corresponding to the global block map after the second traversal. In this embodiment, the second traversal direction specifically refers to: starting from the last matrix element in the last row of the global block map, traverse from right to left, and after traversing the first matrix element in the last row, continue traversing from right to left from the last matrix element in the second to last row, and so on, until all matrix elements are traversed, that is, all matrix elements of the global block map are traversed according to the rule of from right to left and from bottom to top. During the traversal process, the traversed matrix elements need to be updated again, specifically, the matrix element values ​​to the right and below the current matrix element are taken and added by 1 respectively, and then compared with the current matrix element value, and the minimum value of the three is assigned to the current matrix element. Reference Figure 4 The figure on the right, Relaxation Step 2, shows the second traversal of the global block map. The black matrix element is the visited position, i.e., the current matrix element, and the gray matrix element is the neighbor, i.e., the adjacent matrix element (in this embodiment, the matrix elements to the right and below the current matrix element are taken). Assuming the current matrix element is 0, the matrix element to the right is infinite, and the matrix element below is 1, then adding 1 to the matrix elements to the right and below becomes infinite and 2, respectively. The minimum of these three values ​​is 0, so the current matrix element remains 0 (because the current matrix element itself is the boundary).

[0041] It should be noted that the starting point of the traversal in the second traversal direction is the end point of the traversal in the first traversal direction. For example, when the first traversal ends at the matrix element in the lower left corner of the global block map (starting from the upper right corner), the second traversal starts from the matrix element in the lower left corner (and then ends the second traversal at the matrix element in the upper right corner). This is because when the first traversal starts from the upper right corner, only the distance between the matrix elements to the right and above the current matrix element and 0 is updated. Therefore, the second traversal needs to update the distance between the matrix elements to the left and below and 0. Setting the starting point of the second traversal direction to the end point of the traversal in the first traversal direction can meet this requirement.

[0042] like Figure 5 As shown in FIG, this embodiment is an example diagram of the calculation results of the signed distance field. Figure 5The upper left image shows the global tile map, the upper right image shows the signed distance field corresponding to the global tile map, and the lower image shows the numerical representation of the signed distance field. Note that the signed distance field in the upper right image is a vector rendering; zooming in on it accurately represents the global tile map. This signed distance field is calculated using a double-pass detection algorithm, requiring only two passes through the global tile map to approximate the results of the traditional signed distance field calculation. The double-pass detection algorithm has a computational time complexity of O(n), which is linear, significantly improving the computational speed of the signed distance field.

[0043] Step D32: Calculate the distances between the matrix elements on the second local optimized map with a preset value and all matrix elements on the directed distance field of the global block map that originally had the same value, and take the minimum value. During step D32, a matrix element on the second local optimized map with a preset value is taken, and all locations of zero (i.e., locations that originally had the preset value) are found on the directed distance field of the global block map. The distances between the former and the latter are calculated, and the minimum value is used as the result of step D32. Preferably, the distance in this embodiment uses the Manhattan distance, which is simple and fast to calculate.

[0044] Step D33: Search for the next matrix element on the second local optimized map whose value is the preset value. Return to step D32 and continue calculations until all matrix elements on the second local optimized map whose values ​​are the preset value are calculated. Then proceed to step D34. Combining steps D32 and D33, it is readily apparent that calculating the average distance from the matrix element on the second local optimized map with the preset value to the nearest matrix element with the same value on the global block map requires multiple traversals and calculations, resulting in high computational complexity. Therefore, this embodiment uses a signed distance field to simplify the calculation process and increase the speed of calculating the average distance.

[0045] Step D34: Calculate the sum of all minimum values ​​obtained in step D32, and then average them to obtain the average distance between the matrix element with the preset value on the second local optimized map and the nearest matrix element with the same value on the global block map. It should be noted that the method for calculating the average distance between the pixel with the preset value on the global block map and the nearest pixel with the same value on the second local optimized map is the same as described above. It only requires swapping the positions of the second local optimized map and the global block map. The calculation principle is the same and will not be repeated here.

[0046] In step D4, a value in the set that is not included in the calculation is defined as a preset value. The calculation is then repeated in step D3 until all values ​​in the set are included in the calculation, and then the process proceeds to step D5. During step D4, all values ​​in set P are traversed to calculate the two average distances in step D3, and then the next step is executed.

[0047] Step D5: Calculate the sum of all average distances obtained in step D3 to obtain the map similarity between the second local optimized map and the corresponding global block map. This result can be used as a reference to measure whether the two images are similar. Each map similarity is matched with a corresponding global map and a corresponding optimal rotation angle.

[0048] Preferably, among the first preset number of global maps, each global map has the second preset number of mutually different optimal rotation angles, and further, each global map has the second preset number of mutually different optimal transformation matrices, wherein each first local optimized map has a corresponding optimal rotation angle relative to the local map. In this embodiment, each optimal rotation angle matches an optimal transformation matrix for a global map, and then a position information is determined in the corresponding direction and posture of the corresponding global map, thereby providing sufficient pre-stored map information and real-time positioning map information for the positioning of the robot. By setting multiple candidate positioning objects (such as the optimal rotation angle and optimal translation vector mentioned in this embodiment) and their mapping transformation relationship (optimal transformation matrix), the robustness of the positioning algorithm is improved, and the problem that the robot easily loses relevant map feature information is overcome.

[0049] In the aforementioned embodiment, the optimal transformation matrix is ​​used to represent the origin offset and rotation angle between the coordinate system of the corresponding global map and the robot coordinate system of the local map, and the rotation and translation relationship between the coordinate system of the corresponding global map and the robot coordinate system of the local map is determined based on the optimal transformation matrix; wherein, the origin of the robot coordinate system is set to the center of the upper surface of the robot or the current position of the robot, and the coordinate offset (coordinate change in the horizontal and vertical axes) extracted from the optimal transformation matrix corresponding to the largest map correlation coefficient is set to the coordinate value of the global map corresponding to the largest map correlation coefficient. Because this coordinate offset is converted to the coordinate value set relative to the origin of the global coordinate system of the global map, a matching coordinate position is formed, and finally determined as the positioning position of the robot in the currently selected global map. This facilitates the conversion calculation between coordinate systems, speeds up the re-positioning of the robot in abnormal situations such as failure of its own posture or restart, and enables the robot to obtain complete coordinates and posture during mapping, positioning and navigation, thereby improving navigation accuracy.

[0050] In summary, this embodiment first obtains multiple optimal rotation angles as candidate rotation angles based on the cross-correlation between the local map and the global map, and then uses the candidate rotation angles to rotate the same local map to obtain multiple rotated local maps; for each rotated local map, a cross-correlation coefficient is calculated between it and a global map to obtain the corresponding best matching result in combination with the candidate rotation angle; then, for each best matching result, map similarity is calculated under the corresponding global map to normalize them to the same scale for comparison, and then the positioning information corresponding to the best matching result with the greatest similarity is selected from multiple global maps as the target position for robot relocation. Therefore, by combining the pairwise matching operations of multiple global maps and the correlation of multiple candidate rotation angles, first based on a local map and a global map, the mutual correlation coefficient matrix is ​​used to screen out an optimal transformation matrix corresponding to each candidate rotation angle, and then a local map is converted to each global map through the corresponding optimal transformation matrix. Finally, the different maps are normalized to the same scale and the size of the similarities are compared to obtain the positioning results. This overcomes the problem that the robot easily loses relevant feature information during the positioning process and causes inaccurate repositioning, improves the accuracy and efficiency of the robot's repositioning using the limited information of the local map, enhances the robustness of the repositioning algorithm, and reduces the interference of map coordinate system conversion errors.

[0051] As an example, Figure 2 A flowchart of a method for obtaining a rotation angle based on Hough transform provided in an embodiment of the present invention, namely Figure 1 The specific steps of the disclosed step A. The specific method of calculating the second preset number of optimal rotation angles based on the cross-correlation between a straight line of a local map and a straight line of a global map in the Hough space includes the following steps:

[0052] Step A1: Obtain first frequency statistics within a reference coordinate mapping space from the global map through the Hough transform, and simultaneously obtain second frequency statistics within a reference coordinate mapping space from the local map through the Hough transform, and set a reference rotation angle applicable to all reference coordinate mapping spaces; then proceed to step A2. The second frequency statistics and the first frequency statistics both reflect the number of occurrences of straight lines in a specific direction within the corresponding Hough space. The reference coordinate mapping space corresponding to the global map and the reference coordinate mapping space corresponding to the local map are both used to represent the same environmental area. The local map is constructed in real time by the robot within the current motion area, while the global map is constructed in advance by the robot within the same motion area.

[0053] It should be noted that, in this embodiment, the core idea of ​​the Hough transform is to map a set of points (two-dimensional) belonging to a certain graphic in the map to a point (which can be high-dimensional). This point records the number of points in the point set. This point is the parameter of the graphic to be searched, and the range of the parameter is called the parameter space, that is, the reference coordinate mapping space. The Hough transform can not only identify whether there are graphics that need to be detected in the scanned map, but also locate the graphic (including position, angle, etc.). When the feature to be extracted is within the point set and can be described mathematically, it can be searched through the Hough transform.

[0054] The Hough transform is a method for detecting straight lines and various geometric shapes in a binary image. Considering that there are many linear features on the walls inside a building, this embodiment focuses on the detection of straight lines in a grid map.

[0055] The line extraction methods involved in this embodiment all perform a Hough transform of all lines in the corresponding map into polar coordinate points in Hough space, which are used to represent a set of lines in a global map or a local map. Different polar coordinate points represent different lines, and the same polar coordinate point represents at least one line. The polar coordinate point includes a rotation angle and a point-to-line distance. The rotation angle is the angle between the normal of the line represented by the polar coordinate point and the positive direction of the horizontal axis of the coordinate system of the map to which it belongs, and the point-to-line distance is the geometric perpendicular distance from the origin of the coordinate system of the map to which the polar coordinate point belongs to the line represented by the polar coordinate point. If the Hough transform is repeated on the same polar coordinate point, a new vote is cast for the corresponding polar coordinate point in the accumulator space, that is, the count is increased by one. If all points are calculated in this way, it is inevitable that the vote count of some points will be a local maximum (i.e., a peak). This embodiment uses the Hough transform to map lines of the same shape in one map space to points in another coordinate space to vote and count, forming a peak to complete the conversion process of line information, thereby transforming the problem of detecting environmental line features into a problem of counting peaks. By introducing probabilistic peak statistics, the robot's mapping and localization algorithm becomes more robust to noise and incomplete shapes, mitigating the impact of missing straight line features in the map during robot navigation. It's important to note that in conventional Hough transform line detection algorithms, peaks in the accumulator space indicate strong evidence of the corresponding line in the image.

[0056] In order to speed up the detection speed, this embodiment uses Discrete Hough Transform (DHT). DHT divides the Hough space into a matrix HS with a preset number of rows and a preset number of columns, which is defined as the reference coordinate mapping space and belongs to the matrix space within the Hough space.

[0057] The reference coordinate mapping space (parameter space) is not continuous, but an array space composed of rectangular cells (accumulated units) one by one. Each rectangular cell stores the corresponding frequency statistics information (the cumulative result of the number of conversions) of (ρ, θ). In this embodiment, the reference rotation angle is the rotation angle of the polar coordinate point of the reference coordinate mapping space, and the reference point-line distance is the point-line distance of the polar coordinate point of the reference coordinate mapping space. Both are adaptively set according to the actual traversal environment of the robot; when the rotation angle is set to 0, there are infinite cases of corresponding matching point-line distances in the same grid map; when the point-line distance is set to 0, there are infinite cases of corresponding matching rotation angles in the same grid map. Therefore, in order to create a valid reference coordinate mapping space in the Hough space, the maximum value of the reference rotation angle is set to θ s , the minimum value of the reference rotation angle is set to 1; the maximum value of the reference point line distance is set to ρ s , the minimum value of the reference point line distance is set to 1; extract the straight lines on the wall in the grid map (global map and local map) as much as possible, and intuitively show the frequency of occurrence of straight lines in a specific direction on the grid map, which is used to combine the statistical information and polar coordinate information of the reference coordinate mapping space to reflect the distribution position characteristics of the straight lines in the grid map. Specifically, the number of rows of elements arranged in the reference coordinate mapping space is the number of polar coordinate points with the same reference rotation angle but different reference point line distances, that is, the preset number of rows, which is equivalent to the number of parallel straight lines extracted from the map. In some embodiments, it is preferably set to p s , in particular, the reference point line distances in the reference coordinate mapping space form an arithmetic progression with a leading term of 1 and a tolerance of 1. The number of columns of elements arranged in the reference coordinate mapping space is the number of polar coordinate points with the same reference point line distances but different reference rotation angles, that is, the preset number of columns, which is equivalent to the number of intersecting straight lines extracted from the map, and in some embodiments is preferably set to θ s In particular, the reference rotation angles in the reference coordinate mapping space form an arithmetic progression with a first term of 1 and a tolerance of 1; the polar coordinate points in the reference coordinate mapping space are all discrete.

[0058] Preferably, the number of columns of the reference coordinate mapping space can also be the number of polar coordinate points with the same reference rotation angle but different reference point line spacing, which is equal to the preset number of rows; the number of rows of the reference coordinate mapping space is the number of polar coordinate points with the same reference point line spacing but different reference rotation angles, which is equal to the preset number of columns; in this embodiment, the polar coordinate points arranged in the reference coordinate mapping space are all discretely distributed.

[0059] In the aforementioned embodiment, the elements of each row and column in the reference coordinate mapping space are the number of straight lines represented by the polar coordinate points at the corresponding positions in the Hough space. It should be noted that the coordinate system to which the polar coordinate points in the Hough space belong is not a standard polar coordinate system, but belongs to a Cartesian coordinate system. This embodiment maps out a reference coordinate mapping space of the same size and relative distribution area from the global map and the local map respectively, both of which are used as parameter spaces to be detected, wherein the number of polar coordinate points with the same reference rotation angle but different reference point line spacing represents the number of parallel straight lines in the corresponding map, and the number of polar coordinate points with the same reference point line spacing but different reference rotation angles represents the number of straight lines with common points in the corresponding map, so that the straight line parameters described by the reference coordinate mapping space are more comprehensive, covering more and more comprehensive straight line segments in the corresponding map area.

[0060] As an embodiment, in step A1, the specific steps are as follows:

[0061] Step A11: extract a straight line in the global map, and then perform Hough transformation of the currently extracted straight line into the corresponding reference coordinate mapping space. Then, calculate the sum of squares of the number of times the straight lines with different reference point line distances at the same reference rotation angle are extracted. That is, when the reference rotation angle θ is equal to a certain value θ_i, 1≤θ_i≤θ s When the line distance at the reference point is 1 to ρ s Among the lines, using lines with the same reference point spacing as statistical units, the number of times each line is Hough transformed to the corresponding position in the reference coordinate mapping space is counted line by line. The number of times lines with the same reference point spacing at the same reference rotation angle appear at the same polar coordinate point position in the Hough space corresponding to the global map is squared. Finally, the squared values ​​of the number of times lines with different reference point spacings at the same reference rotation angle appear are accumulated and summed, and this sum is used as the first frequency statistical information. That is, first frequency statistical information in a reference coordinate mapping space is obtained from the global map through the Hough transform, where lines with different reference point spacings at the same reference rotation angle are equivalent to parallel lines in the global map. The process then proceeds to step A12.

[0062] Step A12: Calculate the first frequency statistics at each reference rotation angle in sequence according to step A11 to form a discrete sequence of the sum of squares of the global map straight line distribution, wherein the number of elements in the discrete sequence of the sum of squares of the global map straight line distribution is the preset number of columns, corresponding to discrete reference rotation angles from 1 to θ s , which is a discrete angle value, can be an arithmetic progression with a first term of 1 and a common difference of 1 in some embodiments.

[0063] Step A13: extract straight lines in the local map, perform Hough transformation on the straight lines into the corresponding reference coordinate mapping space, and then calculate the sum of squares of the number of times straight lines with different reference point line distances at the same reference rotation angle are extracted, as the second frequency statistical information, wherein straight lines with different reference point line distances at the same reference rotation angle are equivalent to parallel straight lines in the local map; then proceed to step A14; that is, when the reference rotation angle θ is equal to a certain value θ_i, 1≤θ_i≤θ s When the line distance at the reference point is 1 to ρ s Among the lines, using lines with the same reference point spacing as statistical units, the number of times each line is Hough transformed to the corresponding position in the reference coordinate mapping space is counted line by line. Then, the number of times lines with the same reference point spacing and the same reference rotation angle appear at the same polar coordinate point position in the Hough space mapped to the local map is squared. Finally, the squared values ​​of the number of times lines with the same reference rotation angle and different reference point spacing appear are accumulated and summed. This sum is used as the first frequency statistical information, i.e., second frequency statistical information in a reference coordinate mapping space is obtained from the local map through the Hough transform. Then, the process proceeds to step A14.

[0064] Step A14: Calculate the second frequency statistics at each reference rotation angle in sequence according to step A13 to form a discrete sequence of the sum of squares of the linear distribution of the local map. The number of elements in the discrete sequence of the sum of squares of the linear distribution of the local map is the preset number of columns, corresponding to discrete reference rotation angles from 1 to θ. s , which is a discrete angle value, can be an arithmetic progression with a first term of 1 and a common difference of 1 in some embodiments.

[0065] Steps A11 to A14 are equivalent to obtaining the detected and extracted frequencies of each parallel straight line within the same map, but do not obtain the detected and extracted frequencies of each intersecting straight line at different angles and orientations within the same map. Quantitative information of the straight line in the corresponding reference coordinate mapping space with the reference rotation angle as the independent variable is accumulated, and the square sum of the obtained frequencies is then calculated to describe the frequency of straight lines in various directions appearing in the grid map, thereby enabling the robot to identify and locate areas with linear features such as walls and furniture.

[0066] Step A2: Periodically convolve the second frequency statistical information and the first frequency statistical information using the trigonometric function of the reference rotation angle to obtain a cross-correlation signal sequence between the straight line of the local map and the straight line corresponding to the global map; then proceed to step A3. Specifically, the reference point line distance is used as the independent variable, the discrete sequence of the sum of squares of the straight line distribution of the local map is kept unchanged, the reference rotation angle is used to translate the discrete sequence of the sum of squares of the straight line distribution of the global map, and then the two sequences are multiplied with the discrete sequence of the sum of squares of the straight line distribution of the local map and then added together; or the reference point line distance is used as the independent variable, the discrete sequence of the sum of squares of the straight line distribution of the global map is kept unchanged, the reference rotation angle is used to translate the discrete sequence of the sum of squares of the straight line distribution of the local map, and then the two sequences are multiplied with the discrete sequence of the sum of squares of the straight line distribution of the global map and then added together; wherein the cross-correlation between the discrete sequence of the sum of squares of the straight line distribution of the local map and the discrete sequence of the sum of squares of the straight line distribution of the global map can reflect the degree of similarity of the delays of each corresponding reference rotation angle, the discrete sequence of the sum of squares of the straight line distribution of the local map is regarded as the Hough space signal of the local map, and the discrete sequence of the sum of squares of the straight line distribution of the global map is regarded as the Hough space signal of the global map. When obtaining the cross-correlation signal between the discrete sequence of the sum of squares of the local map straight line distribution and the discrete sequence of the sum of squares of the global map straight line distribution, the Hough space signal should be periodically extended because the trigonometric function of the reference rotation angle is periodic.

[0067] As an embodiment, in step A2, the method of periodically convolving the second frequency statistical information and the first frequency statistical information using the trigonometric function of the reference rotation angle to obtain a cross-correlation signal sequence between a straight line in the local map and a straight line corresponding to the global map specifically includes: setting the number of different reference point line distances corresponding to the polar coordinate points in the reference coordinate mapping space as the cumulative number, wherein, in the reference coordinate mapping space, the cumulative number is greater than 0, preferably set to be greater than or equal to 1; when the reference point line distances in the reference coordinate mapping space form an arithmetic progression with a first term of 1 and a tolerance of 1, the cumulative number is ρ s, which can be set as an independent variable in the convolution process; at the same time, the number of polar coordinate points with the same reference point line spacing but different reference rotation angles in the reference coordinate mapping space is set as the reference offset number, which is used to determine whether all sequences have been calculated; then, discrete convolution is performed on the discrete sequence of the sum of squares of the straight line distribution of the global map and the discrete sequence of the sum of squares of the straight line distribution of the local map to obtain a cross-correlation signal sequence of the straight line of the local map and the corresponding straight line of the global map under the periodic extension of different reference rotation angles, so as to achieve periodic extension and accumulation of the second frequency statistical information and the first frequency statistical information using the periodicity of the reference rotation angle to complete the convolution of the first frequency statistical information and the second frequency statistical information; wherein, the trigonometric function periodicity of the reference rotation angle is: based on the trigonometric function relationship in the Hough transform, for the same straight line in the global map or the local map, this is a straight line in the reference coordinate mapping space transformed from the Hough transform, and when the same reference point line spacing is used as the result of the trigonometric function, there is at least one reference rotation angle in the angles obtained by the inverse trigonometric function, and the difference between these reference rotation angles is a multiple of 360 degrees. This embodiment uses a convolution operation to evaluate the similarity between the angular orientations of a line in a local map and a line in a global map within a plurality of discrete angle ranges defined by the reference rotation angle, so as to provide a rotation angle suitable for map matching.

[0068] Specifically, the discrete convolution of the discrete sequence of the sum of squares of the straight line distribution of the global map and the discrete sequence of the sum of squares of the straight line distribution of the local map is specifically:

[0069] The number of different reference point line distances corresponding to the polar coordinate points in the reference coordinate mapping space is set as the cumulative number, which is greater than or equal to 1 and is set as the independent variable in the convolution process; at the same time, the number of polar coordinate points in the reference coordinate mapping space with the same reference point line distance but different reference rotation angles is set as the reference offset number, which is used to determine whether all sequences have been calculated. The reference offset number can be 0.

[0070] Keeping the discrete sequence of the global map straight line distribution square sum unchanged, directly multiply the discrete sequence of the local map straight line distribution square sum with each element of the discrete sequence of the global map straight line distribution square sum at the same reference point line spacing and then add them together, and use them as the first discrete convolution value in the cross-correlation signal sequence. This is regarded as a translation operation of the corresponding reference rotation angle for each element in the discrete sequence of the local map straight line distribution square sum. In this embodiment, the translation operation is a translation in the same direction, and the reference rotation angle in the first translation operation is 0. Then, after each element in the discrete sequence of the local map straight line distribution square sum undergoes a translation operation of the corresponding reference rotation angle, it is multiplied and added with the corresponding element of the discrete sequence of the global map straight line distribution square sum to obtain the convolution value under the current translation operation, which is used as a discrete convolution value in the cross-correlation signal sequence, wherein the discrete sequence of the local map straight line distribution square sum is shifted left or right by the offset amplitude of the corresponding reference rotation angle according to the translation order represented by the current reference offset number, and the offset amplitude of a reference rotation angle is equivalent to an interval of the independent variable. Then, under the same independent variable, it is multiplied and added with each element of the discrete sequence of the global map straight line distribution square sum in pairs to obtain the convolution value under the current translation operation; this is repeated until the reference rotation angles equal to the reference offset number are translated in the same direction to obtain all the discrete convolution values ​​in the cross-correlation signal sequence.

[0071] As another implementation method of discrete convolution, the discrete sequence of the sum of squares of the straight line distribution of the local map is kept unchanged, and the discrete sequence of the sum of squares of the straight line distribution of the global map is directly multiplied by each element of the discrete sequence of the sum of squares of the straight line distribution of the local map at the same reference point line spacing and then added. The multiplication is used as the first discrete convolution value in the cross-correlation signal sequence, and each element in the discrete sequence of the sum of squares of the straight line distribution of the global map is regarded as a translation operation of the corresponding reference rotation angle each time. The translation operation in this embodiment is a translation operation in the same direction, wherein the reference rotation angle under the first translation operation is 0. Then, after each element in the discrete sequence of the global map straight line distribution square sum undergoes a translation operation of the corresponding reference rotation angle, it is multiplied and added with the corresponding element of the discrete sequence of the local map straight line distribution square sum to obtain the convolution value under the current translation operation, which is used as a discrete convolution value in the cross-correlation signal sequence, wherein the discrete sequence of the global map straight line distribution square sum is shifted left or right by the offset amplitude of the corresponding reference rotation angle according to the translation order represented by the current reference offset number, and the offset amplitude of a reference rotation angle is equivalent to an interval of the independent variable, and then multiplied and added with each element of the discrete sequence of the local map straight line distribution square sum under the same independent variable to obtain the convolution value under the current translation operation; this is repeated until the reference rotation angles equal to the reference offset number are translated in the same direction to obtain all the discrete convolution values ​​in the cross-correlation signal sequence.

[0072] The aforementioned embodiment of discrete convolution utilizes the periodicity of the reference rotation angle in the reference coordinate mapping space relative to the reference point line distance, sets the mapping discrete sequence of the translated map and the mapping discrete sequence corresponding to the same map to be matched, multiplies each value in pair by pair and then adds them together, completes the periodic extension of the Hough space, obtains the mutual correlation of each reference rotation angle in the global map and the local map to be matched, and reduces the influence of the angular offset error of the corresponding straight lines in the two maps used for matching.

[0073] Step A3: Calculate and obtain a second preset number of local maxima from the discrete convolution values ​​within the cross-correlation signal sequence (the number is the second preset number of local maxima), and then set the rotation angles corresponding to the second preset number of local maxima currently obtained as the optimal rotation angles between the local map and the global map, and set the rotation angle corresponding to each local maximum as an optimal rotation angle; wherein the cross-correlation signal sequence is a result of a cross-correlation operation based on the reference rotation angle, so there may be multiple maxima at the same reference rotation angle, that is, there may be one or more local maxima as candidates for the rotation angle parameters required for map rotation matching.

[0074] Specifically, the method for calculating and obtaining a second preset number of local maxima from the mutual correlation signal sequence specifically includes: in the reference coordinate mapping space, controlling the mutual correlation signal sequence to perform a partial derivative operation along the direction of the variable axis where the reference rotation angle is located, performing a partial derivative operation on the mutual correlation signal sequence, when the first-order difference of the mutual correlation signal sequence is 0 and the second-order difference of the mutual correlation signal sequence is less than 0, obtaining at least one local maximum discrete convolution value from the mutual correlation signal sequence and determining them as local maxima, wherein the cumulative number of local maxima obtained is a second preset number; then setting all local maxima as the straight line and the global map At the same time, the rotation angles corresponding to all local maxima are set as the optimal rotation angles of the local map relative to the global map. These optimal rotation angles can be used as candidate rotation angles for converting the coordinates calculated by the robot in the local map in real time into the first optimized local map. It should be added that, in the local map constructed in real time, these optimal rotation angles may be the rotation angles of the straight lines extracted in the corresponding directions relative to a reference navigation direction. At the same time, the similarity (matching) of the straight lines extracted in these corresponding directions to the straight lines of the same global map is the greatest.

[0075] In this embodiment, when the first-order difference is 0, at the corresponding polar coordinate point in the reference coordinate mapping space, the rate of change of the cross-correlation signal sequence in the direction of the coordinate axis (variable axis) to which the reference rotation angle corresponding to the polar coordinate point belongs (or the directional derivative in the direction of the coordinate axis (variable axis) to which the reference rotation angle belongs) is 0, and a local maximum or local minimum can be obtained. At this time, the second-order difference is continued to be obtained. When the second-order difference (or the second-order directional derivative of the coordinate axis (variable axis) to which the reference rotation angle belongs) is less than 0, the cross-correlation signal sequence grows slowest in the direction of the coordinate axis (variable axis) to which the reference rotation angle of the corresponding polar coordinate point belongs, and a local maximum is obtained. At this time, the second-order difference of the cross-correlation signal sequence less than 0 corresponds to more than one polar coordinate point in the reference coordinate mapping space, and the maximum point is more than one, so that the local maximum obtained in the end is also more than one. This prevents the algorithm from detecting multiple extremely close "false" straight lines and making misjudgments; furthermore, if the local maximum value in the cross-correlation signal sequence is high enough, only a small amount of time is needed to find it, thereby substantially reducing the calculation time and having high execution efficiency.

[0076] The aforementioned embodiment uses the Hough transform to map a reference coordinate mapping space of the same size and relative distribution area from the global map and the local map respectively, and timely saves the straight line feature information to avoid the loss of map information. Then, the statistical information associated with the straight line is extracted from the respective reference coordinate mapping spaces to perform a convolution operation with the rotation angle as the period to obtain the strength of the cross-correlation between the rotation angle of the straight line of the local map and the rotation angle of the corresponding straight line of the global map, and perform a matching operation between the straight line of the local map and the straight line of the global map; on this basis, the rotation angle corresponding to the convolution value of the local maximum is screened as the optimal rotation angle between the local map and the global map, and the cross-correlation is only evaluated for the distribution frequency characteristics of the corresponding straight line in the reference coordinate mapping space at a specific orientation, thereby accelerating the processing speed of the rotation angle, and thereby accelerating the speed of subsequent conversion of the local map to the global map.

[0077] Based on the aforementioned embodiment, a chip is also disclosed, which is used to store a program. The program is the robot relocation method, which is used to calculate and obtain a cross-correlation signal sequence between a straight line in a local map and a straight line corresponding to a global map, and then calculate and obtain a local maximum from the cross-correlation signal sequence, and use the rotation angle corresponding to this local maximum as a candidate rotation angle and use it to rotate the local map. Then, for each rotated local map, a cross-correlation coefficient is obtained between it and a global map to obtain the corresponding best matching result in combination with the candidate rotation angle; then, for each best matching result, a map similarity is obtained under the corresponding global map through a directed distance field, and then the positioning information corresponding to the matching result with the greatest similarity is selected from multiple global maps as the target position for robot relocation.

[0078] The present invention also protects a robot equipped with the chip, which is used to obtain the optimal rotation angle and optimal translation vector between the local map and the global map based on the mutual correlation between the local map constructed in real time and the corresponding global map, to form an optimal transformation matrix, and then transform a local map into each global map through the corresponding optimal transformation matrix. Finally, different maps are normalized to the same scale for similarity comparison to obtain a positioning result, thereby overcoming the problem that the robot is prone to losing relevant feature information during the positioning process and causing inaccuracy, as well as the problem that traditional methods for calculating map similarity are inefficient, thereby improving the accuracy and efficiency of the robot's positioning using the limited information of the local map and avoiding the occurrence of overlapping maps.

[0079] It will be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the references to memory, storage, database or other media used in the various embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory ROM, programmable memory PROM, electrically programmable memory DPROM, electrically erasable programmable memory DDPROM or flash memory. Volatile memory may include random access memory RAM or external cache memory.

[0080] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0081] The above embodiments merely represent several embodiments of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the concept of the present application, and these modifications and improvements are all within the scope of protection of the present application.

Claims

1. A robot repositioning method, characterized in that: The method comprises the following steps: Step A: Calculating a second preset number of optimal rotation angles based on a correlation between a local map and a global map, rotating a local map using each optimal rotation angle to obtain a second preset number of first local optimized maps; wherein the robot pre-stores the first preset number of global maps; Step B: Controlling the second preset number of first local optimized maps to perform pairwise accelerated convolution with the first preset number of global maps, respectively, to obtain a cross-correlation parameter matrix between each first local optimized map and each corresponding global map; Step C: converting the local map into the corresponding global map according to an optimal transformation matrix composed of an element with the largest value in the same cross-correlation parameter matrix and an optimal rotation angle corresponding to the first local optimized map, and determining to convert the local map into a second local optimized map; Step D: Control the global map to divide the global block map corresponding to the second local optimized map, calculate the directed distance fields of the second local optimized map and the corresponding global block map respectively through the double traversal detection algorithm, and then calculate the average distance between the second local optimized map and the corresponding global block map according to the directed distance field, sum the average distances to obtain the map similarity between the second local optimized map and the corresponding global map, and then select the global map corresponding to the map similarity with the largest value, and then select the matching coordinate position in the currently selected global map as the robot's relocation position according to the optimal transformation matrix corresponding to the map similarity with the largest value.

2. A robot repositioning method according to claim 1, characterized in that: In step D, the method for obtaining the map similarity between the second local optimized map and the corresponding global map includes: Step D1: Segmenting the global map involved in the map similarity calculation into a global block map consisting of locations matching the second local optimized map and having the same size as the second local optimized map; Step D2: defining a set, the set including all matrix elements in the second local optimized map and the corresponding global block map, wherein the values ​​in the set are non-repeated; Step D3, calculating the average distance between a matrix element with a preset value on the second local optimized map and the nearest matrix element with the same value on the corresponding global block map, and calculating the average distance between a matrix element with a preset value on the global block map and the nearest matrix element with the same value on the corresponding second local optimized map; wherein the preset value belongs to the set; Step D4: define a value in the set that is not involved in the calculation as a preset value, return to step D3 to perform calculations until all values ​​in the set are involved in the calculation, and then proceed to step D5; Step D5: Calculate the sum of all average distances obtained in step D3 to obtain the map similarity between the second local optimized map and the corresponding global block map; Each map similarity is matched with a corresponding global map and a corresponding optimal rotation angle.

3. A robot repositioning method according to claim 2, characterized in that: In step D3, the method for calculating the average distance between the matrix elements with preset values ​​on the second local optimization map and the nearest matrix elements with the same values ​​on the corresponding global block map specifically includes the following steps: Step D31, calculating the directed distance field of the global block map; Step D32: Calculate the distances between the matrix elements with preset values ​​on the second local optimized map and all matrix elements with the same values ​​on the directed distance field of the global block map, and take the minimum value. Step D33: Search for the next matrix element whose value on the second local optimization map is the preset value, return to step D32 and continue calculation until all matrix elements whose values ​​on the second local optimization map are the preset value are calculated, and then proceed to step D34; Step D34: Calculate the sum of all minimum values ​​obtained in step D32, and then calculate the average value to obtain the average distance between the matrix element with the preset value on the second local optimization map and the nearest matrix element with the same value on the global block map.

4. A robot repositioning method according to claim 3, characterized in that: In step D31, the method for calculating the directed distance field of the global block map specifically includes: Step D311: Initialize the matrix elements in the global block map; Step D312: Perform a first traversal of the matrix elements in the initialized global block map in the first traversal direction. During the traversal, update the current matrix elements to values ​​that satisfy the first condition. After the first traversal, proceed to step D313. Step D313: Perform a second traversal on the matrix elements in the global block map that have undergone the first traversal in the second traversal direction. During the traversal, update the current matrix elements to values ​​that satisfy the second condition. After the second traversal, obtain the signed distance field corresponding to the global block map.

5. A robot repositioning method according to claim 4, characterized in that: In step D311, the method for initializing the matrix elements in the global block map specifically includes: initializing the matrix elements in the global block map whose values ​​are preset values ​​to 0, and then initializing the other matrix elements to infinity.

6. A robot repositioning method according to claim 4, characterized in that: The first traversal direction in step D312 specifically refers to: starting from the first matrix element in the first row of the global block map, traversing from left to right, after traversing the last matrix element in the first row, continuing to traverse from the first matrix element in the second row from left to right, and so on, until all matrix elements are traversed.

7. A robot repositioning method according to claim 6, characterized in that: The value that satisfies the first condition in step D312 specifically refers to: during the traversal process, taking the matrix element values ​​to the left and above the current matrix element and adding 1 to each, and then comparing the values ​​with the current matrix element value, where the minimum value among the three is the value that satisfies the first condition.

8. A robot repositioning method according to claim 4, characterized in that: The second traversal direction in step D313 specifically refers to: starting from the last matrix element in the last row of the global block map, traversing from right to left, after traversing the first matrix element in the last row, continue traversing from right to left from the last matrix element in the second to last row, and so on, until all matrix elements are traversed.

9. A robot repositioning method according to claim 8, characterized in that: The value that satisfies the second condition in step D313 specifically refers to: during the traversal process, taking the matrix element values ​​to the right and below the current matrix element and adding 1 to each, and then comparing the values ​​with the current matrix element value, where the minimum value among the three is the value that satisfies the second condition.

10. A robot repositioning method according to claim 6 or 8, characterized in that: The traversal starting point of the second traversal direction is the traversal end point of the first traversal direction.

11. A chip for storing a program, characterized in that: The program is the robot repositioning method according to any one of claims 1 to 10.

12. A robot, characterized in that: The robot is equipped with the chip according to claim 11.

Citation Information

Patent Citations

  • Positioning control method, chip and robot based on map matching

    CN113176783B

  • Mobile robot repositioning method based on small sample learning

    CN110553650A

  • Positioning method and device, electronic equipment and storage medium

    CN113256712A