Path determination method and device, nonvolatile storage medium and electronic equipment

By distinguishing the turning sub-region from the non-turning sub-region in path planning and increasing the weight of the turning sub-region, combining the heuristic search algorithm A* to optimize path selection, the problem of path complexity is solved, and a more concise and practical path planning is achieved.

CN120293143APending Publication Date: 2025-07-11BEITAI ZHENHUAN (CHONGQING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510449048.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

The existing path planning algorithms lead to path complexity and there are a large number of redundant inflection points, which affect the simplicity and practicality of the path.

Method used

By introducing a weighting mechanism for path evaluation values, we distinguish the turning sub-region from the non-turning sub-region, and increase the weight of the turning sub-region in path planning. Combined with the heuristic search algorithm A*, we optimize path selection and reduce redundant inflection points.

Benefits of technology

It effectively reduces the redundant inflection points in the path, improves the simplicity and clarity of the path, and improves the practicality of path planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120293143A_ABST
    Figure CN120293143A_ABST
Patent Text Reader

Abstract

The invention discloses a path determination method and device, a nonvolatile storage medium and electronic equipment. The method comprises the following steps: determining a starting point sub-region, an ending point sub-region and an obstacle sub-region of a path region; a path evaluation value corresponding to an adjacent sub-region of the starting point sub-region is determined, a path sub-region added to the path region is determined from the adjacent sub-regions according to the path evaluation value, the path evaluation value is obtained by adding a first evaluation value and a second evaluation value, and the distance from the adjacent sub-region to the terminal point sub-region corresponds to the first evaluation value; the type of the path sub-region corresponds to a second evaluation value; and after the path sub-region is determined each time, selecting a new path sub-region from the adjacent sub-regions according to the path evaluation value of the adjacent sub-region of the path sub-region determined each time, and adding the new path sub-region into the path region until the new path sub-region reaches the terminal point sub-region. According to the method and the device, the technical problem of path complexity caused by redundant inflection points of the path due to a current algorithm is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of path planning, and more particularly, to a path determination method, apparatus, non-volatile storage medium, and electronic device. Background Art

[0002] Common path planning algorithms are search-based methods. Such algorithms usually transform the path planning problem into a graph traversal problem, specify a starting point and an ending point, and find a path in the graph through a search algorithm. However, since such methods usually only consider the length of the path, there are a large number of inflection points in the found path, which in turn leads to path complexity.

[0003] In view of the above problems, no effective solution has been proposed yet. Summary of the Invention

[0004] Embodiments of the present application provide a path determination method, apparatus, non-volatile storage medium, and electronic device to at least solve the technical problem that the current algorithm makes the path complex due to redundant inflection points in the path.

[0005] According to one aspect of the embodiments of the present application, a path determination method is provided, including: determining a starting sub-region, an ending sub-region, and an obstacle sub-region of a path region; determining a path evaluation value corresponding to an adjacent sub-region of the starting sub-region, and determining a path sub-region to be added to the path region from the adjacent sub-regions according to the path evaluation value, where the path evaluation value is obtained by adding a first evaluation value and a second evaluation value, the distance from the adjacent sub-region to the ending sub-region corresponds to the first evaluation value, the type of the path sub-region corresponds to the second evaluation value, the types of the path sub-regions include a turning sub-region and a non-turning sub-region, the turning sub-region is a sub-region that causes the path direction of the path region to turn, and the adjacent sub-regions do not include the obstacle sub-region; after each determination of the path sub-region, selecting a new path sub-region from the adjacent sub-regions according to the path evaluation value of the adjacent sub-region of the path sub-region determined each time and adding it to the path region until the ending sub-region is reached.

[0006] Optionally, determining the path evaluation value corresponding to the adjacent sub-region includes: determining the type of the path sub-region; determining a weight value corresponding to the path sub-region according to the type of the path sub-region, where the turning sub-region corresponds to a first weight, the non-turning sub-region corresponds to a second weight, and the first weight is greater than the second weight; determining the distance from the adjacent sub-region to the ending sub-region; adding the sum of the weight values corresponding to one or more path sub-regions in the path region to the distance from the adjacent sub-region to the ending sub-region, and determining the added result as the path evaluation value corresponding to the adjacent sub-region.

[0007] Optionally, determining the type of a path sub-region includes: determining the previous path sub-region and the subsequent path sub-region corresponding to the path sub-region in the path region, where the subsequent sub-region of the path sub-region located at the end of the path region is the adjacent sub-region; determining the first moving direction of the path sub-region relative to the previous path sub-region, where the first moving direction includes moving upward, moving downward, moving leftward, and moving rightward; determining the second moving direction of the subsequent path sub-region relative to the path sub-region; in the case where the first moving direction and the second moving direction are different, determining the type of the path sub-region as a turning sub-region; in the case where the first moving direction and the second moving direction are the same, determining the type of the path sub-region as a non-turning sub-region.

[0008] Optionally, the calculation formula of the path evaluation value is as follows: f(n) = g(n) + h(n) where f(n) is the path evaluation value corresponding to the adjacent sub-region, n is the number of path sub-regions included in the path region, h(n) is the distance from the adjacent sub-region to the end sub-region, w i is the weight of each path sub-region in the path region.

[0009] Optionally, the sub-region is a grid of a preset size; determining the start sub-region, the end sub-region, and the obstacle sub-region of the path region includes: converting the canvas coordinate system into a grid coordinate system according to the preset size information, where the coordinate range in the canvas coordinate system corresponds one-to-one with the grid coordinates in the grid coordinate system; determining the grid including the start point in the corresponding coordinate range of the canvas coordinate system as the start sub-region; determining the grid including the end point in the corresponding coordinate range of the canvas coordinate system as the end sub-region; determining the grid including the obstacle in the corresponding coordinate range of the canvas coordinate system as the obstacle sub-region.

[0010] Optionally, after reaching the end sub-region, the method further includes: determining the turning sub-regions in the path region; determining the canvas coordinate range of the turning sub-regions corresponding to the turning sub-regions in the canvas coordinate system; determining the center points of the canvas coordinate ranges of the turning sub-regions; connecting the center points as the target path in the canvas coordinate system.

[0011] Optionally, after reaching the end sub-region, the method further includes: selecting a preset number of random sub-regions in the path region, and selecting random adjacent sub-regions of the random sub-regions outside the path region; adding the random adjacent sub-regions as new path sub-regions to the candidate path region, and again selecting new path sub-regions from the adjacent sub-regions according to the path evaluation values of the adjacent sub-regions of the new path sub-regions and adding them to the candidate path region until reaching the end sub-region; determining the path evaluation values corresponding to each candidate path region; determining a target path region from the candidate path region and the path region according to the path evaluation values corresponding to each candidate path region and the path region, where the path evaluation value of the target path region is less than or equal to that of the candidate path region and the path region.

[0012] According to another aspect of the embodiments of the present application, there is also provided a path determination device, including: a first processing module, configured to determine a start sub-region, an end sub-region, and an obstacle sub-region of a path region; a second processing module, configured to determine the path evaluation values corresponding to the adjacent sub-regions of the start sub-region, and determine the path sub-regions to be added to the path region from the adjacent sub-regions according to the path evaluation values, where the path evaluation value is obtained by adding a first evaluation value and a second evaluation value, the distance from the adjacent sub-region to the end sub-region corresponds to the first evaluation value, the type of the path sub-region corresponds to the second evaluation value, the type of the path sub-region includes a turning sub-region and a non-turning sub-region, the turning sub-region is a sub-region that causes the path direction of the path region to turn, and the adjacent sub-region does not include the obstacle sub-region; a third processing module, configured to, after each determination of a path sub-region, again select new path sub-regions from the adjacent sub-regions according to the path evaluation values of the adjacent sub-regions of the path sub-region determined each time and add them to the path region until reaching the end sub-region.

[0013] According to another aspect of the embodiments of the present application, there is also provided a non-volatile storage medium, in which a program is stored, and when the program runs, it controls the device where the non-volatile storage medium is located to execute the path determination method.

[0014] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including: a memory and a processor, the processor is configured to run the program stored in the memory, and when the program runs, it executes the path determination method.

[0015] According to another aspect of the embodiments of the present application, there is also provided a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the path determination method.

[0016] In an embodiment of the present application, a starting sub-region, an ending sub-region, and an obstacle sub-region of a path region are determined; a path evaluation value corresponding to an adjacent sub-region of the starting sub-region is determined, and a path sub-region to be added to the path region is determined from the adjacent sub-regions according to the path evaluation value, where the path evaluation value is obtained by adding a first evaluation value and a second evaluation value, the distance from the adjacent sub-region to the ending sub-region corresponds to the first evaluation value, and the type of the path sub-region corresponds to the second evaluation value. The types of the path sub-regions include a turning sub-region and a non-turning sub-region. The turning sub-region is a sub-region that causes the path direction of the path region to turn, and the adjacent sub-regions do not include the obstacle sub-region; after each path sub-region is determined, a new path sub-region is selected from the adjacent sub-regions according to the path evaluation value of the adjacent sub-region of the path sub-region determined each time and added to the path region until the ending sub-region is reached. By adding a weight term to the cost evaluation function and increasing the weight of the inflection points in the path, the purpose of reducing redundant inflection points is achieved, thereby realizing the technical effect that the path obtained by optimization is more concise, and further solving the technical problem of path complexity caused by redundant inflection points in the current algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application, and do not constitute an improper limitation to the present application. In the drawings:

[0018] Figure 1 is a schematic structural diagram of a computer terminal provided according to an embodiment of the present application;

[0019] Figure 2 is a schematic flowchart of a path determination method provided according to an embodiment of the present application;

[0020] Figure 3 is a schematic diagram of a turning sub-region provided according to an embodiment of the present application;

[0021] Figure 4 is a schematic diagram of a neighborhood grid provided according to an embodiment of the present application;

[0022] Figure 5 is a schematic flowchart of a path determination method process provided according to an embodiment of the present application;

[0023] Figure 6 is a schematic flowchart of an intelligent obstacle avoidance connection strategy provided according to an embodiment of the present application;

[0024] Figure 7 is a comparison diagram of a path of the present application and a traditional path provided according to an embodiment of the present application;

[0025] Figure 8 It is a comparison diagram of another path of the present application and the traditional path provided according to an embodiment of the present application;

[0026] Figure 9 It is a comparison diagram of yet another path of the present application and the traditional path provided according to an embodiment of the present application;

[0027] Figure 10 It is a schematic structural diagram of a path determination device provided according to an embodiment of the present application. Detailed implementation manners

[0028] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those clearly listed steps or units, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0030] Common path planning algorithms are search-based methods. Such algorithms usually transform the path planning problem into a graph traversal problem, specify the starting point and the ending point, and find a path in the graph through a search algorithm. In such methods, the environmental map can usually be gridified, and the path search is carried out by advancing by grid cells, so as to ensure that the path is "horizontal and vertical".

