A routing method and apparatus

CN116166012BActive Publication Date: 2026-04-24CHENGDU DIJIE SUYUAN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHENGDU DIJIE SUYUAN TECH CO LTD
Filing Date
2023-02-10
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

寻路领域最常用的寻路方法是AStar寻路方法,该寻路方法可以通过调整step来调整路径避障的精度,但是传统的AStar寻路方法在大面积的二维平面范围中会占用大量的cpu和内存

Benefits of technology

[0015] Compared to existing technologies, this invention achieves rapid acquisition of the optimal path while effectively reducing memory overhead during pathfinding by seamlessly integrating obstacle segmentation, path point determination, and connected path generation. This addresses the excessive CPU and memory consumption issues of existing pathfinding technologies, including AStar. This invention significantly improves path search speed in a two-dimensional plane and accurately avoids obstacles. Building upon existing pathfinding technologies, this invention preprocesses the two-dimensional plane to accurately generate pathfinding boxes, which define the range of the optimal path, thereby effectively reducing path redundancy and repeated exploration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116166012B_ABST
    Figure CN116166012B_ABST
Patent Text Reader

Abstract

A path finding method includes: segmenting obstacles to form a path finding frame, which is used to determine a path point set. Determining the path point set includes: if the path point set is empty, adding a start point and an end point to the path point set. If the path point set is not empty, traversing the path point set, generating a straight line intersecting the path finding frame, and adding an intersection point to the path point set. Traversing the path point set, if a line connecting the start point and the end point, a line connecting the start point, the intersection point and the end point, or a line connecting the start point, the intersection point, a multi-intersection point and the intersection point, the end point can generate a connected path, the connected path is output. The present application can effectively reduce the memory overhead in the path finding process, and quickly obtain an optimal path finding path.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to data processing technology, and more particularly to a pathfinding method for obstacle maps. Background Technology

[0002] Pathfinding refers to finding a path from a starting point to an end point that avoids obstacles on a plane. The most commonly used pathfinding method is the AStar pathfinding method. This method can adjust the accuracy of obstacle avoidance by adjusting the step, but the traditional AStar pathfinding method consumes a lot of CPU and memory in a large two-dimensional plane.

[0003] Therefore, there is an urgent need for a pathfinding method and device to overcome the shortcomings of existing technologies. Summary of the Invention

[0004] The purpose of this invention is to provide a pathfinding method that can effectively reduce memory overhead during the pathfinding process and quickly obtain the optimal path.

[0005] To achieve the above objectives, the present invention provides a pathfinding method comprising: segmenting obstacles to form a pathfinding frame, the pathfinding frame being used to determine a set of path points. Determining the set of path points includes: if the set of path points is empty, then adding the start point and the end point to the set of path points. If the set of path points is not empty, then traversing the set of path points, generating straight lines intersecting with the pathfinding frame, and adding the intersection points to the set of path points. Traversing the set of path points, if the lines connecting the start and end points, the lines connecting the start, intersection, and end points, or the lines connecting the start and intersection points, multiple intersection points, and intersection and end points can generate a connected path, then outputting the connected path.

[0006] As a preferred approach, the path point set is traversed. If the connection between the start and end points, the connection between the start, intersection, and end points, or the connection between the start and intersection points, multiple intersection points, and intersection and end points does not constitute a connected path, then the pathfinding frame is repeatedly formed and a new path point set is determined until a connected path can be generated and output.

[0007] As a preferred method, if the number of repeatedly formed pathfinding frames exceeds a preset cycle limit, the output "Connected path not found" will be displayed.

[0008] As a preferred method, generating a connected path includes: sequentially adding the intersection points of all paths from the starting point to the ending point of any connected path to the insertion point set.

[0009] As a preferred method, segmenting obstacles includes: finding all obstacles on any two-dimensional plane, and adding the coordinates (x, y), length along the x-direction and length along the y-direction of all rectangular obstacles or rectangular obstacles segmented from irregular obstacles to the obstacle set.

[0010] As a preferred method, forming a pathfinding frame includes: traversing the set of path points, finding the rectangular obstacle that is most adjacent to each path point in a certain direction, and the bounding box between multiple most adjacent rectangular obstacles of the point is the pathfinding frame, or the bounding box formed between the path point and one or more most adjacent rectangular obstacles is the pathfinding frame.

[0011] As a preferred method, generating lines that intersect with the wayfinding frame includes: creating a line passing through each pathpoint in the pathpoint set. If any line intersects the corresponding wayfinding frame, the intersection point is added to the pathpoint set.

