Robot path generation method, electronic device, and computer-readable storage medium
By acquiring a grid map and performing dilation processing and key grid filtering, the optimal path for the robot along the wall is generated, solving the accuracy and efficiency problems of path planning in existing technologies and achieving fast and accurate path generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU HUACHENG SOFTWARE TECH CO LTD
- Filing Date
- 2023-04-12
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies struggle to quickly and accurately generate robot paths along walls.
By acquiring a grid map, the target grid in the idle state is identified, and an expansion process is performed to obtain the grid expansion area. From this, key grids are selected, and grids within a certain range of the occupied grids are used to generate the optimal path for the robot along the wall.
This technology enables the rapid and accurate generation of robot paths along walls, reducing the computational load of path planning and improving the accuracy and efficiency of the paths.
Smart Images

Figure CN116642479B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and in particular to a method for generating a robot's path, an electronic device, and a computer-readable storage medium. Background Technology
[0002] With the development of technology, robots are being applied to an increasingly wide range of fields. Robots require path planning technology for movement. In general applications, path planning technology may have special requirements, such as walking along walls. Therefore, how to quickly and accurately generate a robot's path along a wall has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0003] The main purpose of this application is to provide a method for generating robot paths, an electronic device, and a computer-readable storage medium, which can solve the technical problem of quickly and accurately generating robot paths along walls.
[0004] To address the aforementioned technical problems, the first technical solution adopted in this application is: providing a path generation method for a robot. This method includes acquiring a grid map of the current environment; identifying target grids in an idle state from the grid map; performing dilation processing on the target grids to obtain a grid dilation region; identifying key grids from the grid dilation region, wherein the distance between the key grids and occupied grids is less than a first preset distance and greater than a second preset distance, and the second preset distance is less than the first preset distance; and determining the optimal path for the robot in the current environment based on the key grids.
[0005] To address the aforementioned technical problems, the second technical solution adopted in this application is to provide an electronic device. This electronic device includes a memory and a processor. The memory stores program data, which can be executed by the processor to implement the method described in the first technical solution.
[0006] To address the aforementioned technical problems, the third technical solution adopted in this application is to provide a computer-readable storage medium. This computer-readable storage medium stores program data and can be executed by a processor to implement the method described in the first technical solution.
[0007] The beneficial effects of this application are as follows: First, a grid map of the current environment is acquired. Then, target grids in the idle state within the grid map are identified. These target grids are further processed to obtain grid expansion regions. From these expanded regions, key grids are then further identified. Key grids are target grids in the grid expansion regions whose distance from occupied grids is less than a first preset distance and greater than a second preset distance. Therefore, a set of key grid points close to occupied grids can be obtained, i.e., a set of path points close to the wall. Based on this set of path points, the optimal path for the robot along the wall can be obtained. Attached Figure Description
[0008] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0009] Figure 1 This is a flowchart illustrating the first embodiment of the robot path generation method of this application;
[0010] Figure 2 This is a flowchart illustrating the second embodiment of the robot path generation method of this application;
[0011] Figure 3 This is a flowchart illustrating the third embodiment of the robot path generation method of this application;
[0012] Figure 4 This is a flowchart illustrating the fourth embodiment of the robot path generation method of this application;
[0013] Figure 5 This is a flowchart illustrating the fifth embodiment of the robot path generation method of this application;
[0014] Figure 6 This is a flowchart illustrating the sixth embodiment of the robot path generation method of this application;
[0015] Figure 7 This is a flowchart illustrating the seventh embodiment of the robot path generation method of this application;
[0016] Figure 8 This is a flowchart illustrating the eighth embodiment of the robot path generation method of this application;
[0017] Figure 9 This is a flowchart illustrating a specific embodiment of the robot path generation method of this application;
[0018] Figure 10 This is a schematic diagram of the structure of the first embodiment of the electronic device of this application;
[0019] Figure 11 This is a schematic diagram of the structure of the first embodiment of the computer-readable storage medium of this application. Detailed Implementation
[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0021] The terms "first," "second," etc., used in this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0022] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0023] Reference Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the path generation method for the robot according to this application. It includes the following steps:
[0024] S11: Get the current environment's grid map.
[0025] The current environment is the real-world environment in which the robot needs to move. The task is to acquire a raster map of this environment. There are many methods for acquiring raster maps, such as map scanning, using scanners, especially large-format scanners, to quickly acquire a large number of scanned map images; remote sensing image interpretation, where remote sensing is a means of acquiring real-time, dynamic information about the Earth's surface, and images are the main form of remote sensing data. By interpreting and processing images, various thematic information can be obtained, such as land use, vegetation cover, etc.; regular point sampling, which is suitable for situations where the study area is small and the required data resolution is not high. The area to be studied is divided into a uniform grid, and then the value of each grid is obtained and recorded, which is the raster data of that area; irregular point sampling and interpolation, since regular sampling is limited by various factors, interpolation is used to calculate the sampled raster point values; and some data-to-raster conversion operations, etc.
[0026] S12: Identify the target grid cell in an idle state from the grid map.
[0027] In a grid map, the state of a grid cell can be categorized into three types: idle, occupied, and unknown. An idle state indicates that the area contains no information; an occupied state indicates that the area contains object information; and an unknown state indicates that the area is currently undefined. To determine the robot's path, we first need to identify the locations the robot can traverse, which means identifying the target grid cells that are in the idle state.
[0028] S13: Dilate the target grid to obtain the grid expansion region.
[0029] The target grid is expanded to further narrow down the path planning area. Idle target grids are filtered according to preset rules to obtain the expanded grid region. The expanded grid region can include the target grid and occupied grids within a preset range of the target grid.
[0030] S14: Determine the key grid from the grid expansion region. The distance between the key grid and the grid in the occupied state is less than a first preset distance and greater than a second preset distance.
[0031] Further, key grids are identified from the grid expansion region. Key grids are target grids that are close to occupied grids but maintain a certain distance from them; specifically, they are target grids whose distance from the occupied grid is less than a first preset distance but greater than a second preset distance. The second preset distance is less than the first preset distance. Selecting key grids reduces the computational load for subsequent path planning.
[0032] S15: Determine the optimal path for the robot in the current environment based on the key grid.
[0033] After identifying the key grids, the key grids are processed accordingly to determine the optimal wall-side path that meets the conditions in the current environment.
[0034] In this embodiment, a grid map of the current environment is first acquired, and then target grids in the idle state of the grid map are identified. These target grids are further processed to obtain grid expansion regions, and then key grids are further identified from these expansion regions. Key grids are target grids in the grid expansion region whose distance from occupied grids is less than a first preset distance and greater than a second preset distance. Therefore, a set of key grid points close to occupied grids can be obtained, i.e., a set of path points close to the wall. Based on this set of path points, the optimal path for the robot along the wall can be obtained.
[0035] Reference Figure 2 , Figure 2 This is a flowchart illustrating a second embodiment of the robot path generation method of this application. The method is a further extension of step S13, and includes the following steps:
[0036] S21: Obtain the status and number of all grid cells within the preset range of the target grid.
[0037] S22: Determine whether to dilate the target grid using the status and quantity of all grids.
[0038] All grid cells within a certain range of the target grid are acquired to determine whether the state of the target grid meets the requirements. If the target grid meets the requirements, it is expanded to determine the grid expansion area.
[0039] In one embodiment, the robot's generated path is a wall-following path. First, a target grid in an idle state needs to be surrounded by occupied grids; that is, the distance between the target grid and occupied grids must be less than a given value to ensure the robot can move along the wall. Further, since obstacles are also displayed as occupied grids on the grid map, it is necessary to further determine whether the occupied grids around the target grid are occupied grids corresponding to the wall. This determination depends on the state of the grids surrounding the occupied grid. Therefore, the state and number of all grids within a preset range of the target grid can be directly obtained. Based on the state of these grids and the number of grids corresponding to each state, it can be determined whether the target grid can be expanded to be within the grid expansion area.
[0040] Furthermore, it can also obtain the connection relationship between each state grid and the distribution relationship between state grids to more accurately determine whether the target grid can be expanded and identified as a grid within the grid expansion area.
[0041] Finally, the target grid to be expanded, along with the occupied grids within its corresponding range, are defined as the expansion region. Within the expansion region, target grids whose distance from the occupied grids is less than a preset distance are identified as key grids.
[0042] The above method is used to obtain accurate raster expansion regions, thereby ensuring the accuracy of the key raster point set.
[0043] Reference Figure 3 , Figure 3 This is a flowchart illustrating a third embodiment of the robot path generation method of this application. The method is a further extension of step S12, and includes the following steps:
[0044] S31: Preprocess the raster map.
[0045] Preprocessing includes at least one of noise reduction and resolution processing.
[0046] S32: Identify the target grid cells in the idle state from the preprocessed grid map.
[0047] Since the acquired raster maps typically contain some noise, which may not necessarily be generated by the sensor itself but could also be generated by real objects in the environment, denoising is performed on the acquired raster maps first to avoid interference from this noise in the subsequent dilation process. Map denoising methods are not limited to DBSCAN, radius filtering, and Gaussian filtering.
[0048] Since the acquired raster map usually has a high resolution, and path generation usually involves traversing the map, the acquired raster map is processed to reduce its resolution in order to reduce the computational load of subsequent processing.
[0049] Reference Figure 4 , Figure 4 This is a flowchart illustrating the fourth embodiment of the robot path generation method of this application. The method is a further extension of step S15, and includes the following steps:
[0050] S41: Identify the key grid cells within each grid zone according to the grid map's partitions.
[0051] Generally, the larger and more complex the acquired raster map, the more difficult it is to directly obtain an accurate path. Therefore, in order to reduce the difficulty of path acquisition and improve computational efficiency, the raster map is first divided into several partitions, and then the key raster cells used to determine the path are identified within each partition.
[0052] S42: Responding to the critical path formed by the critical grids within any partition, optimize the critical path to obtain the optimal path.
[0053] The key grids within a partition are optimized to form an optimal path. Specifically, in one embodiment, the key grids in the key path can be reordered to obtain the optimal path. The reordering of key grids can be implemented according to the description of the following embodiment.
[0054] Reference Figure 5 , Figure 5 This is a flowchart illustrating the fifth embodiment of the robot path generation method of this application. This method is a further extension of the above embodiments and includes the following steps:
[0055] S51: Identify the target key grid as the root node in any partition.
[0056] The order of the partitions is determined in advance, with the partition where the robot starts being the first partition.
[0057] If the partition is the first partition, the key grid with the shortest path to the robot is taken as the root node; if the partition is not the first partition, the last key grid corresponding to the optimal path in the previous partition is determined, and the key grid with the shortest path to the last key grid in the partition is taken as the root node.
[0058] S52: Build an octree with the root node as the parent node.
[0059] In an octree, the child nodes of a parent node are located in the eight neighboring grid cells surrounding the parent node's corresponding grid cell on the map.
[0060] S53: Reorder the critical grids in the critical path in the octree to obtain the optimal path.
[0061] In an octree, the key grids are sorted according to the relationships between the nodes determined by the octree, thereby obtaining the optimal path.
[0062] In one embodiment, if a partition still has untraversed key grids after the key grids corresponding to the current octree have been traversed, then the key grid with the shortest path between it and the last traversed key grid in the current octree is taken as the root node. That is, the root node of the untraversed key grids in the current partition is determined starting from the last traversed key grid in the current octree, and the octree is built again using this root node.
[0063] Reference Figure 6 , Figure 6 This is a flowchart illustrating the sixth embodiment of the robot path generation method of this application. The method is a further extension of step S53, and includes the following steps:
[0064] S61: Using the root node as the initial parent node, traverse the octree and store the root node in the first dataset.
[0065] S62: If the current parent node contains multiple untraversed child nodes, update the current parent node with the fewest untraversed child nodes in the subtrees of all untraversed child nodes, and store the child node in the first dataset; if the current parent node contains only one untraversed child node, update the untraversed child node with the current parent node, and store the child node in the first dataset; if the current parent node does not have any untraversed child nodes, determine whether the current parent node's parent node exists. If it does, update the current parent node to the current parent node's parent node, and traverse the octree.
[0066] When the current parent node contains multiple untraversed child nodes, update the child node with the fewest nodes in the subtree to become the current parent node. At the same time, store the updated child node in the first dataset, so that the nodes stored in the first dataset are the shortest paths formed based on the current map.
[0067] When the current parent node contains only one untraversed child node, it means that the parent node has only one path direction, that is, the direction corresponding to the untraversed child node. Therefore, there is no need to make a selection. The child node is updated to the parent node, and the child node updated to the parent node is stored in the first dataset.
[0068] If the current parent node has no untraversed child nodes, check if the current parent node's parent node exists. If it does, update the current parent node to the current parent node's parent node, and then perform the traversal operation described above to traverse the entire octree.
[0069] S63: Sort the node elements in the first dataset according to the traversal order to obtain the optimal path.
[0070] The nodes obtained above are stored in the first dataset in the order of traversal, and then sorted in the order of traversal to obtain the optimal path along the wall.
[0071] Reference Figure 7 , Figure 7 This is a flowchart illustrating the seventh embodiment of the robot path generation method of this application. The method is a further extension of step S63, and includes the following steps:
[0072] S71: Obtain the order of node elements, and determine several first target node elements and several target node element ranges.
[0073] In this context, the key grid corresponding to the first target node element is not adjacent to the key grid corresponding to the adjacent node element in the grid map; the key grid corresponding to the node element within the target node element interval is adjacent to the key grid corresponding to the adjacent node element in the grid map.
[0074] S72: Filter the node elements within the range of each target node element to obtain two second target node elements.
[0075] In this embodiment, each sorted node in the first dataset is evaluated to identify adjacent grid cells, thereby further obtaining adjacent grid cell intervals. After obtaining the non-adjacent grid cells and adjacent grid cell intervals, the node element intervals corresponding to the adjacent grid cell intervals are filtered to obtain two target nodes. These two target nodes can be the first and last node elements in the node element interval.
[0076] S73: Sort several first target node elements and several second target node elements to obtain the optimal path.
[0077] The obtained non-adjacent first target node elements and the second target node elements determined based on the node element intervals are sorted according to their corresponding order in the first dataset to obtain the optimal path.
[0078] Reference Figure 8 , Figure 8 This is a flowchart illustrating the eighth embodiment of the robot path generation method of this application. This method is a further extension of the method for determining the target node element range in the above embodiments, and includes the following steps:
[0079] S81: Get the initial node element range.
[0080] The initial node element range includes at least three node elements.
[0081] S82: Fit and judge at least three node elements to determine the target node element range.
[0082] Fitting judgment is used to determine whether at least three node elements are close to a preset path.
[0083] In one embodiment, a path is generated based on a preset path algorithm and the first and last node elements in the initial node element range. It is then determined whether all node elements are located on the path; if they are, it is determined whether the distance between the node element and the path is less than a preset distance.
[0084] Determine a preset percentage of all node elements in an initial node element range that are located on that path, and determine a preset condition that the percentage of all node elements in the initial node element range that are located on that path is greater than the preset percentage.
[0085] In response to a judgment result that does not meet the preset conditions, the initial node element interval is taken as the target node element interval. When the conditions are not met, it is determined that the node elements on the path are relatively discrete, so the initial node element interval is taken as the target node element interval, and the first node element and the second to last node element of the target node element interval are retained as the second target node element.
[0086] In response to the judgment result satisfying the preset condition, the next node element corresponding to the last node element of the initial node element interval is obtained from the first dataset; in response to the next node element being adjacent to the key grid corresponding to the last node element in the grid map, the next node element is added to the initial node element interval for re-judgment; in response to the next node element being not adjacent to the key grid corresponding to the last node element in the grid map, the initial node element interval is determined as the target node element interval.
[0087] If the preset conditions are not met, determine whether the next node element corresponding to the last node element in the initial node element interval of the first dataset is adjacent to the map grid corresponding to the last node element in the initial node element interval. If they are adjacent, add the next node element to the initial node element interval and re-determine. If they are not adjacent, use the initial node element interval as the target node element interval, and retain the first node element and the last node element of the target node element interval as the second target node element.
[0088] The robot path generation method of this application will be described in more detail below with a specific embodiment.
[0089] Reference Figure 9 , Figure 9 This is a flowchart illustrating a specific embodiment of the robot path generation method of this application. In this embodiment, the path obtained is the robot's path along the wall. The obtained optimal path is the shortest path along the wall.
[0090] Step A: Obtain the global map. The global map can be a raster map.
[0091] Step B: Denoise the global map. Common methods for map denoising include, but are not limited to, DBSCAN, radius filtering, and Gaussian filtering.
[0092] Step C: Reduce map resolution. Since the initial map usually has a high resolution, the map resolution is reduced first to reduce the amount of computation required later.
[0093] Step D: Inflate the map. Globally Figure 1 Generally, it includes three states: idle, occupied, and unknown. An idle state indicates the area contains no information; an occupied state indicates the area contains objects; and an unknown state indicates the area's state is unknown. To enable the robot to walk along a wall while maintaining a certain distance, this step determines whether idle map grids should be transformed into an expanded state. This transformation depends on the number and distribution of idle, occupied, and unknown grids surrounding the currently determined grid. Grids transformed into an expanded state form an expanded region.
[0094] Step E: Extract the skeleton from the inflated region. The purpose of skeleton extraction is to extract key grids from the inflated region. These key grids should at least meet the following conditions: the key grids should be as close to the wall as possible while the distance between the key grid and the wall is no greater than a given threshold; in areas where the road is narrow, the key grids should ensure that the robot can pass through the area. After completing the skeleton extraction, a critical path will be obtained.
[0095] Step F: Map Partitioning. Generally speaking, the larger and more complex the global map, the more difficult it is to directly obtain good paths along walls within it. To reduce the difficulty, this step involves partitioning the global map.
[0096] Step G: Generate the wall-following path point set. If a critical path exists in the current partition, the grids in the critical path need to be sorted. The sorted critical path is referred to as the wall-following path. The wall-following path should ensure that the robot can traverse the critical grids with the shortest possible distance. Since most of the neighbors of the grids in the critical path are also critical grids, this step considers using an octree to quickly obtain the wall-following path point set.
[0097] First, construct an octree.
[0098] make Indicates the partition number ( (Counting from 1), the following rule is used to determine the root node of the octree in each partition: If Then calculate the robot up to the th The path to each key grid in each partition is calculated, and the key grid corresponding to the shortest path is selected. This key grid is then used as the root node. Then calculate the first... The last grid cell along the wall path in each partition to the first The path to each key grid in each partition is calculated, and the key grid corresponding to the shortest path is selected. This key grid is then used as the root node. Let... This represents the octree number in a given partition. (Counting from 1), if a partition contains multiple octrees, then when the octree is... Once the traversal order of the octrees is determined, the last node of the octree is used as the starting point. The distance from this starting point to the remaining key grids in the current partition is calculated, and the key grid corresponding to the shortest distance is selected. This key grid is then used as the first key grid. The root node of an octree.
[0099] An octree is built with the root node as the parent node, and the area in the partition map where the parent node searches for child nodes consists of the eight neighboring grids of the parent node.
[0100] Then, the path along the wall is determined in the octree.
[0101] Step G1: First, mark all nodes in the octree as untraversed. Then, store the root node in a sequential container. In the middle, the root node is marked as traversed and then set as the current parent node.
[0102] Step G2: Start from the current parent node. If the current parent node contains multiple untraversed child nodes, count the number of nodes in the subtrees of all untraversed child nodes of the current parent node. Then, select the child node with the fewest untraversed child nodes from the count results and mark it as traversed. Finally, store this child node in a sequential container. Finally, update the child node to the current parent node and return to step G2.
[0103] If the parent node contains only one untraversed child node, then mark that child node as traversed and store it in a sequential container. Then, update the child node to the current parent node and return to step G2.
[0104] If the current parent node has no untraversed child nodes, then check if the current parent node's parent node exists. If it exists, the current parent node is updated to the current parent node's parent node, and then return to step G2; if it does not exist, the octree traversal ends.
[0105] Step H: Sparse the set of points along the wall path.
[0106] Usually by The resulting set of points along the wall will be quite dense. To remove unnecessary points, this step will... Sparsification of points in the middle, and placement of the sparsified points along the wall. .
[0107] Sparsity can be achieved using one of the methods described below.
[0108] Step H1: Determine Check if the number of midpoints is greater than 1. If it is, set the starting index value. End index value Then proceed to step H2; if it is less than or equal to 1, then... Put all elements into Then end this process.
[0109] Step H2: Determine Is it greater than Number of elements ,like Then The first in Add elements In the middle, then end this process; if Then proceed to step H3.
[0110] Step H3: Determine The first in With the If the points are adjacent on the global map, then... The first in Place one point In the middle, then order , Then return to step H2; if adjacent, let Then proceed to step H4.
[0111] Step H4: Determine Is it greater than If it is greater than, then The first in With the Place one point If the value is less than or equal to the specified value, then the process ends; if the value is less than or equal to the specified value, proceed to step H5.
[0112] Step H5: Determine The first in With the If the points are adjacent on the global map, then... The first in With the Place one point In the middle, then order , Then return to step H2; if adjacent, let Then proceed to step H6.
[0113] Step H6: Using respectively The first in and Using points as the starting and ending points, a path is generated using the preset A* algorithm. ,judge The first in and Points between points In the path Above (the so-called point on the path) Above: For a given point ,if There is at least one point in the middle. The distance is less than Therefore, it is believed that exist Above, and conversely, it is considered Not here Above, among which (Given a value.) Does the proportion exceed [the given value]? ,in Given a value. If it does not exceed Then The first in With the Place one point In the middle, order Then return to step H2; if it exceeds If so, return to step H4.
[0114] like Figure 10 As shown, Figure 10 This is a schematic diagram of the structure of the first embodiment of the electronic device of this application.
[0115] The electronic device includes a processor 110 and a memory 120.
[0116] Processor 110 controls the operation of electronic devices. Processor 110 may also be referred to as a CPU (Central Processing Unit). Processor 110 may be an integrated circuit chip with signal sequence processing capabilities. Processor 110 may also be a general-purpose processor, a digital signal sequence processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.
[0117] The memory 120 stores the instructions and program data required for the processor 110 to operate.
[0118] The processor 110 is used to execute instructions to implement the method provided in any of the first to eighth embodiments of the region partitioning method described in this application and possible combinations thereof.
[0119] like Figure 11 As shown, Figure 11 This is a schematic diagram of the structure of the first embodiment of the computer-readable storage medium of this application.
[0120] One embodiment of the readable storage medium of this application includes a memory 210 that stores program data that, when executed, implements the method provided in any of the first to eighth embodiments of the region partitioning method of this application and possible combinations thereof.
[0121] The memory 210 may include a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or other media that can store program instructions. Alternatively, it may be a server that stores the program instructions, which can send the stored program instructions to other devices for execution or execute the stored program instructions itself.
[0122] In summary, the process begins by acquiring a grid map of the current environment, then identifying idle target grids within the grid map. These target grids are further processed to obtain grid expansion regions, from which key grids are then identified. Key grids are target grids within the grid expansion regions whose distance from occupied grids is less than a first preset distance and greater than a second preset distance. Therefore, a set of key grid points close to occupied grids can be obtained, which is essentially a set of path points close to the wall. Based on this set of path points, the optimal path for the robot along the wall can then be determined.
[0123] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of modules or 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.
[0124] 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, depending on actual needs.
[0125] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0126] If the integrated units in the other embodiments described above are implemented as software functional units and sold or used as independent products, they 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.) or processor 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 USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0127] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A path generation method for a robot, characterized in that, The method includes: Get the current environment's grid map; Identify the target grid cells in the idle state from the grid map; The target grid is expanded to obtain the expanded grid region; A key grid is determined from the grid expansion region. The distance between the key grid and the grid in the occupied state is less than a first preset distance and greater than a second preset distance, wherein the second preset distance is less than the first preset distance. The optimal path for the robot in the current environment is determined based on the key grid.
2. The method according to claim 1, characterized in that, Before performing dilation processing on the target grid to obtain the dilated grid region, the process includes: Obtain the status and number of all grid cells within a preset range of the target grid; The state and quantity of all grid cells are used to determine whether to perform dilation on the target grid cell.
3. The method according to claim 1, characterized in that, Before determining the target grid cell in an idle state from the grid map, the process includes: The raster map is preprocessed; the preprocessing includes at least one of noise reduction and resolution processing. The step of determining the target grid cell in an idle state from the grid map includes: Idle target grids are identified from the preprocessed grid map.
4. The method according to claim 3, characterized in that, Determining the optimal path for the robot in the current environment based on the key grid includes: Based on the partitions of the raster map, identify the key raster within each partition; In response to the critical path formed by the critical grid within any partition, the critical path is optimized to obtain the optimal path.
5. The method according to claim 4, characterized in that, The critical grids responding to any partition constitute the critical path. Optimizing the critical path to obtain the optimal path includes: In response to the critical path formed by the critical grids within any partition, the critical grids in the critical path are reordered to obtain the optimal path.
6. The method according to claim 5, characterized in that, The key grids responding to any partition constitute the key path. Reordering the key grids in the key path to obtain the optimal path includes: In any partition, identify the target key grid as the root node; An octree is constructed using the root node as the parent node; The key grids in the critical path are reordered in the octree to obtain the optimal path.
7. The method according to claim 6, characterized in that, The step of determining the target key raster as the root node in any partition includes: If the partition is the first partition, the key grid with the shortest path to the robot will be taken as the root node; If the partition is not the first partition, determine the last key grid corresponding to the optimal path in the previous partition of the partition, and take the key grid in the partition with the shortest path to the last key grid as the root node.
8. The method according to claim 7, characterized in that, After the key grid corresponding to the current octree is traversed, if there are untraversed key grids in the partition, the key grid with the shortest path between the untraversed key grid and the last traversed key grid in the current octree is taken as the root node.
9. The method according to claim 7, characterized in that, The step of reordering the key grids in the critical path within the octree to obtain the optimal path includes: Using the root node as the initial parent node, traverse the octree and store the root node in the first dataset; If the current parent node contains multiple untraversed child nodes, then update the current parent node with the fewest child nodes in the subtrees of all untraversed child nodes of the current parent node, and store the child node in the first dataset. If the current parent node contains only one untraversed child node, then the untraversed child node is updated to the current parent node, and the child node is stored in the first dataset; If the current parent node does not have any untraversed child nodes, then check if the current parent node's parent node exists. If it does, then the current parent node is updated to the current parent node's parent node, and the octree is traversed. The optimal path is obtained by sorting the node elements in the first dataset according to the traversal order.
10. The method according to claim 9, characterized in that, The step of sorting the node elements in the first dataset according to the traversal order to obtain the optimal path includes: The order of node elements is obtained to determine several first target node elements and several target node element intervals; wherein, the key grid corresponding to the first target node element is not adjacent to the key grid corresponding to the adjacent node element in the grid map; the key grid corresponding to the node element in the target node element interval is adjacent to the key grid corresponding to the adjacent node element in the grid map. Filter the node elements within each target node element range to obtain two second target node elements; The optimal path is obtained by sorting a number of first target node elements and a number of second target node elements.
11. The method according to claim 10, characterized in that, Determining the range of elements of the aforementioned target nodes includes: Obtain an initial node element range, wherein the initial node element range includes at least three node elements; The at least three node elements are fitted and judged to determine the target node element range; In response to the judgment result not meeting the preset conditions, the initial node element range is taken as the target node element range; In response to the judgment result satisfying the preset condition, the next node element corresponding to the last node element of the initial node element interval is obtained from the first dataset; In response to the fact that the key grid corresponding to the next node element is adjacent to the last node element in the grid map, the next node element is added to the initial node element range for re-evaluation; In response to the fact that the key grid corresponding to the next node element and the last node element are not adjacent in the grid map, the initial node element interval is determined as the target node element interval.
12. An electronic device, characterized in that, It includes a memory and a processor, the memory being used to store program data, the program data being executable by the processor to implement the method as described in any one of claims 1-11.
13. A computer-readable storage medium, characterized in that, It stores program data that can be executed by a processor to implement the method as described in any one of claims 1-11.