[0031] Common path search methods include Dijkstra's algorithm and A* algorithm. Dijkstra's algorithm adopts the idea of breadth-first search and is used to find the shortest paths from a starting point to all other nodes in a weighted graph. It starts from the starting point, gradually selects the unprocessed node with the closest distance, and updates the distances of its neighbors until the shortest paths of all nodes are determined. Dijkstra's algorithm needs to traverse a large number of nodes to obtain the shortest path. Based on Dijkstra's algorithm, A* algorithm adds a heuristic evaluation function to calculate the cost values of domain nodes to determine the next search direction, and gradually obtains the path with the minimum total cost from the starting point to the end point, reducing the number of traversed nodes and improving the search efficiency. As a classic heuristic search algorithm, A* algorithm has better performance compared with other global path planning algorithms. Using this kind of method to implement path planning can intelligently avoid obstacles. However, the path obtained by this method still has many redundant inflection points, making the path connection line relatively complex, and its practicality in actual applications is relatively low. Especially in visual block diagram modeling and simulation software, the signal flow or data transmission relationship between modules is represented by the port connection lines between modules. The connection relationship between modules is complex. Although the connection lines between models drawn by A* algorithm can intelligently avoid obstacles, there will be many redundant inflection points, making the path connection line relatively complex, resulting in unclear connection relationships, inconvenient movement of modules, reducing the clarity of the presentation of the connection relationship of the model, and affecting the simulation experiment efficiency.