[0012] As a preferred embodiment, the intersection with the corresponding pathfinding frame includes: the straight line intersecting with any point of the rectangular obstacle connecting the frame, or the straight line intersecting with the line connecting the rectangular obstacles connecting the frame, the straight line including horizontal lines and vertical lines.

[0013] As a preferred embodiment, the pathfinding frame includes an inner wireframe and / or an outer wireframe for the corresponding obstacle. The shape of the pathfinding frame includes a rectangular frame, a circular frame, an elliptical frame, a polygonal frame, and / or an irregularly shaped frame.

[0014] This invention provides a pathfinding device comprising: an obstacle segmentation module and a connected path generation module. The obstacle segmentation module forms a pathfinding frame by segmenting obstacles, which is used to determine a set of path points. Determining the set of path points includes: if the set of path points is empty, adding the start point and the end point to the set of path points; if the set of path points is not empty, traversing the set of path points, generating straight lines intersecting the pathfinding frame, and adding the intersection points to the set of path points. The connected path generation module is used to determine whether the connection between the start and end points, the connection between the start, intersection, and end points, or the connection between the start and intersection points, multiple intersection points, and intersection and end points can generate a connected path, and outputs the connected path.

[0015] Compared to existing technologies, this invention achieves rapid acquisition of the optimal path while effectively reducing memory overhead during pathfinding by seamlessly integrating obstacle segmentation, path point determination, and connected path generation. This addresses the excessive CPU and memory consumption issues of existing pathfinding technologies, including AStar. This invention significantly improves path search speed in a two-dimensional plane and accurately avoids obstacles. Building upon existing pathfinding technologies, this invention preprocesses the two-dimensional plane to accurately generate pathfinding boxes, which define the range of the optimal path, thereby effectively reducing path redundancy and repeated exploration. Attached Figure Description

[0016] Figure 1 This is a schematic diagram illustrating the principle of existing pathfinding methods.

[0017] Figure 2 This is a schematic flowchart of the pathfinding method of the present invention. Detailed Implementation

[0018] In the following description, embodiments of the pathfinding method and apparatus of the present invention will be described with reference to the accompanying drawings.

[0019] The embodiments described herein are specific implementations of the present invention, used to illustrate the concept of the invention, and are illustrative and exemplary, and should not be construed as limiting the embodiments or scope of the present invention. In addition to the embodiments described herein, those skilled in the art can employ other obvious technical solutions based on the content disclosed in the claims and specification of this application. These technical solutions include those that make any obvious substitutions and modifications to the embodiments described herein.

[0020] The accompanying drawings in this specification are schematic diagrams used to help illustrate the concept of the invention and to schematically show the interrelationships of the various parts.

[0021] like Figure 1 The diagram illustrates the principle of a prior art pathfinding method. In the prior art, the AStar search pathfinding method is a method for finding the path with the lowest cost across multiple nodes on a graphical plane. It is commonly used for calculating the movement of NPCs in games or the movement of bots in online games.

[0022] The AStar pathfinding method combines the advantages of best-first search and Dijkstra's pathfinding method: while improving the efficiency of the pathfinding method through heuristic search, it can guarantee finding an optimal path (the evaluation function needs to satisfy monotonicity).

[0023] In this pathfinding method, if g(n) represents the actual distance from the starting point to any vertex n, and h(n) represents the estimated distance from any vertex n to the target vertex (which varies depending on the evaluation function used), then the estimation function of the AStar pathfinding method is: f(n) = g(n) + h(n). Here, n is the next node on the path, g(n) is the cost of the path from the starting node to n, and h(n) is a heuristic function that estimates the cost of the cheapest path from n to the target. The AStar pathfinding method terminates when it chooses to expand on a path from the starting point to the target, or when there is no path to expand on. The heuristic function is problem-specific. If the heuristic function is acceptable—meaning it never overestimates the actual cost of reaching the target—then the AStar pathfinding method guarantees to return the minimum-cost path from the starting point to the target.

[0024] This formula follows the following properties:

[0025] If g(n) is 0, that is, only the evaluation function h(n) from any vertex n to the target is calculated, but the distance from the starting point to vertex n is not calculated, then the pathfinding method is transformed into a best-first search using a greedy strategy, which is the fastest, but may not yield the optimal solution.

[0026] If h(n) is not greater than the actual distance from vertex n to the target vertex, then the optimal solution can definitely be found. Moreover, the smaller h(n) is, the more nodes need to be calculated, and the lower the efficiency of the pathfinding method.

