Path planning method and device, electronic equipment and readable storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN LUMIUNITED TECH CO LTD
- Filing Date
- 2021-06-30
- Publication Date
- 2026-08-07
AI Technical Summary
[0015] The path planning method, apparatus, electronic device, and readable storage medium provided in this application first utilize a pre-defined global path planning algorithm to plan a path based on a preset starting point and a preset ending point, thereby obtaining an initial global path. Then, the first local path in the initial global path that needs optimization is optimized to obtain a target global path. Thus, a target global path that meets the requirements can be obtained, facilitating the movement of mobile devices based on this target global path.
Smart Images

Figure CN115540866B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a path planning method, apparatus, electronic device, and readable storage medium. Background Technology
[0002] With the development of artificial intelligence technology, mobile devices with various mobility functions are becoming increasingly widely used. Before a mobile device moves, global path planning is required based on a specified starting point and destination to obtain a collision-free path from the starting point to the destination. Then, the mobile device moves according to the planned global path. Therefore, how to obtain a global path has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0003] This application provides a path planning method, apparatus, electronic device, and readable storage medium, which can obtain an optimized target global path by optimizing the local paths of an initially obtained global path, so that a mobile device can move based on the target global path.
[0004] The embodiments of this application can be implemented as follows:
[0005] In a first aspect, embodiments of this application provide a path planning method, including:
[0006] Based on a preset starting point and a preset ending point, a global path planning algorithm is used to plan the path and obtain an initial global path.
[0007] Determine the first local path in the initial global path that needs to be optimized;
[0008] The first local path in the initial global path is optimized to obtain a target global path, wherein the target global path has the same start and end points as the initial global path.
[0009] Secondly, embodiments of this application provide a path planning device, comprising:
[0010] The planning module is used to plan a path based on a preset starting point and a preset ending point using a set global path planning algorithm to obtain an initial global path.
[0011] The filtering module is used to determine the first local path that needs to be optimized in the initial global path;
[0012] An optimization module is used to optimize the first local path in the initial global path to obtain a target global path, wherein the target global path has the same start and end points as the initial global path.
[0013] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor can execute the machine-executable instructions to implement the path planning method described in any of the foregoing embodiments.
[0014] Fourthly, embodiments of this application provide a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the path planning method as described in any of the foregoing embodiments.
[0015] The path planning method, apparatus, electronic device, and readable storage medium provided in this application first utilize a pre-defined global path planning algorithm to plan a path based on a preset starting point and a preset ending point, thereby obtaining an initial global path. Then, the first local path in the initial global path that needs optimization is optimized to obtain a target global path. Thus, a target global path that meets the requirements can be obtained, facilitating the movement of mobile devices based on this target global path. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A schematic diagram illustrating the communication between the electronic device 100 and the mobile device 200 provided in an embodiment of this application;
[0018] Figure 2 This is a schematic diagram of an application environment applicable to embodiments of this application;
[0019] Figure 3 A flowchart illustrating the path planning method provided in this application embodiment;
[0020] Figure 4 A flowchart illustrating the process of A-star with a high heuristic content;
[0021] Figure 5 for Figure 3 A flowchart illustrating the sub-steps included in step S200;
[0022] Figure 6 A schematic diagram illustrating the determination of a first local path provided in an embodiment of this application;
[0023] Figure 7 for Figure 2 A flowchart illustrating the sub-steps included in step S300;
[0024] Figure 8 for Figure 7 A flowchart illustrating the sub-steps included in the neutron step S330;
[0025] Figure 9 for Figure 8 A flowchart illustrating the sub-steps included in the neutron step S332;
[0026] Figure 10 A block diagram of the path planning device provided in the embodiments of this application;
[0027] Figure 11 This is a block diagram of an electronic device 100 provided in an embodiment of this application.
[0028] Icons: 10-Smart Home System; 11-Gateway Device; 12-Home Device; 13-Server; 14-Terminal Device; 15-Router; 100-Electronic Device; 110-Processor; 120-Memory; 200-Mobile Device; 300-Path Planning Device; 310-Planning Module; 320-Filtering Module; 330-Optimization Module. Detailed Implementation
[0029] 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 some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can be arranged and designed in various different configurations.
[0030] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0031] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0032] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0033] Please refer to Figure 1 , Figure 1 This is a schematic diagram illustrating the communication between an electronic device 100 and a mobile device 200 provided in an embodiment of this application. The electronic device 100 performs global path planning and locally optimizes the obtained initial global path to obtain a target global path, which is then sent to the mobile device 200. The mobile device 200 moves according to the target global path to reach a preset destination without collision. The preset starting point corresponding to the target global path is generally the current position of the mobile device 200. The electronic device 100 can be any device with path planning capabilities, and the mobile device 200 can be a mobile robot (e.g., an industrial robot, a service robot, etc.) or other automatically moving devices.
[0034] Optionally, the electronic device 100 and the mobile device 200 can be two separate devices; or they can be integrated into a single device, meaning that a single device can obtain a target global path through global path planning and move along that target global path.
[0035] The following describes one application environment involved in this application.
[0036] Please refer to Figure 2 , Figure 2 This is a schematic diagram illustrating an application environment applicable to embodiments of this application. Wherein, Figure 2A smart home system 10 is provided. The smart home system 10 includes a gateway device 11, home devices 12 connected to the gateway device 11, and a server 13 connected to the gateway device 11. The number of gateway devices 11 can be at least one, and the number of home devices 12 can be at least one. Furthermore, when there are multiple gateway devices 11, different gateway devices 11 can also communicate with each other. The gateway device 11, home devices 12, and server 13 can all serve as electronic devices 100 for path planning.
[0037] In this embodiment, the gateway device 11 can be a smart gateway for smart home control, capable of functions such as system information collection, information input, information output, centralized control, remote control, and linkage control. The gateway device 11 can be responsible for specific security alarms, home appliance control, and electricity consumption information collection. The gateway device 11 can also wirelessly interact with products such as smart interactive terminals. The gateway device 11 also possesses wireless routing capabilities, excellent wireless performance, network security, and coverage.
[0038] In this embodiment, the home appliance 12 may include various smart home appliances, sensing devices, and detection devices installed in the indoor space, such as robot vacuum cleaners, smart TVs, smart refrigerators, smart air conditioners, temperature and humidity sensors, pressure sensors, smoke sensors, human body sensors, door and window sensors, smart switches, sockets, lights, infrared transmitters, and camera devices. The home appliance 12 connected to the gateway device 11 can interact with the gateway device 11 for information and commands. The gateway device 11 and the home appliance 12 can connect via Bluetooth, WiFi (Wireless-Fidelity), ZigBee (Zifeng Technology), etc. However, the connection method between the gateway device 11 and the home appliance 12 is not limited in this embodiment.
[0039] In this embodiment, server 13 can be a local server, cloud server, or other server; the specific server type is not limited in this embodiment. Server 13, connected to gateway device 11, can exchange information with gateway device 11 wirelessly. Gateway devices 11 located in different indoor spaces can all communicate with the same server 13 via the network to exchange information between server 13 and gateway device 11.
[0040] Furthermore, the aforementioned smart home system 10 may also include a terminal device 14. The terminal device 14 may include a personal computer (PC), tablet computer, smartphone, personal digital assistant (PDA), etc., and is not limited thereto. The terminal device 14 can also serve as the aforementioned electronic device 100 used for route planning. The terminal device 14 can interact with the server 13 via wireless methods such as 2G / 3G / 4G / 5G / WiFi. Of course, the connection method between the terminal device 14 and the server 13 is not limited in this embodiment. In some embodiments, the terminal device 14 can also be used to interact with the user, facilitating wireless communication between the user and the gateway device 11 via the router 15. Additionally, the user can add an account to both the gateway device 11 and the terminal device 14, enabling information synchronization between the two devices.
[0041] In some embodiments, users can set different trigger scenarios or automated linkages through the application (APP) of the terminal device 14. As one approach, the terminal device 14 can upload scenario configuration information or automation schemes to the server 13. When the trigger conditions of the scenario or automation are met, the server 13 can find the device corresponding to the execution action in the stored scenario configuration information or automation scheme, and notify the device to perform the action to satisfy the execution result of the trigger scenario or automation. Alternatively, the server 13 can also send the scenario configuration information or automation schemes to the gateway device 11, which can then find the device corresponding to the execution action in the stored scenario configuration information or automation scheme. Simultaneously, the gateway device 11 can feed back the device's execution status to the server 13.
[0042] The embodiments of this application will now be described in conjunction with the accompanying drawings.
[0043] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating the path planning method provided in an embodiment of this application. The method may include steps S100 to S300.
[0044] Step S100: Based on the preset starting point and preset ending point, perform path planning using the set global path planning algorithm to obtain the initial global path.
[0045] Path planning when the environment is known or unchanged is called global path planning, and the resulting path planning result is called a global path. In this embodiment, any global path planning algorithm can be used as the set global path algorithm. Then, using the set global path planning algorithm, based on a preset starting point and a preset ending point, global path planning is performed to obtain a path from the preset starting point to the preset ending point without collision, and this path is used as the initial global path.
[0046] The global path planning algorithm can be, but is not limited to, graph search. Graph search relies on a known environmental map and information about obstacles in the map to construct a feasible path from the starting point to the destination. Graph search algorithms include Dijkstra's algorithm, Greedy Best First Search (GBFS), and A* algorithm (hereinafter referred to as A* algorithm), etc.
[0047] Step S200: Determine the first local path in the initial global path that needs to be optimized.
[0048] In this embodiment, the initial global path can be analyzed to determine the local paths within it that need optimization, and these local paths are designated as first local paths. The specific number of first local paths may be one or multiple, depending on the actual situation. The local paths that need optimization refer to those with potential for optimization, i.e., those whose path length can be reduced. For example, if a local path from node A to node B is 1.5 meters long, and there is optimization potential, it means that the optimized length of this local path is less than 1.5 meters. In other words, a path from node A to node B can be planned with a path length less than 1.5 meters.
[0049] Step S300: Optimize the first local path in the initial global path to obtain the target global path.
[0050] After determining the first local path, a new path can be planned based on its start and end points. The initial global path is then updated based on the replanned path to obtain the target global path. The target global path shares the same start and end points as the initial global path. This reduces the path length from the preset start point to the preset end point.
[0051] Optionally, the set global path planning algorithm can be an algorithm capable of quickly obtaining the initial global path, meaning that the path planning speed of the set global path planning algorithm is greater than a preset speed, or the search efficiency of the set global path planning algorithm is higher than a preset efficiency. The specific algorithm used as the set global path planning algorithm can be determined according to actual needs. This reduces the time required to obtain the initial global path, thereby increasing the speed of obtaining the target global path.
[0052] Optionally, in one possible implementation, the global path planning algorithm is either the highly heuristic A* algorithm or a greedy best-first search algorithm. Global path planning algorithms also include Dijkstra's algorithm. Dijkstra's algorithm uses the idea of breadth-first search (BFS), which can find the shortest path, but the number of nodes traversed is huge, meaning Dijkstra's algorithm has low search efficiency. The greedy best-first search algorithm uses the idea of depth-first search (DFS), which traverses fewer nodes, but usually does not find the shortest path or a very short path. The search efficiency of the greedy best-first search algorithm is higher than that of Dijkstra's algorithm.
[0053] The standard A* algorithm combines the advantages of Dijkstra's algorithm and the greedy best-first search algorithm, making it a highly efficient global path planning algorithm. The standard A* algorithm's heuristic function is provided by a heuristic function, which is the estimated cost H (or heuristic cost) from the current point to the destination. Typically, H is the Manhattan distance from the current point to the destination. The total cost used in the standard A* algorithm is the sum of the actual cost from the starting point to the current point and the estimated cost from the current point to the destination. The actual cost is usually represented by the Euclidean distance. The standard A* algorithm traverses the nodes between the starting point and the destination in a minimum total cost first-come, first-served manner, thus completing the global path planning.
[0054] The inventors of this application discovered through research that the standard A* algorithm has high search efficiency when there are no obstacles or the obstacles are small. However, when encountering large concave obstacles, it is necessary to traverse more points to bypass the obstacle, which makes the search efficiency relatively low.
[0055] In this embodiment, an initial global path can be obtained first through a highly efficient global path planning algorithm. Then, its local path is optimized to obtain a target local path that corresponds to the shorter path. The initial global path is then updated based on this target local path to obtain the target global path. This solves the problem of low local path planning efficiency in the A* algorithm when encountering large concave obstacles.
[0056] Among them, the total cost used in the A* algorithm with a high heuristic ratio can be calculated according to the following formula:
[0057] F = A1 * G + A2 * H
[0058] Where, F represents the total cost, G represents the actual cost from the starting point to the current point, H represents the estimated cost from the current point to the end point, A1 represents the first preset weight corresponding to the actual cost, A2 represents the second preset weight corresponding to the estimated cost, and A2 > A1.
[0059] The following briefly describes the A* algorithm with a high heuristic ratio in combination with Figure 4 Brief description is given to the A* algorithm with a high heuristic ratio.
[0060] Step1: Establish two lists. One list stores the parent nodes that have been traversed, called close_list; the other list stores the child nodes that have been traversed, called open_list.
[0061] Step2: First, put the starting point into open_list. Then, traverse all the nodes directly connected to the starting point, calculate the total cost F of these nodes, and take these nodes as the child nodes of the starting point, put them into open_list, and take the starting point as the parent node of these nodes and put it into close_list.
[0062] Step3: Take out the node node_par with the minimum total cost F in open_list, traverse all the other nodes node_chi directly connected to this node node_par except those in close_list and obstacles, and calculate the total cost F of these nodes. If a certain node node_chi is already in open_list, then compare the current total cost Fnew of this node node_chi with the previous total cost Fold. If Fnew < Fold, then update the total cost of this node node_chi to Fnew and take node_par as the parent node of this node node_chi; otherwise, do not make any change to this node node_chi. If a certain node node_chi does not exist in open_list, then put this node node_chi into open_list and take node_par as the parent node of this node node_chi. Finally, put node_par into close_list.
[0063] Step 4: Repeat the search process in Step 3, traversing the nodes. Stop the search when either of the following two conditions exists: 1) The destination appears in open_list, indicating that there is a feasible path from the starting point to the destination; 2) There are no nodes in open_list, indicating that there is no feasible path from the starting point to the destination.
[0064] Step 5: If the situation in step 4 1) occurs, start from the endpoint and find the planned path through the parent-child node relationship; if the situation in step 4 2) occurs, indicate that there is no feasible path from the starting point to the endpoint.
[0065] Optionally, after obtaining the initial global path, it can be achieved through... Figure 5 The first local path is determined as shown. Please refer to... Figure 5 , Figure 5 for Figure 3 A flowchart illustrating the sub-steps included in step S200. Step S200 may include sub-steps S210 and S220.
[0066] Sub-step S210: Select candidate local paths from the initial global path based on the distance from each node in the initial global path to the preset endpoint.
[0067] Sub-step S220: Determine the first local path from the candidate local paths.
[0068] In this embodiment, the nodes in the initial global path are traversed in order from the preset starting point towards the preset ending point. The distances from adjacent nodes to the preset ending point are compared to find a series of consecutive nodes whose distances increase sequentially. The local path formed by these consecutive nodes is then used as the candidate local path. The distance from a node to the preset ending point can be the estimated cost of that node or other data that reflects the distance from the node to the preset ending point.
[0069] Let's combine the following... Figure 6 An example is given to illustrate the method of selecting candidate local paths.
[0070] Please refer to Figure 6 In the diagram, A (dark gray) represents obstacles, light gray represents the initial global path, S represents the preset starting point, and G represents the preset ending point. The initial global path sequentially includes the preset starting point S, node 1, node 2, ..., node 4, ..., node 10, node 11, ..., and the preset ending point G. Assuming the cost of moving one square horizontally or vertically is 10, the distance from a node to the preset ending point can be the Manhattan distance used to estimate the cost.
[0071] The Manhattan distances from the preset starting point S to node 11 to the preset ending point G are 70, 50, 40, 30, 40, 50, 60, 70, 80, 90, 100, and 90, respectively. It can be seen that the distance from node 3 to node 10 increases, and the local path from node 3 to node 10 can be used as the candidate local path.
[0072] As an optional implementation, all found candidate local paths can be used as the first local path, and then optimized. This ensures that the final target global path has a relatively short length.
[0073] As another optional implementation, the candidate local path with the longer path length can be selected as the first local path based on the path length of each candidate local path. If the path length of a candidate local path is short, it indicates that the degree of optimization is small; if the path length of the candidate local path is long, it indicates that the candidate local path may have greater optimization potential. This can reduce optimization time and further improve the speed of obtaining the target global path.
[0074] Optionally, during the selection process, a certain number of candidate paths can be selected as the first local path in descending order of path length. Alternatively, the path length of each candidate local path can be compared with a preset length, and the candidate local path with a path length greater than the preset length can be selected as the first local path.
[0075] It is understood that the above is merely an example, and the first local path can also be determined from the candidate local paths in other ways.
[0076] Given a first local path, one possible implementation is to use any algorithm to plan a path based on the start and end points of each segment of the first local path, thereby obtaining a new local path whose start and end points are the same as those of the corresponding first local path. Then, in the initial global path, the first local path can be replaced with the new local path corresponding to it, thus obtaining the target global path. This facilitates the rapid acquisition of the target global path.
[0077] As another possible implementation, it can be achieved through... Figure 7 The method shown updates the initial global path based on each segment of the first local path, and uses the initial global path obtained from the last update as the target global path.
[0078] Please refer to Figure 7 , Figure 7 for Figure 2A flowchart illustrating the sub-steps included in step S300. Step S300 may include sub-steps S310 to S340.
[0079] Sub-step S310: Extend the current first local path along the current initial global path to the preset starting point, and perform path planning based on the start and end points of each obtained first extended path to obtain the first path planning result.
[0080] In this embodiment, the current first local path is a specific first local path targeted by this optimization. If no optimization has been performed on the first local path, that is, if no optimization has been performed on any first local path, the current initial global path is the initial global path, i.e., the global path obtained through step S100. If the first local path has been optimized, the current initial global path is the global path obtained after the most recent optimization of a segment of the first local path.
[0081] For example, when optimizing a first local path 1 for the first time, the current first local path is first local path 1, and the current initial global path is the initial global path. When optimizing another first local path 2 for the second time, the current first local path is first local path 2, and the current initial global path is the global path with the same start and end points as the initial global path obtained after optimizing the first local path 1. It can be understood that the target global path is the current initial global path obtained in the last update.
[0082] The current first local path is the first local path that is closest to the preset starting point and has not yet been optimized. Therefore, the current first local path is determined according to the order from the preset starting point to the preset ending point, and then optimized to facilitate continuous optimization, thereby shortening the path length from the preset starting point to the preset ending point.
[0083] Given the current first local path and the current initial global path corresponding to this local optimization, the endpoint of the current first local path that is close to the preset starting point can be extended along the current initial global path toward the preset starting point, thereby determining the current first local path after each extension, and taking the current first local path after each extension as a first extension path.
[0084] Next, based on the start and end points of each first extension path, a first path planning result corresponding to that first extension path can be obtained through global path planning. It is understood that the start and end points of the first extension path and its corresponding first path planning result are the same.
[0085] When performing global path planning based on the start and end points of the first extended path, the global path planning algorithm used can be any global path planning algorithm; it can also be the global path planning algorithm set in step S100. Optionally, during the optimization of the first local path, the A* algorithm or the greedy best-first algorithm can be used to plan the path again.
[0086] Optionally, based on the obtained first path planning results, it can be determined whether to stop extending the current first local path along the current initial global path to the preset starting point in the current manner; alternatively, other judgment strategies can be used to determine whether to stop the extension, such as stopping the extension when the node reached is the preset starting point, as the number of extended nodes continues to increase. It is understood that the above is merely illustrative, and this embodiment does not specifically limit the method for determining when to stop the extension; it can be set according to actual needs.
[0087] Here, the number of extended nodes represents the number of nodes extended compared to the current first local path. For example... Figure 6 As shown in A, if the current first local path is a local path from node 3 to node 10, when the number of extended nodes is 0, the extended current first local path (i.e., the first extended path) is a local path from node 3 to node 10; when the number of extended nodes is 1, the extended current first local path is a local path from node 2 to node 10; when the number of extended nodes is 2, the extended current first local path is a local path from node 1 to node 10.
[0088] In this embodiment, the current first local path can be extended by sequentially increasing the number of extension nodes. For example, the number of extension nodes is 0 for the first extension, 1 for the second, and 2 for the third. Alternatively, the current first local path can be extended by randomly arranging or otherwise distributing the number of extension nodes. For example, in the process of extending by randomly arranging the number of extension nodes, the number of extension nodes is 1 for the first extension, 0 for the second, and 2 for the third.
[0089] In obtaining the first path planning result, the number of extension nodes sorted in ascending order can increment by 1 sequentially. This makes it easier to find the target local path that maximizes the optimization of the first local path. Alternatively, the number of extension nodes sorted in ascending order can also deviate from the sequential incrementing order, which facilitates quickly obtaining the target local path.
[0090] In obtaining the first path planning result, the number of extension nodes used may be 0, which makes it easier to ensure that the first local path is optimized to the maximum extent.
[0091] It is worth noting that the above-mentioned ascending order of the number of extended nodes is only used to illustrate the situation where the number of extended nodes is in ascending order, and is not intended to limit the number of extended nodes used sequentially during the extension process to be arranged in ascending order. In this embodiment, there is no specific limitation on whether the number of extended nodes used sequentially during the extension process increases sequentially. That is, for example, when extending 1, 2, and 3 nodes respectively, it could be that 1 node was extended in the first extension, 2 nodes in the second extension, and 3 nodes in the third extension; or it could be that 2 nodes were extended in the first extension, 1 node in the second extension, and 3 nodes in the third extension.
[0092] Sub-step S320: Based on each first extended path and the first path planning result, obtain the first path difference before and after each planning step.
[0093] Here, a first path difference represents the difference in path length between a first extended path and the replanned local path; that is, it represents the difference in path length between a first extended path and the corresponding first path planning result. Optionally, when using a grid map for path planning, the number of squares traversed to move horizontally or vertically from the current square to the target can be calculated, ignoring diagonal movement, and this number of squares can be used as the path length to determine the first path difference. This facilitates the rapid determination of the first path difference.
[0094] For ease of subsequent comparison, the first path difference can be the difference between the first value and the second value. The first value represents the path length before planning, that is, the path length of the first extended path; the second value represents the path length after planning, that is, the path length of the path represented by the first path planning result corresponding to a first extended path.
[0095] Sub-step S330: Determine the target local path and the second local path based on the first path difference and the first path planning result.
[0096] Wherein, the second local path is a local path in the current initial global path whose start and end points are the same as those of the target local path.
[0097] In this embodiment, a first path planning result can be directly selected as the target local path, and the first extended path corresponding to the first path planning result can be used as the second local path. This allows for rapid acquisition of the target local path, thereby improving optimization speed.
[0098] Alternatively, if the number of extension nodes sorted in ascending order does not increase by 1 sequentially, based on the obtained first path difference, candidate points that can be extended to by the current first local path are determined. Then, path optimization is performed again based on these candidate points, and the target local path is determined from the replanned path. This improves the optimization effect. It can be understood that in this method, the end of the second local path furthest from the preset starting point is the same as the endpoint of the current first local path furthest from the preset starting point, and the other end is a candidate point corresponding to the target local path.
[0099] Optionally, in one implementation, after each extension, the newly obtained first path difference can be compared with a first preset value. If the newly obtained first path difference is greater than the first preset value, the first path planning result corresponding to the first path difference can be used as the target local path, and the first extended path corresponding to the first path difference can be used as the second local path. Thus, optimization can be completed quickly while meeting certain optimization requirements.
[0100] Alternatively, in another implementation, it can also be achieved through... Figure 8 The target local path is determined as shown. Please refer to... Figure 8 , Figure 8 for Figure 7 A flowchart illustrating the sub-steps included in neutron step S330. Sub-step S330 may include sub-step S331 and sub-step S332.
[0101] Sub-step S331: By comparison, determine the largest first path difference among the first path differences.
[0102] Sub-step S332: Determine the target local path based on the maximum first path difference.
[0103] Optionally, as an alternative implementation, when multiple first path differences are obtained, the largest first path difference among the multiple first path differences can be determined by comparison, and the first path planning result corresponding to the largest first path difference can be used as the target local path, and the first extended path corresponding to the largest first path difference can be used as the second local path.
[0104] Optionally, during the extension process, the extension can be carried out in order of increasing number of extension nodes. After each extension, the newly obtained first path difference is compared with the previously obtained first path difference. If the newly obtained first path difference is less than the previously obtained first path difference, the extension can be stopped, and the first path planning result corresponding to the newly obtained first path difference and the first extension path corresponding to the newly obtained first path difference are respectively used as the target local path and the second local path.
[0105] Alternatively, as another optional implementation, the number of extension nodes used during the extension process is checked to see if it increments by 1 sequentially when sorted in ascending order. If so, the first path planning result corresponding to the maximum first path difference is used as the target local path, and the first extension path corresponding to the maximum first path difference is used as the second local path.
[0106] If not, then it can be done through Figure 9 The target local path is obtained as shown. Please refer to... Figure 9 , Figure 9 for Figure 8 A flowchart illustrating the sub-steps included in neutron step S332. Sub-step S332 may include sub-steps S3321 to S3324.
[0107] Sub-step S3321: Based on the first quantity corresponding to the maximum first path difference, select the second and third quantities from the number of extended nodes sorted in ascending order.
[0108] The number of used extension nodes can be sorted in ascending order. Based on the position of the first number corresponding to the maximum first path difference in the sorted results, a second and third number are selected. Specifically, in the ascending sorted number of extension nodes, the first number lies between the second and third numbers. Optionally, the second and third numbers can be two numbers adjacent to the first number in the sorted results, or two numbers obtained based on other determination methods, such as two numbers separated from the first number by one position in the sorted results. For example, the sorted results may include a, b, c, d, and e, where c represents the first number, and the second and third numbers can be b and d, or a and e, respectively.
[0109] Sub-step S3322: Based on the second quantity and the third quantity, determine multiple candidate points.
[0110] Once the second and third quantities are determined, the nodes corresponding to the second and third quantities can be used as start and end points to determine candidate point local paths from the current initial global path. That is, the candidate point local paths are local paths within the current initial global path that use the nodes corresponding to the second and third quantities as start and end points. The candidate points are the nodes on the candidate point local paths.
[0111] Optionally, the plurality of candidate points can be some nodes on the local path of the candidate points, or it can include all nodes on the local path of the candidate points. The specific choice can be determined according to actual needs.
[0112] Sub-step S3323: Each candidate point is sequentially used as the node to which the current first local path extends. The multiple candidate points are traversed to obtain the second path planning result corresponding to each candidate point and the difference between the second path before and after planning.
[0113] Given the multiple candidate points, the current first local path can be extended sequentially to each candidate point, thereby obtaining multiple second extended paths. Based on the start and end points of each obtained second extended path, global path planning is performed to obtain the second path planning result corresponding to each candidate point, i.e., the second path planning result corresponding to each second extended path. Based on the second extended path and the second path planning result corresponding to each candidate point, the second path difference corresponding to that candidate point can be obtained. Here, the second path difference represents the difference obtained by subtracting a fourth value from a third value, where the third value represents the path length of the second extended path, and the fourth value represents the path length of the second path planning result.
[0114] The global path planning algorithm used in sub-step S3323 and the global path planning algorithm used in sub-step S310 can be the same or different. For example, both can use the A* algorithm, which has a high heuristic weight.
[0115] Sub-step S3324: Select a second path planning result as the target local path based on the second path difference corresponding to each candidate point.
[0116] Optionally, the second path difference corresponding to each candidate point can be compared with a second preset value, and a second path difference greater than the second preset value can be randomly selected. The second path planning result corresponding to this second path difference can be used as the target local path, and the second extended path corresponding to this second path difference can be used as the second local path. Alternatively, the maximum second path difference can be determined by comparison, and the second path planning result corresponding to the maximum second path difference can be used as the target local path, and the second extended path corresponding to the maximum second path difference can be used as the second local path.
[0117] Specifically, when the plurality of candidate points include all nodes on the local path of the candidate points, the second path planning result corresponding to the maximum second path difference is used as the target local path, and the second extended path corresponding to the maximum second path difference is used as the second local path. This achieves maximum optimization.
[0118] Sub-step S340: Replace the second local path in the current initial global path with the target local path to obtain the updated current initial global path.
[0119] After obtaining the updated current initial global path, it is determined whether there is still an unoptimized first local path. If so, sub-steps S310 to S340 are executed again. During the re-execution of sub-steps S310 to S340, the updated current initial global path is the same as the current initial global path mentioned in sub-step S310; that is, the updated current initial global path is the new current initial global path. If it does not exist, the optimization is considered complete, and the updated current initial global path is taken as the target global path. Thus, by traversing fewer nodes, a satisfactory target global path (i.e., the shortest or relatively shortest path) can be obtained, improving the planning efficiency of the target global path.
[0120] The following is combined with Figure 6 An example is provided to illustrate how the target local path is obtained. In this example, the extension process proceeds by sequentially increasing the number of extension nodes.
[0121] The endpoint furthest from the preset starting point S in the current first local path can be taken as the starting point Slo of the path to be optimized (i.e., the second local path), and the endpoint closest to the preset starting point S can be taken as the starting point Gloo of the endpoint of the path to be optimized. Then, starting from the starting point Gloo, the endpoint can be iterated, and the node with the largest difference between the path before and after optimization can be taken as the final optimized endpoint, at which point the iteration stops (i.e., the extension stops). Different nodes as endpoints of the path to be optimized will have different degrees of optimization effect; therefore, the endpoint can be iterated multiple times, and the iteration stops when the maximum optimization effect is found. The degree of optimization is determined by the path difference delta_S before and after optimization.
[0122] According to the current initial global path, the endpoint of the path to be optimized can be moved from the starting point Gloo towards the preset starting point S by 1, 2...n nodes in sequence, so as to continuously iterate the endpoint of the path to be optimized and find the local path with the greatest optimization.
[0123] The minimum number of moving nodes (i.e., the number of extended nodes) can be 0. That is, based on the starting point Slo and the initial point Gloo, the first path planning result and the first path difference delta_S(0) corresponding to the starting point Gloo can be obtained through global path planning. After extending based on the non-zero number of extended nodes, the corresponding path difference delta_S(i) (i = 1, 2...n) can also be calculated.
[0124] For example, the current first local path is Figure 6 In B, a local path from node 3 to node 10 is defined, with node 3 as the starting point Gloo and node 10 as the starting point Slo. Based on nodes 3 and 10, a new path is obtained through global path planning, and this new path is used as a first path planning result. Based on the path between nodes 3 and 10 before planning and the obtained first path planning result, a first path difference delta_S (0) is obtained. Then, the endpoint of the current first local path that is closest to the preset starting point S is moved from node 3 to node 2, and the corresponding first path planning result and first path difference delta_S (1) are obtained again. After that, the endpoint of the current first local path that is closest to the preset starting point S can be moved from node 3 to node 1, and the corresponding first path planning result and first path difference delta_S (2) are obtained.
[0125] When delta_S(n) <= delta_S(n-1), the iteration towards the endpoint is stopped, and the endpoint of the (n-1)th iteration is taken as the final optimized endpoint Glof, thus achieving maximum optimization of the local path. At this point, the local path from the starting point Slo to the endpoint Glof in the current initial global path is the second local path, and the corresponding first path planning result is the target local path. Afterwards, the second local path can be replaced with the target local path in the current initial global path.
[0126] Alternatively, the endpoint can be iterated through discretization, thereby reducing the endpoint iteration time and increasing the planning speed.
[0127] When iterating using the discretization method, the endpoint of the path to be optimized can be moved from the starting point Gloo along the current initial global path towards the preset starting point S by 10, 20...10*n nodes sequentially. The corresponding path difference delta_S(i) (i = 1, 2...n) is calculated through global path planning. The first path planning result and the first path difference delta_S(0) are also obtained when the number of moved nodes (i.e., the number of extended nodes) is 0. The discretization iteration stops when delta_S(n) <= delta_S(n-1). It is understood that the specific number of nodes moved during the discretization iteration can be set according to actual needs, for example, the number of nodes moved sequentially can be 10, 30, 40, ...
[0128] Traverse the nodes between the endpoint of the (n-2)th iteration and the endpoint of the nth iteration in the above discretization iteration, take the above nodes as the endpoints of optimization in turn, and obtain the corresponding new path difference delta_S. Take the node with the largest new path difference delta_S in the interval as the final endpoint Glof of optimization, and obtain the maximum optimization of the local path.
[0129] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of the path planning device 300 is given below. Please refer to... Figure 10 , Figure 10 This is a block diagram of the path planning device 300 provided in this embodiment. It should be noted that the basic principle and technical effects of the path planning device 300 provided in this embodiment are the same as those in the above embodiments. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments. The path planning device 300 may include: a planning module 310, a filtering module 320, and an optimization module 330.
[0130] The planning module 310 is used to perform path planning based on a preset starting point and a preset ending point using a set global path planning algorithm to obtain an initial global path.
[0131] The filtering module 320 is used to determine the first local path that needs to be optimized in the initial global path.
[0132] The optimization module 330 is used to optimize the first local path in the initial global path to obtain a target global path. The target global path has the same start and end points as the initial global path.
[0133] Optionally, in this embodiment, the optimization module 330 is specifically used to: extend the current first local path along the current initial global path to the preset starting point, and perform path planning based on the start and end points of each obtained first extended path to obtain a first path planning result, wherein the current first local path is the first local path closest to the preset starting point that has not yet been optimized; obtain a first path difference before and after each planning based on each first extended path and the first path planning result; determine a target local path and a second local path based on the first path difference and the first path planning result, wherein the second local path is a local path in the current initial global path whose start and end points are the same as those of the target local path; replace the second local path in the current initial global path with the target local path to obtain an updated current initial global path, wherein the target global path is the current initial global path obtained in the last update.
[0134] Optionally, in this embodiment, the optimization module 330 is specifically used to: determine the largest first path difference among the first path differences by comparison; and determine the target local path based on the largest first path difference.
[0135] Optionally, in this embodiment, the number of extended nodes sorted in ascending order is incremented by 1 each time, and the optimization module 330 is specifically used to: take the first path planning result corresponding to the maximum first path difference as the target local path.
[0136] Optionally, in this embodiment, the number of extended nodes sorted in ascending order is not incremented by 1 each time.
[0137] Optionally, in this embodiment, the optimization module 330 is specifically used to: select a second quantity and a third quantity from the ascending sorted number of extended nodes according to the first quantity corresponding to the maximum first path difference, wherein the first quantity is located between the second quantity and the third quantity in the ascending sorted number of extended nodes; determine a plurality of candidate points according to the second quantity and the third quantity, wherein the candidate points are nodes on the local path of the candidate points, and the local path of the candidate points is a local path in the current initial global path with the nodes corresponding to the second quantity and the third quantity as the starting and ending points; sequentially use each candidate point as the node to which the current first local path extends, traverse the plurality of candidate points, obtain the second path planning result corresponding to each candidate point and the second path difference before and after planning; select a second path planning result as the target local path according to the second path difference corresponding to each candidate point.
[0138] Optionally, in this embodiment, the plurality of candidate points include all nodes on the local path of the candidate points, and the optimization module 330 is specifically used to: determine the maximum second path difference by comparison, and use the second path planning result corresponding to the maximum second path difference as the target local path.
[0139] Optionally, in this embodiment, the filtering module 320 is specifically used to: select candidate local paths from the initial global path based on the distance from each node in the initial global path to the preset endpoint, wherein the distance from each node in the candidate local path to the preset endpoint is in an increasing order from the preset starting point to the preset endpoint; and determine the first local path from the candidate local paths.
[0140] Optionally, in this embodiment, the filtering module 320 is specifically used to: select candidate local paths with a path length greater than a preset length as the first local path.
[0141] Optionally, in this embodiment, the global path planning algorithm is a highly heuristic A* algorithm or a greedy best-first algorithm, and / or, during the optimization of the first local path, the A* algorithm or the greedy best-first algorithm is used to plan the path again, and the total cost used in the highly heuristic A* algorithm is calculated according to the following formula:
[0142] F = A1 * G + A2 * H
[0143] Where F represents the total cost, G represents the actual cost from the starting point to the current point, H represents the estimated cost from the current point to the end point, A1 represents the first preset weight corresponding to the actual cost, A2 represents the second preset weight corresponding to the estimated cost, and A2>A1.
[0144] Please refer to Figure 11 , Figure 11 This is a block diagram of an electronic device 100 provided in an embodiment of this application. Figure 11 As shown, the electronic device 100 may include one or more of the following components: processor 110, memory 120, and one or more application programs, wherein the one or more application programs may be stored in memory 120 and configured to be executed by one or more processors 110, and the one or more programs are configured to perform the path planning method as described in the foregoing method embodiments.
[0145] Processor 110 may include one or more processing cores. Processor 110 connects to various parts within the electronic device 100 using various interfaces and lines, and performs various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets, or instruction sets stored in memory 120, and by calling data stored in memory 120. Optionally, processor 110 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 110 may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 110 and may be implemented separately using a communication chip.
[0146] The memory 120 may include random access memory (RAM) or read-only memory (ROM). The memory 120 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described above. The data storage area may also store data created by the electronic device 100 during use. Those skilled in the art will understand that... Figure 11 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device 100 described above. For example, the electronic device 100 may also include components that are more... Figure 11 The more or fewer components shown, or having the same Figure 11 The different configurations shown.
[0147] This application also provides a readable storage medium storing a computer program that, when executed by a processor, implements the steps of the path planning method.
[0148] In summary, the embodiments of the present invention provide a path planning method, apparatus, electronic device, and readable storage medium. First, using a pre-defined global path planning algorithm, a path is planned based on a preset starting point and a preset ending point to obtain an initial global path. Then, a first local path requiring optimization within the initial global path is optimized to obtain a target global path. Thus, a target global path that meets the requirements can be obtained, facilitating movement of the mobile device based on this target global path.
[0149] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0150] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0151] If the aforementioned functions are implemented as software functional modules 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 a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0152] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A path planning method, characterized in that, include: Based on a preset starting point and a preset ending point, a global path planning algorithm is used to plan the path and obtain an initial global path. Based on the distance from each node in the initial global path to the preset endpoint, candidate local paths are selected from the initial global path, wherein the distance from each node in the candidate local path to the preset endpoint is in an increasing order from the preset starting point to the preset endpoint. A first local path is determined from the candidate local paths; The first local path in the initial global path is optimized to obtain a target global path, wherein the target global path has the same start and end points as the initial global path.
2. The method according to claim 1, characterized in that, The step of optimizing the first local path in the initial global path to obtain the target global path includes: The current first local path is extended along the current initial global path to the preset starting point, and path planning is performed according to the start and end points of each obtained first extended path to obtain the first path planning result. The current first local path is the first local path that is closest to the preset starting point and has not yet been optimized. Based on each first extension path and the first path planning result, obtain the first path difference before and after each planning step; Based on the first path difference and the first path planning result, a target local path and a second local path are determined, wherein the second local path is a local path in the current initial global path whose start and end points are the same as those of the target local path. The second local path in the current initial global path is replaced with the target local path to obtain the updated current initial global path, wherein the target global path is the current initial global path obtained in the last update.
3. The method according to claim 2, characterized in that, The step of determining the target local path based on the first path difference and the first path planning result includes: By comparison, the largest first path difference among the first path differences is determined; The target local path is determined based on the maximum first path difference.
4. The method according to claim 3, characterized in that, The number of extended nodes, sorted in ascending order, is incremented by 1 each time. Determining the target local path based on the maximum first path difference includes: The first path planning result corresponding to the maximum first path difference is taken as the target local path.
5. The method according to claim 3, characterized in that, The number of extended nodes sorted in ascending order is not incremented by 1 for each node.
6. The method according to claim 5, characterized in that, Determining the target local path based on the maximum first path difference includes: Based on the first quantity corresponding to the maximum first path difference, a second quantity and a third quantity are selected from the number of extended nodes sorted in ascending order, wherein the first quantity is located between the second quantity and the third quantity in the number of extended nodes sorted in ascending order. Based on the second quantity and the third quantity, multiple candidate points are determined, wherein the candidate points are nodes on the local path of the candidate points, and the local path of the candidate points is a local path in the current initial global path with the nodes corresponding to the second quantity and the third quantity as the starting and ending points; Each candidate point is sequentially used as the node to which the current first local path extends. The multiple candidate points are traversed to obtain the second path planning result corresponding to each candidate point and the difference between the second path before and after planning. Based on the second path difference corresponding to each candidate point, a second path planning result is selected as the target local path.
7. The method according to claim 6, characterized in that, The plurality of candidate points includes all nodes on the local path of the candidate points. The step of selecting a second path planning result as the target local path based on the second path difference corresponding to each candidate point includes: The maximum second path difference is determined by comparison, and the second path planning result corresponding to the maximum second path difference is used as the target local path.
8. The method according to claim 1, characterized in that, Determining the first local path from the candidate local paths includes: Candidate local paths with a path length greater than a preset length are selected as the first local path.
9. The method according to any one of claims 1-7, characterized in that, The global path planning algorithm is either a highly heuristic A* algorithm or a greedy best-first algorithm, and / or, during the optimization of the first local path, the A* algorithm or the greedy best-first algorithm is used to plan the path again. The total cost used in the highly heuristic A* algorithm is calculated according to the following formula: F=A1 G+A2 H Where F represents the total cost, G represents the actual cost from the starting point to the current point, H represents the estimated cost from the current point to the end point, A1 represents the first preset weight corresponding to the actual cost, A2 represents the second preset weight corresponding to the estimated cost, and A2>A1.
10. A path planning device, characterized in that, include: The planning module is used to plan a path based on a preset starting point and a preset ending point using a set global path planning algorithm to obtain an initial global path. A filtering module is used to select candidate local paths from the initial global path based on the distance from each node in the initial global path to the preset endpoint, wherein the distance from each node in the candidate local path to the preset endpoint is in an increasing order from the preset starting point to the preset endpoint; and to determine a first local path from the candidate local paths. An optimization module is used to optimize the first local path in the initial global path to obtain a target global path, wherein the target global path has the same start and end points as the initial global path.
11. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor to implement the path planning method according to any one of claims 1-9.
12. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the path planning method as described in any one of claims 1-9.
Citation Information
Patent Citations
Unmanned vehicle path planning method based on improved A * algorithm and deep reinforcement learning
CN111780777A