[0032] To solve the above problems, relevant solutions are provided in the embodiments of the present application, which are described in detail below.

[0033] According to the embodiments of the present application, a method embodiment of a path determination method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from here.

[0034] The method embodiments provided by the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 It is a hardware structure block diagram of a computer terminal for implementing the path determination method. As Figure 1As shown, the computer terminal 10 may include one or more processors 102 (shown as 102a, 102b, ……, 102n in the figure) (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may further include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply, and / or a camera. Those of ordinary skill in the art can understand that Figure 1 the structure shown is only schematic and does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 may further include more or fewer components than Figure 1 shown therein, or have a different configuration from Figure 1 that shown.

[0035] It should be noted that the above one or more processors 102 and / or other data processing circuits are generally referred to as "data processing circuits" herein. The data processing circuit may be embodied in whole or in part as software, hardware, firmware, or any combination thereof. In addition, the data processing circuit may be a single independent processing module, or be incorporated in whole or in part into any one of other elements in the computer terminal 10. As involved in the embodiments of the present application, the data processing circuit is a processor control (such as the selection of a variable resistance terminal path connected to an interface).

[0036] The memory 104 may be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the path determination method in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the above-mentioned path determination method. The memory 104 may include a high-speed random access memory, and may further include a non-volatile memory, such as one or more magnetic storage devices, a flash memory, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely provided with respect to the processor 102, and these remote memories may be connected to the computer terminal 10 through a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0037] The transmission device 106 is used to receive or send data via a network. Specific examples of the above network may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0038] The display can be, for example, a touch-screen liquid crystal display (LCD), which enables the user to interact with the user interface of the computer terminal 10.

[0039] Under the above operating environment, the embodiment of the present application provides a path determination method, as Figure 2 shown, the method includes the following steps:

[0040] Step S202, determining a start sub-region, an end sub-region, and an obstacle sub-region of the path region.

[0041] Optionally, before determining the start sub-region, the end sub-region, and the obstacle sub-region of the path region, the method further includes defining a two-dimensional coordinate system of the canvas, obtaining the coordinates of the modules (i.e., obstacles) in the model therein, and obtaining the start coordinate and the end coordinate of the connection line.

[0042] In the technical solution provided in step S202, the sub-region is a grid of a preset size; determining the start sub-region, the end sub-region, and the obstacle sub-region of the path region includes: converting the canvas coordinate system into a grid coordinate system according to the preset size information, where the coordinate range in the canvas coordinate system corresponds one-to-one with the grid coordinates in the grid coordinate system; determining the grid including the start point in the corresponding canvas coordinate range as the start sub-region; determining the grid including the end point in the corresponding canvas coordinate range as the end sub-region; and determining the grid including the obstacle in the corresponding canvas coordinate range as the obstacle sub-region.

[0043] Optionally, determining the start sub-region, the end sub-region, and the obstacle sub-region of the path region includes: meshing the canvas coordinate system with a fixed size (i.e., the preset size), converting the canvas coordinates of the module (i.e., the obstacle) and the start and end canvas coordinates of the connection line into grid (i.e., sub-region) coordinates, and obtaining the start grid (i.e., the start sub-region) coordinates S(x S , y S ), the end grid (i.e., the end sub-region) coordinates G(x G , y G)。Mark the grid where the module is located as an obstacle sub-region. The default weight of all grids is 1 (i.e., the second weight).

[0044] Step S204, determine the path evaluation value corresponding to the adjacent sub-region of the starting sub-region, and determine the path sub-region to be added to the path region from the adjacent sub-regions according to the path evaluation value. Among them, the path evaluation value is obtained by adding the first evaluation value and the second evaluation value. The distance from the adjacent sub-region to the ending sub-region corresponds to the first evaluation value, and the type of the path sub-region corresponds to the second evaluation value. The types of the path sub-regions include turning sub-regions and non-turning sub-regions. A turning sub-region is a sub-region that causes the path direction of the path region to turn. The adjacent sub-regions do not include obstacle sub-regions.

[0045] Optionally, the path direction is the direction of the path line corresponding to the path region after adding the sub-region to the path region. For example, it can be the direction of the path line composed of the center lines of each sub-region.

[0046] In the technical solution provided in step S204, determining the path evaluation value corresponding to the adjacent sub-region includes: determining the type of the path sub-region; according to the type of the path sub-region, determining the weight value corresponding to the path sub-region. Among them, the turning sub-region corresponds to the first weight, and the non-turning sub-region corresponds to the second weight. The first weight is greater than the second weight; determining the distance from the adjacent sub-region to the ending sub-region; adding the sum of the weight values corresponding to one or more path sub-regions in the path region to the distance from the adjacent sub-region to the ending sub-region, and determining the added result as the path evaluation value corresponding to the adjacent sub-region.

[0047] Optionally, before determining the path evaluation value corresponding to the adjacent sub-region of the starting sub-region, the method further includes creating a set of grids to be visited open list, representing the grids to be visited, and putting the starting point S into this set; creating a set of grids that have been visited close list, representing the grids passed by the connection path in the form of index pairs, using the child nodes of the current grid node as its index, that is, {child node, parent node}, and the index of the starting point S is recorded as itself.

[0048] As an alternative implementation, determining the type of a path sub-region includes: determining the previous path sub-region and the subsequent path sub-region corresponding to the path sub-region in the path region, where the subsequent sub-region of the path sub-region located at the end of the path region is the adjacent sub-region; determining the first movement direction of the path sub-region relative to the previous path sub-region, where the first movement direction includes moving upward, moving downward, moving leftward, and moving rightward; determining the second movement direction of the subsequent path sub-region relative to the path sub-region; in the case where the first movement direction and the second movement direction are different, determining that the type of the path sub-region is a turning sub-region; and in the case where the first movement direction and the second movement direction are the same, determining that the type of the path sub-region is a non-turning sub-region.

[0049] Optionally, Figure 3 is a schematic diagram of a turning sub-region, as Figure 3 shown, X is the turning sub-region, and its first movement direction and second movement direction are different.

[0050] Optionally, the calculation formula of the path evaluation value is as follows: f(n) = g(n) + h(n), where f(n) is the path evaluation value corresponding to the adjacent sub-region, n is the number of path sub-regions included in the path region, h(n) is the distance from the adjacent sub-region to the end sub-region, and w i is the weight of each path sub-region in the path region.

[0051] Optionally, temporarily taking the adjacent sub-region as the path sub-region and calculating its corresponding path evaluation value, the cost from the starting grid S through the parent node grid to the current grid n (i.e., the adjacent sub-region) is: where w is the weight of each grid passed from the starting grid S to the current grid n. The default weight of the grid is 1. If the current grid is an inflection point grid, its weight is 2, and w n (i.e., the weight of the adjacent sub-region) is 1.

[0052] The heuristic function h(n) represents the cost from the current grid n to the end grid G, and is expressed as the Manhattan distance between the node grid n and G: h(n) = abs(x n - x G ) + abs(y n - y G ), where x represents the abscissa of the corresponding grid, and y represents the ordinate of the corresponding grid (coordinates in the grid coordinate system).

[0053] The costs f(S) and g(S) of the starting point S are recorded as 0.

[0054] Step S206: After each determination of a path sub-region, again select a new path sub-region from the adjacent sub-regions based on the path evaluation values of the adjacent sub-regions of the path sub-region determined each time, and add it to the path region until the end sub-region is reached.

[0055] Optionally, selecting a new path sub-region from the adjacent sub-regions based on the path evaluation values of the adjacent sub-regions of the path sub-region determined each time and adding it to the path region until the end sub-region is reached includes:

[0056] (1) Select the node grid with the smallest total cost f(n) in the open list as the current node grid n, and delete the node grid n from the open list.

[0057] (2) Obtain the neighborhood grids of the current node grid n (as shown, the four adjacent squares above, below, left, and right of grid n are its neighborhood grids), eliminate the grids marked as obstacles among them, and obtain the set β of reachable neighborhood nodes of grid n Figure 4 (i.e., the adjacent sub-regions). Traverse the grid nodes in β n and perform the following calculations: n 1) Denote the currently traversed grid node as m, where m ∈ β

[0058] . n

[0059] 2) Calculate the cost g(m) from the start point S via node n to m, and the Manhattan distance h(m) between grid m and the end point G, and update the total cost f(m) of grid m.

[0060] 3) Add the node m to the open list and record its cost f(m).

[0061] 4) Add the index pair {m, n} to the close list, that is, the parent node n can be accessed through index m.

[0062] Repeat steps (1) to (2) until the current node grid is the end point G.

[0063] (3) In the close list, search in reverse order based on the parent node included in the end point G until the start point S, and thus obtain the optimal connection path.

[0064] In the technical solution provided in step S206, after reaching the end sub-region, the method further includes: determining the turning sub-regions in the path region; determining the corresponding turning sub-region canvas coordinate ranges in the canvas coordinate system; determining the center points of the turning sub-region canvas coordinate ranges; connecting the center points as the target path in the canvas coordinate system.

[0065] Optionally, after obtaining the grid path (path area), filter out the inflection point grids (i.e., turning sub-areas), obtain the coordinates of the center points of the inflection point grids in the canvas coordinate system, use them as the routing points of the connection path, and combine the start and end coordinates in the canvas coordinate system to obtain the final connection path.

[0066] As an alternative implementation, after reaching the end sub-area, the method further includes: selecting a preset number of random sub-areas in the path area, and selecting random adjacent sub-areas of the random sub-areas outside the path area; adding the random adjacent sub-areas as new path sub-areas to the candidate path area, and again selecting new path sub-areas from the adjacent sub-areas according to the path evaluation values of the adjacent sub-areas of the new path sub-areas and adding them to the candidate path area until reaching the end sub-area; determining the path evaluation values corresponding to each candidate path area; determining the target path area in the candidate path area and the path area according to the path evaluation values corresponding to each candidate path area and the path area, where the path evaluation value of the target path area is less than or equal to the candidate path area and the path area.

[0067] As an alternative implementation, in order to further optimize the path and avoid falling into a local optimum, after obtaining the path area reaching the end, a random exploration mechanism is introduced to find a better path. First, select a preset number of random sub-areas from the initially formed path area. At the same time, select random adjacent sub-areas of these random sub-areas outside the path area as the starting points of the exploration, so as to increase the diversity of the path. Then, add these random adjacent sub-areas outside the path area to the candidate path area, and again select new path sub-areas from the adjacent sub-areas of these sub-areas according to the path evaluation value, and continuously expand the path until reaching the end sub-area again. This process may generate multiple path variants, and each variant corresponds to a candidate path area. Next, calculate the path evaluation values for all these candidate path areas and the initial path area. The evaluation value combines the actual length and the number of inflection points of the path. Finally, according to the evaluation values of each candidate path area and the initial path area, determine the target path area from them, that is, the path whose evaluation value is lower than or equal to the evaluation values of all candidate and initial path areas. The target path area is the optimized final connection path.

[0068] The embodiment of the present application provides a path determination method, as Figure 5 shown, the method includes the following steps:

[0069] Step S502: Set up a two-dimensional canvas coordinate system, and obtain the module, the connection start point and end point coordinates.

[0070] Step S504: Grid the canvas coordinates, obtain the connection start point grid coordinate S and the connection end point grid coordinate G in the grid coordinate system, and mark the grid where the module is located as an obstacle.

[0071] Step S506: In the grid coordinate system, obtain the connection path from the starting point S to the ending point G according to the starting point S, the ending point G, the obstacle markers, and the intelligent obstacle avoidance connection strategy.

[0072] Optionally, Figure 6 shows a flowchart of an intelligent obstacle avoidance connection strategy, as Figure 6 shown, this strategy includes the following steps:

[0073] Step S601: Create an open list of grids to be visited and a closed list of visited grids.

[0074] Step S602: Put the starting point S into the open list; record its index in the closed list as itself; set the cost f(S) and g(S) of the starting point S to 0.

[0075] Step S603: Select the grid node with the minimum total cost f(n) in the open list as the current grid node n, delete the node grid n from the open list, and determine whether the node n is the connection end point G. If so, execute step S607; if not, execute step S604.

[0076] Step S604: Obtain the neighborhood grid nodes of the current grid node n, exclude the grid nodes marked as obstacles among them, and obtain the reachable neighborhood node set β of the grid n n

[0077] Step S605: For m ∈ β n , calculate the cost g(m) from the starting grid S passing through the parent grid to the current grid n, which is expressed as the sum of the grid path weights from the starting grid S via the node n to m. Among them, the weight of the inflection point grid is greater. Calculate the cost h(m) from the node m to the end point G, which is expressed as the Manhattan distance between m and G; update the total cost f(m) of the node m = g(m) + h(m).

[0078] Step S606: Add the node m to the open list and record its cost f(m), add the key-value pair {m, n} to the closed list, and determine whether all nodes in the reachable neighborhood grid set β n have been traversed. If so, execute step S603; otherwise, execute step S604.

[0079] Step S607: In the closed list, start from the end point G and backtrack upward, find the parent node in reverse order until the starting point S, and connect the backtracked grid nodes from S to G to obtain the connection path.

[0080] Through the above steps, an intelligent obstacle avoidance path optimization method can be realized. By evenly meshing the canvas in the modeling environment and converting the canvas coordinate system into a grid coordinate system, path search from the starting point to the ending point is carried out in the grid coordinate system to ensure that the final obtained path connection is "horizontal and vertical". Then, the improved A* algorithm is used for path search. In this improved algorithm, an improved cost evaluation function f(n) = g(n) + h(n) is introduced. Among them, g(n) is the cost from the starting grid to the current grid via the parent node grid, which is expressed as the weighted distance from the starting grid to the current grid via the parent node grid, that is, the weighted sum of the grids passed from the starting point to the current grid. Among them, if the grid is an inflection point in the path, the weight of this grid is 2, otherwise it is the default weight 1 (the specific weight value is set according to the actual application situation); h(n) is the heuristic function, which is expressed as the Manhattan distance from the current grid to the ending grid. Finally, after obtaining the grid path, the coordinates of the inflection point grids in the grid path are extracted, and the coordinates of the center points of the inflection point grids in the canvas coordinate system are used as the routing point coordinates. Combining the starting point and ending point coordinates, the final connection path is obtained. The method embodiment of the present application makes the total cost of the connection path positively correlated with the number of inflection points in the path by judging the inflection points and increasing their cost weights, so as to obtain the path with the minimum number of inflection points as the connection path, reducing unnecessary inflection points in the connection. Figure 7 , Figure 8 , Figure 9 is a comparison diagram of the connection lines between the method (improved A* algorithm) of the present application and the original A* algorithm, as Figure 7 , Figure 8 , Figure 9 shown. Compared with the original A* algorithm, the method of the present application effectively reduces redundant invalid inflection points, making the module connection lines in the visual modeling canvas clearer and more concise.