[0027] A typical implementation of the AStar pathfinding method uses a priority queue to repeatedly select the node with the lowest (estimated) cost for expansion. This priority queue is called an open set or open table. At each step of the pathfinding method, the node with the lowest f(n) value is removed from the queue, its neighbors' f and g values ​​are updated accordingly, and these neighbors are added to the queue. This pathfinding method continues until a removed node (and therefore the node with the lowest f value among all edge nodes) becomes the target node. The f value of this target is also the cost of the shortest path, because in an acceptable heuristic pathfinding method, the target h value is zero.

[0028] The implementation method of the pathfinding method of the present invention is as follows: Figure 2 The flowchart of the pathfinding method of the present invention is shown. Compared with the existing pathfinding methods, the present invention adds a preprocessing step to reduce pathfinding overhead. By seamlessly connecting obstacle segmentation, path point determination, and connected path generation, the present invention achieves rapid acquisition of the optimal path while effectively reducing memory overhead during the pathfinding process, thus improving the problem of excessive CPU and memory consumption in existing pathfinding technologies, including AStar. The present invention effectively improves the path search speed in a two-dimensional plane and can accurately avoid obstacles. Based on existing pathfinding technologies, the present invention performs preprocessing operations on the two-dimensional plane to accurately generate a pathfinding frame, which is used to define the range of the optimal path, thereby effectively reducing path redundancy and repeated exploration. The pathfinding method may include the following steps:

[0029] Step 101: Segment the obstacles to form a pathfinding frame, which is used to determine a set of path points. Determining the set of path points includes: if the set of path points is empty, adding the start point and the end point to the set of path points.

[0030] More specifically, the start and end points are selected by the user input or by preset coordinates.

[0031] Step 102: If the path point set is not empty, then traverse the path point set and generate a pathfinding box.

[0032] Step 103: Generate a straight line.

[0033] More specifically, generating a straight line may include iterating through a set of path points and creating a straight line through each path point in the set.

[0034] Step 104: Generate a straight line that intersects the pathfinding frame and add the intersection point to the path point set. Generating a straight line that intersects the pathfinding frame includes: creating a straight line that intersects with an obstacle or a frame formed by its connecting lines.

[0035] Step 105: Traverse the lines formed by the path points in the path point set, and determine whether the lines connecting the start and end points, the lines connecting the start, intersection, and end points, or the lines connecting the start and intersection points, multiple intersection points, and intersection and end points can generate a connected path.

[0036] More specifically, you can iterate through the lines connecting the starting point and the ending point to see if they intersect. If they do intersect, a connected path can be generated.

[0037] Step 106: If a connected path can be generated, then generate the connected path and output the connected path and all the intersections passed through by the connected path, or the set of insertion points generated by the start, intersection and end points.

[0038] Traverse the set of path points. If the connection between the start and end points, the connection between the start, intersection, and end points, or the connection between the start, intersection, multi-intersection, and intersection / end point paths do not constitute a connected path, then repeatedly form a pathfinding frame and determine a new set of path points until a connected path can be generated and output the connected path and all the intersections passed through by the connected path, or the set of insertion points generated by the start, intersection, and end points.

[0039] Furthermore, generating a connected path can be simplified to traversing the lines starting from the beginning and the lines starting from the end. If there are intersecting line segments between them, then a connected path has been found.

[0040] Step 107: Further process the set of insertion points using existing pathfinding methods.

[0041] More specifically, for all the insertion points in the insertion point set, the AStar pathfinding method can be used to find an optimized path that passes through the above points.

[0042] In a further preferred embodiment, if the number of repeatedly formed pathfinding frames exceeds a preset cycle limit, the output "Connected path not found" is displayed.

[0043] In a further preferred embodiment, generating a connected path includes: sequentially adding all intersection points of any connected path from the starting point to the ending point to the insertion point set.

[0044] In a further preferred embodiment, segmenting obstacles includes: finding all obstacles on any two-dimensional plane, and adding the coordinates (x, y), length along the x-direction of the plane, and length along the y-direction of the plane of all rectangular obstacles or rectangular obstacles segmented from irregular obstacles to the obstacle set.

[0045] More specifically, find all rectangular obstacles on the two-dimensional plane, and add the coordinates (x, y), width (length along the x-direction of the plane), and height (length along the y-direction of the plane) of all rectangular obstacles to the obstacle set. Rectangular obstacles are used to simulate obstacles in actual use. If it is necessary to simulate irregular obstacles, the irregular obstacles can be divided into small rectangular blocks.

[0046] In a further preferred embodiment, forming a pathfinding frame includes: traversing the set of path points, finding the rectangular obstacle that is most adjacent to each path point in a certain direction, and the line frame connecting multiple most adjacent rectangular obstacles of the point is the pathfinding frame, or the line frame formed by the path point and one or more most adjacent rectangular obstacles is the pathfinding frame.

