CN116202539A - Robot repositioning method, chip and robot - Google Patents

Robot repositioning method, chip and robot Download PDF

Info

Publication number
CN116202539A
CN116202539A CN202111450874.3A CN202111450874A CN116202539A CN 116202539 A CN116202539 A CN 116202539A CN 202111450874 A CN202111450874 A CN 202111450874A CN 116202539 A CN116202539 A CN 116202539A
Authority
CN
China
Prior art keywords
map
global
local
matrix
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111450874.3A
Other languages
Chinese (zh)
Inventor
赵一帆
黄惠保
陈锦杰
游思遐
张子倩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Amicro Semiconductor Co Ltd
Original Assignee
Zhuhai Amicro Semiconductor Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Amicro Semiconductor Co Ltd filed Critical Zhuhai Amicro Semiconductor Co Ltd
Priority to CN202111450874.3A priority Critical patent/CN116202539A/en
Publication of CN116202539A publication Critical patent/CN116202539A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01CMEASURING DISTANCES, LEVELS OR BEARINGS; SURVEYING; NAVIGATION; GYROSCOPIC INSTRUMENTS; PHOTOGRAMMETRY OR VIDEOGRAMMETRY
    • G01C21/00Navigation; Navigational instruments not provided for in groups G01C1/00 - G01C19/00
    • G01C21/26Navigation; Navigational instruments not provided for in groups G01C1/00 - G01C19/00 specially adapted for navigation in a road network
    • G01C21/28Navigation; Navigational instruments not provided for in groups G01C1/00 - G01C19/00 specially adapted for navigation in a road network with correlation of data from several navigational instruments
    • G01C21/30Map- or contour-matching
    • G01C21/32Structuring or formatting of map data