[0081] As an optional implementation manner, a data structure area for storing path information can be dynamically created in the memory, including a path node queue and a turning point queue. The path node queue specifically stores the information of the grid nodes to be evaluated and already evaluated, which is convenient for quickly locating and updating the node status during the algorithm loop iteration, especially the cost information of the nodes. These information are associated with the weights of the turning point queue through indexes. During the planning process of the connection path, in order to pursue the optimization of the path, that is, the minimum number of turning points, the algorithm will evaluate and update the nodes in the path node queue multiple times. At this time, only by adjusting the data of the turning point weights in the turning point queue can the overall evaluation value of the path be affected, without having to reconstruct the entire path. This method not only improves the flexibility and efficiency of the connection path planning, but also ensures the optimality of the path planning result, effectively avoiding the problem of the complication of the path connection in the traditional algorithm, and realizing the intelligent optimization and clear display of the connection path.

[0082] The embodiment of the present application provides a path determination deviceFigure 10 is a structural schematic diagram of the device, as Figure 10 shown, the device includes: a first processing module 100, configured to determine a starting sub-region, an ending sub-region, and an obstacle sub-region of a path region; a second processing module 102, configured to determine a path evaluation value corresponding to an adjacent sub-region of the starting sub-region, and determine a path sub-region to be added to the path region from the adjacent sub-regions according to the path evaluation value, where the path evaluation value is obtained by adding a first evaluation value and a second evaluation value, the distance from the adjacent sub-region to the ending sub-region corresponds to the first evaluation value, and the type of the path sub-region corresponds to the second evaluation value, and the type of the path sub-region includes a turning sub-region and a non-turning sub-region, the turning sub-region is a sub-region that causes the path direction of the path region to turn, and the adjacent sub-region does not include the obstacle sub-region; a third processing module 104, configured to, after each determination of a path sub-region, select a new path sub-region from the adjacent sub-regions according to the path evaluation value of the adjacent sub-region of the path sub-region determined each time, and add it to the path region until the ending sub-region is reached.

[0083] In some embodiments of the present application, the second processing module 102 determines the path evaluation value corresponding to the adjacent sub-region, including: determining the type of the path sub-region; determining a weight value corresponding to the path sub-region according to the type of the path sub-region, where the turning sub-region corresponds to a first weight, and the non-turning sub-region corresponds to a second weight, and the first weight is greater than the second weight; determining the distance from the adjacent sub-region to the ending sub-region; adding the sum of the weight values corresponding to one or more path sub-regions in the path region to the distance from the adjacent sub-region to the ending sub-region, and determining the added result as the path evaluation value corresponding to the adjacent sub-region.

[0084] In some embodiments of the present application, the second processing module 102 determines the type of the path sub-region, including: determining a previous path sub-region and a subsequent path sub-region corresponding to the path sub-region in the path region, where the subsequent sub-region of the path sub-region located at the end of the path region is the adjacent sub-region; determining a first moving direction of the path sub-region relative to the previous path sub-region, where the first moving direction includes moving upward, moving downward, moving leftward, and moving rightward; determining a second moving direction of the subsequent path sub-region relative to the path sub-region; in the case where the first moving direction and the second moving direction are different, determining the type of the path sub-region as a turning sub-region; in the case where the first moving direction and the second moving direction are the same, determining the type of the path sub-region as a non-turning sub-region.

[0085] In some embodiments of the present application, the calculation formula of the path evaluation value is as follows: f(n) = g(n) + h(n), where f(n) is the path evaluation value corresponding to the adjacent sub-region, and n is the number of path sub-regions included in the path region. h(n) is the distance from an adjacent sub-region to the end sub-region, and w i is the weight of each path sub-region in the path region.

[0086] In some embodiments of the present application, the sub-region is a grid of a preset size; the first processing module 100 determines the start sub-region, the end sub-region, and the obstacle sub-region of the path region, including: converting the canvas coordinate system into a grid coordinate system according to the preset size information, where the coordinate range in the canvas coordinate system corresponds one-to-one with the grid coordinates in the grid coordinate system; determining the grid including the start point in the corresponding coordinate range of the canvas coordinate system as the start sub-region; determining the grid including the end point in the corresponding coordinate range of the canvas coordinate system as the end sub-region; and determining the grid including the obstacle in the corresponding coordinate range of the canvas coordinate system as the obstacle sub-region.

[0087] In some embodiments of the present application, after reaching the end sub-region, the method further includes: determining the turning sub-region in the path region; determining the canvas coordinate range of the turning sub-region corresponding to the turning sub-region in the canvas coordinate system; determining the center point of the canvas coordinate range of the turning sub-region; and connecting the center points as the target path in the canvas coordinate system.