[0047] Furthermore, finding the nearest adjacent rectangular obstacle can be done by finding the nearest rectangular obstacle that is adjacent to each point in the top, bottom, left, and right directions.

[0048] In a further preferred embodiment, generating the straight line intersecting the pathfinding frame includes: creating a straight line passing through each path point in the path point set. If any straight line intersects the corresponding pathfinding frame, the intersection point is added to the path point set.

[0049] In a further preferred embodiment, the intersection with the corresponding pathfinding frame includes: the straight line intersecting with any point of the rectangular obstacle connecting the frame, or the straight line intersecting with the line connecting the rectangular obstacles connecting the frame, and the straight line includes horizontal lines and vertical lines.

[0050] More specifically, the intersection of a straight line with a rectangular obstacle connecting the frame includes the case where it intersects with the inner and outer frames (in this case, the obstacle connection line is not necessarily a straight line, and the frame shape is not necessarily a rectangle but can be other shapes): For example, the above case also includes the case where the created horizontal and vertical lines are close to the nearest rectangular obstacle, and the point where the line intersects at the corner of the rectangular obstacle (the intersection point on the outer frame edge of the obstacle) is added to the set.

[0051] In a further preferred embodiment, the pathfinding frame includes an inner wireframe and / or an outer wireframe for the corresponding obstacle. The shape of the pathfinding frame includes a rectangular frame, a circular frame, an elliptical frame, a polygonal frame, and / or an irregularly shaped frame.

[0052] Definitions:

[0053] 1. Loop Limit: Used to prevent the program from getting stuck in an infinite loop, because there may be situations where the starting point or the ending point is surrounded by obstacles, in which case it is impossible to find a path.

[0054] 2. Nearest Obstacles: A waypoint may be surrounded by one or more obstacles, so it is necessary to determine the nearest obstacles in the four directions of up, down, left, and right, and then determine the waypoint for the next iteration in turn.

[0055] Compared with existing technologies, the pathfinding method of this invention achieves rapid acquisition of the optimal path while effectively reducing memory overhead during the pathfinding process by seamlessly integrating obstacle segmentation, path point determination, and connected path generation. This addresses the problem of excessive CPU and memory consumption in existing pathfinding technologies, including AStar. This invention effectively improves the path search speed in a two-dimensional plane and can accurately avoid obstacles. Building upon existing pathfinding technologies, this invention preprocesses the two-dimensional plane to accurately generate a pathfinding frame, which is then used to define the range of the optimal path, thereby effectively reducing path redundancy and repeated exploration.

[0056] This invention also provides a pathfinding device, comprising: an obstacle segmentation module and a connected path generation module. The obstacle segmentation module forms a pathfinding frame by segmenting obstacles, which is used to determine a set of path points. Determining the set of path points includes: if the set of path points is empty, adding the start point and the end point to the set of path points; if the set of path points is not empty, traversing the set of path points, generating straight lines intersecting with the pathfinding frame, and adding the intersection points to the set of path points. The connected path generation module is used to determine whether the connection between the start and end points, the connection between the start, intersection, and end points, or the connection between the start and intersection points, multiple intersection points, and intersection and end points can generate a connected path, and outputs the connected path.

[0057] Compared with existing technologies, the pathfinding device of this invention achieves rapid acquisition of the optimal path while effectively reducing memory overhead during the pathfinding process by seamlessly integrating obstacle segmentation, path point determination, and connected path generation. This addresses the problem of excessive CPU and memory consumption in existing pathfinding technologies, including AStar. This invention effectively improves path search speed in a two-dimensional plane and can accurately avoid obstacles. Building upon existing pathfinding technologies, this invention preprocesses the two-dimensional plane to accurately generate a pathfinding frame, which defines the range of the optimal path, thereby effectively reducing path redundancy and repeated exploration.

[0058] The embodiments of the pathfinding method and apparatus of the present invention have been described above, with the aim of explaining the spirit of the present invention. Please note that those skilled in the art can modify and combine the features of the above embodiments without departing from the spirit of the present invention; therefore, the present invention is not limited to the above embodiments. Specific features of the pathfinding apparatus of the present invention, such as shape, size, and position, can be specifically designed based on the functions of the features disclosed above, and these designs are all achievable by those skilled in the art. Furthermore, the technical features disclosed above are not limited to the disclosed combinations with other features; those skilled in the art can also make other combinations between the technical features according to the purpose of the invention, to achieve the purpose of the present invention.

Claims

1. A pathfinding method, characterized in that, The method includes: The obstacles are segmented to form a pathfinding frame, wherein the pathfinding frame is used to determine a set of path points; wherein determining the set of path points includes: if the set of path points is empty, then adding the start point and the end point to the set of path points; if the set of path points is not empty, then traversing the set of path points, generating lines that intersect with the pathfinding frame, and adding the intersection points to the set of path points. Iterate through the set of path points. If the connection between the start and end points, the connection between the start, intersection, and end points, or the connection between the start and intersection points, multiple intersection points, and intersection and end points can generate a connected path, then output the connected path. Iterate through the set of path points. If the lines connecting the start and end points, the lines connecting the start, intersection, and end points, or the lines connecting the start and intersection points, multiple intersection points, and intersection and end points do not constitute a connected path, then repeatedly form a pathfinding frame and determine a new set of path points until a connected path can be generated and output. For all the insertion points in the insertion point set, the AStar pathfinding method is further used to find an optimized path that passes through the above points. Forming a pathfinding frame includes: traversing the set of path points, finding the rectangular obstacle that is most adjacent to each path point in a certain direction, and the bounding box between multiple most adjacent rectangular obstacles of the point is the pathfinding frame, or the bounding box formed between the path point and one or more most adjacent rectangular obstacles is the pathfinding frame. Generating lines that intersect with the wayfinding box includes: creating a line passing through each path point in the path point set; if any line intersects with the corresponding wayfinding box, adding the intersection point to the path point set; wherein, intersecting with the corresponding wayfinding box includes: The straight line intersects any point among the rectangular obstacles connecting the frame, or the straight line intersects the line connecting the rectangular obstacles connecting the frame, wherein the straight line includes horizontal lines and vertical lines.

2. The pathfinding method according to claim 1, characterized in that, If the number of repeatedly formed pathfinding boxes exceeds the preset cycle limit, the output "Connected path not found" will be displayed.

3. The pathfinding method according to claim 2, characterized in that, Generating connected paths includes: Add the intersection points of all paths from the starting point to the ending point of any connected path to the insertion point set in sequence.

4. The pathfinding method according to claim 1, characterized in that, The obstacles to be divided include: Find all obstacles on any two-dimensional plane, and add the coordinates (x, y), length along the x-direction and length along the y-direction of all rectangular obstacles or rectangular obstacles divided by irregular obstacles to the obstacle set.

5. The pathfinding method according to claim 1, characterized in that, The pathfinding frame includes an inner wireframe and / or an outer wireframe for the corresponding obstacle; The shape of the pathfinding frame includes a rectangular frame, a circular frame, an elliptical frame, a polygonal frame, and / or an irregular graphic frame.

6. A pathfinding device, characterized in that, The device includes an obstacle segmentation module and a connected path generation module, wherein... The obstacle segmentation module forms a pathfinding frame by segmenting obstacles, wherein the pathfinding frame is used to determine a set of path points; wherein determining the set of path points includes: if the set of path points is empty, then adding the start point and the end point to the set of path points; if the set of path points is not empty, then traversing the set of path points, generating straight lines that intersect with the pathfinding frame, and adding the intersection points to the set of path points. The connected path generation module is used to determine whether the connections between the start and end points, the connections between the start, intersecting, and end points, or the connections between the start, intersecting, multi-intersecting, and intersecting / end point paths can form a connected path, and outputs the connected path; it also iterates through the set of path points, and if the connections between the start and end points, the connections between the start, intersecting, and end points, or the connections between the start, intersecting, multi-intersecting, and intersecting / end point paths do not constitute a connected path, then it repeatedly forms a pathfinding frame and determines a new set of path points until a connected path can be generated and outputs the connected path; and... For all the insertion points in the insertion point set, the AStar pathfinding method is further used to find an optimized path that passes through the above points. Forming a pathfinding frame includes: traversing the set of path points, finding the rectangular obstacle that is most adjacent to each path point in a certain direction, and the bounding box between multiple most adjacent rectangular obstacles of the point is the pathfinding frame, or the bounding box formed between the path point and one or more most adjacent rectangular obstacles is the pathfinding frame. Generating lines that intersect with the wayfinding box includes: creating a line passing through each path point in the path point set; if any line intersects with the corresponding wayfinding box, adding the intersection point to the path point set; wherein, intersecting with the corresponding wayfinding box includes: The straight line intersects any point among the rectangular obstacles connecting the frame, or the straight line intersects the line connecting the rectangular obstacles connecting the frame, wherein the straight line includes horizontal lines and vertical lines.

Citation Information

Patent Citations

  • Three-dimensional obstacle avoidance flight path planning method based on pre-planned path optimization RRT algorithm

    CN112179351A