Map management method based on band-string matching, and robot
By using a map management method based on string matching, the robot determines priorities and performs string matching in multi-frame maps, solving the compatibility problem when map elements are modified in existing technologies and achieving more efficient map management and navigation positioning.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- AMICRO SEMICONDUCTOR CO LTD
- Filing Date
- 2025-09-09
- Publication Date
- 2026-07-02
AI Technical Summary
In existing technologies, robot map management methods are prone to errors when inserting or deleting map element information, have poor compatibility, and require frequent maintenance of map version numbers, which can lead to map unavailability.
A map management method based on string matching is adopted. By pre-constructing multiple frames of maps and using map traversal marker values to determine priorities, the robot traverses the current frame map and performs string matching until a match is successful. The current frame map is then loaded as the navigation map, thus avoiding the dependency on map version numbers.
It reduces the coupling when modifying map information, improves operational compatibility, reduces coding errors, and simplifies map management processes.
Smart Images

Figure CN2025120005_02072026_PF_FP_ABST
Abstract
Description
Map Management Method and Robot Based on String Matching Technical Field
[0001] This application relates to the technical field of map management, and more particularly to a map management method and robot based on string matching. Background Technology
[0002] Chinese invention patent application CN202211277471.8 discloses a robot map management method that uses a fixed increment to mark map identification values on the map traversal marker value, marking the map layer by layer. This records the map identification value of the current map representing a new environmental area. Through continuous marking at each floor, a unique identifier value for each floor area can be obtained, establishing a multi-floor map list (linear storage space). This facilitates the differentiation and scheduling of map information from different floor areas. The incremented map identification value is stored as a map version number in the map file. Each piece of map information must be in sequential order; otherwise, the information will not be read. Therefore, robot map information saving and updating typically uses an upward incrementing version number method to support the saving of new map information. However, this method often has poor compatibility with operations such as inserting or deleting map elements, leading to errors, insufficient testing, and missed tests when modifying map element information, ultimately rendering the map unusable. Summary of the Invention
[0003] This application aims to provide a map management method and robot based on string matching, and the specific technical solution is as follows:
[0004] Based on a map management method using string matching, the robot pre-constructs multiple map frames and then identifies each frame using a map traversal marker value. The traversal marker value of a map frame indicates its priority, thus determining the traversal order between different map frames. The map management method includes: Step A: The robot traverses the current frame map, where the current frame map is the highest priority untraversed map among the multiple frames; then, Step B is executed; Step B: It is determined whether the robot has successfully traversed the current frame map. If so, the current frame map is changed from an untraversed map to a traversed map, and Step C is executed; Step C: The robot initializes the map storage area and then, according to the string matching method... The structure is organized to generate the band string corresponding to the reference frame map; then step D is executed; wherein, the map storage area is used to store the reference frame map; in step D, the robot uses the band string corresponding to the reference frame map to perform band string matching on the current frame map, and determines whether the current frame map is successfully matched. If it is, the current frame map is loaded as a map for robot navigation and positioning. Otherwise, according to priority, the next frame map is traversed in the multi-frame map and the next frame map is updated to the current frame map, and then step A is executed; wherein, the priority of the next frame map in step D is lower than the priority of the current frame map in step A; wherein, the reference frame map is a pre-matched frame map among the multi-frame maps. Attached Figure Description
[0005] Figure 1 is a flowchart illustrating a map management method based on string matching, as disclosed in an embodiment of this application.
[0006] Figure 2 is a schematic diagram of a string matching process disclosed in another embodiment of this application.
[0007] Figure 3 is a schematic diagram of multiple strings within a segment disclosed in another embodiment of this application. Detailed Implementation
[0008] The technical solutions of the embodiments of this application will be described in detail below with reference to the accompanying drawings. To further illustrate the embodiments, this application provides accompanying drawings. These drawings are part of the disclosure of this application and are 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 implementation methods and the advantages of this application.
[0009] Currently, the robot's saving and retrieval of multi-frame maps are based on map version numbers (e.g., identifier values). This means that each piece of map information stored in the memory file must have a specific order; otherwise, the map information will not be accessed. Consequently, the map file uses version numbers (e.g., identifier values) for iterative control. These version numbers (e.g., identifier values) are incremented by a fixed value to iteratively generate map files with different version numbers. That is, each time a map file is modified, it iterates up one version number to indicate the modification. If element information is inserted or deleted into a map file with a specific version number, the element information in the resulting map file will not be the original element information. Inserted or deleted element information may have coupling relationships with other element information. Under the aforementioned incrementing fixed-value mode, the version number of the map file after inserting or deleting element information cannot be updated adaptively in a timely manner, reducing its compatibility with operations involving inserting or deleting element information. Inserted or deleted element information may also affect other element information, easily leading to problems due to code errors, insufficient testing, and missed tests. Furthermore, this method requires continuous maintenance of the map version number, resulting in low efficiency.
[0010] As one embodiment, this embodiment discloses a map management method based on string matching, where the robot is the executor of the map management method. Before executing the map management method, the robot pre-constructs multiple map frames. To configure the priority of each map frame, this embodiment references a map traversal marker value marking method from Chinese invention patent application number CN202211277471.8. This method involves the robot identifying each map frame using map traversal marker values. Specifically, the map identification value is marked by adding a fixed increment to the map traversal marker value, recording the map identification value of the current map used to represent a new environmental area. The traversal marker value of one map frame indicates the priority of that frame, determining the traversal order between different map frames. However, when performing read or write operations on each map frame, errors can occur because the marking method of the map identification value and the map after inserting or deleting element information are easily coupled and associated with other element information, preventing the robot from loading the correct map for navigation and positioning.
[0011] Based on this, as shown in Figure 1, the map management method includes:
[0012] Step A: The robot traverses the current frame map, where the current frame map is the highest priority untraversed map among the multiple frames; then, step B is executed; before executing step A, the robot first loads the pre-configured priority multiple frame maps, distinguishes between traversed and untraversed maps, and then selects the highest priority untraversed map as the current frame map, allowing the robot to traverse it.
[0013] Step B: Determine whether the robot has successfully traversed the current frame map. If yes, the current frame map is changed from an untraversed map to a traversed map, and step C is executed; otherwise, the map management method is stopped. In step B, when the robot discovers a map area with a planarable path in the current frame map during traversal, it is determined that the traversal of the current frame map has been successful.
[0014] Step C: The robot initializes the map storage area and then organizes the tape string corresponding to the reference frame map according to the tape structure; then, step D is executed. Specifically, in step C, the robot initializes the information in the map storage area, including initializing various types of map information associated with tape strings for robot navigation. Each type of map information corresponds to a map element. The map storage area is used to store the reference frame map; therefore, step C is essentially initializing the reference frame map, obtaining map elements, and then organizing the map elements into a tape string corresponding to the reference frame map according to the tape structure, so that the map elements match the current frame map in a tape string structure; then, step D is executed.
[0015] In step C, the robot initializes multiple map elements from the map storage area, including initializing the content and type of each map element's strip. Then, the robot formats each map element into a corresponding strip string according to the strip structure, i.e., initializes a corresponding strip string. Since each strip string is a strip string within the reference frame map, the robot organizes all the formatted map elements into the strip string corresponding to the reference frame map, thereby formatting each map element into the structural information of the strip element.
[0016] Step D: The robot uses the string corresponding to the reference frame map to perform string matching on the current frame map, and determines whether the current frame map is successfully matched. If it is, the current frame map is loaded as a map for robot navigation and positioning. Otherwise, it traverses the next frame map in the multi-frame map according to priority and updates the next frame map to the current frame map, and then executes step A. The priority of the next frame map in step D is lower than the priority of the current frame map in step A. The reference frame map is a pre-matched frame map among the multi-frame maps, which can be understood as a pre-set standard map. Each map element in the reference frame map can be stored in the map file in a string structure, and the string converted from each map element in the reference frame map can be modified.
[0017] Step D involves matching the current frame map with the corresponding band string of the reference frame map. The basic process includes first confirming that the corresponding band string initialized and organized in step C is a band string that accepts band string matching and is stored in the map storage area. Then, the band string that accepts band string matching is read from the current frame map. Next, the band string corresponding to the current frame map is controlled to perform band type matching and band length matching with the band string stored in the map storage area. For example, the corresponding band type in the map storage area is compared first. If the band type matches, the corresponding band content is read and the band length is compared.
[0018] When step D determines that the robot has successfully matched the current frame map using the band string corresponding to the reference frame map, the robot obtains each map element from the current frame map that matches the band type and band length of the corresponding band string in the reference frame map / the map storage area. These elements can be directly used for navigation and positioning in the current frame map, and the current frame map can be updated to the reference frame map.
[0019] When step D determines that the robot fails to match the current frame map with the reference frame map, it selects the highest priority frame map from the untraversed maps of the multi-frame map as the next frame map, updates the next frame map to the current frame map, and then repeats steps A to D. Thus, based on the reference frame map in the map storage area, in the case of failure to match the reference frame map, it iterates through the untraversed maps in the multi-frame map to match the reference frame map until the match is successful.
[0020] In summary, by executing steps A to D, the robot organizes the reference frame maps stored in the map storage area into corresponding string strings. Then, it uses these string strings to match the current frame map. If the match fails, a lower-priority map frame is used to match the string strings corresponding to the reference frame map. This process continues until a match is successful, at which point the current frame map is loaded as the map for robot localization. Therefore, this application introduces string strings to represent map information, replacing the existing technology that uses map version numbers to identify map information. This allows two matching map frames to be manipulated using string strings, eliminating the need to consider the matching and generation order of map information from different frames. This reduces coupling between different maps, solves the problem of poor compatibility of map version numbers with modifications and deletions of map information, and addresses the need to maintain map version numbers. It also reduces errors during map information encoding.
[0021] Based on the aforementioned embodiments, in step B, it is determined whether the robot has searched for a navigation path from the current frame map. If yes, it is determined that the robot has successfully traversed the current frame map and that the current frame map supports string matching; otherwise, it is determined that the robot traversal has failed.
[0022] If the robot finds a navigation path from the current frame map using a conventional path search algorithm (e.g., a heuristic search algorithm), it indicates that the current frame map is a usable map. The robot can collect navigation paths from the current frame map and use it for path planning. The map information used for path planning can be formatted into a string structure in the current frame map. The strings formatted from different map information are not coupled to each other and work together to help the robot plan its path within the accessible area of the map and obtain a navigation path. Then, the string formatted from the map information in this current frame map is suitable for proceeding to step D to perform string matching, so as to load it into a map for robot positioning.
[0023] Conversely, if the robot cannot find a navigation path from the current frame map, it is determined that the map information of the current frame map cannot provide a reachable area for the robot, and therefore it is not suitable for the robot to perform navigation and positioning. Thus, the robot traversal is determined to have failed and the execution of the map management method is stopped.
[0024] Based on the foregoing embodiments, in step C, the method for the robot to initialize the map storage area includes: setting various types of map elements in the map storage area, so that the robot can at least distinguish from the map storage area the map elements used for participating in band string matching and the map elements not used for band string matching; when initializing the map storage area in step C, various types of map elements are loaded, indicating that the map storage area can match or generate band strings. Specifically, initializing the map storage area configures relevant types of map elements that support reading and writing by external devices, thereby determining which types of map elements the reference frame map can distinguish for matching and generation. However, these are all configured with the corresponding band types before being stored in the map storage area or before participating in band string matching. From the perspective of serialized access, each map element used for participating in band string matching can be serially written into a map frame or serially read out from a map frame.
[0025] In step C, if a map frame contains multiple map elements, the reference frame map stored in the map storage area can have multiple map elements. Each map element corresponds to a type of map element, and each type of map element represents a type of map information within a map frame. After initialization, it is not only determined which type of map elements can be matched and generated, but they are also independent of each other, at least not arranged in order according to sequence number in the map storage area, and there is no coupling. If some historical map information pre-stored in a map frame is too redundant or even never used again, such map information can be deleted, and the corresponding map elements can be deleted accordingly. Since different map elements are not coupled, it will not affect other map elements.
[0026] Therefore, before performing band matching in step D, it is necessary to initialize the map elements of the band type participating in the band matching in step C. There can be multiple band types prepared in advance for band matching in step C, which correspond to various types of map information in the reference frame map.
[0027] In some initialization embodiments, during the initialization of the map storage area by the robot, if new map elements are introduced into the map storage area by modifying the map, the map elements existing in a frame of the map are first marked as old map elements. Then, when a frame of the map is modified, the map elements existing in the modified frame of the map are composed of the new map elements formed before the modification and the old map elements, so that the map storage area is compatible with the set band type and the newly set band type. The old map elements and the new map elements each correspond to a band type. To illustrate, some map elements in the robot mapping system, even after modification, cannot be discarded due to user needs. For example, when virtual wall information from version 1 is modified to boundary information from version 2, the robot mapping system needs to save both the virtual wall information from version 1 and the boundary information from version 2. Therefore, the virtual wall information from version 1 is formatted as an old map element in step C. After the reference frame map is modified, the boundary information from version 2 is formatted as a new map element in step C. This not only retains the virtual wall information from version 1 as a typed map element but also sets up a new typed map element. The old map element is synchronized to the new map element in the modified reference frame map. Thus, when the new map element participates in band matching in step D, the old map element is still retained. Therefore, by initializing the map storage area to create new map elements, new typed map elements are supported backward. Simultaneously, by initializing the map storage area to retain old map elements, older versions of map information are supported forward, eliminating the need to maintain the map version number.
[0028] As one embodiment, as shown in Figure 3, the robot configures a map frame as a segment, and formats a map element as a string, so that a segment is composed of multiple strings. In the segment structure in Figure 3, the strings are arranged from top to bottom as string 1, string 2, string ... (omitting the multiple strings between string n and string 2), and string n. Each string is composed of string type, string length, and string content in sequence. In Figure 3, string 1 is composed of string type 1, string length 1, and string content 1 in sequence; string 2 is composed of string type 2, string length 2, and string content 2 in sequence; string ... is composed of string type ..., string length ..., and string content ... in sequence; and string n is composed of string type n, string length n, and string content n in sequence.
[0029] Each time content of a certain length is retrieved from a map element, it can be formatted into the structure information of a strip element. The formatted result is represented as a strip string composed of strip elements. Strip type, strip length, or strip content are strip elements. A strip string supports adding, deleting, modifying, or searching for strip elements, which is equivalent to adding, deleting, searching, and modifying map elements on strip elements. The same strip element in different strip strings is independent of each other. Different strip strings represent different types of map information, and different types of map information correspond to different formatted strip elements.
[0030] In this embodiment, the robot configures the data type defined by the data stored in the memory space of a map element as a strip type. The memory space here includes the aforementioned map storage area and the cache space of the current frame map. The robot configures the data length of a map element in the memory space as a strip length and configures the content data stored in the memory space of a map element as strip content, so that a map element is formatted as a strip string, and different map elements do not affect each other when participating in the strip string matching.
[0031] In this embodiment, a map frame is either the current frame map or a reference frame map; a map element within a map frame corresponds to at least one band type, at least one band length, and at least one band content; wherein, the data length of the band content is the band length. The map information represented by a map element, including the displayed map, map room polygon information, the number of virtual wall coordinates in the environment, restricted areas, etc., are all organized in a structure called a segment as shown in Figure 3. Schematically, the map room polygon information is represented here as a band string, the band type is a defined unsigned 32-bit fixed value, the band length is the data length occupied by the room polygon information, and the band content stores the room polygon information, which includes the physical outline of the polygon room, virtual boundaries, etc.
[0032] In summary, for a specific segment, as long as all the band types, band lengths, and band contents are determined, all the band strings for that segment can be generated, as well as all the corresponding band elements within those band strings. Furthermore, different band strings do not interfere with each other, and the addition, deletion, querying, and modification of map elements are only performed on the band elements, without needing to consider the order in which the band strings are loaded. This reduces the coupling between different band strings, meaning that the encoding and modification of each band string within the same map frame can be done independently, reducing errors.
[0033] As one embodiment, in step C, after the robot initializes the map storage area, the method of organizing map elements into a tape string corresponding to the reference frame map according to the tape structure includes: whenever a currently specified map element is searched from the map storage area, the tape type is configured for the currently specified map element according to the data type defined by the data stored in the map storage area of the currently specified map element; the tape length is configured for the currently specified map element according to the data length of the currently specified map element in the map storage area; the tape content is configured for the currently specified map element according to the content data stored in the map storage area of the currently specified map element; and the tape type, tape length, and tape content are sequentially combined to form a tape string corresponding to the currently specified map element and stored in the map storage area, thereby realizing the formatting of a map element into a tape string.
[0034] It should be noted that the currently specified map element is the map element that needs to be transformed according to the string matching in step D and is searched in the map storage area, and is not coupled with other map elements in the reference frame map.
[0035] Based on this, the system searches for each map element within the map storage area and sequentially configures the band type, band length, and band content for each map element that needs to participate in band string matching. This process continues until all map elements in the map storage area have been searched. A band string corresponding to each specified map element in the map storage area is then sequentially formed. Finally, each band string formed in the map storage area is organized into a band string corresponding to the reference frame map, thus serializing each specified map element into the reference frame map. Since band type, band length, and band content all belong to band elements, the string of serialized band elements can be understood as a band string. The reading of band strings corresponding to different map elements does not affect each other. Therefore, based on the construction of band strings, the generation order of each map element does not need to be considered, overcoming the technical deficiency of existing technologies where each map information stored in a map file must have a specific order.
[0036] As one embodiment, as shown in Figure 2, in step D, the method for the robot to perform band matching on the current frame map using the band corresponding to the reference frame map includes:
[0037] Step D1: Read the matching band elements of the current map element from the current frame map, store the matching band elements in the temporary storage area, and then execute step D2. The temporary storage area is a pre-allocated storage area for caching band strings, and internally sets up a band structure for initializing each band element of the band string.
[0038] Preferably, the elements to be matched for the current map element can be a pre-set standard input stream, and all of them need to be read into the temporary storage area; otherwise, an error will occur.
[0039] Each execution of step D1 in the temporary storage area can store one band element to be matched. One band element to be matched corresponds to a map element of a certain band type. A band element to be matched originates from the current frame map and is a band element from one of the band strings that has been pre-read and formatted from the current frame map. Therefore, different executions of step D1 can store band elements from different band strings in the current frame map.
[0040] Step D2: Determine whether the number of bytes occupied by the elements to be matched stored in the temporary storage area has reached the target number of bytes to be loaded. If yes, proceed to step D3; otherwise, stop executing the map management method.
[0041] The elements to be matched stored in the temporary storage area can be arranged in ascending order of low byte to high byte, so that the temporary storage area stores the band type first and then the band length of the same band string. In a band string that the robot pre-reads from the current frame map, the sum of the number of bytes occupied by the band type and the number of bytes occupied by the band length equals the target loading byte count. When the robot determines that the number of bytes occupied by the elements to be matched stored in the temporary storage area reaches the target loading byte count, it determines that the elements to be matched serially stored in the temporary storage area consist of the same band type and band length.
[0042] Step D3: Format the target number of bytes to be matched in the temporary storage area into the band type and band length in the temporary storage area. This can be understood as splitting the band type and band length from the band elements to be matched and storing them in the temporary storage area sequentially, each corresponding to a type of band element participating in the band string matching. Then execute step D4.
[0043] Step D4: Within the map storage area described in step C, search for a band type that matches the band type in the temporary storage area from the band types of the band string corresponding to the reference frame map, thereby matching the band type corresponding to the current map element in the current frame map with the band type of the band string corresponding to the reference frame map; then proceed to step D5.
[0044] Step D5: Determine if a band type matching the band type in the temporary storage area is found. If yes, proceed to step D6; otherwise, update the next map element in the current frame map to the current map element and then proceed to step D1. This indicates that the band type matching for the current map element has failed, and the next map element needs to be buffered to the temporary storage area to repeat the aforementioned band string matching until a band type matching the band type in the temporary storage area is found. Here, the next map element and the current map element are two map elements whose matching results within the current frame map are unrelated; in the storage file of the current frame map, the next map element is stored after the current frame map.
[0045] Step D6: Store the band content of the current map element in the current frame map into the map storage area and update it with the band content of the band string containing the matching band type found in step D4. Essentially, this overwrites the band content of a matching band string in the reference frame map within the map storage area; then execute step D7. Therefore, after matching the band type of the matching band string found in D4, step D7 performs band length matching.
[0046] Step D7: Determine whether the data length of the current map element's content stored in the map storage area in step D6 is equal to the length of the band in the temporary storage area. If yes, proceed to step D8; otherwise, update the next map element in the current frame map to the current map element and then proceed to step D1. This will determine that the band length matching of the current map element has failed, and the next map element needs to be buffered to the temporary storage area to repeat the aforementioned band string matching.
[0047] Since step D6 updates the band content of the current map element in the current frame map to the band content of the band string containing the matching band type found in step D4, when step D7 determines the data length of the band content, it will parse the data length of the band content of the current map element actually stored in the map storage area in step D6, and then compare it with the band length in the pre-determined temporary storage area. The pre-determined band length in the temporary storage area is equivalent to the band length of the current map element read into the current frame map in step D1. Therefore, step D7 determining the data length of the band content is essentially comparing whether the data length of the band content stored in the map storage area is the same as the pre-read band length (or standard data length). If they are the same, it proves that the data length of the band content actually written into the storage space matches the pre-determined band length, that is, there is no error in the band content, and the current map element in the current frame map can be loaded and used for positioning and navigation. At this time, there is no need to consider the matching and generation order of other map elements in the same frame map, reducing errors during encoding.
[0048] Step D8: Determine if the current map element in the current frame map matches the corresponding string in the reference frame map (i.e., the current map element in the current frame map matches successfully). Update the current map element stored in the map storage area to the corresponding string in the reference frame map. Then, update the next map element in the current frame map to the current map element and execute step D1 again to begin string matching of the next map element in the current frame map and its corresponding string in the reference frame map. Preferably, the next map element in the current frame map is a newly specified map element by the robot. Therefore, the robot can start from the first pre-set map element in the current frame map and sequentially match each map element in the current frame map in a read / write access direction. Alternatively, it can import the next map element as needed to continue string matching in the current frame map. This allows each string in the same frame map to be matched independently, decoupling the coupled code between the strings.
[0049] The process does not end when a mismatch is detected in step D5 or D7, or when a match is successful in step D8. Instead, it returns to step D1 to continue matching the remaining stripe strings converted from the current frame map. This continues until all map elements in the current frame map have been read or the last map element has been read (or the end of the map file if the current frame map is organized into a map file). Only then is it determined that all map elements in the current frame map match the stripe strings corresponding to the reference frame map, thus confirming a successful match for the current frame map.
[0050] Based on the above embodiments, when the current frame map is organized into a map file, the last map element in the current frame map to undergo band matching is stored in the map file, serving as the last formatted band in the current frame map and also the last band read. In step D, the method for determining whether the current frame map is successfully matched includes:
[0051] In step D8, before updating the next map element in the current frame map to the current map element, the robot determines whether the current map element is the last map element in the current frame map to undergo band match. If the current map element is the last map element in the current frame map to undergo band match, the robot determines that the current frame map has been successfully matched, that there is no next map element in the current frame map, and that all map elements in the current frame map have undergone band match. Then, according to priority, the robot traverses the next map in the multi-frame map and updates the next map to the current frame map, and then executes step A. If the current map element is not the last map element in the current frame map to undergo band match, the robot updates the next map element in the current frame map to the current map element, and then executes step D1 to control the next map element and the corresponding band in the reference frame map to participate in band match.
[0052] In step D5 or step D7, before the robot updates the next map element in the current frame map to the current map element, step D5 determines that no band type matching the band type in the temporary storage area is found, or step D7 determines that the data length of the band content of the current map element stored in the map storage area in step D6 is not equal to the band length in the temporary storage area. At this time, it is determined whether the current map element is the last map element in the current frame map to be matched with a band string. If it is determined that the current map element is the last map element in the current frame map to be matched with a band string, it is determined that the matching of the current frame map has failed and that there is no next map element in the current frame map. It is also determined that all map elements in the current frame map have been matched with a band string. Then, according to the priority, the next frame map is traversed in the multi-frame map and the next frame map is updated to the current frame map, and then step A is executed. If it is determined that the current map element is not the last map element in the current frame map to be matched with a string, then the next map element in the current frame map is updated to the current map element and step D1 is executed again, so as to control the next map element and the corresponding string in the reference frame map to participate in the string matching.
[0053] Based on this, before executing step D1, it is determined whether the current map element is a map element in the current frame that has not undergone string matching. If so, step D1 is executed; otherwise, step D1 is not executed. At this point, the robot has already read the end of the map file and determined that all map elements in the current frame have undergone string matching. Then, according to priority, the robot traverses the next frame map in the multi-frame map and updates the next frame map to the current frame map before executing step A. Furthermore, before the first execution of step D1, if it is determined that the current map element is the last map element in the current frame to undergo string matching, then only one round of steps D1 to D8 may be executed.
[0054] Therefore, during the repeated execution of steps D1 to D8, as long as the last map element is not matched or the end of the file organized by the current frame map is reached, the process will not end due to a single incorrect matching of a band element. Instead, it will continue to match all remaining band strings within the same frame map until all elements are read or the end of the file is reached. Only after all map elements in the current frame map file have participated in band string matching will the band string matching for the next frame map begin.
[0055] It should be noted that each time step D6 is executed to store the band content of a map element in the current frame map into the map storage area, it is determined that there is a band type in the map storage area that matches the map element. The band type of the map element is the band type in the temporary storage area mentioned in step D4. Then, step D7 is executed to determine whether the data length of the band content of the map element in the map storage area is equal to the band length in the temporary storage area, so as to determine whether the map element matches the corresponding band string in the map storage area. The map element stored in the previous execution of step D6 and the map element stored in the current execution of step D6 are both in the same frame map. The matching result between the map element stored in the previous execution of step D6 and the corresponding band string in the map storage area does not affect the matching result between the map element stored in the current execution of step D6 and the corresponding band string in the map storage area. Thus, the matching process of the band elements can import the band string corresponding to the reference frame map and update the map storage area according to actual needs, so that each band element (band type or band length) can be matched separately with the band string corresponding to the reference frame map. This changes the matching between each band element read in the current frame map and the band elements of the band string corresponding to the reference frame map, thereby decoupling the coupled code between each band element, so that the band elements that are successfully matched on different band strings are called without affecting each other.
[0056] Based on the above embodiment, in step D1, before storing the band element to be matched in the temporary storage area, the band content of the current map element is read from the current frame map. Reading the band content of the current map element can be done after the band element to be matched for the current map element is read from the current frame map. The band content of the current map element is used in step D6. The band element to be matched does not include the band content. When the number of bytes occupied by the band element to be matched is equal to the sum of the number of bytes occupied by the band type and the number of bytes occupied by the band length, the number of bytes occupied by the band element to be matched is equal to the target loading bytes. For example, when the band element to be matched is a 4-byte band type or a 4-byte band length, the target loading bytes are equal to 8 bytes. This allows the band type and band length to be determined before reading the band content of the current map element, thus facilitating the formatting of the first few bytes of the target loading bytes in the temporary storage area into the band type and band length in step D3.
[0057] Based on the above embodiments, each time the robot returns to step D1 from step D5, step D7, or step D8, after the temporary storage area has been opened, the cache starting address used to store the matching band element in the previous execution of step D1 is offset by a preset buffer amount in the temporary storage area to obtain a new cache starting address. Then, starting from the new cache starting address, the matching band element corresponding to the next map element is stored in the temporary storage area. At this time, the temporary storage area is not loaded with band content. Then, in step D2, the robot counts whether the number of bytes occupied by the stored matching band element has reached the target number of loaded bytes, so as to provide the formattable band type and band length in the next map element.
[0058] The preset buffer size is equal to the data length of the band element to be matched of the current map element in the temporary storage area. When a band element to be matched corresponding to the current map element can be a 4-byte band type or a 4-byte band length, the preset buffer size is equal to 8 bytes, so that the band element to be matched stored in the temporary storage area exists as a character stream. After the band string matching is completed, the cache starting address will be automatically offset according to the preset buffer size, so that the formattable band type and band length in the next map element are offset beyond the preset buffer size before being stored in the temporary storage area.
[0059] Each time the content of the current map element is read from the current frame map, the read start address offset by a preset read offset is used to read the content of the current map element when step D1 was executed last time. A new read start address is obtained. At this time, neither the read start address nor the new read start address is an address in the temporary storage area, nor is it equal to the cache start address or the new cache start address. The preset read offset is equal to the data length of the content of the current map element. Then, in order to store the content of the next map element into the map storage area in step D6, the robot first reads the content of the next map element in the current frame map from the new read start address. Then, when executing step D6, it stores the content in the map storage area and updates it with the content of the band string of the matching band type found in step D4. Then, in step D7, it is determined whether the length of the data recently stored in the map storage area is equal to the length of the next map element recently stored in the temporary storage area. When step D8 determines that the current map element in the current frame map matches the band string corresponding to the reference frame map, in addition to updating the next map element in the current frame map to the current map element, the data length of the content of the next map element is also updated to the preset read offset. Then, step D1 is executed, and the new cache start address is offset by the preset read offset, so that the robot continues to read the content of the next map element from the current frame map based on the new cache start address offset.
[0060] The above embodiments are only for illustrating the technical concept and features of this application, and are intended to enable those skilled in the art to understand the content of this application and implement it accordingly. They should not be used to limit the scope of protection of this application. All equivalent changes or modifications made in accordance with the spirit and essence of this application should be included within the scope of protection of this application.
Claims
1. A map management method based on string matching involves the robot pre-constructing multiple map frames and then identifying each frame using map traversal marker values. The traversal marker value of a map frame indicates the priority of that frame, thereby determining the traversal order between different map frames; characterized in that the map management method includes: Step A: The robot traverses the current frame map, where the current frame map is the highest priority untraversed map among the multiple frames; then proceed to step B. Step B: Determine whether the robot has successfully traversed the current frame map. If so, determine that the current frame map has changed from an untraversed map to a traversed map and proceed to step C. Step C: The robot initializes the map storage area and then organizes the tape string corresponding to the reference frame map according to the tape structure; then it executes step D; wherein, the map storage area is used to store the reference frame map; Step D: The robot uses the corresponding string of the reference frame map to perform string matching on the current frame map, and determines whether the current frame map is successfully matched. If it is, the current frame map is loaded as a map for robot navigation and positioning. Otherwise, according to the priority, the robot traverses the next frame map in the multi-frame map and updates the next frame map to the current frame map, and then executes step A. In step D, the priority of the next frame map is lower than the priority of the current frame map in step A. The reference frame map is a pre-matched frame map among the multiple frame maps.
2. The map management method according to claim 1, characterized in that, In step B, it is determined whether the robot has found a navigation path from the current frame map. If yes, it is determined that the robot has successfully traversed the current frame map; otherwise, it is determined that the robot's traversal has failed.
3. The map management method according to claim 1, characterized in that, In step C, the method for the robot to initialize the map storage area includes: By setting multiple types of map elements in the map storage area, the robot can distinguish at least the map elements used for participating in the band matching from the map storage area. Among them, map elements used for string matching can be serially written into a map frame or serially read out from a map frame. Within a single map frame, there are multiple map elements. Each map element corresponds to a type of map element, and each type of map element represents a type of map information within a single map frame.
4. The map management method according to claim 3, characterized in that, During the initialization of the map storage area by the robot, if new map elements are introduced into the map storage area by modifying the map, the map elements existing in a frame of the map are first marked as old map elements. Then, when a frame of the map is modified, the map elements existing in the modified frame of the map are composed of the new map elements formed before the modification and the old map elements. The old map elements and the new map elements each correspond to a type of band.
5. The map management method according to claim 3, characterized in that, The robot configures a map frame as a segment, and the robot formats a map element as a string, so that a segment is composed of multiple strings. A string consists of a type, length, and content in sequence; the type, length, or content are the elements; a string can support adding, deleting, modifying, or searching for elements. Among them, the robot configures the data type defined by storing data of a map element in memory space as a type, the robot configures the data length of a map element in memory space as a length, and the robot configures the content data stored by a map element in memory space as content. Wherein, a frame map is the current frame map or a reference frame map; a map element within a frame map corresponds to at least one band type, at least one band length, and at least one band content.
6. The map management method according to claim 5, characterized in that, In step C, after the robot initializes the map storage area, the method for organizing the tape string corresponding to the reference frame map according to the tape structure includes: Whenever a specified map element is searched in the map storage area, a band type is configured for the specified map element according to the data type defined by the data stored in the map storage area. Then, a band length is configured for the specified map element according to the data length of the specified map element in the map storage area. Then, a band content is configured for the specified map element according to the content data stored in the map storage area. The band type, band length, and band content are then sequentially combined to form the band string corresponding to the specified map element and stored in the map storage area. This process continues until all map elements in the map storage area have been searched. Finally, each band string in the map storage area is organized into the band string corresponding to the reference frame map. The currently specified map element is the map element that needs to be transformed according to the string matching in step D and searched in the map storage area.
7. The map management method according to claim 5, characterized in that, In step D, the method by which the robot performs band matching on the current frame map using the bands corresponding to the reference frame map includes: Step D1: Read the matching band element of the current map element from the current frame map, store the matching band element in the temporary storage area, and then execute step D2; wherein, the temporary storage area is a storage area that is pre-allocated for caching band strings. Step D2: Determine whether the number of bytes occupied by the elements to be matched stored in the temporary storage area has reached the target number of bytes to be loaded. If yes, proceed to step D3. Step D3: Format the target load byte number of the matching band elements stored in the temporary storage area into the band type and band length in the temporary storage area respectively; then execute step D4; Step D4: In the map storage area described in step C, search for a band type that matches the band type in the temporary storage area from the band types of the band string corresponding to the reference frame map, and then execute step D5. Step D5: Determine whether a band type matching the band type in the temporary storage area is found. If yes, proceed to step D6; otherwise, update the next map element in the current frame map to the current map element and then proceed to step D1. Step D6: Store the content of the current map element in the current frame map into the map storage area and update it with the content of the band string containing the matching band type found in step D4, and then execute step D7. Step D7: Determine whether the data length of the current map element's content stored in the map storage area in step D6 is equal to the length of the content in the temporary storage area. If yes, proceed to step D8; otherwise, update the next map element in the current frame map to the current map element and then proceed to step D1. Step D8: Determine that the current map element in the current frame map matches the corresponding string of the reference frame map, and update the current map element stored in the map storage area to the corresponding string of the reference frame map; then update the next map element in the current frame map to the current map element and execute step D1 again.
8. The map management method according to claim 7, characterized in that, In step D, the method for determining whether the current frame map is successfully matched includes: In step D8, before updating the next map element in the current frame map to the current map element, it is determined whether the current map element is the last map element in the current frame map to be matched with a string. If so, it is determined that the current frame map is successfully matched; otherwise, the next map element in the current frame map is updated to the current map element. In step D5 or step D7, before updating the next map element in the current frame map to the current map element, it is determined whether the current map element is the last map element in the current frame map to be matched with a string. If so, it is determined that the matching of the current frame map has failed; otherwise, the next map element in the current frame map is updated to the current map element.
9. The map management method according to claim 7, characterized in that, In step D1, before storing the band element to be matched into the temporary storage area, the band content of the current map element is also read from the current frame map. The element to be matched does not include the element with content. When the number of bytes occupied by the element to be matched is equal to the sum of the number of bytes occupied by the type and the number of bytes occupied by the length, the number of bytes occupied by the element to be matched is equal to the number of bytes loaded in the target.
10. The map management method according to claim 9, characterized in that, Each time the process returns to step D1 from step D5, step D7, or step D8, with the temporary storage area already allocated, the cache starting address used to store the matching band element during the previous execution of step D1 is offset by a preset buffer amount within the temporary storage area to obtain a new cache starting address. Then, starting from the new cache starting address, the matching band element of the next map element is stored in the temporary storage area. The preset buffer amount is equal to the data length of the matching band element of the current map element within the temporary storage area. Each time the content of the current map element is read from the current frame map, the read start address offset used in the previous execution of step D1 is controlled by a preset read offset amount to obtain a new read start address, and then the content of the next map element is read from the new read start address in the current frame map; wherein, the preset read offset amount is equal to the data length of the content of the current map element.
11. A robot that pre-constructs multiple frames of maps and then identifies each frame of the map by traversing map marker values, wherein... The traversal marker value of a map frame indicates the priority of the map frame to determine the traversal order between different map frames; characterized in that the robot is used to execute a map management method based on string matching; The map management method includes: Step A: The robot traverses the current frame map, where the current frame map is the highest priority untraversed map among the multiple frames; then proceed to step B. Step B: Determine whether the robot has successfully traversed the current frame map. If so, determine that the current frame map has changed from an untraversed map to a traversed map and proceed to step C. Step C: The robot initializes the map storage area and then organizes the tape string corresponding to the reference frame map according to the tape structure; then it executes step D; wherein, the map storage area is used to store the reference frame map; Step D: The robot uses the corresponding string of the reference frame map to perform string matching on the current frame map, and determines whether the current frame map is successfully matched. If it is, the current frame map is loaded as a map for robot navigation and positioning. Otherwise, according to the priority, the robot traverses the next frame map in the multi-frame map and updates the next frame map to the current frame map, and then executes step A. In step D, the priority of the next frame map is lower than the priority of the current frame map in step A. The reference frame map is a pre-matched frame map among the multiple frame maps.