[0088] In some embodiments of the present application, after reaching the end sub-region, the third processing module 104 is further configured to: select a preset number of random sub-regions in the path region, and select random adjacent sub-regions of the random sub-regions outside the path region; add the random adjacent sub-regions as new path sub-regions to the candidate path region, and again select new path sub-regions from the adjacent sub-regions according to the path evaluation values of the adjacent sub-regions of the new path sub-regions and add them to the candidate path region until reaching the end sub-region; determine the path evaluation values corresponding to each candidate path region; and determine the target path region in the candidate path region and the path region according to the path evaluation values corresponding to each candidate path region and the path region, where the path evaluation value of the target path region is less than or equal to that of the candidate path region and the path region.

[0089] It should be noted that each module in the above path determination device may be a program module (for example, a set of program instructions for implementing a specific function), or a hardware module. For the latter, it may be presented in the following forms, but not limited thereto: the manifestation form of each of the above modules is a processor, or the functions of each of the above modules are implemented by a processor.

[0090] An embodiment of the present application provides a non-volatile storage medium. A program is stored in the non-volatile storage medium. When the program runs, it controls the device where the non-volatile storage medium is located to execute the following path determination method: Determine the start sub-region, end sub-region, and obstacle sub-region of the path region; Determine the path evaluation values corresponding to the adjacent sub-regions of the start sub-region, and determine the path sub-regions to be added to the path region from the adjacent sub-regions according to the path evaluation values. The path evaluation value is obtained by adding a first evaluation value and a second evaluation value. The distance from the adjacent sub-region to the end sub-region corresponds to the first evaluation value, and the type of the path sub-region corresponds to the second evaluation value. The types of the path sub-regions include turning sub-regions and non-turning sub-regions. A turning sub-region is a sub-region that causes the path direction of the path region to turn. The adjacent sub-regions do not include obstacle sub-regions; After each determination of a path sub-region, again select a new path sub-region from the adjacent sub-regions according to the path evaluation values of the adjacent sub-regions of the determined path sub-region each time and add it to the path region until the end sub-region is reached.

[0091] An embodiment of the present application provides an electronic device, including: a memory and a processor. The processor is used to run the program stored in the memory. When the program runs, it executes the following path determination method: Determine the start sub-region, end sub-region, and obstacle sub-region of the path region; Determine the path evaluation values corresponding to the adjacent sub-regions of the start sub-region, and determine the path sub-regions to be added to the path region from the adjacent sub-regions according to the path evaluation values. The path evaluation value is obtained by adding a first evaluation value and a second evaluation value. The distance from the adjacent sub-region to the end sub-region corresponds to the first evaluation value, and the type of the path sub-region corresponds to the second evaluation value. The types of the path sub-regions include turning sub-regions and non-turning sub-regions. A turning sub-region is a sub-region that causes the path direction of the path region to turn. The adjacent sub-regions do not include obstacle sub-regions; After each determination of a path sub-region, again select a new path sub-region from the adjacent sub-regions according to the path evaluation values of the adjacent sub-regions of the determined path sub-region each time and add it to the path region until the end sub-region is reached.

[0092] An embodiment of the present application provides a computer program product, including a computer program, which implements the following path determination method when executed by a processor: determining a starting sub-region, an ending sub-region, and an obstacle sub-region of a path region; determining path evaluation values corresponding to adjacent sub-regions of the starting sub-region, and determining, based on the path evaluation values, path sub-regions to be added to the path region from the adjacent sub-regions, where the path evaluation value is obtained by adding a first evaluation value and a second evaluation value, the distance from an adjacent sub-region to the ending sub-region corresponds to the first evaluation value, and the type of the path sub-region corresponds to the second evaluation value, the types of the path sub-regions include turning sub-regions and non-turning sub-regions, a turning sub-region is a sub-region that causes the path direction of the path region to turn, and the adjacent sub-regions do not include the obstacle sub-region; after each determination of a path sub-region, again selecting, based on the path evaluation values of the adjacent sub-regions of the path sub-region determined each time, new path sub-regions from the adjacent sub-regions and adding them to the path region until the ending sub-region is reached.

[0093] In the above embodiments of the present application, the descriptions of the respective embodiments have their own focuses. For parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0094] In several embodiments provided by the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of the units can be a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the units or modules can be in an electrical or other form.

[0095] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0096] In addition, the functional units in various embodiments of the present application can be integrated in one processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0097] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the related technology, or all or part of this 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 for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The foregoing storage medium includes: various media that can store program codes, such as USB flash drives, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), mobile hard disks, magnetic disks, or optical discs.

[0098] The foregoing are only the preferred embodiments of this application. It should be noted that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and refinements can still be made, and these improvements and refinements should also be regarded as the protection scope of this application.

Claims

1. A path determination method, characterized in that, Including: Determine the starting sub-region, ending sub-region, and obstacle sub-region of the path region; Determine the path evaluation values corresponding to the adjacent sub-regions of the starting sub-region, and determine the path sub-regions to be added to the path region from the adjacent sub-regions according to the path evaluation values. Among them, the path evaluation value is obtained by adding the first evaluation value and the second evaluation value. The distance from the adjacent sub-region to the ending sub-region corresponds to the first evaluation value, and the type of the path sub-region corresponds to the second evaluation value. The types of the path sub-regions include turning sub-regions and non-turning sub-regions. The turning sub-region is a sub-region that causes the path direction of the path region to turn. The adjacent sub-regions do not include obstacle sub-regions; After each determination of the path sub-region, again select new path sub-regions from the adjacent sub-regions according to the path evaluation values of the adjacent sub-regions of the path sub-region determined each time and add them to the path region until reaching the ending sub-region.