Landscapes

  • Engineering & Computer Science (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Automation & Control Theory (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Control Of Position, Course, Altitude, Or Attitude Of Moving Bodies (AREA)

Abstract

The invention discloses a repositioning method of a robot, a chip and the robot, wherein the technical scheme is used for acquiring an optimal rotation angle and an optimal translation vector between a local map and a global map according to the cross correlation between the local map and the corresponding global map which are constructed in real time, forming an optimal conversion matrix, converting one local map into each global map through the corresponding optimal conversion matrix, then solving the map similarity between each rotated local map and the corresponding global map, and comparing the sizes of the map similarity to acquire the repositioning result of the robot, so that the problem that the repositioning is inaccurate due to the fact that the robot easily loses related characteristic information in the repositioning process is solved, and the problem that the accuracy and efficiency of calculating the map similarity are low in the traditional method are solved, the accuracy and the efficiency of repositioning by the robot through the limited information of the local map are improved, and the phenomenon of overlapping the map is avoided.

Description

Robot repositioning method, chip and robot
Technical Field
The invention relates to the technical field of robot positioning, in particular to a robot repositioning method, a chip and a robot.
Background
Most indoor intelligent mobile robots at present have the capability of autonomous positioning and navigation, namely, the indoor intelligent mobile robots position and position according to the existing map data in the process of executing tasks, so as to realize autonomous navigation. Repositioning is required when the robot has a map, but does not know where it is located on the map. However, since the features of the grid map are less, the mobile robot is easy to lose related feature information when extracting features from the grid map for repositioning, so that the position of the mobile robot cannot be quickly and accurately found, and when the positioning result is incorrect, the abnormal phenomenon of overlapping the images occurs. In the patent with application number CN202110575423.6, a positioning control method based on map matching is disclosed, and the method calculates correlation coefficients of a plurality of local maps and corresponding global maps through covariance operation to determine the coordinate position of the best match, 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 does not exert a satisfactory effect in practical applications.
Disclosure of Invention
In order to solve the problems, the invention provides a robot repositioning method, a chip and a robot, which are used for quickly and accurately converting a local map which is built in real time into a corresponding global map by calculating matching results of a plurality of global maps and a local map through similarity evaluation so as to realize repositioning. The specific technical scheme of the invention is as follows:
A robot repositioning method, the method comprising the steps of: step A, calculating a second preset number of optimal rotation angles according to the cross correlation between a local map and a global map, and calling each optimal rotation angle to rotate one local map respectively to obtain a second preset number of first local optimized maps; the robot is pre-stored with a first preset number of global maps; step B, controlling the second preset number of first local optimization maps to respectively perform pairwise acceleration convolution with the first preset number of global maps to obtain a cross-correlation parameter matrix of each first local optimization map and each corresponding global map; step C, converting the local map into a corresponding global map according to an optimal conversion matrix formed by an element with the largest value in the same cross-correlation parameter matrix and an optimal rotation angle corresponding to the first local optimization map, and determining to convert the local map into a second local optimization map; and D, controlling the global map to partition a global block map corresponding to the second local optimization map, respectively calculating directed distance fields of the second local optimization map and the corresponding global block map through a double-traversal detection algorithm, respectively calculating the average distance of the mutual mapping of the second local optimization map and the corresponding global block map according to the directed distance fields, summing the average distances to obtain the map similarity between the second local optimization map and the corresponding global map, selecting the global map corresponding to the map similarity with the largest value, and then selecting the matched coordinate position as the repositioning position of the robot in the currently selected global map according to the optimal transformation matrix corresponding to the map similarity with the largest value.
Further, in the step D, the method for obtaining the map similarity between the second locally optimized map and the corresponding global map includes: step D1, dividing a global block map which consists of a position matched with the second local optimization map and has the same size as the second local optimization map in a global map which participates in map similarity calculation; step D2, defining a set, wherein the set comprises a second local optimization map and all matrix elements in a corresponding global block map, and the values in the set are not repeated; step D3, calculating the average distance from the matrix element with the preset value on the second local optimization map to the nearest matrix element with the same value on the corresponding global block map, and calculating the average distance from the matrix element with the preset value on the global block map to the nearest matrix element with the same value on the corresponding second local optimization map; wherein the preset value belongs to the set; step D4, defining one value which does not participate in calculation in the set as a preset value, returning to the step D3 for calculation until all the values in the set participate in calculation, and then entering the step D5; step D5, calculating the sum of all average distances obtained in the step D3 to obtain the map similarity of the second local optimization map and the corresponding global block map; wherein each map similarity matches a corresponding one of the global maps and matches a corresponding one of the optimal rotation angles.
Further, in the step D3, the method for calculating the average distance between the matrix element with the preset value on the second locally optimized map and the nearest matrix element with the same value on the corresponding global block map specifically includes the following steps: step D31, calculating a directed distance field of the global block map; d32, calculating the distances between matrix elements with the preset value on the second local optimization map and all matrix elements originally having the same value on the directed distance field of the global block map respectively, and taking the minimum value of the distances; step D33, searching matrix elements with the preset values on the next second local optimization map, returning to the step D32 for calculation until all the matrix elements with the preset values on the second local optimization map are calculated, and then entering the step D34; and D34, calculating the sum of all the minimum values obtained in the step D32, and then averaging to obtain the average distance from the matrix element with the preset value on the second local optimization map to the nearest matrix element with the same value on the global block map.
Further, in the step D31, the method for calculating the directional distance field of the global block map specifically includes: step D311, initializing matrix elements in the global block map; step D312, performing first traversal on matrix elements in the initialized global block map according to a first traversal direction, updating the current matrix elements to values meeting a first condition in the traversal process, and entering a step D313 after the first traversal is finished; and D313, performing second traversal on the matrix elements in the global partitioned map subjected to the first traversal according to the second traversal direction, updating the current matrix elements to values meeting a second condition in the traversal process, and obtaining a directed distance field corresponding to the global partitioned map after the second traversal is finished.
Further, in the step D311, the method for initializing the matrix element in the global block map specifically includes: and initializing matrix elements with preset values in the global block map to 0, and then initializing other matrix elements to infinity.
Further, the first traversing direction in the step D312 specifically refers to: traversing from left to right starting from the first matrix element of the first row of the global block map, continuing traversing from left to right from the first matrix element of the second row after traversing the last matrix element of the first row, and so on until traversing the complete matrix element.
Further, the value satisfying the first condition in the step D312 specifically refers to: in the traversal process, matrix element values at the left and the upper sides of the current matrix element are taken, added with 1 respectively, and then compared with the current matrix element value, wherein the minimum value among the three values is a value meeting a first condition.
Further, the second traversing direction in the step D313 specifically refers to: traversing from right to left starting from the last matrix element of the last row of the global block map, and after traversing the first matrix element of the last row, traversing from right to left continuing from the last matrix element of the last row, and so on until traversing the complete matrix element.
Further, the value satisfying the second condition in step D313 specifically refers to: in the traversal process, matrix element values on the right side and the lower side of the current matrix element are taken, added with 1 respectively, and then compared with the current matrix element value in size, wherein the minimum value among the three values is a value meeting a second condition.
Further, the traversal start point of the second traversal direction is the traversal end point of the first traversal direction.
A chip for storing a program, which is the robot repositioning method.
A robot equipped with said chip.
The invention has the beneficial effects that: the technical scheme is used for acquiring the optimal rotation angle and the optimal translation vector between the local map and the global map according to the cross correlation between the local map and the corresponding global map which are constructed in real time, forming an optimal conversion matrix, converting one local map into each global map through the corresponding optimal conversion matrix, then solving the map similarity between each rotated local map and the corresponding global map, and acquiring the repositioning result of the robot through the comparison of the size of the map similarity, so that the problems of inaccurate repositioning caused by the fact that the robot easily loses related characteristic information in the repositioning process and the problems of inaccurate accuracy and low efficiency of calculating the map similarity by the traditional method are solved, the accuracy and the efficiency of repositioning by the robot through the limited information of the local map are improved, and the phenomenon of overlapping the map is avoided.
Drawings
Fig. 1 is a flowchart of a robot repositioning method according to an embodiment of the present invention.
Fig. 2 is a flowchart of a method for acquiring a rotation angle based on hough transform according to an embodiment of the invention.
Fig. 3 is a flowchart of a map similarity calculation method according to an embodiment of the invention.
Fig. 4 is a schematic diagram of a directional distance field calculation process according to an embodiment of the invention.
FIG. 5 is a graph illustrating an example of the calculation result of the directed distance field according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described and illustrated below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden on the person of ordinary skill in the art based on the embodiments provided herein, are intended to be within the scope of the present application.
In order to quickly and accurately calculate the offset and the rotation angle (commonly referred to as the gesture transformation of the local map) of the local map constructed by the robot in real time relative to the preset global map, and further control the robot to quickly and accurately reposition under the abnormal conditions of failure, restarting or manual moving and the like of the pose of the robot due to the loss of characteristic information, fig. 1 discloses a repositioning method of the robot, which specifically comprises the following steps:
Step A, calculating a second preset number of optimal rotation angles according to the cross correlation between a local map and a global map, and calling each optimal rotation angle to rotate one local map respectively to obtain a second preset number of first local optimized maps; wherein the robot has a first preset number of global maps stored in advance. As shown in fig. 2, the step a specifically includes: a1, acquiring first frequency count information in a reference coordinate mapping space from a global map through Hough transformation, simultaneously acquiring second frequency count information in the reference coordinate mapping space from a local map through Hough transformation, and setting reference rotation angles applicable to all the reference coordinate mapping spaces; wherein the reference coordinate mapping space belongs to the Hough space; step A2 is then entered. Step A2, the trigonometric function of the reference rotation angle is utilized to periodically convolve the second frequency statistic information and the first frequency statistic information to obtain a cross-correlation signal sequence of a straight line of a local map and a straight line corresponding to a global map, wherein the cross-correlation signal sequence is expressed as the correlation of the straight line of the local map and the straight line of the global map in the rotation angle; step A3 is then entered. And A3, calculating and acquiring a second preset number of local maxima from the cross-correlation signal sequence, and setting the rotation angle corresponding to the second preset number of local maxima which are currently acquired as the optimal rotation angle of the local map relative to the second preset number of global maps, namely the optimal rotation angle of the same local map relative to the second preset number of corresponding global maps. In this embodiment, the optimal rotation angles corresponding to the second preset number of local maxima one by one may be obtained by performing a partial derivative operation on the cross-correlation signal sequence, and each of the optimal rotation angles may be used as a rotation angle of an X axis of a robot coordinate system of the same local map with respect to an X' axis of a global coordinate system of a corresponding global map. It should be added that, in the local map constructed in real time, the optimal rotation angles may be rotation angles of the straight lines extracted in the corresponding directions relative to a reference navigation direction, and at the same time, the similarity degree of the straight lines extracted in the corresponding directions relative to the corresponding straight lines of the same global map is the greatest. The global map is constructed in the same motion area in advance by the robot. By executing the steps A1 to A3, a reference coordinate mapping space with the same size as the relative distribution area is mapped from the global map and the local map respectively by utilizing Hough transformation, the linear characteristic information is stored in time, the linear detection can be quickened, the loss of map information is avoided, statistical information related to the linear is extracted from the respective reference coordinate mapping space, convolution operation taking the rotation angle as a period continuation is carried out, so that the strength of the cross correlation of the rotation angle of the linear of the local map and the rotation angle of the linear corresponding to the global map is obtained, and the matching operation of the linear of the local map and the linear of the global map is executed; on the basis, the rotation angle corresponding to the convolution value of the local maximum value is selected as the optimal rotation angle between the local map and the global map, so that the optimal rotation angle serving as a candidate object is more accurate, the cross correlation is evaluated only aiming at the distribution frequency characteristic of the straight line corresponding to the reference coordinate mapping space in a specific direction, the processing speed of the rotation angle is accelerated, and the speed of converting the subsequent local map into the global map is further accelerated.
In the step A, each optimal rotation angle is called to rotate a local map respectively, and a second preset number of first local optimization maps are obtained, namely the second preset number of first local optimization maps are obtained; step B is then entered. Each first local optimization map has a corresponding optimal rotation angle, preferably, the same local map is rotated by a corresponding optimal rotation angle according to time sequence to obtain the first local optimization map, so that a second preset number of optimal rotation angles are sequentially called to rotate to obtain a second preset number of first local optimization maps; or the same local map is rotated by a corresponding optimal rotation angle to obtain the first local optimization map after different rotation operations, so that a second preset number of optimal rotation angles are synchronously called to rotate to obtain the second preset number of first local optimization maps.
In the step a, the posture of the straight line in the first local optimization map is obtained by rotating the corresponding straight line in the local map towards a specific direction according to the optimal rotation angle, so that the local posture obtained after the corresponding straight line or the corresponding linear feature is rotated is the same as the global posture of the corresponding straight line in the global map in the dimension of the direction posture, the direction posture of the straight line in the first local optimization map is equal to the direction posture of the corresponding straight line in the global map, and the straight line in the local map and the straight line in the global map can be regarded as being matched in direction; in order to perform conversion between the robot coordinate system of the local map and the global coordinate system of the global map and complete accurate positioning of the robot in the map (overcome positioning errors of the robot coordinate system due to sensor installation errors), the present embodiment also requires a translation vector and a rotation matrix composed of trigonometric function values of the optimal rotation angle to complete conversion between the robot coordinate system of the local map and the global coordinate system of the global map (to the same map plane). Therefore, it is necessary to calculate the displacement pose, and in this embodiment, the cross-correlation calculation is performed on the local map and the global map, and the position coordinate with the highest correlation obtained is used as the coordinate offset that is most likely to be matched under the corresponding angle, including the offset of the origin of the robot coordinate system with respect to the origin of the global coordinate system of the global map. The global coordinate system of the global map can be a reference navigation coordinate system used for positioning and ranging in the robot mapping navigation process.
It should be noted that, the formation of a rotation matrix by using trigonometric function values of the optimal rotation angle is realized by adopting a conventional technical means, and as known by those skilled in the art, a rotation matrix is multiplied by coordinates in the local map and added with a translation vector to obtain coordinates in the local map to be converted into coordinates in the global map, wherein by introducing a homogeneous coordinate form and based on a conversion relation between plane rectangular coordinate systems, a rotation matrix and a translation vector can be combined into a conversion matrix, so as to facilitate conversion calculation between coordinate systems.
And B, controlling the second preset number of first local optimization maps to respectively perform pairwise acceleration convolution with the first preset number of global maps to obtain a cross-correlation parameter matrix of each first local optimization map and each corresponding global map, and then entering the step C. Specifically, when the map sizes of the global map and the first local optimization map are larger, in order to reduce huge calculation cost caused by traditional convolution operation, the embodiment uses discrete fourier transform to transform each first local optimization map and a global map corresponding to the convolution from time domain space to frequency domain space, then multiplies a transformation value of the first local optimization map at the frequency domain space position with a transformation value of the global map corresponding to the convolution at the corresponding frequency domain space position, and obtains a cross-correlation parameter matrix through discrete fourier transform inverse transform to complete acceleration convolution so as to replace convolution between the first local optimization map and the global map with convolution of two column elements and obtain the same operation result; wherein, in the first local optimization maps with the second preset number, each first local optimization map is set to perform the acceleration convolution with any global map, and a cross-correlation parameter matrix with the number being the product of the first preset number and the second preset number is obtained, so as to realize the pairwise acceleration convolution; 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, the present embodiment uses the discrete fourier transform to accelerate the convolution calculation of the two maps, and converts the multiplication calculation of the convolution calculation for each item of small window into two-column convolution, so as to reduce the number of calculation times and the occupied amount of the memory, especially the more the transformed map discrete data, the more significant the degree of the saving of the calculation amount, especially the more obvious the magnitude reduction of the calculation amount.
It should be added that this embodiment controls the first locally optimized map (the value of the map coordinate position or the value of the map image at the corresponding matrix element point) and a global map (the value of the map coordinate position or the value of the map image at the corresponding matrix element point) to perform discrete convolution, sets the offset amplitude of one of the operable maps in the horizontal axis direction to be the length of one row of the grid of the first locally optimized map, and sets the offset amplitude of the operable map in the vertical axis direction to be the length of one column of the grid of the first locally optimized map. For example, the global map is taken as a map data item capable of being processed in a translation mode, the whole value included in the whole length of the first local optimization map is set to be a translation parameter in the horizontal axis direction, and the whole value included in the whole width of the first local optimization map is set to be a translation parameter in the vertical axis direction. When the conversion to the frequency domain is followed by multiplication by the corresponding position element, the position specifically involved in the multiplication is known to those skilled in the art who understand the discrete fourier transform, and will not be described in detail herein. The matrix elements of the matrix of the map are values at the coordinate positions of the map or the map image is values at the corresponding matrix element points, the specific values of the matrix elements involved in the map convolution operation include, but are not limited to, the number of times, the frequency and the brightness value of the map image when the straight line falls into the corresponding positions, and the specific value type has negligible influence on the evaluation result of the cross-correlation of each first local optimization map and each corresponding global map.
In this embodiment, in the process of processing the discrete convolution of each first local optimization map and a corresponding global map by using the discrete fourier transform, only the discrete fourier transform result of the matrix element sequence of the corresponding grid map of the current front half is calculated in the frequency domain during each backtracking, i.e. the discrete fourier transform result of the matrix element sequence of the corresponding grid map of the current back half can be calculated, so that the computational complexity is reduced, the magnitude of the computation amount before and after the transformation is reduced from the magnitude of the power to the magnitude of the logarithm, and the difference is obvious.
And C, converting the local map into a corresponding global map according to an optimal conversion matrix formed by an element with the largest value in the same cross-correlation parameter matrix and an optimal rotation angle corresponding to the first local optimization map, and determining to convert the local map into a second local optimization map. Specifically, an element with the largest value is obtained from the same cross-correlation parameter matrix, then the horizontal axis coordinate corresponding to the element with the largest value obtained at present and the vertical axis coordinate thereof and an optimal rotation angle corresponding to the first local optimization map form an optimal conversion matrix between the corresponding global map and the local map, wherein the horizontal axis coordinate corresponding to the element with the largest value obtained at present and the vertical axis coordinate thereof are coordinate offset of the local map which is most matched with the global map, are equivalent to offset of the origin of a robot coordinate system of the local map relative to the horizontal axis and the vertical axis of the origin of the global coordinate system of the global map, can form the translation vector, and the robot is accurately positioned by combining the corresponding optimal rotation angle. And then converting the local map into a corresponding global map by utilizing an optimal conversion matrix, determining to convert the local map into a second local optimized map, wherein the conversion comprises rotating and translating the robot coordinate system, converting the robot coordinate system into the global map so as to facilitate the robot to be positioned in the global map, and completing the matching of the cross-correlation of one local map and the corresponding global map, wherein the second local optimized map is used as a map matching result of the two maps at a corresponding optimal rotation angle. Step D is then entered.
The steps can be seen from the foregoing: the second preset number of optimal conversion matrixes based on the global map can be obtained through processing based on the second preset number of local maps and the global map in a pairwise acceleration convolution mode, so that the second preset number of coordinate offsets relative to the origin of the global coordinate system of the global map are converted, and the second preset number of positioning positions can be positioned in the same global map; on the basis, the two-by-two acceleration convolution based on the second preset number of local maps and the first preset number of global maps can be used for processing and obtaining the optimal conversion matrix processing based on the second preset number of one global map to obtain the coordinate offset with the number of products of the first preset number and the second preset number, and the positioning positions with the number of products of the first preset number and the second preset number can be integrated and positioned in all the global maps.
And D, controlling the global map to partition a global block map corresponding to the second local optimization map, respectively calculating directed distance fields of the second local optimization map and the corresponding global block map through a double-traversal detection algorithm, respectively calculating the average distance of the mutual mapping of the second local optimization map and the corresponding global block map according to the directed distance fields, summing the average distances to obtain the map similarity between the second local optimization map and the corresponding global map, selecting the global map corresponding to the map similarity with the largest value, and then selecting the matched coordinate position as the repositioning position of the robot in the currently selected global map according to the optimal transformation matrix corresponding to the map similarity with the largest value. Each global map can calculate a second preset number of repositioning results based on a corresponding number of optimal transformation matrices with a second preset number, wherein each optimal rotation angle corresponds to one repositioning result, and at this time, it is required to evaluate which repositioning result is the most matched and the most accurate in all global maps.
Specifically, as shown in fig. 3, in the present embodiment, the method for obtaining the map similarity between the second locally optimized map and the corresponding global map includes: and D1, dividing a global block map which consists of a position matched with the second local optimization map and has the same size as the second local optimization map in the global map which participates in the similarity calculation of the map, namely dividing the block map with the same size (equal length and equal width) from the global map in order to facilitate the similarity calculation of matrix elements one by one, and then entering the step D2. In step D2, a set P is defined first, and statistics is performed on all matrix elements in the second local optimization map and the corresponding global block map. It should be noted that, the map according to the present invention is a grid map, and the occupancy state of the grid is generally represented by a free and a local, so that the set P includes the free and/or the local without repeated values, and then the process proceeds to step D3. And D3, calculating the average distance of the matrix elements with the preset value on the second local optimization map to the nearest matrix elements with the same value on the corresponding global block map, and calculating the average distance of the matrix elements with the preset value on the global block map to the nearest matrix elements with the same value on the corresponding second local optimization map, and then entering the step D4. Wherein the preset value belongs to the set P.
In the process of executing the step D3, the method further includes the following steps:
step D31, calculating a directional distance field of the global block map, and then proceeding to step D32. It is noted that a directed distance field (Signed Distance Field, SDF), a data set that identifies distance parameters to a specified location, while also identifying directions by signs. The SDF is used for rendering characters instead of the traditional alpha-test (transparent test), can use smaller text textures and can be seamlessly integrated with the traditional alpha-test method without serious distortion of magnification, and has great advantages in text rendering, but smaller directed distance field textures need to be calculated through a larger text picture. The finite distance field is usually calculated by adopting a recursive algorithm, the time complexity is O (nlogn), the linear time O (n) cannot be reached, and the calculation speed is low. Therefore, the embodiment adopts a double-traversal detection algorithm to optimize the calculation process of the SDF so as to improve the calculation speed. Fig. 4 discloses a schematic diagram of a directional distance field calculation process, and referring to fig. 4, a method for calculating a directional distance field of a global block map specifically includes:
step D311, initializing matrix elements in the global block map, and the left diagram Init of fig. 4 shows the initialized global block map. The method for initializing the matrix elements in the global block map specifically comprises the following steps: initializing matrix elements with preset values in the global block map to 0, initializing other matrix elements to infinity, and indicating zero boundaries by the position marked with 0 in the map Init, wherein the preset values belong to the values in the set sum P. The initialization process provides for the subsequent minimum value to be taken.
Step D312, performing first traversal on matrix elements in the initialized global block map according to the first traversal direction, updating the current matrix elements to values meeting a first condition in the traversal process, and entering step D313 after the first traversal is finished. In this embodiment, the first traversal direction specifically refers to: traversing from left to right starting from the first matrix element of the first row of the global block map, continuing traversing from left to right from the first matrix element of the second row after traversing the last matrix element of the first row, and so on until traversing the complete matrix element, namely traversing all matrix elements of the global block map according to rules from left to right and from top to bottom. In the traversal process, the traversed matrix element (called the current matrix element) needs to be updated, specifically, the matrix element values at the left and the upper sides of the current matrix element are taken and respectively added with 1, then the values are compared with the current matrix element values, and the minimum value of the three values is taken and assigned to the current matrix element. Referring to fig. 4, the middle graph registration Step 1 shows a first traversal of the global block map, in which black matrix element points are the activated position, i.e., the current matrix element, and gray matrix element points are neighbor, i.e., the adjacent matrix elements (in this embodiment, the matrix elements to the left and above the current matrix element are taken). Assuming that the current matrix element is infinity, the left matrix element is 0, and the upper matrix element is infinity, then the left and upper matrix elements become 1 and infinity after 1 is added, respectively, the minimum value of the three is 1, and then the current matrix element is updated to be 1. The above mentioned positions of 0 are boundaries, so that the meaning of 1 is that the current matrix element is at a distance of 1 from the boundary. It should be noted that, because the first traversal direction is from the top left corner to the bottom right corner of the global block map, taking the values of matrix elements to the left and above the current matrix element may avoid taking matrix elements that are not traversed, i.e., matrix elements that have not yet been updated, such values are not computationally meaningful.
Alternatively, the first traversing direction may be from the last matrix element of the first row of the global block map, from right to left, after the first matrix element of the first row is traversed, from the last matrix element of the second row is continuously traversed from right to left, and so on, until the complete matrix element is traversed, i.e. all matrix elements of the global block map are traversed according to a rule from right to left and from top to bottom. In addition, the traversal starting point of the first traversal direction may be a matrix element where other vertices of the global block map are located, and traversal is performed in the diagonal direction according to the similar rule, which is not described herein. 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, the matrix elements to the right and above the current matrix element need to be fetched when the values are compared, which is also to avoid fetching matrix elements that are not traversed. When the first traversing direction changes, the value needs to be adaptively changed, and details are not repeated.
And D313, performing second traversal on the matrix elements in the global partitioned map subjected to the first traversal according to the second traversal direction, updating the current matrix elements to values meeting a second condition in the traversal process, and obtaining a directed distance field corresponding to the global partitioned map after the second traversal is finished. In this embodiment, the second traversal direction specifically refers to: traversing from right to left from the last matrix element of the last row of the global block map, after traversing the first matrix element of the last row, traversing from right to left from the last matrix element of the last row, and so on until traversing the complete matrix element, namely traversing all matrix elements of the global block map according to rules from right to left and from bottom to top. In the traversal process, the traversed matrix elements are required to be updated again, specifically, matrix element values on the right side and the lower side of the current matrix element are taken, 1 is added respectively, then the values are compared with the current matrix element values, and the minimum value of the three values is taken to be assigned to the current matrix element. Referring to fig. 4, the right graph correlation Step 2 shows a second traversal of the global block map, in which black matrix element points are the activated position, i.e., the current matrix element, and gray matrix element points are neighbor, i.e., neighboring matrix elements (in this embodiment, the matrix elements to the right and below the current matrix element are taken). Assuming that the current matrix element is 0, the right matrix element is infinity, and the lower matrix element is 1, then the right and lower matrix elements become infinity and 2 after adding 1, respectively, and the minimum value among the three is 0, so that the current matrix element is still 0 (because the current matrix element is a boundary).
The first traversal direction is traversed by the first traversal direction. For example, the first traversal is ended at the bottom left matrix element of the global block map (starting from the top right) and the second traversal is started from the bottom left matrix element (then the second traversal is ended at the top right matrix element). This is because the first traversal starts from the upper right corner, only the distance from 0 to the matrix elements to the right and above the current matrix element is updated, so the second traversal needs to update the distance from 0 to the matrix elements to the left and below, and the second traversal start point is set as the traversal end point of the first traversal direction, which can meet this requirement.
As shown in fig. 5, this embodiment is an exemplary graph of the calculation result of the directed distance field. The upper left part of the figure 5 is a global block map, the upper right part is a directed distance field corresponding to the global block map, and the lower part is a numerical form corresponding to the directed distance field. It should be noted that the directional distance field on the right is a vector rendering diagram, and the global block map can be restored without distortion after being amplified, the directional distance field is calculated by adopting a double-traversal detection algorithm, the approximate result of the directional distance field calculated by the traditional algorithm can be obtained by only traversing the global block map twice, the calculation time complexity of the double-traversal detection algorithm is O (n), namely, the linear speed is reached, and the calculation speed of the directional distance field is greatly improved.
And D32, calculating the distances between matrix elements with the preset value on the second local optimization map and all matrix elements originally having the same value on the directed distance field of the global block map, and taking the minimum value of the distances. In the process of executing step D32, the second local optimization map takes a matrix element with a value of a preset value, and finds all 0 positions (i.e. positions with original values of the preset value) on the directed distance field of the global block map, sequentially calculates the distances between the first position and all 0 positions of the second position, and takes the minimum value as the result of step D32. Preferably, the distance in the embodiment adopts Manhattan distance, and the calculation method is simple and quick.
And D33, searching for matrix elements with preset values on the next second local optimization map, returning to the step D32 for calculation until all matrix elements with preset values on the second local optimization map are calculated, and then entering the step D34. In combination with step D32 and step D33, it is easy to see that, calculating the average distance from the matrix element with the preset value on the second locally optimized map to the nearest matrix element with the same value on the global block map requires multiple traversals and operations, so that the calculation complexity is high.
And D34, calculating the sum of all the minimum values obtained in the step D32, and then averaging to obtain the average distance from the matrix element with the preset value on the second local optimization map to 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 from the pixel with the preset value on the global block map to the nearest pixel with the same value on the second local optimization map is consistent with the foregoing, and only the positions of the second local optimization map and the global block map are exchanged, so that the calculation principle is consistent and not repeated.
And D4, defining one value which does not participate in calculation in the set as a preset value, returning to the step D3 for calculation until all the values in the set participate in calculation, and then entering the step D5. In the process of executing step D4, all values in the set P are traversed to calculate two average distances in step D3, and then the next step is executed.
And D5, calculating the sum of all average distances obtained in the step D3 to obtain the map similarity of the second local optimization map and the corresponding global block map, wherein the result can be used as a reference for measuring whether the two images are similar or not, and each map similarity is matched with a corresponding global map and is matched with a corresponding optimal rotation angle.
Preferably, in 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 locally optimized map has a corresponding one of the optimal rotation angles with respect to the local map. In this embodiment, each optimal rotation angle matches an optimal transformation matrix for a global map, and further determines a position information on a corresponding direction gesture of the corresponding global map, so as to provide sufficient pre-stored map information and map information for real-time positioning for positioning of the robot, and the robustness of a positioning algorithm is improved by setting a plurality of candidate positioning objects (such as the optimal rotation angle and the optimal translation vector mentioned in this embodiment) and mapping transformation relations (optimal transformation matrix) thereof, so as to overcome the problem that the robot easily loses related map feature information.
In the foregoing embodiment, the optimal conversion matrix is used to represent an origin offset and a 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 conversion matrix; the origin of the robot coordinate system is set as the center of the upper surface of the robot or the current position of the robot, then the coordinate offset (the change of the horizontal axis coordinate) extracted from the optimal conversion matrix corresponding to the map correlation coefficient with the largest value is set as the coordinate value of the global map corresponding to the map correlation coefficient with the largest value, because the coordinate offset is converted into the coordinate value set relative to the origin of the global coordinate system of the global map, the matched coordinate position is formed, and finally the coordinate position is determined as the positioning position of the robot in the currently selected global map. Therefore, conversion calculation between coordinate systems is facilitated, repositioning of the robot under abnormal conditions such as failure or restarting of the pose of the robot is accelerated, the robot can obtain complete self coordinates and poses in the process of mapping, positioning and navigation, and the navigation precision is higher.
In summary, in this embodiment, a plurality of optimal rotation angles are obtained as candidate rotation angles based on the cross correlation between the local map and the global map, and then the candidate rotation angles are utilized to rotate the same local map to obtain a plurality of rotated local maps; aiming at each rotated local map, the cross-correlation coefficient of the local map and a global map is calculated so as to calculate a corresponding optimal matching result by combining candidate rotation angles; and then solving the map similarity under the corresponding global map for each best matching result to normalize the map similarity to the same scale for comparison, and selecting positioning information corresponding to the best matching result with the largest similarity from a plurality of global maps as the target position of robot repositioning. Thereby: combining the correlation of a plurality of global maps and a plurality of candidate rotation angles, firstly screening an optimal conversion matrix corresponding to each candidate rotation angle by utilizing a cross-correlation coefficient matrix based on a local map and a global map, then converting a local map into each global map through the corresponding optimal conversion matrix, and finally normalizing different maps to the same scale for similarity comparison so as to obtain a positioning result, thereby solving the problem of inaccurate repositioning caused by easy loss of relevant characteristic information in the positioning process of the robot, improving the accuracy and efficiency of repositioning by utilizing the limited information of the local map, enhancing the robustness of a repositioning algorithm, and reducing the interference of the conversion error of a map coordinate system.
As an embodiment, fig. 2 is a flowchart of a method for obtaining a rotation angle based on hough transform according to an embodiment of the present invention, that is, a specific step of step a disclosed in fig. 1. The specific method for calculating the second preset number of optimal rotation angles according to the cross correlation between the straight line of a local map and the straight line of a global map in the Hough space comprises the following steps:
a1, acquiring first frequency count information in a reference coordinate mapping space from a global map through Hough transformation, simultaneously acquiring second frequency count information in the reference coordinate mapping space from a local map through Hough transformation, and setting reference rotation angles applicable to all the reference coordinate mapping spaces; step A2 is then entered. The second frequency count information and the first frequency count information are both numbers of occurrences reflecting straight lines in a specific direction in the corresponding hough space. The global map is constructed in the same motion area in advance by the robot.
It should be noted that, in this embodiment, the core idea of the hough transform is to map a point set (two-dimensional) belonging to a certain graph in the map onto a point (which may be a high-dimensional), where the point records the number of points in the point set, and the point is a parameter of the graph that is intended to be searched, and the range of the parameter is called a parameter space, that is, the reference coordinate mapping space. The hough transform can not only identify the presence or absence of a graphic to be detected in the map constructed by the scan, but also locate the graphic (including position, angle, etc.). When this feature that is attempted to be extracted is located within the set of points and can be described mathematically, a look-up can be made by a hough transform.
The hough transform is a method of detecting straight lines and various geometric figures in a binary image, and this embodiment focuses on the detection of straight lines in a grid map, since many linear features are considered to exist on walls inside a building.
The straight line extraction method related to the embodiment is to transform all straight lines in the corresponding map into polar coordinate points in the Hough space, and the polar coordinate points are used for representing a set of straight lines of the global map or the local map; wherein different polar coordinate points represent different straight lines, and at least one straight line is represented on the same polar coordinate point; the polar coordinate point comprises a rotation angle and a point-line distance, the rotation angle is an included angle formed by the normal line of the straight line represented by the polar coordinate point and the positive direction of the transverse axis of the coordinate system of the map, and the point-line distance is the geometric vertical distance from the origin of the coordinate system of the map to which the polar coordinate point belongs to the straight line represented by the polar coordinate point. If the hough transform is repeated to the same polar coordinate point, a new vote is cast for the corresponding polar coordinate point in the accumulator space, i.e. a count is added, all points are calculated in this way, and it is inevitable that some point voting numbers are local maxima (i.e. peaks). The embodiment maps the straight lines with the same shape in one map space to points in the other coordinate space based on Hough transformation to vote and count, and forms a peak value to complete conversion processing of the straight line information, so that the problem of detecting the straight line characteristics of the environment is converted into a statistical peak value problem. By introducing probability peak statistics, the robot mapping and positioning algorithm has better robustness to noise or incomplete shapes, and the influence of map linear feature loss in the robot navigation process is reduced. It should be noted that, in the conventional hough transform straight line detection algorithm, the peak value generated in the accumulator space represents strong evidence that a corresponding straight line exists in the image.
In order to increase the detection speed, the present embodiment uses discrete hough transform (DiscrDtizDd Hough Transform, DHT), where the DHT divides a matrix HS with a preset number of rows and a preset number of columns from the hough space, which is defined as the reference coordinate mapping space, and belongs to the matrix space in the hough space.
The reference coordinate mapping space (parameter space) is not continuous, but is an array space composed of rectangular cells (accumulation units) each having stored therein frequency count information (accumulated result of the number of times of occurrence of conversion) corresponding to (ρ, θ). In this embodiment, the reference rotation angle is a rotation angle of a 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, which are adaptively set according to an actual environment traversed by the robot; when the rotation angle is set to 0, the point-line distance correspondingly matched in the same grid map is in infinite condition; when the dot-line distance is set to 0, the rotation angle corresponding to the match within the same grid map is infinite. Therefore, in order to create an effective reference coordinate mapping space within the hough space, the maximum value of the reference rotation angle is set to θ s The ginseng is prepared fromSetting the minimum value of the rotation angle to be 1; the maximum value of the line distance of the reference point is set as ρ s The minimum value of the reference point line distance is set to be 1; and extracting straight lines on walls in the grid map (global map and local map) as far as possible, intuitively displaying the occurrence frequency of the straight lines in a specific direction on the grid map, and reflecting the distribution position characteristics of the straight lines in the grid map by combining the statistical information and the polar coordinate information of the reference coordinate mapping space. Specifically, the number of lines of the 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, i.e. the preset number of lines is equivalent to the number of parallel straight lines extracted from the map, and in some embodiments, is preferably set as ρ s In particular, the reference point line in the reference coordinate mapping space is separated from the arithmetic series which forms the first term 1 and has 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 distance but different reference rotation angles, namely the preset column number, which is equivalent to the number of intersecting straight lines extracted from the map, and is preferably set as theta in some embodiments s In particular, the reference rotation angles within the reference coordinate mapping space constitute an arithmetic progression with a first order of 1 and a tolerance of 1; the polar coordinate points of the reference coordinate mapping space are all discrete.
Preferably, the number of columns of the reference coordinate mapping space may also be the number of polar coordinate points with the same reference rotation angle but different reference point line distances, which is equal to the preset number of columns; the number of lines of the reference coordinate mapping space is the number of polar coordinate points with the same reference point line distance but different reference rotation angles and is equal to the preset number of lines; in this embodiment, the polar coordinate points arranged in the reference coordinate mapping space are all discretely distributed.
In the foregoing embodiment, the element of each row and each column in the reference coordinate mapping space is 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 a cartesian coordinate system. In this embodiment, reference coordinate mapping spaces with the same size and the same relative distribution area are mapped from the global map and the local map respectively and are used as parameter spaces to be detected, wherein the number of polar coordinate points with the same reference rotation angle and different reference point line distances represents the number of parallel straight lines in the corresponding map, the number of polar coordinate points with the same reference point line distances and different reference rotation angles represents the number of straight lines in the corresponding map, so that the straight line parameters described by the reference coordinate mapping spaces are more comprehensive, and more comprehensive straight line segments are covered in the corresponding map area.
As an embodiment, in the step A1, the following steps are specifically performed:
a11, extracting straight lines in the global map, then converting the currently extracted straight lines Hough into corresponding reference coordinate mapping space, and then obtaining the square sum by utilizing the times that the straight lines with different reference point line distances on the same reference rotation angle are respectively extracted, namely when the reference rotation angle theta is equal to a certain value theta_i, 1 is less than or equal to theta_i is less than or equal to theta s At a reference point, the line distance is 1 to ρ s And taking the straight lines with the same reference point line distance as a statistical unit, counting the times that each straight line is subjected to Hough transformation to the corresponding position in the reference coordinate mapping space one by one, squaring the times that the straight lines with the same reference point line distance with the same reference rotation angle appear at the same polar coordinate point position in the Hough space correspondingly mapped in the global map, and finally accumulating and summing square values of the times that the straight lines with different reference point line distances with the same reference rotation angle appear, wherein the sum value is used as the first frequency statistical information, namely acquiring the first frequency statistical information in the reference coordinate mapping space from the global map through Hough transformation, and the straight lines with different reference point line distances on the same reference rotation angle are equivalent to the parallel straight lines in the global map. Step a12 is then entered.
Step A12, calculating the first frequency statistic information on each reference rotation angle in sequence according to the step A11 to form a discrete sequence of the square sum of the linear distribution of the global map, wherein the discrete sequence of the square sum of the linear distribution of the global map is inThe number of elements of (2) is the preset number of columns, and the corresponding discrete reference rotation angle is 1 to theta s Belonging to discrete angle values, may be an arithmetic series with a first order of 1 and a tolerance of 1 in some embodiments.
A13, extracting straight lines in the local map, then converting the straight lines Hough into corresponding reference coordinate mapping spaces, and then obtaining square sums by utilizing the times that the straight lines with different reference point line distances on the same reference rotation angle are respectively extracted, wherein the straight lines with different reference point line distances on the same reference rotation angle are equivalent to parallel straight lines in the local map, and the square sums are used as the second frequency statistic information; then go to step a14; that is, when the reference rotation angle θ is equal to a certain value θ_i, 1.ltoreq.θ_i.ltoreq.θ s At a reference point, the line distance is 1 to ρ s And taking the straight lines with the same reference point line distance as a statistical unit, counting the times that each straight line is subjected to Hough transformation to the corresponding position in the reference coordinate mapping space one by one, squaring the times that the straight lines with the same reference point line distance with the same reference rotation angle appear at the same polar coordinate point position in the Hough space correspondingly mapped by the local map, and finally accumulating and summing the square values of the times that the straight lines with different reference point line distances with the same reference rotation angle appear, wherein the sum value is used as the first frequency statistic information, namely obtaining second frequency statistic information in one reference coordinate mapping space from the local map through Hough transformation. Step a14 is then entered.
And A14, sequentially calculating the second frequency statistic information on each reference rotation angle according to the step A13 to form a discrete sequence of the square sum of the linear distribution of the local map. Wherein the number of elements in the discrete sequence of the square sum of the linear distribution of the local map is the preset number of columns, and the corresponding discrete reference rotation angle is 1 to theta s Belonging to discrete angle values, may be an arithmetic series with a first order of 1 and a tolerance of 1 in some embodiments.
Step A11 to step A14 are equivalent to obtaining the frequency numbers of detected and extracted of each parallel straight line in the same map, but do not obtain the frequency numbers of detected and extracted of each crossed straight line in different angle orientations in the same map, accumulating quantization information taking a reference rotation angle as an independent variable in a corresponding reference coordinate mapping space to form the straight line, squaring the obtained frequency numbers, and describing the frequency conditions of the straight lines in all directions in a grid map by using the obtained frequency numbers to realize the identification and positioning evaluation of the robot on the areas such as walls, furniture and the like with linear characteristics.
A2, convolving the second frequency statistic information and the first frequency statistic information periodically by utilizing the trigonometric function of the reference rotation angle to obtain a cross-correlation signal sequence of a straight line of the local map and a straight line corresponding to the global map; step A3 is then entered. Specifically, the reference point line distance is taken as an independent variable, a discrete sequence of the local map linear distribution square sum is kept unchanged, the discrete sequence of the global map linear distribution square sum is translated by utilizing the reference rotation angle, and then multiplied by the discrete sequence of the local map linear distribution square sum by two respectively and added; or taking the reference point line distance as an independent variable, keeping the discrete sequence of the linear distribution square sum of the global map unchanged, translating the discrete sequence of the linear distribution square sum of the local map by using the reference rotation angle, multiplying the translation sequence by the discrete sequence of the linear distribution square sum of the global map by each other, and adding the translation sequence; the cross-correlation between the discrete sequence of the local map linear distribution square sum and the discrete sequence of the global map linear distribution square sum can be reflected to the similarity degree of delay of each corresponding reference rotation angle, the discrete sequence of the local map linear distribution square sum is regarded as a hough space signal of the local map, and the discrete sequence of the global map linear distribution square sum is regarded as a hough space signal of the global map. When the cross-correlation signal of the discrete sequence of the local map linear distribution sum of squares and the discrete sequence of the global map linear distribution sum of squares is found, since the trigonometric function of the reference rotation angle is periodic, the hough space signal should be subjected to periodic continuation.
As an embodiment, in the step A2, the second frequency is counted periodically by using a trigonometric function of the reference rotation angleThe method for obtaining the cross-correlation signal sequence of the straight line of the local map and the straight line corresponding to the global map specifically comprises the following steps: setting the number of different reference point line distances corresponding to the polar coordinate points in the reference coordinate mapping space as the accumulation times, wherein the accumulation times are more than 0, preferably more than or equal to 1 in the reference coordinate mapping space; when the reference point line in the reference coordinate mapping space is 1 from the component leader and the tolerance is 1, the accumulated times is ρ s Can be set as an argument in the convolution process; meanwhile, setting the number of polar coordinate points with the same reference point line distance but different reference rotation angles in the reference coordinate mapping space as reference offset times for judging whether all sequences are calculated; performing discrete convolution on the discrete sequence of the linear distribution square sum of the global map and the discrete sequence of the linear distribution square sum of the local map to obtain a cross-correlation signal sequence of the linear of the local map and the corresponding linear of the global map under the periodic extension action of different reference rotation angles, and performing periodic extension and accumulation on the second frequency statistic information and the first frequency statistic information by utilizing the periodicity of the reference rotation angles to finish convolution of the first frequency statistic information and the second frequency statistic information; wherein the trigonometric function periodicity of the reference rotation angle is: based on trigonometric function relation in the Hough transform, for the same straight line in the global map or the local map, which is a straight line in the reference coordinate mapping space, when the same reference point line distance is used as a result of trigonometric function, at least one reference rotation angle exists in angles obtained by the inverse trigonometric function, and the difference value of the reference rotation angles is a multiple of 360 degrees. In the embodiment, the similarity degree of the angular orientations of the straight line in the local map and the straight line in the global map is evaluated in a plurality of discrete angle ranges defined by the reference rotation angle in a convolution operation mode so as to provide a rotation angle suitable for map matching.
Specifically, the discrete convolution of the discrete sequence of the global map linear distribution square sum and the discrete sequence of the local map linear distribution square sum specifically includes:
setting the number of different reference point line distances corresponding to polar coordinate points in the reference coordinate mapping space as accumulation times, wherein the accumulation times are greater than or equal to 1 and set as independent variables in the convolution process; meanwhile, the number of polar coordinate points with the same reference point line distance but different reference rotation angles in the reference coordinate mapping space is set as the reference offset frequency, and the reference offset frequency can be 0 for judging whether all sequences are calculated.
And (3) keeping the discrete sequence of the square sum of the linear distribution of the global map unchanged, directly multiplying the discrete sequence of the square sum of the linear distribution of the local map with each element of the discrete sequence of the square sum of the linear distribution of the global map by two under the same reference point line distance, and adding the discrete sequence of the square sum of the linear distribution of the local map as a first discrete convolution value in the cross-correlation signal sequence, wherein each element in the discrete sequence of the square sum of the linear distribution of the local map is regarded as a translation operation of a corresponding reference rotation angle every time, and the translation operation in the embodiment is translation 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 local map linear distribution square sum generates translation operation of a corresponding reference rotation angle, multiplying the translation operation with the corresponding element of the discrete sequence of the global map linear distribution square sum, and adding the multiplied translation operation to obtain a convolution value under the current translation operation, wherein the discrete sequence of the local map linear distribution square sum is used as a discrete convolution value in the cross-correlation signal sequence, the corresponding offset amplitude of the reference rotation angle is moved leftwards or rightwards according to the translation sequence represented by the current reference offset times, the offset amplitude of the reference rotation angle is equal to an interval of an independent variable, and then multiplying the multiplied convolution value with each element of the discrete sequence of the global map linear distribution square sum by two under the same independent variable, and adding the multiplied convolution value under the current translation operation; and repeating the steps until the reference rotation angles with the number of the reference offset times are translated along the same direction, and obtaining all the discrete convolution values in the cross-correlation signal sequence.
As another discrete convolution implementation manner, the discrete sequence of the square sum of the linear distribution of the local map is kept unchanged, the discrete sequence of the square sum of the linear distribution of the global map is directly multiplied by each element of the discrete sequence of the square sum of the linear distribution of the local map by two under the same line distance of a reference point, and then added, and is regarded as a first discrete convolution value in the cross-correlation signal sequence, and each element in the discrete sequence of the square sum of the linear distribution of the global map is regarded as a translation operation of a corresponding reference rotation angle every time, wherein the translation operation in the embodiment is a translation operation in the same direction, and the reference rotation angle under the first translation operation is 0. Then, after each element in the discrete sequence of the global map linear distribution square sum generates translation operation of a corresponding reference rotation angle, multiplying the translation operation with the corresponding element of the discrete sequence of the local map linear distribution square sum, and adding the multiplied translation operation to obtain a convolution value under the current translation operation, wherein the discrete sequence of the global map linear distribution square sum is used as a discrete convolution value in the cross-correlation signal sequence, the corresponding offset amplitude of the reference rotation angle is moved leftwards or rightwards according to the translation sequence represented by the current reference offset times, the offset amplitude of the reference rotation angle is equal to an interval of an independent variable, and then multiplying the multiplication operation with each element of the discrete sequence of the local map linear distribution square sum by two under the same independent variable, and adding the multiplication operation to obtain the convolution value under the current translation operation; and repeating the steps until the reference rotation angles with the number of the reference offset times are translated along the same direction, and obtaining all the discrete convolution values in the cross-correlation signal sequence.
The foregoing discrete convolution embodiment uses the periodicity of the reference rotation angle in the reference coordinate mapping space relative to the reference point line distance to set the two-two multiplication of each value in the mapping discrete sequence of the map with translation and the mapping discrete sequence corresponding to the same map to be matched, and then adds the two-two multiplication to complete the period prolongation of the hough space, so as to obtain the cross correlation of the global map and the local map, which need to be matched, of each reference rotation angle, and reduce the influence of the angle offset error of the corresponding straight line in the two maps used for matching.
A3, calculating and obtaining a second preset number of local maxima (the number is the second preset number of local maxima) from discrete convolution values in the cross-correlation signal sequence, and setting the rotation angle corresponding to the second preset number of local maxima which are obtained currently as the optimal rotation angle between the local map and the global map, wherein the rotation angle corresponding to each local maxima is set as an optimal rotation angle; the cross-correlation signal sequence is the result of cross-correlation operation based on the reference rotation angle, so that a plurality of maxima, namely one or more local maxima, may exist under the same reference rotation angle as candidates of rotation angle parameters required by map rotation matching.
Specifically, the method for calculating and obtaining the second preset number of local maxima from the cross-correlation signal sequence specifically includes: in the reference coordinate mapping space, controlling the cross-correlation signal sequence to execute a partial derivative operation along the direction of the variable axis where the reference rotation angle is located, executing a partial derivative operation on the cross-correlation signal sequence, and obtaining at least one local maximum discrete convolution value from the cross-correlation signal sequence and determining the local maximum value from the cross-correlation signal sequence when the first-order difference of the cross-correlation signal sequence is 0 and the second-order difference of the cross-correlation signal sequence is smaller than 0, wherein the number of the local maximum values obtained by accumulation is a second preset number; setting all local maxima as discrete convolution values with the greatest similarity between the straight line of the local map and the straight line of the global map, setting the rotation angles corresponding to all local maxima as the optimal rotation angles of the local map relative to the global map respectively, wherein the optimal rotation angles can be used as candidate rotation angles for converting coordinates obtained by real-time calculation of a robot in the local map into the first optimal local map, and supplementing that in the local map constructed in real time, the optimal rotation angles can be rotation angles of the straight lines extracted in the adaptive directions relative to a reference navigation direction, and meanwhile, the similarity (matching) degree of the straight lines extracted in the adaptive directions relative to the straight line of the same global map is the greatest.
In this embodiment, when the first order difference is found to be 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 of the coordinate axis (variable axis) to which the reference rotation angle belongs) is 0, a local maximum value or a local minimum value may be obtained, at this time, the second order difference is continuously found, and 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 most slowly in the direction of the coordinate axis (variable axis) to which the reference rotation angle corresponding to the corresponding polar coordinate point belongs, so as to obtain a local maximum value, at this time, the second order difference of the cross-correlation signal sequence less than 0 is not only one polar coordinate point corresponding to the reference coordinate mapping space, so that the finally obtained local maximum value is not only one. Thus, misjudgment caused by the fact that a plurality of extremely adjacent false straight lines are detected by an algorithm is prevented; furthermore, if the local maxima existing in the cross-correlation signal sequence are high enough, only a small part of time is needed for searching, so that the calculation time is substantially reduced, and the execution efficiency is high.
According to the embodiment, the reference coordinate mapping space with the same size as the relative distribution area is mapped from the global map and the local map through Hough transformation, the linear characteristic information is stored in time, loss of map information is avoided, statistical information related to the linear is extracted from the respective reference coordinate mapping space, convolution operation taking the rotation angle as a period continuation is carried out, so that the strength of the cross correlation of the rotation angle of the linear of the local map and the rotation angle of the linear corresponding to the global map is obtained, and matching operation of the linear of the local map and the linear of the global map is executed; on the basis, the rotation angle corresponding to the convolution value of the local maximum value is selected as the optimal rotation angle between the local map and the global map, and the cross correlation is evaluated only aiming at the distribution frequency characteristic of the corresponding straight line in the reference coordinate mapping space in a specific direction, so that the processing speed of the rotation angle is accelerated, and the speed of converting the subsequent local map into the global map is further accelerated.
Based on the foregoing embodiment, a chip is further disclosed, where the chip is configured to store a program, where the program is the robot repositioning method, and is configured to calculate and obtain a cross-correlation signal sequence of a straight line of a local map and a straight line corresponding to a global map, calculate and obtain a local maximum value from the cross-correlation signal sequence, use a rotation angle corresponding to the local maximum value as a candidate rotation angle and use the candidate rotation angle to rotate the local map, and calculate a cross-correlation coefficient with respect to each rotated local map and one global map to calculate a corresponding best matching result in combination with the candidate rotation angle; and then solving the similarity of the maps through a directed distance field under the corresponding global map according to each optimal matching result, and selecting positioning information corresponding to the matching result with the largest similarity from a plurality of global maps as the target position for robot repositioning.
The invention also protects a robot, the robot is provided with the chip, the robot is used for acquiring the optimal rotation angle and the optimal translation vector between the local map and the global map according to the cross correlation between the local map which is built immediately and the corresponding global map to form an optimal conversion matrix, then one local map is converted into each global map through the corresponding optimal conversion matrix, finally, different maps are normalized to the same scale for similarity comparison so as to obtain a positioning result, the problem that the robot is inaccurate due to the fact that relevant characteristic information is easily lost in the positioning process is solved, the problem that the traditional method is low in calculating the map similarity is solved, the accuracy and the efficiency of positioning by using limited information of the local map are improved, and the phenomenon of overlapping of the map is avoided.
Those skilled in the art will appreciate that implementing all or part of the above described embodiment methods may be accomplished by way of a computer program stored in a non-transitory computer readable storage medium, which when executed, may comprise the steps of embodiments of the above described methods. References to memory, storage, databases, or other media used in the various embodiments provided herein may include non-volatile and/or volatile memory. The 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 can include random access memory RAM or external cache memory.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing embodiments are merely representative of several embodiments of the invention, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application.

Claims (12)

1. A method of repositioning a robot, the method comprising the steps of:
step A, calculating a second preset number of optimal rotation angles according to the cross correlation between a local map and a global map, and calling each optimal rotation angle to rotate one local map respectively to obtain a second preset number of first local optimized maps; the robot is pre-stored with a first preset number of global maps;
step B, controlling the second preset number of first local optimization maps to respectively perform pairwise acceleration convolution with the first preset number of global maps to obtain a cross-correlation parameter matrix of each first local optimization map and each corresponding global map;
Step C, converting the local map into a corresponding global map according to an optimal conversion matrix formed by an element with the largest value in the same cross-correlation parameter matrix and an optimal rotation angle corresponding to the first local optimization map, and determining to convert the local map into a second local optimization map;
and D, controlling the global map to partition a global block map corresponding to the second local optimization map, respectively calculating directed distance fields of the second local optimization map and the corresponding global block map through a double-traversal detection algorithm, respectively calculating the average distance of the mutual mapping of the second local optimization map and the corresponding global block map according to the directed distance fields, summing the average distances to obtain the map similarity between the second local optimization map and the corresponding global map, selecting the global map corresponding to the map similarity with the largest value, and then selecting the matched coordinate position as the repositioning position of the robot in the currently selected global map according to the optimal transformation matrix corresponding to the map similarity with the largest value.
2. The robot repositioning method according to claim 1, wherein in the step D, the method of obtaining the map similarity between the second locally optimized map and the corresponding global map comprises:
Step D1, dividing a global block map which consists of a position matched with the second local optimization map and has the same size as the second local optimization map in a global map which participates in map similarity calculation;
step D2, defining a set, wherein the set comprises a second local optimization map and all matrix elements in a corresponding global block map, and the values in the set are not repeated;
step D3, calculating the average distance from the matrix element with the preset value on the second local optimization map to the nearest matrix element with the same value on the corresponding global block map, and calculating the average distance from the matrix element with the preset value on the global block map to the nearest matrix element with the same value on the corresponding second local optimization map; wherein the preset value belongs to the set;
step D4, defining one value which does not participate in calculation in the set as a preset value, returning to the step D3 for calculation until all the values in the set participate in calculation, and then entering the step D5;
step D5, calculating the sum of all average distances obtained in the step D3 to obtain the map similarity of the second local optimization map and the corresponding global block map;
Wherein each map similarity matches a corresponding one of the global maps and matches a corresponding one of the optimal rotation angles.
3. The method for repositioning the robot according to claim 2, wherein in the step D3, the method for calculating the average distance between the matrix element with the preset value on the second locally optimized map and the nearest matrix element with the same value on the corresponding global block map specifically includes the following steps:
step D31, calculating a directed distance field of the global block map;
d32, calculating the distances between matrix elements with the preset value on the second local optimization map and all matrix elements originally having the same value on the directed distance field of the global block map respectively, and taking the minimum value of the distances;
step D33, searching matrix elements with the preset values on the next second local optimization map, returning to the step D32 for calculation until all the matrix elements with the preset values on the second local optimization map are calculated, and then entering the step D34;
and D34, calculating the sum of all the minimum values obtained in the step D32, and then averaging to obtain the average distance from the matrix element with the preset value on the second local optimization map to the nearest matrix element with the same value on the global block map.
4. A method for repositioning a robot according to claim 3, wherein in step D31, the method for calculating the directional distance field of the global block map specifically comprises:
step D311, initializing matrix elements in the global block map;
step D312, performing first traversal on matrix elements in the initialized global block map according to a first traversal direction, updating the current matrix elements to values meeting a first condition in the traversal process, and entering a step D313 after the first traversal is finished;
and D313, performing second traversal on the matrix elements in the global partitioned map subjected to the first traversal according to the second traversal direction, updating the current matrix elements to values meeting a second condition in the traversal process, and obtaining a directed distance field corresponding to the global partitioned map after the second traversal is finished.
5. The method for repositioning the robot of claim 4, wherein in the step D311, the method for initializing the matrix elements in the global block map specifically comprises: and initializing matrix elements with preset values in the global block map to 0, and then initializing other matrix elements to infinity.
6. The method for repositioning a robot according to claim 4, wherein the first traversing direction in the step D312 specifically refers to: traversing from left to right starting from the first matrix element of the first row of the global block map, continuing traversing from left to right from the first matrix element of the second row after traversing the last matrix element of the first row, and so on until traversing the complete matrix element.
7. The method for repositioning a robot according to claim 6, wherein the value satisfying the first condition in step D312 specifically refers to: in the traversal process, matrix element values at the left and the upper sides of the current matrix element are taken, added with 1 respectively, and then compared with the current matrix element value, wherein the minimum value among the three values is a value meeting a first condition.
8. The method according to claim 4, wherein the second traversing direction in the step D313 specifically refers to: traversing from right to left starting from the last matrix element of the last row of the global block map, and after traversing the first matrix element of the last row, traversing from right to left continuing from the last matrix element of the last row, and so on until traversing the complete matrix element.
9. The robot repositioning method according to claim 8, wherein the value satisfying the second condition in step D313 specifically refers to: in the traversal process, matrix element values on the right side and the lower side of the current matrix element are taken, added with 1 respectively, and then compared with the current matrix element value in size, wherein the minimum value among the three values is a value meeting a second condition.
10. The robotic repositioning method of claim 6 or 8, wherein the second traversal direction has a traversal start point that is a 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 it is equipped with a chip as claimed in claim 11.
CN202111450874.3A 2021-12-01 2021-12-01 Robot repositioning method, chip and robot Pending CN116202539A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111450874.3A CN116202539A (en) 2021-12-01 2021-12-01 Robot repositioning method, chip and robot

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111450874.3A CN116202539A (en) 2021-12-01 2021-12-01 Robot repositioning method, chip and robot

Publications (1)

Publication Number Publication Date
CN116202539A true CN116202539A (en) 2023-06-02

Family

ID=86506499

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111450874.3A Pending CN116202539A (en) 2021-12-01 2021-12-01 Robot repositioning method, chip and robot

Country Status (1)

Country Link
CN (1) CN116202539A (en)

Similar Documents

Publication Publication Date Title
CN111780763B (en) Visual positioning method and device based on visual map
CN111640157B (en) Checkerboard corner detection method based on neural network and application thereof
CN110930454A (en) Six-degree-of-freedom pose estimation algorithm based on boundary box outer key point positioning
CN109859226B (en) Detection method of checkerboard corner sub-pixels for graph segmentation
CN111145228B (en) Heterologous image registration method based on fusion of local contour points and shape features
CN111540005B (en) Loop detection method based on two-dimensional grid map
CN113269094B (en) Laser SLAM system and method based on feature extraction algorithm and key frame
CN111750864A (en) Repositioning method and device based on visual map
CN110907947A (en) Real-time loop detection method in SLAM problem of mobile robot
CN116129037B (en) Visual touch sensor, three-dimensional reconstruction method, system, equipment and storage medium thereof
CN110929598B (en) Unmanned aerial vehicle-mounted SAR image matching method based on contour features
US11288839B2 (en) Supermarket shopping cart positioning method, supermarket shopping cart positioning system, and supermarket shopping cart
CN117036623B (en) Matching point screening method based on triangulation
CN113538620A (en) SLAM mapping result evaluation method oriented to two-dimensional grid map
CN117590362A (en) Multi-laser radar external parameter calibration method, device and equipment
CN116202539A (en) Robot repositioning method, chip and robot
CN117058008A (en) Remote sensing image geometry and radiation integrated correction method, device, equipment and medium
CN113176783B (en) Positioning control method based on map matching, chip and robot
CN116203937A (en) Map fusion method, chip and robot
CN111178366B (en) Mobile robot positioning method and mobile robot
CN114387353A (en) Camera calibration method, calibration device and computer readable storage medium
CN113340258B (en) Hough transform-based rotation angle acquisition method, chip and robot
CN112069445A (en) 2D SLAM algorithm evaluation and quantification method
CN113112547A (en) Robot, repositioning method thereof, positioning device and storage medium
CN112927256A (en) Boundary fusion method and device for partitioned area and mobile robot

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination