Angle-based robot repositioning method
By combining a single-point ranging sensor and a gyroscope on the robot, a target sub-map is constructed and line segment matching is performed, which solves the problem of positioning error in inertial navigation and realizes low-cost, high-precision robot repositioning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AMICRO SEMICONDUCTOR CO LTD
- Filing Date
- 2022-06-20
- Publication Date
- 2026-06-05
AI Technical Summary
Existing robots suffer from gyroscope cumulative angle errors in inertial navigation, leading to inaccurate positioning. This is particularly difficult to eliminate in low-cost solutions, and relying on rotating LiDAR or vision-assisted positioning is costly and involves a large amount of data processing.
A method combining a single-point ranging sensor and a gyroscope is adopted. By rotating within the global working area to construct a target sub-map and performing similarity matching of fitted line segments, the robot's position and angle errors are corrected. Relocalization is then performed using point cloud data and gyroscope angle information.
It improves the robot's positioning accuracy within the global working area, reduces computational load and cost, overcomes positioning errors caused by inertial sensors, and achieves accurate positioning under uncertain position and angle information.
Smart Images

Figure CN117288183B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of robot navigation, and more particularly to an angle-based robot relocalization method. Background Technology
[0002] SLAM, as a localization and map reconstruction technology, enables mobile robots to perceive their own position and surrounding environment through the use and fusion of various sensors. Currently, commercially available robots with localization capabilities primarily rely on rotating LiDAR or vision-assisted positioning, resulting in relatively high costs, requiring significant chip resources, and necessitating the filtering and processing of large amounts of data during localization tasks. Currently, some robots relying on inertial navigation systems use gyroscopes for navigation and localization. However, gyroscopes exhibit numerous errors during robot movement, such as temperature drift, zero drift, and wandering errors. These errors accumulate over time, and in low-cost solutions, they cannot be eliminated. Furthermore, gyroscope angular errors can cause the coordinates marked on the map to deviate from the actual physical location, especially when the robot is randomly placed in a previously traversed area, making it difficult to accurately pinpoint its location. Summary of the Invention
[0003] To address the aforementioned technical deficiencies, this invention discloses an angle-based robot relocalization method. In inertial navigation with a gyroscope for angle measurement, without knowing the current position or angle information, the robot can relocalize itself within the global working area by utilizing only the fitting results of point cloud data collected by a single-point ranging sensor and the matching results between two sub-frames. The specific technical solution is as follows:
[0004] An angle-based robot relocalization method is proposed, wherein the robot relocalization method is executed by a robot with a fixedly mounted single-point ranging sensor and gyroscope. The single-point ranging sensor is used to collect point cloud data of the robot's environment and mark it on a map, and the gyroscope is used to collect the robot's angle information. The robot relocalization method includes: Step 1, the robot determines its current window, wherein there is at least one window in the global working area; Step 2, the robot rotates sequentially at different rotation center positions within the current window, and constructs a target sub-map at each rotation center position; Step 3, within the global working area, when the robot selects a window adjacent to the current window as the next window, the robot moves to the next window, updates the next window to the current window, and then repeats Step 2 until the robot has traversed the entire working area. Step 4: Within the global working area, the robot controls the rotation of the target sub-image and then controls the similarity matching of the length of the fitted line segments in the rotated target sub-image with the fitted line segments in other target sub-images. Step 5: When the matching success rate between the fitted line segments in two target sub-images reaches the first preset success rate, it is determined that the two target sub-images are successfully matched, and the angle error and error coordinate offset are obtained. Then, the angle error is used to process the current rotation center position of the robot to obtain a temporary repositioning position. Step 6: When the robot has matched all target sub-images, the robot averages all the obtained error coordinate offsets to obtain the positioning coordinate compensation. Then, the positioning coordinate compensation is used to correct the latest obtained temporary repositioning position to obtain the repositioning position, thus completing the repositioning of the robot within the global working area.
[0005] Furthermore, for two target sub-graphs within the global working area, the robot sets one target sub-graph as a reference target sub-graph and the other as a target sub-graph to be matched. Specifically, before performing line length similarity matching between a fitted line segment in the reference target sub-graph and a fitted line segment in the target sub-graph in step 4, the target sub-graph to be matched is rotated by a preset angle step. When the target sub-graph to be matched rotates by the preset angle step in a preset clockwise direction, the robot updates the rotated target sub-graph to be matched and then performs line length similarity matching between a fitted line segment in the reference target sub-graph and a fitted line segment in the target sub-graph. When the matching success rate between the fitted line segment in the reference target sub-graph and the fitted line segment in the target sub-graph reaches a first preset success rate, the robot... The angle by which the latest updated target sub-image to be matched has rotated relative to the original target sub-image to be matched is set as the angle error. The angle error is then used to correct the robot's initial pose angle at the current rotation center position to obtain the temporary relocation angle. The coordinates of the robot's current rotation center position are then transformed using the angle error to obtain the coordinates of the temporary relocation position. When the robot has matched all target sub-images within all windows of the global working area, the robot updates the coordinates of the latest obtained temporary relocation position to the coordinates of the relocation position, and updates the latest obtained temporary relocation angle to the robot's initial pose angle at the relocation position. The initial pose angle of the robot at the current rotation center position is the angle between the robot's forward direction before rotation and the coordinate axis at the current rotation center position.
[0006] Further, in step 1, the position of the robot when performing step 1 is taken as the center of the current window. A preset extension distance is extended horizontally to the left of the center of the current window, and a preset extension distance is extended horizontally to the right of the center of the current window to form the horizontal side length of the current window. The preset extension distance is equal to half of the maximum ranging distance of the single-point ranging sensor, so as to scan multiple line feature sub-maps within the current window. The window is a rectangular area defined in the map, used to divide the global working area and limit the coverage of the line feature sub-maps scanned by the robot within the corresponding area.
[0007] Furthermore, the windows adjacent to the currently occupied window include the windows adjacent to the top, bottom, left, and right sides of the currently occupied window; the shapes of all windows adjacent to the currently occupied window are the same as the shape of the currently occupied window, and the sizes of all windows adjacent to the currently occupied window are the same as the size of the currently occupied window; the x-coordinates of all points in the windows adjacent to the top of the currently occupied window are equal to the x-coordinates of all points in the currently occupied window, and the difference between the y-coordinates of all vertices in the windows adjacent to the top of the currently occupied window and the y-coordinates of vertices at the same position in the currently occupied window is the vertical side length of the currently occupied window; the x-coordinates of all points in the windows adjacent to the bottom of the currently occupied window are equal to the x-coordinates of all points in the currently occupied window, and the current window... The difference between the ordinate of each vertex of the current window and the ordinate of the vertex in the same position relative to the lower adjacent window of the current window is the vertical side length of the current window; the ordinates of each point in the right adjacent window of the current window are equal to the ordinates of each point in the current window, and the difference between the x-coordinates of each vertex in the right adjacent window of the current window and the x-coordinates of the vertex in the same position relative to the current window is the horizontal side length of the current window; the ordinates of each point in the left adjacent window of the current window are equal to the ordinates of each point in the current window, and the difference between the x-coordinates of each vertex in the current window and the x-coordinates of the vertex in the same position relative to the left adjacent window of the current window is the horizontal side length of the current window; wherein, the same positional relationship means that the relative positional relationship between two vertices with respect to the center of their respective windows is the same.
[0008] Further, in step 2, the method for constructing the target sub-map includes: whenever the robot rotates one revolution at the rotation center position, controlling the single-point ranging sensor to collect point cloud data during the robot's rotation, then fitting the corresponding line segments within each angle range, then setting the portion of the fitted line segments within the current window as a set of fitted line segments within the current window, then forming a line feature sub-map from the set of fitted line segments, determining that a line feature sub-map has been scanned, and setting the line feature sub-map as the target sub-map; wherein, the point cloud data includes the coordinate information of the position point scanned by the single-point ranging sensor and the angle information of the position point; whenever a line feature sub-map is scanned, the robot also records its coordinates and initial pose angle at the rotation center position, the coordinates of the rotation center position being relative position coordinates formed with the position where the robot was when performing step 1 as the origin.
[0009] Further, in step 2, the method for constructing the target sub-map includes: the robot sequentially rotates a preset number of times at different rotation center positions within the current window, and scans a preset number of line feature sub-maps at each rotation center position. Then, at each rotation center position, the scanned line feature sub-maps of the preset number of times are merged into a corresponding target sub-map; wherein, one rotation center position corresponds to one merged target sub-map; wherein, whenever the robot rotates one revolution at the rotation center position, the single-point ranging sensor is controlled to collect point cloud data during the robot's rotation, and then fitted into line segments with corresponding directions within each angle range. The portion of the fitted line segments with corresponding directions within the current window is then set as a set of fitted line segments within the current window, and then the set of fitted line segments is combined into a line feature sub-map to determine that a line feature sub-map has been scanned, wherein, a set of fitted line segments contains at least one fitted line segment.
[0010] Further, in step 2, the method of merging the scanned line feature sub-images of a preset number of revolutions at each rotation center position into a target sub-image includes: Step 21, the robot rotates in place at a rotation center position for the current revolution, then the robot performs fitting processing on the point cloud data collected for the current revolution to obtain a set of fitted line segments within the current window, and then combines the set of fitted line segments into a line feature sub-image; Step 22, it is determined whether the number of revolutions the robot has rotated in place at the rotation center position mentioned in step 21 is equal to the preset number of revolutions. If yes, step 23 is executed; otherwise, step 24 is executed; Step 23, the robot has scanned the line feature sub-images of a preset number of revolutions and stops rotating in place at the rotation center position; then, during the process of the robot traversing the fitted line segments within the line feature sub-images of a preset number of revolutions, the robot selects one of the line feature sub-images as a template. Subgraph; The robot sequentially determines whether each fitted line segment in the template subgraph completely overlaps with the fitted line segments in each of the other line feature subgraphs. If so, the two currently determined completely overlapping fitted line segments are set as the same fitted line segment in the target subgraph; otherwise, the two currently determined partially overlapping fitted line segments are set as two fitted line segments in the target subgraph. After the robot has determined each fitted line segment in the template subgraph and any fitted line segment in each of the other line feature subgraphs, it obtains each fitted line segment in the target subgraph, completing the merging of the line feature subgraphs with a preset number of revolutions into the target subgraph. Step 24: The robot updates the next revolution to the current revolution and then executes step 22. Wherein, the robot rotating in place at a rotation center position for the current revolution means that the robot rotates 360 degrees around the rotation center position. Wherein, the preset number of revolutions is set to be greater than the value 1.
[0011] Furthermore, the shape of the currently occupied window is rectangular; the horizontal side length of the currently occupied window is equal to the maximum ranging distance of the single-point ranging sensor; the vertical side length of the currently occupied window is greater than or equal to the robot's body diameter; half of the maximum ranging distance of the single-point ranging sensor is equal to a preset extension distance; the robot sets the center of the currently occupied window as the first rotation center position; the robot sets the vertical central axis of the currently occupied window as the baseline; the robot sets the positions located at half the preset extension distance from the center of the currently occupied window and on two symmetrical directions perpendicular to the baseline as the second first rotation center position and the second second rotation center position, respectively; the robot sets the positions located at the preset extension distance from the center of the currently occupied window and on two symmetrical directions perpendicular to the baseline as the third first rotation center position and the third second rotation center position, respectively; wherein, the first rotation center position, the second first rotation center position, the second second rotation center position, the third first rotation center position, and the third second rotation center position all belong to the rotation center positions, and the robot sequentially and non-repeatingly traverses each of the rotation center positions within the currently occupied window to scan multiple line feature sub-maps within the currently occupied window.
[0012] Further, in step 2, whenever the robot detects that the length of the fitted line segment corresponding to the direction is greater than a preset fitting length threshold, the following situation exists: when the fitted line segment corresponding to the direction is located within the current window, the robot sets the fitted line segment corresponding to the direction as the fitted line segment and marks it on the map, and records the coordinates of the starting point, the coordinates of the ending point, and the tilt angle of the fitted line segment corresponding to the direction, thus determining and recording the fitted line segment corresponding to the direction; wherein, the tilt angle is set as the angle formed by the fitted line segment corresponding to the direction and the coordinate axis; wherein, the criteria for judging that two line segments are different include different starting point coordinates, different ending point coordinates, or different tilt angles; wherein, the fitted line segment corresponding to the direction is the target straight line equation that the robot fits into the point cloud data collected within the corresponding angle range using the least squares method, and the target straight line equation represents the line segment corresponding to the direction.
[0013] Further, in step 5, the matching success rate between the fitted line segments of the two target subgraphs is the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment length; wherein, the fitted line segment pair participating in the similarity matching of line segment length consists of a fitted line segment in one target subgraph and a fitted line segment in another target subgraph; within the global working area, the target subgraph group containing the two fitted line segments participating in the similarity matching of line segment length constitutes a target subgraph pair; in a target subgraph pair, one target subgraph is set as the reference target subgraph, and the other target subgraph is set as the target subgraph to be matched, which is the target subgraph rotated in step 4.
[0014] Further, in step 4, the method for matching the similarity of the length of the fitted line segments in the target sub-image after the robot controls the rotation with the fitted line segments in other target sub-images is as follows: the robot controls the fitted line segments in the target sub-image to be matched to perform similarity matching of the length of the fitted line segments at corresponding positions in the reference target sub-image; the method for matching the similarity of the length of the fitted line segments in the target sub-image to be matched to the fitted line segments at corresponding positions in the reference target sub-image specifically includes: step 41, calculating the absolute value of the difference between the length of a fitted line segment in the target sub-image to be matched and the length of a fitted line segment in the reference target sub-image; step 42, when step 41 When the absolute value of the difference is less than or equal to a preset length threshold, it is determined that a fitted line segment in the target sub-image to be matched and a fitted line segment at the corresponding position in the reference target sub-image have successfully matched in terms of line segment length similarity, and the fitted line segment currently undergoing line segment length similarity matching is marked as a successfully matched fitted line segment pair; when the absolute value of the difference in step 41 is greater than the preset length threshold, it is determined that a fitted line segment in the target sub-image to be matched and a fitted line segment at the corresponding position in the reference target sub-image have failed to match in terms of line segment length similarity, and the fitted line segment currently undergoing line segment length similarity matching is marked as a failed matched fitted line segment pair.
[0015] Furthermore, when the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment lengths is greater than or equal to a first preset success rate, it is determined that the target subgraph to be matched and the reference target subgraph are successfully matched, and marked as a successfully matched target subgraph pair; within the global working area, when the ratio of the number of all successfully matched target subgraph pairs to the number of all target subgraph pairs participating in the matching is greater than or equal to a second preset success rate, the similarity matching of line segment lengths between the fitted line segments in the target subgraph to be matched and the fitted line segments in the reference target subgraph is stopped; wherein, all target subgraph pairs participating in the matching include any two different target subgraphs.
[0016] Furthermore, before the robot performs length similarity matching between each fitted line segment in the target sub-image to be matched and the fitted line segment at the corresponding position in the reference target sub-image, or when it detects that the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching is less than the first preset success rate, the robot sets the rotation center position corresponding to the target sub-image to be matched as the offset starting position; then it controls the target sub-image to be matched to translate along the predetermined coordinate axis direction from the offset starting position according to the preset translation step size; each time the target sub-image to be matched is translated once, the translated target sub-image to be matched is updated to the target sub-image to be matched, and then the robot is controlled to execute steps 41 and 42.
[0017] Furthermore, provided that the coordinate offset of the target sub-image to be matched, translated from its offset starting position along the same coordinate axis, does not reach the maximum preset offset, whenever the target sub-image to be matched is translated by a preset translation step, the robot determines whether the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment lengths is greater than or equal to the first preset success rate. If so, it is determined that the target sub-image to be matched is successfully matched with the reference target sub-image, and the coordinate offset of the target sub-image to be matched, translated from its offset starting position along the latest translation direction, is... The displacement is set to the error coordinate offset, and then the target sub-image to be matched is controlled to stop translating; otherwise, the robot adjusts the direction of the predetermined coordinate axis to the opposite or perpendicular coordinate axis direction, updates the opposite or perpendicular coordinate axis direction to the predetermined coordinate axis direction, and then controls the target sub-image to be matched to translate along the predetermined coordinate axis direction from the offset starting position by the preset translation step size; if the coordinate offset of the target sub-image to be matched translated along the same coordinate axis direction from the offset starting position has reached the maximum preset offset, then the robot determines that the match is successful. When the ratio of the number of all fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment lengths is less than a first preset success rate, the robot adjusts the direction of the predetermined coordinate axis to an opposite or perpendicular coordinate axis direction, then updates the opposite or perpendicular coordinate axis direction to the predetermined coordinate axis direction, and then controls the target sub-image to be matched to translate along the predetermined coordinate axis direction from the offset starting position by the preset translation step size; wherein, the same target sub-image to be matched, starting from the offset starting position, translates along the predetermined coordinate axis direction by the coordinate... Before the offset reaches the maximum preset offset, whenever the same target sub-image to be matched is translated once along the predetermined coordinate axis direction by the preset translation step, the translated target sub-image to be matched is updated to the target sub-image to be matched, and then steps 41 and 42 are executed; whenever the robot matches each fitted line segment in the target sub-image to be matched with the fitted line segment at the corresponding position in the reference target sub-image, the robot determines whether the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment length is greater than or equal to the first preset success rate.
[0018] Furthermore, when the coordinate offset of the target sub-image to be matched, which has been translated along all coordinate axes from the offset starting position, reaches the maximum preset offset, if the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in similarity matching is less than the first preset success rate, then it is determined that the target sub-image to be matched has failed to match the reference target sub-image. Then, excluding the pair of target sub-images that failed to match, steps 4 and 5 are executed. The preset maximum positioning error is associated with the maximum preset offset, which includes the maximum preset offset coordinate in the horizontal axis direction and the maximum preset offset coordinate in the vertical axis direction.
[0019] Furthermore, when the robot has traversed all the target sub-images within all windows of the global working area, the robot obtains multiple error coordinate offsets. If the robot determines that the number of currently obtained error coordinate offsets is greater than the preset processing number, then among all the currently obtained error coordinate offsets, the error coordinate offsets with the largest horizontal coordinate value, the error coordinate offsets with the smallest horizontal coordinate value, the error coordinate offsets with the largest vertical coordinate value, and the error coordinate offsets with the smallest vertical coordinate value are all removed; then the average value of the remaining error coordinate offsets is calculated to obtain the average coordinate offset; then the average coordinate offset is set as the positioning coordinate compensation value; wherein, each error coordinate offset includes a horizontal axis error coordinate offset and a vertical axis error coordinate offset; each positioning coordinate compensation value includes a horizontal axis positioning coordinate compensation value and a vertical axis positioning coordinate compensation value.
[0020] The beneficial technical effect of this invention is that, in scenarios where the robot is uncertain about its current position coordinates, angle information, and the coordinate systems of the constructed line feature sub-maps are not unified, before performing similarity matching on the fitted line segments within two target sub-maps or line feature sub-maps (which can be equivalent to target sub-maps), the robot will also perform a rotation transformation on one of the target sub-maps or line feature sub-maps (which can be equivalent to target sub-maps). This can overcome the positioning error caused by the inertial sensor by using a trial rotation when the pose is uncertain. Similarly, the robot itself will also merge the line feature sub-maps composed of fitted line segments by rotating in place, making the corresponding point cloud data in the merged target sub-map more uniform and dense, thereby improving the positioning accuracy of the robot using the target sub-map.
[0021] In the process of matching the similarity of the line segments of fitted line segments within two target sub-images or line feature sub-images, only the line segment length is used for comparison. First, a pair of fitted line segments whose similarity meets a certain ratio is marked. Then, the two target sub-images containing the fitted line segment pairs with suitable similarity that meet a certain ratio are marked. In the subsequent relocalization process, only when two target sub-images are successfully matched will an error coordinate offset be obtained for correcting or relocalizing the robot's position. Moreover, a reasonable upper limit is set for the number of successfully matched target sub-image pairs within each window to reduce the computational load of calling target sub-images and matching localization. Attached Figure Description
[0022] Figure 1 This is a flowchart of an angle-based robot relocalization method disclosed in one embodiment of the present invention. Detailed Implementation
[0023] The technical solutions of the embodiments of the present invention will be described in detail below with reference to the accompanying drawings. To further illustrate the embodiments, the present invention provides accompanying drawings. These drawings are part of the disclosure of the present invention, mainly used to illustrate the embodiments, and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these drawings, those skilled in the art should be able to understand other possible implementations and the advantages of the present invention. The flowchart depicts a process or method. Although the flowchart describes the steps as sequential processes, many of the steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. The process can be terminated when its operation is complete, but may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subroutine, etc.
[0024] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification, claims and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product or device.
[0025] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. The implementation conditions used in the embodiments can be further adjusted according to the specific manufacturer's conditions, and the implementation conditions not specified are generally those in routine experiments.
[0026] As one embodiment, this invention discloses an angle-based robot relocalization method. The robot relocalization method is executed by a robot with a fixedly mounted single-point ranging sensor and gyroscope. The single-point ranging sensor is used to collect point cloud data of the robot's environment and mark it on a map. The single-point ranging sensor does not have a rotating mechanism like a lidar sensor; it can be a TOF sensor, which is fixedly mounted on one side of the robot. This embodiment relies on the robot's body rotation (generally a 360-degree rotation) to drive the fixedly mounted single-point ranging sensor to scan the surrounding environment and obtain multi-contour discrete points (which can be regarded as position points) reflecting the environment and the resulting point cloud map. That is, it collects environmental features around the robot to obtain point cloud data, processes the point cloud data to obtain relevant straight lines, and uses these straight lines to construct an environmental map (which belongs to the map). The gyroscope is used to collect the robot's rotation angle. When the robot rotates, the gyroscope and the single-point ranging sensor collect data synchronously. The map built by the robot also needs to be transformed according to the angle collected by the gyroscope, such as transforming the pose information included in the point cloud data into a coordinate system.
[0027] Preferably, the single-point ranging sensor can be a Time-of-Flight (TOF) sensor, fixedly installed on either side of the robot's body, including the left or right side. As long as the distance to obstacles and walls on the side where the single-point ranging sensor is located can be accurately measured during the robot's movement, a straight line can be marked on the corresponding grid map. However, it is limited by the maximum ranging distance of the TOF sensor. That is, during the scanning of surrounding obstacles, the effective ranging distance of the TOF sensor allows for point cloud errors or a certain level of accuracy, and is configured to sample at a certain frequency to acquire and record the robot's pose information during movement. It should be noted that TOF stands for Time of Flight. TOF sensors generally require the use of a specific artificial light source for measurement, that is, by measuring the "time of flight" between the transmitter and reflector of signals such as ultrasound, microwaves, and light to calculate the distance between them. There are many types of TOF sensors, with those using infrared or laser ranging being the most commonly used. The robot provided in this embodiment includes a planned-movement sweeping robot, enabling the sweeping robot to clean in a preset direction.
[0028] As one example, such as Figure 1 As shown, the robot relocalization method includes:
[0029] Step S1: The robot determines its current window. The robot can use an existing window as its current window, or it can create a new window at its current location and set it as the current window. Then, proceed to step S2. The robot collects point cloud data using a single-point ranging sensor. In this embodiment, the robot rotates in place to drive the single-point ranging sensor fixedly mounted on its body to scan the surrounding environment, obtaining discrete points (which can be considered as position points) of the surrounding environment's contours. This forms a point cloud sub-map in a local area, i.e., collecting environmental features around the robot to obtain point cloud data. Since most of these are discrete points, the related line segments obtained from subsequent data processing of the point cloud data are not necessarily continuous line segments. The robot also constructs its current window on the map based on the maximum ranging distance of the single-point ranging sensor. After the robot starts moving within a global working area, it can know the current window, including the window where the robot's current position is located, in order to determine the positional relationship of the current window within the global working area, and then determine the next window for the robot to traverse within the global working area. There is at least one window in the global working area, and each window has multiple line feature sub-maps pre-constructed, which can be obtained by the robot from the corresponding map.
[0030] It should be noted that the relocation disclosed in this embodiment means that within the global working area, the robot is randomly placed into any traversed area, and then its original position is relocated back. The working position before the robot was randomly placed is the relocation position, i.e., the position the robot needs to relocate back to. The pre-established local coordinate system is established with the direction corresponding to the robot's initial pose angle as the coordinate axis direction, so the local coordinate system established in advance at each position can be unified. Since the robot is randomly placed in a position and the robot does not currently know the pose information of that position, it is uncertain whether the robot has abnormally shut down, etc., so the angle information is uncertain. That is, the robot does not know the current position coordinates and angle information, and the angle information recorded at the corresponding position in the pre-established local coordinate system may not match the robot's current position. In some embodiments, the robot will set the relocation position and / or the randomly placed position inside the window it is currently in.
[0031] Step S2: The robot rotates sequentially at different rotation center positions within the current window, constructing a target sub-image at each rotation center position. After the robot has traversed all rotation center positions within the current window and constructed the corresponding target sub-image at each rotation center position, step S3 is executed. Here, the target sub-image can be a set of fitted line segments with various orientations fitted from point cloud data. Furthermore, after the robot has traversed all rotation center positions within the current window, it obtains multiple target sub-images within the current window. The robot then merges the corresponding target sub-images at all rotation center positions within a window and records them in the robot's memory. Each rotation center position corresponds to one merged target sub-image, which adds more point cloud data (coordinate information and angle information of position points) or more uniform fitted line segments compared to a single line feature sub-image. Then, step S3 is executed.
[0032] In some implementations, the robot rotates sequentially a preset number of times at different rotation center positions within the current window, and scans a preset number of line feature sub-maps at each rotation center position. Here, the robot rotates in place for a preset number of times at each rotation center position. The robot rotates once at each rotation center position with a rotation cycle of 360 degrees, and scans one line feature sub-map per rotation. If multiple line feature sub-maps scanned at a rotation center position can cover the point cloud within the same area, then the first line feature sub-map scanned can be directly set as a target sub-map, that is, a target sub-map constructed at that rotation center position.
[0033] In other implementations, considering point cloud noise, during the robot's rotation of a preset number of times at a rotation center position, the line feature sub-image scanned in the current rotation may cover a new point cloud than the line feature sub-image scanned in the previous rotation, adding new fitted line segments. Therefore, these multiple line feature sub-images are merged into a target sub-image, making the point cloud or fitted line segments covered by the target sub-image more uniform and dense. At each rotation center position, the line feature sub-images scanned for a preset number of rotations are merged into a target sub-image. Then, after the robot traverses all rotation center positions within the current window and merges the corresponding target sub-image at each rotation center position, specifically, in step S2, during each rotation of the robot at a rotation center position, the point cloud data collected during the rotation is fitted to obtain a set of fitted line segments within the current window, wherein each set of fitted line segments contains at least one fitted line segment. Each set of fitted line segments is then combined into a corresponding line feature sub-image, and this process is repeated multiple times to form multiple line feature sub-images, which are then merged into a target sub-image.
[0034] Step S3: Within the global working area, after the robot completes step S2, it selects a window adjacent to the currently occupied window as the next window. This next window has no overlapping area with the currently occupied window. The robot first moves to the next window and updates it to the currently occupied window. To avoid repeated traversal, the next window is only updated if it has not been traversed. Then, step S2 is repeated until the robot has traversed all windows within the global working area and merged all target sub-images. In other words, the robot scans all target sub-images within each window of the global working area without repetition, as per step S2. Then, step S4 is executed. The window adjacent to the currently occupied window can be a window region of the same size as the currently occupied window, and a certain gap is allowed between these two adjacent windows.
[0035] Step S4: Within the global working area, the robot controls the rotation of the target sub-image, and then controls the fitted line segments within the rotated target sub-image to perform line length similarity matching with fitted line segments in other target sub-images; then, step S5 is executed. The rotation of the target sub-image essentially involves the rotation of the points and line segments that make up the target sub-image. Since the robot needs to reposition itself back to its previously lost position, in this embodiment, before controlling the fitted line segments to perform line length similarity matching, the robot first rotates the target sub-image to be matched. Figure 1 We can use different angles to achieve a higher matching success rate and restore the lost positions from the perspective of angle within the coordinate system of the target subgraph.
[0036] In some embodiments, step S4 may involve simultaneously rotating all target sub-images within each window, and then controlling the fitted line segments in each rotated target sub-image to perform line length similarity matching with the fitted line segments in other rotated target sub-images, or controlling the fitted line segments in each rotated target sub-image to perform line length similarity matching with the fitted line segments in other unrotated target sub-images.
[0037] In other embodiments, the robot may first rotate one of the target sub-images, then perform line length similarity matching between the fitted line segments in the rotated target sub-image and the fitted line segments in other target sub-images within the global working area. Next, it may select a target sub-image that has not undergone rotation, rotate it, and then perform line length similarity matching between the fitted line segments in other target sub-images within the global working area. This process is repeated until the robot has matched any target sub-image within the global working area. In each instance of line length similarity matching, one target sub-image is the rotated sub-image, belonging to the line feature sub-image to be matched; the other target sub-image serves as a reference line feature sub-image, belonging to the template type line feature sub-image. This other target sub-image can be a pre-rotated target sub-image, a target sub-image that has not undergone rotation, or the target sub-image before rotation, making the subsequently calculated pose angles and coordinates more accurate.
[0038] Specifically, within the global working area, specifically within each previously established window, the robot controls each fitted line segment in each target sub-image to perform line length similarity matching with the corresponding fitted line segments in other target sub-images (which may be unrotated or rotated). Utilizing the one-to-one correspondence between fitted line segments in two different target sub-images, similarity matching is performed between the positional relationships of the line segment attributes. Specifically, this involves the degree of overlap (or similarity) in line segment length between two fitted line segments. The relative positional relationship (where the line is located) of the two fitted line segments participating in the line length similarity matching relative to the center of the window (the origin of the coordinate system to which the window belongs) is equivalent; or, the relative positional relationship (where the line is located) of the two fitted line segments participating in the line length similarity matching relative to the rotation center of their respective target sub-images is equivalent; or, the two fitted line segments participating in the similarity matching are parallel fitted line segments of two target sub-images located within the global working area. To achieve a more comprehensive match, the robot can also set two fitted line segments participating in similarity matching as each fitted line segment within a target sub-image and any fitted line segment within other target sub-images in the same window; or the robot can set two fitted line segments participating in similarity matching as each fitted line segment within a target sub-image and any fitted line segment within any target sub-image in other windows. Among the fitted line segments in two target sub-images within the same window or different windows, similarity matching is performed one by one between the positional relationships of the line segment attributes, constructing a one-to-one correspondence of fitted line segments between any two target sub-images within the global working area. Based on this, all fitted line segment pairs with low similarity can be eliminated in the global working area at once.
[0039] Step S5: Within the global working area, when the matching success rate between the fitted line segments in two target sub-images reaches the first preset success rate, it is determined that the two target sub-images are successfully matched, and the angle error and error coordinate offset are obtained. Then, the angle error is used to process the robot's current rotation center position to obtain a temporary repositioning position; then, step S6 is executed. Here, processing the robot's current rotation center position with the angle error is equivalent to using the angle error to perform a rotation transformation on the coordinate information of the robot's current rotation center position, which can be a rotation transformation around the origin of the coordinate system of the target sub-image where the robot's current rotation center position is located. In this embodiment, the robot performs length similarity matching between a fitted line segment in one target sub-image and a fitted line segment at a corresponding position in another target sub-image, either within the same window or in different windows, until all fitted line segments in both target sub-images have undergone length similarity matching. Since the calculation focuses on the matching success rate between fitted line segments in the two target sub-images, step S5 is repeatedly executed to update the matching success rate until the robot has matched all fitted line segments in both target sub-images, or the robot completes length similarity matching between each fitted line segment in one target sub-image and a fitted line segment at a corresponding position in another target sub-image. Then, if the fitted line segments in the two target sub-images... If the matching success rate between line segments reaches the first preset success rate, the robot will obtain the coordinates of a temporary relocation position and the robot's pose angle at that temporary relocation position. It can choose to stop the similarity matching of the line segment lengths of the fitted line segments between the target sub-images. After the robot has matched all the fitted line segments in the two target sub-images that have undergone similarity matching for line segment lengths, if the matching success rate between the fitted line segments in the two target sub-images still does not reach the first preset success rate, the robot will not obtain the coordinates of the temporary relocation position, nor will it obtain its pose angle at that temporary relocation position. Then, it can choose to continue executing step S4 based on excluding the unmatched target sub-image pairs or the unmatched fitted line segment pairs, so as to control the target sub-image that was rotated once in the previous execution of step S4 to continue rotating once more.
[0040] Specifically, the matching success rate between fitted line segments within two target sub-graphs is the cumulative matching success rate calculated by the robot during the traversal of the two target sub-graphs. The preferred first preset success rate is 60%. Therefore, for these two target sub-graphs, if the ratio of successfully matched fitted line segment pairs to the total number of fitted line segment pairs participating in similarity matching is greater than or equal to 60%, then the two target sub-graphs are considered successfully matched. In the same matching phase, the robot only obtains an error coordinate offset whenever the matching success rate between fitted line segments within two target sub-graphs reaches the first preset success rate. To overcome the positional errors marked on the map, one of the two target sub-maps is rotated and translated before participating in the similarity matching between the fitted line segments. Thus, only when the lengths of the two fitted line segments reach a certain degree of agreement is the coordinate translation amount of the target sub-map (which has already been rotated) calculated as an error, which can be either a single-step error or an accumulated error. The matching between these two target sub-maps can also be understood as the similarity matching of the lengths of the fitted line segments within the two target sub-maps, which is also simplified to the similarity matching between the two target sub-maps. At this point, the number of successfully matched fitted line segments can be recorded.
[0041] Step S6: When the robot has matched all the target sub-images, that is, when the robot has traversed and matched all the fitted line segments in any two target sub-images within the global working area and performed similarity matching of line segment lengths, the robot averages all the error coordinate offsets obtained in Step S5 to obtain the positioning coordinate compensation amount. All the error coordinate offsets obtained in Step S5 are the error coordinate offsets obtained when two target sub-images are successfully matched. Each error coordinate offset includes a horizontal axis error offset and a vertical axis error offset. When the error coordinate offset is obtained by translation in the horizontal axis direction, its vertical axis error offset is set to 0 and does not participate in the averaging process, while its horizontal axis error offset participates in the averaging process to obtain the positioning coordinate compensation amount. When the error coordinate offset is obtained by translation in the vertical axis direction, its horizontal axis error offset is set to 0 and does not participate in the averaging process, while its horizontal axis error offset participates in the averaging process to obtain the positioning coordinate compensation amount. The offset is set to 0 and does not participate in the averaging process, while its vertical axis error offset participates in the averaging process to obtain the positioning coordinate compensation amount. Then, the robot uses the positioning coordinate compensation amount to correct the robot's current rotation center position obtained in step S5, specifically correcting the coordinates of the robot's current rotation center position obtained in step S5 to obtain the repositioning position, including its horizontal and vertical axis coordinates. At the same time, the robot updates the pose angle of the robot at the last obtained temporary repositioning position to the robot's initial pose angle at the repositioning position. The direction of this initial pose angle can be the direction from the robot's current rotation center position obtained in step S5 to the repositioning position. At this time, the robot stops performing line segment length similarity matching on the fitted line segments between the target sub-images; the robot's repositioning within the global working area is completed.
[0042] Preferably, when the matching success rate between target subgraphs within the global working area reaches a second preset success rate, multiple error coordinate offsets are obtained, and it is determined that the traversal of all windows within the global working area has been completed. This can be understood as using an exhaustive approach to match any two different target subgraphs within different windows or within the same window. That is, each target subgraph is matched with any other target subgraph, and the matching success rate between the same target subgraph and the other target subgraphs determined in step S5 is recorded as the matching success rate (cumulative result) of that target subgraph. Alternatively, to reduce the computational load, all target subgraph pairs participating in the matching are set to a fixed target subgraph within a fixed window and any other target subgraph. For the same pair of target subgraphs or the same pair of fitted line segments, only one line segment length similarity match is performed, excluding the pair of target subgraphs or the pair of fitted line segments that failed to match in the previous match, thus completing the matching of all target subgraphs within the global working area with less computational cost. Then, the average value of all obtained error coordinate offsets is calculated. Specifically, the average value of all error coordinate offsets or representative error coordinate offsets is obtained to get the positioning coordinate compensation amount, which is used as the optimal error amount. The positioning coordinate compensation amount is then used to correct the coordinates of the temporary repositioning position obtained by iterative transformation of the angle error amount, so as to obtain the coordinates of the robot's repositioning position. The correction can be performed by adding coaxial coordinates to obtain the coordinate information of the repositioning position, so as to complete a repositioning within the current window, which is a global positioning of the robot pose. The current window is a region that can be updated and transformed to the neighborhood. In this embodiment, the matching success rate between target sub-images increases with the successful matching of every two target sub-images in the global working area. The successful matching of two target sub-images is determined by step S5. The second preset success rate is preferably 60%. Because there are not many target sub-images in the global working area, the robot will traverse all target sub-images in the global working area for matching and comparison. If more than half of the paired matching target sub-images can be found, the global repositioning of the robot pose can be performed through step S6.
[0043] In summary, for scenarios where the robot is uncertain about its current position coordinates, angle information, and the coordinate systems of the constructed line feature sub-maps are not unified, the robot will perform a rotation transformation on one of the target sub-maps or line feature sub-maps (which can be equivalent to target sub-maps) before performing similarity matching on the fitted line segments within the two target sub-maps or line feature sub-maps (which can be equivalent to target sub-maps). This can overcome the positioning error caused by the inertial sensor by using a trial rotation when the pose is uncertain. Similarly, the robot will also merge the line feature sub-maps composed of fitted line segments by rotating in place, making the corresponding point cloud data in the merged target sub-map more uniform and dense, thereby improving the positioning accuracy of the robot using the target sub-map.
[0044] In the process of matching the similarity of the line segments of fitted line segments within two target sub-images or line feature sub-images, only the line segment length is used for comparison. First, a pair of fitted line segments whose similarity meets a certain ratio is marked. Then, the two target sub-images containing the fitted line segment pairs with suitable similarity that meet a certain ratio are marked. In the subsequent relocalization process, only when two target sub-images are successfully matched will an error coordinate offset be obtained for correcting or relocalizing the robot's position. Moreover, a reasonable upper limit is set for the number of successfully matched target sub-image pairs within each window to reduce the computational load of calling target sub-images and matching localization.
[0045] As one embodiment, each time the robot executes step S4, for two target sub-images within the current window or other windows, or target sub-images located in two different windows, the robot sets one target sub-image as a reference target sub-image and the other target sub-image as the target sub-image to be matched. Here, the windows are local areas covering the global working area, and the windows are rectangular areas, making the global working area composed of multiple rectangular areas. Before the robot executes step S4 to perform line length similarity matching between a fitted line segment in the reference target sub-image and a fitted line segment in the target sub-image to be matched, it first rotates the target sub-image to be matched according to a preset angle step size. This rotation can be an autorotation, a rotation around the center of the current window, or a rotation around the center of the global working area. The rotation of the target sub-image to be matched is actually the rotation of the fitted line segments that make up the target sub-image to be matched, and it is also a rotation according to the preset angle step size. When the target sub-image to be matched rotates one preset angle step along a preset clockwise direction, the robot updates the rotated target sub-image to the target sub-image to be matched. Preferably, the preset clockwise direction is either clockwise or counterclockwise, and the minimum rotation step of the target sub-image configured by the robot is 1 degree, i.e., the preset angle step is 1 degree. Whenever the target sub-image to be matched rotates 1 degree, the fitted line segment in the target sub-image to be matched after rotating 1 degree is controlled to perform a similarity matching of line segment length with the fitted line segment in the reference target sub-image. Then, when the matching success rate between the fitted line segment in the reference target sub-image and the fitted line segment in the target sub-image to be matched reaches a first preset success rate, the angle rotated by the latest updated target sub-image to be matched relative to the original target sub-image to be matched is set as the angle error. The angle error is then used to correct the robot's initial pose angle at the current rotation center position to obtain the temporary repositioning angle. The robot also uses the angle error to transform the coordinates of the robot's current rotation center position to obtain the coordinates of the temporary repositioning position. When a target sub-image is updated in either the reference target sub-image or the target sub-image to be matched, including updates after rotation and replacement with other target sub-images (from the same window or different windows), a new angle error is obtained after the matching success rate between the fitted line segment in the reference target sub-image and the fitted line segment in the target sub-image to be matched reaches a first preset success rate. The robot records this new angle error, which is the angle of rotation relative to the original target sub-image to be matched (when the target sub-image to be matched has undergone multiple rotations, the original target sub-image to be matched is relative to the target sub-image to be matched when it has not been rotated; or, the original target sub-image to be matched can also be replaced by other target sub-images in the same window or target sub-images in different windows). If the same target sub-image to be matched is configured to have undergone multiple rotations along the same clockwise direction, the obtained angle error will increase.Each time the robot obtains an angle error, it corrects the robot's initial pose angle at the current rotation center position, obtaining a new temporary repositioning angle. The robot also uses each obtained angle error to transform the coordinates of its current rotation center position, obtaining the coordinates of a new temporary repositioning position. The initial pose angle at the current rotation center position remains constant. The robot records the coordinates and temporary repositioning angle of each obtained temporary repositioning position. Each time the robot obtains a new angle error, it corrects the initial pose angle at the current rotation center position and transforms the coordinates of the current rotation center position, thereby updating the temporary repositioning angle and the coordinates of the temporary repositioning position. In this embodiment, when the robot has matched all target sub-images within all windows of the global working area, the robot obtains the coordinates and temporary repositioning angle of the latest updated temporary repositioning position. Then, the robot updates the coordinates of the latest temporary repositioning position to the coordinates of the repositioning position, and updates the latest temporary repositioning angle to its initial pose angle at the repositioning position to obtain the pose angle repositioning result. This overcomes the angle offset error accumulated by the sensor.
[0046] It should be noted that each time the target sub-image rotates, the fitted line segments that make up the target sub-image rotate around the center of the target sub-image (e.g., the rotation center position) in a preset clockwise direction by a preset angle step. The line feature sub-image is rotated in a similar manner.
[0047] In some embodiments, when the robot has traversed all windows within the global working area and found any target sub-image, the robot averages all the obtained temporary repositioning angles to obtain a pose angle compensation amount. Then, the pose angle compensation amount is added to the initial pose angle (unupdated angle information) at the current rotation center position, and the result of the addition is updated to the initial pose angle of the robot's current rotation center position to obtain the robot's initial forward direction information at the current rotation center position. This information is then set as the angle that the robot needs to rotate at the repositioning position to restore the original pose, thereby improving the accuracy of pose calculation.
[0048] As one embodiment, in step S2, whenever the robot rotates one full circle at the rotation center (the robot rotates 360 degrees in place), the single-point ranging sensor is controlled to collect point cloud data during the robot's rotation. The point cloud data includes the coordinate information of the position point scanned by the single-point ranging sensor and the angle information of that position point. The position point can represent the outline of an obstacle in the robot's surrounding environment or a point in the collected point cloud. The robot then fits the position points within each angle range into line segments with corresponding directions, forming multiple discrete straight line segments distributed within the window. The angle range is determined based on the fitting function model. For example, when using the least squares method for fitting, the angle range is determined based on the parameters of the target straight line fitting function to form the line segments with the corresponding directions. If the Hough transform is used to represent the straight line, the angle range between the epipolar line and the x-axis of the coordinate system of the corresponding line feature map or window is pre-set to determine the line segments to be fitted in each coordinate quadrant, thus forming the line segments with the corresponding directions. Then, the robot sets the portion of the fitted line segment corresponding to the current direction within the current window as a set of fitted line segments within the current window, including multiple fitted line segments, which can be fitted line segments with the required length and slope. This set of fitted line segments is then combined into a line feature sub-map, i.e., a collection of fitted line segments on the map, thus completing the construction of a line feature sub-map within the current window. This line feature sub-map can then be directly set as the target sub-map. Line feature sub-maps or target sub-maps in other windows within the global working area are constructed using the same method, thus merging into multiple sets of fitted line segments within the global working area. In this embodiment, whenever the robot forms a line feature sub-map in each window of the global working area, the robot also records its coordinate information at the rotation center position and its initial pose angle information (angle information before the robot starts rotating one revolution at the rotation center position (angle information measured by the gyroscope)), so that the error coordinate offset and the angle error can be combined to compensate for the coordinates and angle of the robot's repositioning position.
[0049] As one embodiment, in step S1, the method of constructing the current window in the map based on the maximum ranging distance of the single-point ranging sensor includes: taking the position of the robot when performing step S1 as the center of the current window, extending a first extension distance along the horizontal left side of the robot (corresponding to the left side of the robot's forward direction), and extending a second extension distance along the horizontal right side of the robot (corresponding to the right side of the robot's forward direction) to form the horizontal side length of the current window. The vertical side length of the current window is preferably equal to the horizontal side length of the current window, or the vertical side length of the current window is preferably greater than or equal to the diameter of the robot's body, thereby delineating a local area in the map to facilitate local robot positioning. It should be noted that the map is a grid map pre-constructed by the robot, which can be converted from point cloud data collected by the TOF sensor and angle information collected by the gyroscope. The first extension distance and the second extension distance are both equal to half of the maximum ranging distance of the single-point ranging sensor, and the horizontal side length of the current window is equal to the maximum ranging distance of the single-point ranging sensor. The shape of the current window is rectangular. Preferably, the maximum ranging distance of the single-point ranging sensor is 4 meters. If the horizontal side length of the current window is 4 meters, then the horizontal distance between the vertical side of the current window and the robot's current position is 2 meters.
[0050] It should be noted that in this invention, all mentioned windows are rectangular areas defined on the map, used to divide the global working area into regions and limit the coverage of the line feature sub-maps scanned by the robot within the corresponding divided areas. Whether it's the current window or the next window, the global working area is divided into corresponding sub-regions, with one window corresponding to one sub-region. This facilitates the robot's traversal of the global working area according to a predetermined traversal order. Each window can be defined by a specific boundary line, associated with the robot's actual position, or it can be a rectangular area centered on the robot's position in each work cycle. It is reflected on the map and serves as a landmark product of regional division within the global working area, specifically exploring point cloud information in outward regions. The window size is related to the maximum ranging distance of the single-point ranging sensor; this facilitates the window defining the point cloud data collected by the TOF sensor and reflecting the contour information of the environment, and also allows multiple line feature sub-maps to be contained within a single window.
[0051] As one embodiment, the windows constructed in the neighborhood of the currently occupied window include the window adjacent to the top, bottom, left, and right sides of the currently occupied window. The shapes and sizes of the windows constructed in the neighborhood of the currently occupied window are the same as those of the currently occupied window. This makes the windows constructed in the neighborhood of the currently occupied window equivalent to the four neighborhoods of a window on the map. Specifically, the x-coordinates of the points in the windows adjacent to the top of the currently occupied window are equal to the x-coordinates of the points in the currently occupied window, and the difference between the y-coordinates of the vertices of the vertices of the windows adjacent to the top of the currently occupied window and the y-coordinates of the vertices at the same position relative to the currently occupied window is the vertical side length of the currently occupied window. The x-coordinates of all points in the windows adjacent to the bottom of the current window are equal to the x-coordinates of all points in the current window. The difference between the y-coordinates of all vertices of the current window and the y-coordinates of vertices in the same positional relationship of the windows adjacent to the bottom of the current window is the vertical side length of the current window. Similarly, the y-coordinates of all points in the windows adjacent to the right of the current window are equal to the y-coordinates of all points in the current window. The difference between the x-coordinates of all vertices of the windows adjacent to the right of the current window and the y-coordinates of vertices in the same positional relationship of the windows adjacent to the right of the current window is the horizontal side length of the current window. Likewise, the y-coordinates of all points in the windows adjacent to the left of the current window are equal to the y-coordinates of all points in the current window. The difference between the x-coordinates of all vertices of the current window and the y-coordinates of vertices in the same positional relationship of the windows adjacent to the left of the current window is the horizontal side length of the current window. Here, "same positional relationship" means that the relative positions of two vertices with respect to the center of their respective windows are the same, including direction and distance. This also makes it easy for the robot to repeatedly traverse each window when it acts as the next window. So whenever the robot starts to repeatedly traverse a window, it can reuse the association information of the target sub-images in that window, including the similarity matching of the fitted line segments in each target sub-image involved in step S4 with the fitted line segments in other target sub-images, the matching success rate of the fitted line segments in the two target sub-images disclosed in step S5, the angle error amount, and the error coordinate offset amount, so as to directly correct and obtain the robot's positioning in the corresponding window.
[0052] Preferably, the shape of the currently located window is rectangular; the horizontal side length of the currently located window is equal to the maximum ranging distance of the single-point ranging sensor; the vertical side length of the currently located window is greater than or equal to the robot's body diameter; half of the maximum ranging distance of the single-point ranging sensor is equal to the first extension distance; the robot sets the center of the currently located window as the first rotation center position; the robot sets the vertical centerline of the currently located window as the baseline, preferably, the vertical direction of the currently located window is set to be parallel to the robot's forward direction; the robot sets two symmetrical points located at half the first extension distance from the center of the currently located window and perpendicular to the baseline as the second first rotation center position and the second second second rotation center position, respectively. The rotation center positions are located to the left and right of the first rotation center position. The robot sets the positions on two symmetrical directions that are a first extension distance away from the center of the current window and located on the vertical baseline as the third rotation center position and the third rotation center position, respectively. The third rotation center position and the third rotation center position are located to the left and right of the first rotation center position and can be located on the vertical edge of the current window. Then, only half of the target sub-images scanned at the third rotation center position and the third rotation center position are located within the current window, and the other half can be ignored. In this embodiment, the fitted line segments inside the window are divided into corresponding groups of fitted line segments within the current window to form corresponding line feature sub-images. However, the fitted line segments in the line feature sub-images in different windows can be matched for similarity of line segment length. It should be noted that the first rotation center position, the second rotation center position, the second rotation center position, the third rotation center position, and the third rotation center position all belong to the rotation center positions. The robot traverses each rotation center position sequentially and without repetition within the current window to construct multiple line feature sub-graphs within the current window, and then merges them into the target sub-graph through the robot's rotational movement.
[0053] Preferably, the time interval between two consecutive rotations of the robot at the rotation center position is limited to a reasonable time range to avoid repeatedly collected point cloud data being used to construct the same line feature sub-map; or the distance between the positions (rotation center positions) where two consecutive rotations are performed (rotating in place to scan the line feature sub-map) is limited by the effective ranging distance of the single-point ranging sensor. The distance between the positions where two consecutive rotations are performed is less than or equal to the maximum ranging distance of the single-point ranging sensor. Corresponding to the above embodiment, the distance between two rotation center positions includes the distance between the first rotation center position and the second rotation center position, the distance between the first rotation center position and the third rotation center position, and the distance between the third second rotation center position and the third first rotation center position, which are respectively equal to one-quarter of the maximum ranging distance of the single-point ranging sensor, one-half of the maximum ranging distance of the single-point ranging sensor, and the maximum ranging distance of the single-point ranging sensor.
[0054] As one embodiment, in step S2, the method for constructing the target sub-map includes: the robot sequentially rotates a preset number of times at different rotation center positions within the current window, and scans a preset number of line feature sub-maps at each rotation center position, and then merges the scanned line feature sub-maps at each rotation center position into a corresponding target sub-map; wherein, one rotation center position corresponds to one merged target sub-map; wherein, whenever the robot rotates one revolution at the rotation center position, the single-point ranging sensor is controlled to collect point cloud data during the robot's rotation, and then fitted into line segments with corresponding directions within each angle range, and then the portion of the fitted line segments with corresponding directions within the current window is set as a set of fitted line segments within the current window, and then the set of fitted line segments is combined into a line feature sub-map to determine that a line feature sub-map has been scanned, wherein, a set of fitted line segments contains at least one fitted line segment. Specifically, considering point cloud noise, during the robot's rotation a preset number of times at a rotation center position, the line feature sub-image scanned in the previous rotation covers a new point cloud and adds new fitted line segments. Therefore, these multiple line feature sub-images are merged into a target sub-image, making the point cloud or fitted line segments covered by the target sub-image more uniform and dense. At each rotation center position, the line feature sub-images scanned a preset number of times are merged into a target sub-image. Then, after the robot traverses all rotation center positions within the current window and merges the corresponding target sub-image at each rotation center position, specifically, in step S2, during each rotation of the robot at a rotation center position, the point cloud data collected during the rotation is fitted to obtain a set of fitted line segments within the current window, where each set of fitted line segments contains at least one fitted line segment. Each set of fitted line segments is then combined into a corresponding line feature sub-image. This process is repeated multiple times to form multiple line feature sub-images, which are then merged into a target sub-image. It should be noted that in order to construct the target submap within the corresponding window, whenever the robot moves to a rotation center position, the robot fits multiple fitted line segments at the current rotation center position (this rotation center position is known, and the robot may have walked from an unknown area). Then, all the fitted line segments are combined into a line feature submap, which is equivalent to a set of fitted line segments in a local area, and can record the corresponding fitted line segments in the map.In step S2, the rotation center position can be symmetrically set within the current window. When the robot assembles a target sub-map, in addition to recording the line feature sub-map, it also needs to record the rotation center position (including the robot's coordinates and initial pose angle at that position (the angle at which it just moved to the rotation center position)) and the corresponding creation time. The rotation center position is not part of the line feature sub-map scanned at that rotation center position because the rotation center position was not directly detected by the robot's TOF sensor and may not be included in the fitted line segment.
[0055] Based on the above embodiments, in step S2, the method of merging the scanned line feature sub-images of a preset number of revolutions at each rotation center position into a target sub-image includes: Step 21, the robot rotates in place at a rotation center position for the current revolution, then the robot performs fitting processing on the point cloud data collected for the current revolution to obtain a set of fitted line segments within the current window, and then combines the set of fitted line segments into a line feature sub-image. The robot can use the least squares method to fit the point cloud data collected at a rotation center position into straight line segments of various directions to form a line feature sub-image within a window; then execute step 22; Step 22, determine whether the number of revolutions the robot rotates in place at the rotation center position mentioned in step 21 is equal to the preset number of revolutions, if yes, execute step 23, otherwise execute step 24.
[0056] Step 23: The robot has scanned the line feature sub-maps a preset number of times and stopped rotating in place at the rotation center position. At this time, the robot's front may rotate back to the direction it was pointing when it first moved to the rotation center position, corresponding to the robot's initial pose angle at the current rotation center position. Then, during the process of traversing the fitted line segments in the line feature sub-maps a preset number of times, the robot selects one of the line feature sub-maps as a template sub-map. The robot then sequentially judges each fitted line segment in the template sub-map and its corresponding fitted line in each of the other line feature sub-maps. If the segments are completely overlapping, then the two currently identified completely overlapping fitted line segments are set as the same fitted line segment in the target sub-graph. That is, within the line feature sub-graph with a preset number of loops, multiple fitted line segments with equal lengths and the same points they pass through are merged into one fitted line segment. Otherwise, the two currently identified partially overlapping fitted line segments are set as two different fitted line segments in the target sub-graph. The positional relationship between the two partially overlapping fitted line segments includes, but is not limited to, parallel but not overlapping, partially overlapping but with different lengths, and intersecting. Due to the presence of point cloud noise, the fitted line segments in two line feature sub-maps scanned successively by the robot at the same rotation center position are not completely identical. For example, the fitted line segment fitted from the point cloud collected in the first loop may be slightly longer than the fitted line segment fitted from the point cloud collected in the second loop that has the same relative positional relationship with the rotation center position (the fitted line segment fitted from the point cloud collected in the second loop may be discontinuous, resulting in a shorter line segment). Alternatively, the fitted line segment fitted from the point cloud collected in the first loop may be offset by one grid grid in one coordinate axis direction compared to the fitted line segment fitted from the point cloud collected in the second loop that has the same relative positional relationship with the rotation center position (caused by accumulated position offset error). Therefore, it is necessary to add any two non-overlapping fitted line segments to the same target sub-map within a preset number of line feature sub-maps to increase the density of the point cloud data in the target sub-map and the uniformity of the fitted line segment distribution. After the robot has determined the fitted line segments in the template subgraph and any fitted line segments in each of the other line feature subgraphs, it obtains each fitted line segment in the target subgraph and merges the line feature subgraphs with a preset number of cycles into the target subgraph.
[0057] In some embodiments, the robot can determine, according to step 23 above, the relative positional relationship between each fitted line segment in the template sub-image and the corresponding fitted line segment in each of the other line feature sub-images. Specifically, in each pair of fitted line segments involved in step 23, the relative positional relationship between the fitted line segment in the template sub-image and the rotation center position is equivalent to the relative positional relationship between the fitted line segments in the other line feature sub-images scanned at the rotation center position and the rotation center position. Specifically, within a preset number of line feature sub-images, as long as a fitted line segment in one line feature sub-image has the same relative rotation center position as another line feature sub-image... If a fitted line segment in a relative positional relationship does not completely overlap, it is considered as two fitted line segments. This adds more and more uniform point cloud data information and more fitted line segments distributed at various locations to a target sub-image. Although these two fitted line segments partially overlap, their segment lengths are not equal, and they are still considered as two different fitted line segments. These two fitted line segments have the same relative positional relationship with the same rotation center position. Specifically, the nearest distance from the rotation center position to these two fitted line segments is equal, and these two fitted line segments are located on the same side of the rotation center position, which can reduce the number of fitted line segments matched in the judgment process.
[0058] Step 24: The robot updates the next revolution to the current revolution, then executes step 22, and rotates again at the same rotation center position to achieve the preset number of revolutions at the same rotation center position; wherein, the robot rotating the current revolution at a rotation center position means that the robot rotates 360 degrees around the rotation center position; the preset number of revolutions is set to be greater than the value 1. When the preset number of rotations is preferably 3, the robot scans three line feature sub-images sequentially at the same rotation center position, namely the first line feature sub-image, the second line feature sub-image, and the third line feature sub-image. The first line feature sub-image is set as a template sub-image. If the robot first determines that the first fitted line segment in the template sub-image partially overlaps with the second fitted line segment at the corresponding position in the second line feature sub-image, then the first fitted line segment and the second fitted line segment are respectively set as two fitted line segments at different positions in the target sub-image. Then, if the robot determines that the first fitted line segment in the template sub-image completely overlaps with the third fitted line segment at the corresponding position in the third line feature sub-image, then the first fitted line segment and the third fitted line segment are set as the same fitted line segment in the target sub-image, which can be marked as the first fitted line segment in the target sub-image. This process is repeated until the robot has determined each fitted line segment in the template sub-image and any fitted line segment in the other two line feature sub-images, thus obtaining each fitted line segment in the target sub-image and completing the merging of the three line feature sub-images into the target sub-image.
[0059] As an embodiment of the robot correcting the measurement errors of related sensors, in step S2, there is also the following processing of the fitted line segment with the corresponding direction: when the fitted line segment with the corresponding direction is located inside the current window, if the robot detects that the length of the fitted line segment with the corresponding direction is greater than the preset fitting length threshold, then the fitted line segment with the corresponding direction is set as the fitted line segment and marked on the map, and the coordinates of the starting point, the coordinates of the ending point, and the tilt angle (which can be the angle between the fitted line segment and the horizontal axis of the coordinate system) of the fitted line segment with the corresponding direction are recorded. Thus, a fitted line segment is represented based on the recorded information. Although a straight line (corresponding to the straight line fitting equation) is fitted, only the line segment of the corresponding length is extracted as the fitted line segment when it falls within the current window, and then added to the corresponding set of fitted line segments in the current window. When the fitted line segment extends from the inside of the current window to the outside of the current window, or extends from the outside of the current window to the inside of the current window (the fitted line segment that passes through the current window is longer), if the robot detects that the length of the segment intercepted within the current window is greater than a preset fitting length threshold, then the segment intercepted within the current window is set as the fitted line segment and marked on the map. The robot also records the coordinates of the starting point, the coordinates of the ending point, and the tilt angle (which can be the angle between the fitted line segment and the horizontal axis of the coordinate system) of the segment intercepted within the current window. Based on the recorded information, a fitted line segment is determined and added to the corresponding set of fitted line segments within the current window. Specifically, the tilt angle is represented by the angle between the fitted line segment and the coordinate axis. The preset fitting length threshold is preferably 1 meter. During the robot's walking process, the single-point ranging sensor on the side (such as a TOF sensor) can accurately measure the distance to the side wall. Then, in step S2, a line segment with a characteristic direction can be easily fitted. During the fitting process, it is necessary to first filter out the position points that are far from the target fitted line to reduce the fitting error of the line. Because the single-point ranging sensor directly measures the distance, position points that exceed the maximum measuring distance are easily eliminated. After detecting the line equation, only the line segment with a length greater than 1m will be recorded and marked on the corresponding grid map to form the fitted line segment within the current window. Thus, before matching, shorter fitted line segments are excluded by the line segment length, improving the subsequent matching accuracy.
[0060] Based on the above embodiments, regarding step S2, during the process of the robot's TOF sensor detecting the boundary of the same wall (detecting the same straight line in the surrounding environment), this can be during the robot's movement along the boundary of the same wall or during the robot's walking along an I-shaped path. The TOF sensor will continuously detect the same wall, but the robot will not continuously record the same straight line segment on the map. Instead, when detecting the boundary (straight line) of the same wall, it will continuously compare the angle between the currently detected straight line and the pre-recorded straight line segment in the same direction. If the angle is found to be greater than 2 degrees, it is determined that there is an angle error in the angle measured by the gyroscope, and angle correction needs to be started. During the robot's movement, once a straight line is fitted, it searches for the fitted line segment with the corresponding direction in a pre-set database to calculate the angle information between the two. In this embodiment, the criteria for judging that two line segments are different include different coordinates of the starting point of the line segment, different coordinates of the ending point of the line segment, or different tilt angles. Each line segment can also be converted into the angle between the line segment and the horizontal axis of the coordinate system, using the shortest distance of the line segment from the origin of the coordinate system. The line segment corresponding to the direction fitted from the boundary of the wall is determined by the target straight line equation formed by the robot using the least squares method to fit the point cloud data collected within the corresponding angle range. This target straight line equation represents the line segment corresponding to the direction.Therefore, whenever the robot fits a new line segment (relative to the previously fitted straight line of the corresponding direction) from the boundary of the wall, the angle between the currently fitted new line segment and a pre-recorded fitted line segment of the same direction (which can be obtained by calling the straight line data of the corresponding direction from a pre-set database, and may have angular errors in the previously recorded fitted line segment) is calculated. If the angle between the currently fitted new line segment and the pre-recorded fitted line segment of the same direction is greater than the preset fitting angle threshold, a weighted average is performed on the tilt angle of the currently fitted new line segment and the tilt angle of the pre-recorded fitted line segment of the same direction to obtain a calibration tilt angle. The angle between the currently fitted new line segment and the pre-recorded fitted line segment of the same direction is equal to the absolute value of the angle difference between the tilt angle of the currently fitted new line segment and the tilt angle of the pre-recorded fitted line segment of the same direction. Specifically, the degree is equal to the sum of the product of the tilt angle of the newly fitted line segment and its applied weight, and the product of the tilt angle of the pre-recorded fitted line segment of the same direction and its applied weight; then the calibrated tilt angle is updated to the tilt angle of the pre-recorded fitted line segment of the same direction; preferably, in order to obtain the calibrated tilt angle, the robot applies a weight of 70% to the tilt angle of the newly fitted line segment and a weight of 30% to the tilt angle of the pre-recorded fitted line segment of the same direction, and the preset fitting angle threshold is 2 degrees; in this embodiment, the tilt angle of the pre-recorded fitted line segment of the same direction is an angle with error to be corrected, so the weight assigned to the tilt angle of the newly fitted line segment is relatively large, and the possibility of the pre-recorded fitted line segment matching the newly fitted line segment is greater, so that the direction of the subsequently recorded fitted line segment is closer to the direction of the detection contour line corresponding to the actual environment.
[0061] Preferably, for the same detection direction, the effective ranging position point farthest from the single-point ranging sensor is marked as the ranging endpoint of the single-point ranging sensor, which is equivalent to the farthest obstacle contour point that can be detected. During the robot's rotation around the same position, specifically when rotating in place at a preset rotation speed, a higher frame rate of the single-point ranging sensor results in a smaller distance between the ranging endpoints of two adjacent single-point ranging sensors, leading to denser point cloud data and more accurate obstacle information, thus ensuring the precision and accuracy of positioning. Conversely, a lower frame rate of the single-point ranging sensor results in a larger distance between the ranging endpoints of two adjacent single-point ranging sensors, leading to sparser point cloud data. To meet the requirements of fitting straight lines and mapping matching, in this embodiment, the distance between the ranging endpoints of two adjacent single-point ranging sensors can be set to equal the arc length moved by the ranging endpoint when the robot rotates one degree in place. This is related to the robot's body diameter, rotation speed, and / or the frame rate of the single-point ranging sensor.
[0062] As one embodiment, in step S5, the matching success rate between the fitted line segments of the two target sub-graphs is the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment lengths. The fitted line segment pairs participating in the similarity matching of line segment lengths are composed of fitted line segments located in the two target sub-graphs. Each fitted line segment in one target sub-graph participates in the similarity matching of line segment lengths with any fitted line segment in any other target sub-graph to form a fitted line segment pair, i.e., a fitted line segment pair participating in the similarity matching of line segment lengths. A successfully matched fitted line segment pair is one of two fitted line segments that successfully matched during the similarity matching of line segment lengths in step S4. A segment is denoted as a successfully matched fitted line segment pair. Preferably, to reduce the number of matches, the relative position of a fitted line segment in one of the target subgraphs of the fitted line segment pair participating in the similarity matching of line segment lengths, relative to the rotation center of the target subgraph, can be equivalent to the relative position of a fitted line segment in another target subgraph of the fitted line segment pair participating in the similarity matching of line segment lengths, relative to the rotation center of the other target subgraph (the shortest distance from the rotation center to the corresponding fitted line segment and the angle between the fitted line segment and the horizontal axis of the coordinate system). Specifically, a fitted line segment in one target subgraph of the fitted line segment pair participating in the similarity matching of line segment lengths and a fitted line segment in another target subgraph of the fitted line segment pair participating in the similarity matching are parallel to each other. Within the global working area, the target sub-image group containing two fitted line segments participating in the similarity matching of line segment lengths constitutes a target sub-image pair. A target sub-image pair can consist of any two target sub-images within the global working area. In a target sub-image pair, one target sub-image is set as a reference target sub-image, and the other target sub-image is set as the target sub-image to be matched, which is the target sub-image rotated in step S4. The two target sub-images participating in the matching are any two target sub-images within the global working area, enabling traversal and matching of each target sub-image within each window of the global working area. This matching is essentially a shorthand for the similarity matching of line segment lengths performed on fitted line segments. Similarly, to reduce the number of matches, the robot sets all target sub-image pairs participating in the matching to a fixed target sub-image within the currently occupied window and any other target sub-image. For the same pair of target sub-images or the same pair of fitted line segments, only one matching is performed, thus completing the matching of all target sub-images within the various global working areas.
[0063] Based on the above embodiments, for two target sub-graphs (a pair of line feature sub-graphs within the same window) involved in matching, the robot sets one of the target sub-graphs as the reference target sub-graph and the other target sub-graph as the target sub-graph to be matched. The target sub-graph to be matched is the target sub-graph that has been rotated in step S4. Preferably, the target sub-graph to be matched is a map area other than the reference target sub-graph within the global working area.
[0064] Corresponding to step S4, when the degree of overlap between a fitted line segment in the target sub-image to be matched and a fitted line segment at the corresponding position in the reference line feature sub-image in terms of line segment length is higher than a preset degree of overlap, it is determined that the fitted line segment in the target sub-image to be matched and the fitted line segment at the corresponding position in the reference target sub-image have successfully matched in similarity matching, and are recorded as a successfully matched fitted line segment pair. It should be noted that the robot needs to calculate the degree of overlap in the line segment length dimension between each fitted line segment in the target sub-image to be matched and the fitted line segment at the corresponding position in the reference target sub-image one by one. In order to expand the search area, the fitted line segment at the corresponding position in the reference target sub-image can be any fitted line segment in the reference target sub-image. Alternatively, in order to reduce the amount of computation, the fitted line segment at the corresponding position in the reference target sub-image can be parallel to the fitted line segment in the target sub-image to be matched that participates in the similarity matching of line segment length.
[0065] After the robot completes step S4 by matching each fitted line segment in the target sub-image to be matched with the corresponding fitted line segment in the reference target sub-image, the robot proceeds to step S5. When the ratio of the number of successfully matched fitted line segment pairs to the number of fitted line segment pairs participating in the similarity matching of line segment length is greater than or equal to a first preset success rate, it is determined that the target sub-image to be matched and the reference target sub-image are successfully matched, and this is recorded as a successfully matched target sub-image pair. The number of fitted line segment pairs participating in the similarity matching of line segment length exceeds a certain threshold. In some embodiments, the two fitted line segments participating in the similarity matching of line segment length are parallel fitted line segments located in the target sub-image to be matched and the reference target sub-image, respectively. Therefore, the number of fitted line segment pairs participating in the similarity matching of line segment length is preferably equal to the number of fitted line segments in the target sub-image to be matched, or equal to the number of fitted line segments in the reference target sub-image.
[0066] Corresponding to step S6, after the robot has matched (or traversed) all target subgraphs within the global working area, if the ratio of the number of successfully matched target subgraph pairs to the number of target subgraph pairs participating in the matching is greater than or equal to the second preset success rate, or if the number of target subgraph pairs participating in the matching exceeds a certain threshold, it is determined that the robot has completed the similarity matching of the line lengths of all fitted line segments within the global working area, completed the matching of all target subgraphs, and obtained successfully matched target subgraph pairs, which is sufficient to use all successfully matched target subgraph pairs for global localization of the robot.
[0067] As one embodiment, in step S4, the method for matching the similarity of the line lengths of fitted line segments in the target sub-image after robot control and rotation with fitted line segments in other target sub-images is as follows: the robot controls the fitted line segments in the target sub-image to be matched to perform similarity matching of their line lengths with the fitted line segments at corresponding positions in the reference target sub-image; the method specifically includes: step 41, calculating the absolute value of the difference between the line length of a fitted line segment in the target sub-image to be matched and the line length of a fitted line segment in the reference target sub-image, thereby measuring the difference between the two fitted line segments in the line length dimension through the difference. Then, step 42 is executed; in step 42, when the absolute value of the difference mentioned in step 41 is less than or equal to a preset length threshold, it is determined that a fitted line segment in the target sub-image to be matched and a fitted line segment at the corresponding position in the reference target sub-image have successfully matched in terms of line segment length similarity, and the two fitted line segments currently undergoing line segment length similarity matching are marked as a successfully matched fitted line segment pair; when the absolute value of the difference mentioned in step 41 is greater than the preset length threshold, it is determined that a fitted line segment in the target sub-image to be matched and a fitted line segment at the corresponding position in the reference target sub-image have failed to match in terms of line segment length similarity, and the fitted line segments currently undergoing line segment length similarity matching are marked as a failed matched fitted line segment pair. When the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in line segment length similarity matching is greater than or equal to a first preset success rate, it is determined that the target sub-image to be matched and the reference target sub-image have successfully matched, and are marked as a successfully matched target sub-image pair; the first preset success rate is preferably 60%.
[0068] In some embodiments, the ratio of the absolute value of the difference between the length of a fitted line segment in the target sub-image to the length of a fitted line segment in the reference target sub-image and the length of the reference line segment is denoted as the difference rate in the line segment length dimension. When the difference between the value 1 and the difference rate in the line segment length dimension is greater than or equal to a preset overlap, it is determined that a fitted line segment in the target sub-image to be matched and a fitted line segment at the corresponding position in the reference target sub-image have successfully matched in terms of line segment length similarity. The two fitted line segments currently undergoing line segment length similarity matching are then marked as a successfully matched pair of fitted line segments. The reference line segment is the fitted line segment with the relatively larger line segment length among the two fitted line segments currently undergoing line segment length similarity matching. Preferably, the preset overlap is set to 80%.
[0069] In some embodiments, within the global working area, when the ratio of the number of successfully matched target subgraph pairs to the number of target subgraph pairs participating in the matching is greater than or equal to a second preset success rate, the similarity matching of the line segment lengths between the fitted line segments in the target subgraph to be matched and the fitted line segments in the reference target subgraph is stopped. Traversal of each fitted line segment within any target subgraph in the global working area is also stopped, and the target subgraph is controlled to stop rotating. Here, all target subgraph pairs participating in the matching include any two different target subgraphs.
[0070] As one embodiment, before the robot performs length similarity matching between each fitted line segment in the target sub-image to be matched and the fitted line segment at the corresponding position in the reference target sub-image, the robot sets the rotation center position corresponding to the target sub-image to be matched as the offset starting point position. Here, before the line segment length similarity matching, the fitted line segments in the target sub-image to be matched will be translated, but the corresponding rotation center position will not be translated. The target sub-image to be matched in step S4 is a rotated target sub-image. In some embodiments, when the ratio of the number of successfully matched fitted line segment pairs to the number of fitted line segment pairs participating in the line segment length similarity matching is less than a first preset success rate, the robot also sets the rotation center position corresponding to the target sub-image to be matched as the offset starting point position. In fact, the robot has already traversed and matched each fitted line segment in the target sub-image to be matched and the fitted line segment at the corresponding position in the reference target sub-image. Then, the robot controls the target sub-image to be matched to start from the offset starting position and translate along the predetermined coordinate axis direction according to the preset translation step size. Specifically, for the same target sub-image to be matched, before the coordinate offset of the translation along the predetermined coordinate axis direction reaches the maximum preset offset, each translation step size will shift the corresponding fitted line segment within the translated target sub-image to be matched. The translation direction is not limited to the positive or negative direction of the coordinate axis. At this time, the target sub-image to be matched can completely overlap with the reference target sub-image, or the target sub-image to be matched can be completely covered by the reference target sub-image, or the target sub-image to be matched can completely cover the reference target sub-image. This method maps the target sub-image to the reference target sub-image by translating along the coordinate axis, overcoming the influence of noise errors from sensor acquisition. In this embodiment, each time the same target sub-image is translated along the predetermined coordinate axis by the preset translation step size, the translated target sub-image is updated to the target sub-image, enabling the corresponding fitted line segments within the target sub-image to execute steps 41 and 42. This controls the length of the fitted line segments within the target sub-image and the fitted line segments at corresponding positions in the reference target sub-image. In the process of similarity matching, it is necessary to calculate the overlap rate (which can be regarded as the similarity of line segment lengths) in the line segment length dimension. Then, after the robot matches each fitted line segment in the target sub-image to be matched with the fitted line segment at the corresponding position in the reference target sub-image, the robot determines whether the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the line segment length similarity matching is greater than or equal to the first preset success rate, and judges the matching status of the target sub-image to be matched and the reference target sub-image after each translation.
[0071] It should be noted that the maximum preset offset is preferably 10 grids. The maximum preset offset can be the ratio of the preset maximum positioning error to the preset grid side length, or the rounded result of this ratio, in units of grids. The preset maximum positioning error and preset translation step size should not exceed the side length of a window, nor should they exceed the maximum ranging distance of the single-point ranging sensor. The preset maximum positioning error can be obtained through repeated comparative experiments using sensing data from the TOF sensor and / or gyroscope. To expand the search area within the global working area, the fitted line segment at the corresponding position in the reference target sub-image can be any fitted line segment within the reference target sub-image. Alternatively, to reduce computational load, the fitted line segment at the corresponding position in the reference target sub-image can be parallel to the fitted line segment in the target sub-image participating in the line segment length similarity matching.
[0072] Based on the above embodiments, provided that the coordinate offset of a target sub-image to be matched, starting from the offset starting position, has not reached the maximum preset offset, whenever the target sub-image to be matched is translated by a preset translation step, after the robot has matched each fitted line segment in the target sub-image to the corresponding fitted line segment in the reference target sub-image, the robot determines that the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment lengths is greater than or equal to the first preset success rate. If so, the target sub-image to be matched (which can be understood as a target sub-image that has not undergone translation) is determined to be... When a target sub-image (which can also be understood as a translated target sub-image to be matched) successfully matches the reference target sub-image, it is recorded as a successfully matched target sub-image pair. The coordinate offset of the target sub-image to be matched, which has been translated from the offset starting position in the latest translation direction, is set as the error coordinate offset. The unit is a grid, which can be an integer multiple of the preset translation step size. This integer multiple is the number of times the target sub-image to be matched has been translated in the same translation direction. The error coordinate offset has a positive or negative sign associated with the translation direction, which can affect the coordinates of the robot's repositioning position during subsequent corrections. At this time, the robot controls the target sub-image to be matched to stop translating.
[0073] It should be noted that the error coordinate offset is decomposed into coordinate offset in the horizontal axis direction and coordinate offset in the vertical axis direction. The error coordinate offset can change with the translation direction. When the error coordinate offset is accumulated by the translation of the target sub-image to be matched in the horizontal axis direction, its vertical axis error offset is set to 0; when the error coordinate offset is accumulated by the translation of the target sub-image to be matched in the vertical axis direction, its horizontal axis error offset is set to 0.
[0074] Provided that the coordinate offset of a target sub-image to be matched, starting from the offset starting position, has not reached the maximum preset offset, whenever the target sub-image to be matched moves by a preset translation step, after the robot has matched each fitted line segment in the target sub-image with the corresponding fitted line segment in the reference target sub-image, if the ratio of the number of successfully matched fitted line segment pairs to the number of fitted line segment pairs participating in similarity matching is less than a first preset success rate, the robot may have matched each fitted line segment in the target sub-image with the corresponding fitted line segment in the reference target sub-image, or matched the largest... If a fitted line segment matches a fitted line segment at a corresponding position within the reference target sub-image, the robot adjusts the direction of the predetermined coordinate axis to an opposite or perpendicular coordinate axis direction, and then updates the opposite or perpendicular coordinate axis direction to the predetermined coordinate axis direction. At this time, the opposite or perpendicular coordinate axis direction is the latest translation direction adjusted by the robot, which can be changed from the positive x-axis (horizontal axis) direction to the negative x-axis (horizontal axis) direction, or from the positive x-axis (horizontal axis) direction to the positive y-axis (vertical axis) direction, so as to control the target sub-image to be matched to translate in a different translation direction than before, overcoming the influence of position offset error in the corresponding coordinate axis direction. Then, the robot controls the target sub-image to be matched (the corresponding rotation center position is the offset starting position) to translate along the predetermined coordinate axis direction (updated) by the preset translation step size starting from the offset starting position. The translated target sub-image to be matched is then updated. Steps 41 and 42 are repeated until the robot has matched each fitted line segment in the target sub-image to be matched with the fitted line segment at the corresponding position in the reference target sub-image. The robot calculates the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in similarity matching. Then, the robot determines whether to continue controlling the target sub-image to be matched to translate along the predetermined coordinate axis direction by judging whether the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in line segment length similarity matching is greater than or equal to the first preset success rate.
[0075] It should be noted that, starting from the offset starting position, before the coordinate offset of the same target sub-image to be matched reaches the maximum preset offset in the predetermined coordinate axis direction, each time the same target sub-image to be matched is translated once along the predetermined coordinate axis direction by the preset translation step size, the translated target sub-image to be matched is updated as the target sub-image to be matched, and then steps 41 and 42 are executed to calculate the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in similarity matching in the new translation direction. Moreover, after the robot matches each fitted line segment in the target sub-image to be matched with the fitted line segment at the corresponding position in the reference target sub-image, the robot determines whether the ratio of the number of successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment length is greater than or equal to the first preset success rate.
[0076] If the coordinate offset of the target sub-image to be matched, translated from the offset starting position along the same coordinate axis, has reached the maximum preset offset, then after the robot has matched each fitted line segment in the target sub-image to be matched with the fitted line segment at the corresponding position in the reference target sub-image, it is determined whether the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in similarity matching is greater than or equal to the first preset success rate. If so, it is determined that the target sub-image to be matched (which can be understood as the target sub-image to be matched that has not undergone translation, or the target sub-image to be matched after translation) is matched with the target sub-image to be matched. The reference target sub-image is successfully matched and recorded as a successfully matched target sub-image pair. The coordinate offset that the robot has translated in the latest translation direction is set as the error coordinate offset and recorded. That is, the maximum preset offset is set as the error coordinate offset, which corresponds to an error coordinate offset of the target sub-image to be matched, but the error coordinate offset is not updated. Then the robot controls the target sub-image to be matched to stop translating, and also ends the similarity matching of the line length between each fitted line segment in the target sub-image to be matched and the fitted line segment at the corresponding position in the reference target sub-image. If the robot determines that the ratio of the number of successfully matched fitted line segment pairs to the number of fitted line segment pairs participating in similarity matching is less than the first preset success rate, then it adjusts the direction of the predetermined coordinate axis to the opposite or perpendicular coordinate axis direction, updates the opposite or perpendicular coordinate axis direction to the predetermined coordinate axis direction, and then controls the original target sub-image to be matched to translate along the predetermined coordinate axis direction from the offset starting position by the preset translation step size. The translated target sub-image to be matched is then updated to the target sub-image to be matched, and steps 41 and 42 are executed. Similarly, on the updated predetermined coordinate axis... In terms of direction, the target sub-image to be matched starts from the same offset starting position. Before the coordinate offset of the translation in the predetermined coordinate axis direction reaches the maximum preset offset, the target sub-image to be matched is updated after each translation step of the preset translation step, and then steps 41 and 42 are executed. Whenever the robot matches each fitted line segment in the target sub-image to be matched with the fitted line segment at the corresponding position in the reference target sub-image, the robot determines whether the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment length is greater than or equal to the first preset success rate.
[0077] Based on the aforementioned embodiments, after the robot has controlled the original target sub-image to be matched to be translated along all coordinate axes from the offset starting position, and the coordinate offset of the target sub-image to be matched from the offset starting position along all coordinate axes has reached the maximum preset offset, when the robot determines that the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in similarity matching is less than a first preset success rate, the robot determines that the original target sub-image to be matched has failed to match the reference target sub-image. Specifically, the same target sub-image to be matched is controlled to be translated from the offset starting position along all coordinate axes. During the translation along the coordinate axes, each time the target sub-image to be matched is translated, the robot determines that the ratio of the number of successfully matched fitted line segment pairs to the number of fitted line segment pairs participating in similarity matching is less than the first preset success rate. Even if the coordinate offset of the target sub-image to be matched, which has been translated along each coordinate axis from the offset starting position, reaches the maximum preset offset, the robot still determines that the ratio of the number of successfully matched fitted line segment pairs to the number of fitted line segment pairs participating in similarity matching is less than the first preset success rate. Only then is it determined that the original target sub-image to be matched has failed to match the reference target sub-image. Based on this, after excluding a pair of target sub-images that failed to match, the robot returns to steps S4 and S5, controlling the original target sub-image to be matched to rotate. If the original target sub-image to be matched was obtained by rotating a target sub-image in the previous step S4, it continues to rotate one preset angle step length along the preset clockwise direction. Then, the rotated target sub-image to be matched is updated to the target sub-image to be matched. In step S4, the similarity of the line lengths of each fitted line segment in the target sub-image to be matched is performed with the fitted line segment at the corresponding position in the reference target sub-image. After the robot has matched each fitted line segment in the target sub-image to be matched with the fitted line segment at the corresponding position in the reference target sub-image, when the matching success rate between the fitted line segments in the two target sub-images (corresponding to the target sub-image to be matched and the reference target sub-image) reaches the first preset success rate in step S5, it is determined that the target sub-image to be matched and the reference target sub-image are successfully matched, and the angle error and the error coordinate offset are obtained.
[0078] As one embodiment, in step S6, when the robot has traversed all the target subgraphs within all windows of the global working area, the robot obtains multiple error coordinate offsets and determines that the robot has matched any two target subgraphs within all windows of the global working area. If the aforementioned embodiment excludes some failed target subgraph pairs during the repeated execution of steps S4 and S5, that is, the robot will not match the target subgraph pair but will traverse the two target subgraphs included in the target subgraph pair, because each target subgraph included in the failed target subgraph pair can be successfully matched with other target subgraphs. If the robot determines that the number of currently obtained error coordinate offsets is greater than the preset processing number, then it removes the error coordinate offsets with the largest horizontal coordinate value, the smallest horizontal coordinate value, the largest vertical coordinate value, and the smallest vertical coordinate value from all the currently obtained error coordinate offsets; then it calculates the average of the remaining error coordinate offsets to obtain the average coordinate offset; and then sets the average coordinate offset as the positioning coordinate compensation amount; wherein each error coordinate offset includes a horizontal axis error coordinate offset and a vertical axis error coordinate offset; and each positioning coordinate compensation amount includes a horizontal axis positioning coordinate compensation amount and a vertical axis positioning coordinate compensation amount.
[0079] Specifically, if the robot determines that the number of currently obtained error coordinate offsets is greater than the preset processing number, then among all the currently obtained error coordinate offsets, the error coordinate offsets with the largest horizontal coordinate value, the error coordinate offsets with the smallest horizontal coordinate value, the error coordinate offsets with the largest vertical coordinate value, and the error coordinate offsets with the smallest vertical coordinate value are all removed. Since each error coordinate offset includes a horizontal axis error coordinate offset and a vertical axis error coordinate offset, an error coordinate offset can be represented as a coordinate value composed of a horizontal axis error coordinate offset and a vertical axis error coordinate offset. Then, the average horizontal axis error coordinate offsets of the remaining error coordinate offsets are calculated to obtain the average horizontal axis coordinate value. This averaging is achieved by summing and averaging the remaining horizontal axis error coordinate offsets, and the number of horizontal axis error coordinate offsets is equal to the number of data points used for averaging. Similarly, the average vertical axis error coordinate offsets of the remaining error coordinate offsets are calculated to obtain the average vertical axis coordinate value. This averaging is achieved by summing and averaging the remaining vertical axis error coordinate offsets, and the number of vertical axis error coordinate offsets is equal to the number of data points used for averaging. The average horizontal axis coordinate value and the average vertical axis coordinate value are then combined to form the average coordinate offset. This average coordinate offset is then set as the positioning coordinate compensation value by the robot. Each positioning coordinate compensation value includes one horizontal axis positioning coordinate compensation value and one vertical axis positioning coordinate compensation value, which can be understood as being represented in coordinate value form. Then, the robot control positioning coordinate compensation amount is added to the latest temporary repositioning position obtained in step S5 above to obtain the coordinates of the repositioning position. Specifically, the horizontal axis positioning coordinate compensation amount of the positioning coordinate compensation amount is added to the horizontal coordinate of the temporary repositioning position, and the vertical axis positioning coordinate compensation amount of the positioning coordinate compensation amount is added to the vertical coordinate of the temporary repositioning position to obtain the coordinates of the repositioning position.
[0080] In some embodiments, if the robot determines that the number of currently obtained error coordinate offsets is less than or equal to a preset processing number, it directly calculates the average value of all currently obtained error coordinate offsets to obtain the average coordinate offset. The principle of calculating the average value is similar to that in the above embodiments, except that the number of data points for taking the average value is equal to the number of currently obtained error coordinate offsets, and equal to the number of horizontal axis error coordinate offsets among all currently obtained error coordinate offsets. When an error coordinate offset can be represented as a coordinate value composed of a horizontal axis error coordinate offset and a vertical axis error coordinate offset, the number of horizontal axis error coordinate offsets among all currently obtained error coordinate offsets is equal to the number of vertical axis error coordinate offsets among all currently obtained error coordinate offsets.
[0081] It should be noted that, corresponding to the target sub-image matching process mentioned in the previous embodiment, the setting of the preset processing quantity is related to the number of times the target sub-image to be matched is translated along the predetermined coordinate axis direction from the offset starting position, or the number of times the translation direction is changed; since there are four coordinate axis directions in the plane coordinate system where the current window is located, including the positive direction of the horizontal axis (positive direction of the horizontal coordinate axis, i.e., the positive direction of the x-axis), the negative direction of the horizontal axis (negative direction of the horizontal coordinate axis, i.e., the negative direction of the x-axis), the positive direction of the vertical axis (positive direction of the vertical coordinate axis, i.e., the positive direction of the y-axis), and the negative direction of the vertical axis (negative direction of the vertical coordinate axis, i.e., the negative direction of the y-axis), in order to reduce the accumulated offset error (position error), this embodiment sets the preset processing quantity to the value of 3.
[0082] In some embodiments, after the robot traverses all target sub-images within the global working area, if the ratio of the number of successfully matched target sub-image pairs to the number of all target sub-image pairs participating in the matching is greater than or equal to a second preset success rate, the robot obtains multiple error coordinate offsets. Specifically, each time the robot determines a successfully matched target sub-image pair in step S5, an error coordinate offset is set, ensuring that after traversing all line feature sub-images within the global working area and performing similarity matching on all fitted line segment pairs, the robot obtains multiple error coordinate offsets. The robot counts all error coordinate offsets, and the cumulative number of error coordinate offsets is equal to the number of successfully matched target sub-image pairs. Each error coordinate offset includes a horizontal axis error coordinate offset and a vertical axis error coordinate offset. Each error coordinate offset is represented in coordinate form; the horizontal axis error coordinate offset is the coordinate value of the error coordinate offset in the x-axis direction, and the vertical axis error coordinate offset is the coordinate value of the error coordinate offset in the y-axis direction. In some embodiments, without considering the sign difference caused by the translation direction, the values of each error coordinate offset on the horizontal axis are equal, and the values of each error coordinate offset on the vertical axis are equal; therefore, without considering position errors, i.e., in an ideal state, the sum of all error coordinate offsets results in a coordinate value of 0 on each coordinate axis.
[0083] In summary, for target sub-image matching, the degree of overlap between the lengths of fitted line segments and the number of fitted line segments meeting the corresponding overlap rate are used for matching judgment, reducing computational complexity and improving computational speed. For positional positioning errors in the target sub-images involved in the matching, the target sub-image is first rotated and then translated along each coordinate axis direction. The degree of overlap between the lengths of fitted line segments and the number of fitted line segments meeting the corresponding overlap rate are repeatedly used for matching judgment until the number of successfully matched fitted line segments meets the predetermined matching success rate. This not only overcomes the interference of coordinate offset errors at various angles but also extracts multiple error quantities for subsequent processing as compensation quantities for the robot's position coordinates. Specifically, an error coordinate offset quantity for correcting or repositioning the robot's position is obtained only when two target sub-images are successfully matched. Furthermore, a reasonable upper limit is set for the number of successfully matched target sub-image pairs within each window, reducing the computational load of calling target sub-images and matching positioning.
[0084] It should be noted that, in the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0085] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, the functional units in the various embodiments of this application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units.
[0086] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0087] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. An angle-based robot relocalization method, characterized in that, The robot relocalization method is executed by a robot with a fixed single-point ranging sensor and a gyroscope. The single-point ranging sensor is used to collect point cloud data of the robot's environment and mark it on the map, while the gyroscope is used to collect the robot's angle information. The robot relocation method includes: Step 1: The robot determines its current window location, where at least one window exists within the global working area; Step 2: The robot rotates sequentially at different rotation center positions within the current window, and constructs a target sub-graph at each rotation center position; Step 3: Within the global working area, when the robot selects the window adjacent to the current window as the next window, the robot moves to the next window, updates the next window to the current window, and then repeats step 2 until the robot has traversed all windows in the global working area and constructed the target subgraph. Step 4: Within the global working area, the robot controls the rotation of the target sub-image, and then controls the similarity matching of the length of the fitted line segments in the rotated target sub-image with the fitted line segments in other target sub-images. Step 5: When the matching success rate between the fitted line segments in the two target sub-images reaches the first preset success rate, it is determined that the two target sub-images are successfully matched, and the angle error and error coordinate offset are obtained; then the angle error is used to process the current rotation center position of the robot to obtain a temporary repositioning position. Step 6: When the robot has matched all the target sub-images, the robot averages all the obtained error coordinate offsets to obtain the positioning coordinate compensation; then the positioning coordinate compensation is used to correct the latest temporary repositioning position to obtain the repositioning position, thus completing the robot's repositioning within the global working area.
2. The robot relocation method according to claim 1, characterized in that, For two target sub-images within the global working area, the robot sets one target sub-image as the reference target sub-image and the other target sub-image as the target sub-image to be matched. In particular, before step 4 performs line length similarity matching between a fitted line segment in the reference target sub-image and a fitted line segment in the target sub-image to be matched, the target sub-image to be matched is rotated according to a preset angle step size. When the target sub-image to be matched rotates by the preset angle step along the preset clockwise direction, the robot updates the rotated target sub-image to be matched and then performs line length similarity matching between a fitted line segment in the reference target sub-image and a fitted line segment in the target sub-image to be matched. When the matching success rate between the fitted line segment in the reference target sub-image and the fitted line segment in the target sub-image to be matched reaches the first preset success rate, the robot sets the angle by which the latest updated target sub-image to be matched has rotated relative to the original target sub-image to be matched as the angle error. The angle error is then used to correct the robot's initial pose angle at the current rotation center position to obtain the temporary repositioning angle. The angle error is then used to transform the coordinates of the robot's current rotation center position to obtain the coordinates of the temporary repositioning position. When the robot has matched all the target sub-images in all windows of the global working area, the robot updates the coordinates of the latest temporary relocation position to the coordinates of the relocation position, and updates the latest temporary relocation angle to the robot's initial pose angle at the relocation position. Wherein, the initial pose angle of the robot at the current rotation center position is the angle between the robot's forward direction before rotation and the coordinate axis at the current rotation center position.
3. The robot relocation method according to claim 1, characterized in that, In step 1, the position of the robot when performing step 1 is taken as the center of the current window. A preset extension distance is extended horizontally to the left of the center of the current window, and a preset extension distance is extended horizontally to the right of the center of the current window to form the horizontal side length of the current window. The preset extension distance is equal to half of the maximum ranging distance of the single-point ranging sensor, so as to scan multiple line feature sub-maps within the current window. The window is a rectangular area defined in the map, used to divide the global working area and limit the coverage of the line feature sub-map scanned by the robot within the corresponding area.
4. The robot relocation method according to claim 3, characterized in that, The windows adjacent to the current window include the window above the current window, the window below the current window, the window to the left of the current window, and the window to the right of the current window; the shape of each window adjacent to the current window is the same as the shape of the current window, and the size of each window adjacent to the current window is the same as the size of the current window. The x-coordinates of each point in the window above the current window are equal to the x-coordinates of each point in the current window. The difference between the y-coordinates of each vertex in the window above the current window and the y-coordinates of the vertices at the same position in the current window is the vertical side length of the current window. The x-coordinates of all points in the windows that make up the current window below are equal to the x-coordinates of all points in the current window. The difference between the y-coordinates of all vertices of the current window and the y-coordinates of the vertices in the same positional relationship of the windows that make up the current window below is the vertical side length of the current window. The ordinates of all points in the windows adjacent to the right of the current window are equal to the ordinates of all points in the current window. The difference between the x-coordinates of all vertices in the windows adjacent to the right of the current window and the x-coordinates of the vertices at the same position in the current window is the horizontal side length of the current window. The ordinates of all points in the window that is adjacent to the left of the current window are equal to the ordinates of all points in the current window. The difference between the x-coordinates of all vertices of the current window and the x-coordinates of the vertices in the window that are adjacent to the left of the current window at the same position is the horizontal side length of the current window. The same positional relationship means that the relative positional relationship between two vertices with respect to the center of the window in which they are located is the same.
5. The robot relocation method according to claim 1, characterized in that, In step 2, the method for constructing the target sub-map includes: whenever the robot rotates one revolution at the rotation center position, controlling the single-point ranging sensor to collect point cloud data during the robot's rotation, then fitting the corresponding line segments within each angle range, then setting the portion of the fitted line segments within the current window as a set of fitted line segments within the current window, then forming a line feature sub-map from the set of fitted line segments, determining a line feature sub-map, and setting the line feature sub-map as the target sub-map; The point cloud data includes the coordinate information of the location point scanned by the single-point ranging sensor and the angle information of that location point; whenever a line feature sub-map is scanned, the robot also records its coordinates and initial pose angle at the rotation center position. The coordinates of the rotation center position are relative position coordinates formed with the position where the robot is when it performs step 1 as the origin.
6. The robot relocation method according to claim 1, characterized in that, In step 2, the method for constructing the target sub-map includes: the robot rotating sequentially at different rotation center positions within the current window a preset number of times, and scanning a preset number of line feature sub-maps at each rotation center position, and then merging the scanned line feature sub-maps at each rotation center position into a corresponding target sub-map; wherein, one target sub-map is merged at each rotation center position. Specifically, whenever the robot rotates once at the rotation center, the single-point ranging sensor collects point cloud data during the robot's rotation, and then fits it into line segments with corresponding directions within each angle range. The portion of the fitted line segments with corresponding directions within the current window is then set as a set of fitted line segments within the current window. This set of fitted line segments is then combined into a line feature sub-map, and a line feature sub-map is determined to be scanned. In this set of fitted line segments, there is at least one fitted line segment.
7. The robot relocation method according to claim 6, characterized in that, In step 2, the method of merging the scanned line feature sub-images of a preset number of revolutions at each rotation center position into a target sub-image includes: Step 21: The robot rotates in place at a rotation center position for the current revolution. The robot then performs fitting processing on the point cloud data collected for the current revolution to obtain a set of fitted line segments within the current window. The set of fitted line segments is then combined into a line feature sub-map. Step 22: Determine whether the number of rotations the robot makes at the rotation center position described in step 21 is equal to the preset number of rotations. If yes, proceed to step 23; otherwise, proceed to step 24. Step 23: The robot has scanned a preset number of line feature sub-maps and stopped rotating in place at the rotation center. Then, while traversing the fitted line segments within the preset number of line feature sub-maps, the robot selects one of the line feature sub-maps as a template sub-map. The robot sequentially determines whether each fitted line segment in the template sub-map completely overlaps with the fitted line segments in each of the other line feature sub-maps. If so, the two currently determined completely overlapping fitted line segments are set as the same fitted line segment in the target sub-map; otherwise, the two currently determined partially overlapping fitted line segments are set as two fitted line segments in the target sub-map. After the robot has determined each fitted line segment in the template sub-map and any fitted line segment in each of the other line feature sub-maps, it obtains each fitted line segment in the target sub-map, thus completing the merging of the preset number of line feature sub-maps into the target sub-map. Step 24: The robot updates the next lap to the current lap, and then executes step 22; In this context, the robot's rotation in place at a rotation center position is one full rotation, which means the robot rotates 360 degrees around that rotation center position. The preset number of laps is set to be greater than 1.
8. The robot relocation method according to claim 7, characterized in that, The current window is rectangular; the horizontal side length of the current window is equal to the maximum ranging distance of the single-point ranging sensor; the vertical side length of the current window is greater than or equal to the robot's body diameter; half of the maximum ranging distance of the single-point ranging sensor is equal to the preset extension distance. The robot sets the center of the window it is currently in as the first rotation center position; The robot sets the vertical centerline of the currently located window as the baseline; The robot sets the positions on two symmetrical directions of the vertical baseline that are half the distance from the center of the window it is currently in and located on the vertical baseline as the second first rotation center position and the second second rotation center position, respectively. The robot sets the positions on two symmetrical directions that are a preset extension distance from the center of the window it is currently in and located on the vertical baseline as the third first rotation center position and the third second rotation center position, respectively. Among them, the first rotation center position, the second rotation center position, the second rotation center position, the third rotation center position, and the third rotation center position all belong to the rotation center positions. The robot traverses each of the rotation center positions sequentially and without repetition within the current window to scan multiple line feature sub-maps within the current window.
9. The robot relocation method according to claim 6, characterized in that, In step 2, whenever the robot detects that the length of the fitted line segment corresponding to the desired direction is greater than a preset fitting length threshold, the following situation exists: When the fitted line segment with the corresponding direction is within the current window, the robot sets the fitted line segment with the corresponding direction as the fitted line segment and marks it on the map, and records the coordinates of the starting point, the coordinates of the ending point, and the tilt angle of the fitted line segment with the corresponding direction, and determines to record the fitted line segment with the corresponding direction. The tilt angle is set to the angle between the fitted line segment and the coordinate axis. Among them, the criteria for judging whether two line segments are different include that the coordinates of the starting point of the line segments are different, the coordinates of the ending point of the line segments are different, or the angle of inclination is different. The fitted line segment corresponding to the direction is formed by the robot using the least squares method to fit the point cloud data collected within the corresponding angle range into a target straight line equation, which represents the line segment corresponding to the direction.
10. The robot relocation method according to claim 5 or 6, characterized in that, In step 5, the matching success rate between the fitted line segments of the two target subgraphs is the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment length; wherein, the fitted line segment pair participating in the similarity matching of line segment length consists of a fitted line segment in one target subgraph and a fitted line segment in the other target subgraph. Within the global working area, the target subgraph group containing two fitted line segments that participate in the similarity matching of line segment lengths is a target subgraph pair; in a target subgraph pair, one target subgraph is set as a reference target subgraph, and the other target subgraph is set as a target subgraph to be matched, which is the target subgraph rotated in step 4.
11. The robot relocation method according to claim 10, characterized in that, In step 4, the method of matching the similarity of the length of the fitted line segments in the target sub-image after the robot controls the rotation with the fitted line segments in other target sub-images is as follows: the robot controls the fitted line segments in the target sub-image to be matched to match the fitted line segments at the corresponding positions in the reference target sub-image to match the length of the fitted line segments. The method for matching the similarity of line lengths between fitted line segments in the target sub-image to be matched and fitted line segments at corresponding positions in the reference target sub-image specifically includes: Step 41: Calculate the absolute value of the difference between the length of a fitted line segment in the target sub-image to be matched and the length of a fitted line segment in the reference target sub-image; Step 42: When the absolute value of the difference mentioned in Step 41 is less than or equal to a preset length threshold, it is determined that a fitted line segment in the target sub-image to be matched and a fitted line segment at the corresponding position in the reference target sub-image have successfully matched in terms of line segment length similarity, and the fitted line segment currently undergoing line segment length similarity matching is marked as a successfully matched fitted line segment pair; When the absolute value of the difference mentioned in Step 41 is greater than the preset length threshold, it is determined that a fitted line segment in the target sub-image to be matched and a fitted line segment at the corresponding position in the reference target sub-image have failed to match in terms of line segment length similarity, and the fitted line segment currently undergoing line segment length similarity matching is marked as a failed matched fitted line segment pair.
12. The robot relocation method according to claim 11, characterized in that, When the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment length is greater than or equal to the first preset success rate, it is determined that the target subgraph to be matched is successfully matched with the reference target subgraph, and it is marked as a successfully matched target subgraph pair. Within the global working area, when the ratio of the number of all successfully matched target subgraph pairs to the number of all target subgraph pairs participating in the matching is greater than or equal to the second preset success rate, the similarity matching of the line segment length between the fitted line segment in the target subgraph to be matched and the fitted line segment in the reference target subgraph is stopped; wherein, all target subgraph pairs participating in the matching include any two different target subgraphs.
13. The robot relocation method according to claim 11, characterized in that, Before the robot performs length similarity matching between each fitted line segment in the target sub-image to be matched and the fitted line segment at the corresponding position in the reference target sub-image, or when the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching is less than a first preset success rate, the robot sets the rotation center position corresponding to the target sub-image to be matched as the offset starting position; then controls the target sub-image to be matched to translate along the predetermined coordinate axis direction from the offset starting position according to the preset translation step size; each time the target sub-image to be matched is translated once, the translated target sub-image to be matched is updated to the target sub-image to be matched, and then the robot is controlled to execute steps 41 and 42.
14. The robot relocation method according to claim 13, characterized in that, Provided that the coordinate offset of the target sub-image to be matched, translated from the offset starting position along the same coordinate axis, has not reached the maximum preset offset, whenever the target sub-image to be matched is translated by a preset translation step, the robot determines whether the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment length is greater than or equal to the first preset success rate. If yes, the target sub-image to be matched is determined to be successfully matched with the reference target sub-image, and the coordinate offset of the target sub-image to be matched, translated from the offset starting position along the latest translation direction, is set as the error coordinate offset, and the target sub-image to be matched stops translating; otherwise, the robot adjusts the direction of the predetermined coordinate axis to the opposite or perpendicular coordinate axis direction, updates the opposite or perpendicular coordinate axis direction to the predetermined coordinate axis direction, and then controls the target sub-image to be matched to translate from the offset starting position along the predetermined coordinate axis direction by the preset translation step. If the coordinate offset of the target sub-image to be matched, which has been translated along the same coordinate axis from the offset starting position, has reached the maximum preset offset, then when the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment lengths is less than the first preset success rate, the robot adjusts the direction of the predetermined coordinate axis to the opposite or perpendicular coordinate axis direction, updates the opposite or perpendicular coordinate axis direction to the predetermined coordinate axis direction, and then controls the target sub-image to be matched to translate along the predetermined coordinate axis direction from the offset starting position by the preset translation step size; Specifically, starting from the offset starting position, before the coordinate offset of the same target sub-image to be matched reaches the maximum preset offset, each time the same target sub-image to be matched is translated along the predetermined coordinate axis direction by the preset translation step, the translated target sub-image to be matched is updated to the target sub-image to be matched, and then steps 41 and 42 are executed; each time the robot matches each fitted line segment in the target sub-image to be matched with the fitted line segment at the corresponding position in the reference target sub-image, the robot determines whether the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in the similarity matching of line segment length is greater than or equal to the first preset success rate.
15. The robot relocation method according to claim 14, characterized in that, When the coordinate offset of the target sub-image to be matched, which has been translated along all coordinate axes from the offset starting position, reaches the maximum preset offset, if the ratio of the number of all successfully matched fitted line segment pairs to the number of all fitted line segment pairs participating in similarity matching is less than the first preset success rate, then it is determined that the target sub-image to be matched and the reference target sub-image have failed to match. Then, excluding the pair of target sub-images that failed to match, steps 4 and 5 are executed. The maximum positioning error is pre-set and is associated with the maximum preset offset, which includes the maximum preset offset coordinate in the horizontal axis direction and the maximum preset offset coordinate in the vertical axis direction.
16. The robot relocation method according to claim 15, characterized in that, When the robot has traversed all the target sub-images within all windows of the global working area, the robot obtains multiple error coordinate offsets. If the robot determines that the number of currently obtained error coordinate offsets is greater than the preset processing number, then among all the currently obtained error coordinate offsets, the error coordinate offsets with the largest horizontal coordinate value, the error coordinate offsets with the smallest horizontal coordinate value, the error coordinate offsets with the largest vertical coordinate value, and the error coordinate offsets with the smallest vertical coordinate value are all removed. Then, the average value of the remaining error coordinate offsets is calculated to obtain the average coordinate offset. Then, the average coordinate offset is set as the positioning coordinate compensation value. Each error coordinate offset includes a horizontal axis error coordinate offset and a vertical axis error coordinate offset. Each positioning coordinate compensation value includes a horizontal axis positioning coordinate compensation value and a vertical axis positioning coordinate compensation value.