2. The path determination method according to claim 1, wherein Determining the path evaluation value corresponding to the adjacent sub-region includes: Determine the type of the path sub-region; According to the type of the path sub-region, determine the weight value corresponding to the path sub-region. Among them, the turning sub-region corresponds to the first weight, and the non-turning sub-region corresponds to the second weight. The first weight is greater than the second weight; Determine the distance from the adjacent sub-region to the ending sub-region; Add the sum of the weight values corresponding to one or more of the path sub-regions in the path region to the distance from the adjacent sub-region to the ending sub-region, and determine the added result as the path evaluation value corresponding to the adjacent sub-region.

3. The path determination method according to claim 2, wherein Determining the type of the path sub-region includes: Determine the previous path sub-region and the subsequent path sub-region corresponding to the path sub-region in the path region. Among them, the subsequent sub-region of the path sub-region located at the end of the path region is the adjacent sub-region; Determine the first moving direction of the path sub-region relative to the previous path sub-region. Among them, the first moving direction includes moving upward, moving downward, moving leftward, and moving rightward; Determine the second moving direction of the subsequent path sub-region relative to the path sub-region; In the case where the first moving direction and the second moving direction are different, determine the type of the path sub-region as a turning sub-region; In the case where the first moving direction and the second moving direction are the same, determine the type of the path sub-region as a non-turning sub-region.

4. The path determination method according to claim 2, wherein The calculation formula of the path evaluation value is as follows: f(n) = g(n) + h(n) Among them, f(n) is the path evaluation value corresponding to the adjacent sub-region, n is the number of path sub-regions included in the path region, h(n) is the distance from the adjacent sub-region to the end sub-region, and w i is the weight of each path sub-region in the path region.

5. The path determination method according to claim 1, wherein The sub-region is a grid with a preset size; Determining the starting sub-region, ending sub-region, and obstacle sub-region of the path region includes: Convert the canvas coordinate system into a grid coordinate system according to the preset size information, where the coordinate range in the canvas coordinate system corresponds one-to-one with the grid coordinates in the grid coordinate system; Determine the grid whose coordinate range in the corresponding canvas coordinate system includes the starting point as the starting sub-region; Determine the grid whose coordinate range in the corresponding canvas coordinate system includes the ending point as the ending sub-region; Determine the grid in the corresponding canvas coordinate system whose coordinate range includes the obstacle as the obstacle sub-region.

6. The path determination method according to claim 1, wherein After reaching the end sub-region, the method further includes: Determine the turning sub-region in the path region; Determine the canvas coordinate range of the turning sub-region corresponding to the turning sub-region in the canvas coordinate system; Determine the center point of the canvas coordinate range of the turning sub-region; Connect each of the center points as the target path in the canvas coordinate system.

7. The path determination method according to claim 1, wherein After reaching the end sub-region, the method further includes: Select a preset number of random sub-regions in the path region, and select random adjacent sub-regions of the random sub-regions outside the path region; Add the random adjacent sub-regions as new path sub-regions to the candidate path region, and again select new path sub-regions from the adjacent sub-regions according to the path evaluation values of the adjacent sub-regions of the new path sub-regions and add them to the candidate path region until reaching the end sub-region; Determine the path evaluation values corresponding to each candidate path region; Determine the target path region from the candidate path regions and the path region according to each candidate path region and the path evaluation value corresponding to the path region, wherein the path evaluation value of the target path region is less than or equal to the candidate path regions and the path region.

8. A path determination device, characterized in that, Includes: A first processing module for determining the starting sub-region, the ending sub-region, and the obstacle sub-region of the path region; A second processing module for determining the path evaluation values corresponding to the adjacent sub-regions of the starting sub-region, and determining the path sub-regions to be added to the path region from the adjacent sub-regions according to the path evaluation values, wherein the path evaluation value is obtained by adding a first evaluation value and a second evaluation value, the distance from the adjacent sub-region to the end sub-region corresponds to the first evaluation value, the type of the path sub-region corresponds to the second evaluation value, the types of the path sub-regions include turning sub-regions and non-turning sub-regions, the turning sub-region is a sub-region that causes the path direction of the path region to turn, and the adjacent sub-regions do not include obstacle sub-regions; A third processing module for, after each determination of the path sub-region, again selecting new path sub-regions from the adjacent sub-regions according to the path evaluation values of the adjacent sub-regions of the path sub-region determined each time and adding them to the path region until reaching the end sub-region.

9. A non-volatile storage medium, characterized in that, The non-volatile storage medium stores a program, wherein when the program runs, it controls the device where the non-volatile storage medium is located to execute the path determination method according to any one of claims 1 to 7.

10. An electronic device, characterized in that, Includes: A memory and a processor, the processor is used to run the program stored in the memory, wherein when the program runs, it executes the path determination method according to any one of claims 1 to 7.

11. A computer program product, comprising a computer program, characterized in that, The computer program, when executed by the processor, implements the path determination method according to any one of claims 1 to 7.