Dynamic path planning method and system based on improved A* algorithm
By introducing the environmental obstacle impact term and the DWA algorithm into the A* algorithm, the path planning is optimized, the problem of the A* algorithm failing to effectively avoid obstacles is solved, and safer and more stable path planning is achieved.
Patent Information
- Application Number
- CN202210869782.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-22
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-07-22
AI Technical Summary
The existing A* algorithm fails to effectively consider surrounding obstacles in path planning, resulting in the planned path being too close to the obstacles, increasing the risk of collision between moving objects.
By introducing the environmental obstacle impact term, the evaluation function of the A* algorithm is improved, the path planning is optimized by combining the obstacle density and obstacle density, and the DWA algorithm is combined with the local path planning to avoid obstacles.
It effectively avoids obstacle-dense areas, reduces the risk of collision between planning objects and obstacles, optimizes the path length and number of turning points, and improves the safety and stability of the path.
Smart Images

Figure CN115268441B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of path planning, and in particular to a dynamic path planning method and system based on an improved A* algorithm. Background Art
[0002] The A* algorithm is an algorithm optimized by the Dijstra algorithm. It is simple and efficient. It is widely used in path planning tasks and is the most used path planning algorithm in a two-dimensional plane environment. Compared with traditional algorithms, the A* algorithm incorporates the concept of heuristic function and uses path loss as a judgment mechanism for selecting nodes. It is no longer a purposeless global search. During the search process, the next node is determined by considering the evaluation of the current node to the starting point and the current node to the target point, and so on, until the target node is searched.
[0003] The specific steps of the A* algorithm are as follows: In a two-dimensional grid map, set the starting point as point A and the target point as point B. At the beginning of the path planning task, set point A as the starting node, and traverse the non-obstruction points in the 8 points near A at the same time, calculate the evaluation function of each node respectively, and finally change the current node from the starting node point A to the point with the lowest evaluation function, and update the information of the neighboring nodes, and so on and so forth, continuously selecting the point with the lowest evaluation function as the current node until point B is found. Finally, continuously search for the parent node of the current node from the target point until the starting node, so as to obtain the best path.
[0004] Since the existing A* algorithm does not consider the number of surrounding obstacles during the search process, the searched path may be too close to obstacles or even close to obstacles. Such a path may cause collisions with moving objects, especially fast-moving objects. For example, if the robot's body or arm is too close to an obstacle during driving, there is a risk of collision if it deviates slightly.
[0005] Therefore, the path searched by the existing A* algorithm is likely to cause the planned object to collide with obstacles, which has become a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0006] The present invention provides a dynamic path planning method and system based on an improved A* algorithm, which is used to solve the technical problem that the path searched by the existing A* algorithm easily causes the planned object to collide with obstacles.
[0007] In order to solve the above technical problems, the technical solution proposed by the present invention is:
[0008] A dynamic path planning method based on an improved A* algorithm comprises the following steps:
[0009] The evaluation function of the traditional A* algorithm is added with the environmental obstacle influence term to construct an improved A* algorithm; the environmental obstacle influence term is determined by the obstacle density around the current node and the global obstacle density; dynamic path planning is performed on the planning object based on the improved A* algorithm.
[0010] Preferably, the evaluation function of the improved A* algorithm is:
[0011] f(n)=g(n)+h(n)+d sg ×ω×o(n);
[0012] Where n represents the node, g(n) is the true cost, which represents the distance from the starting point to the current node; h(n) is the heuristic function, which represents the remaining distance from the current node to the target node; d sg represents the straight-line distance between the current node and the target node, o(n) is the environmental obstacle function, and its value represents the density of obstacles around the current point; ω is the obstacle weight factor, which determines the sensitivity of the planned path to obstacles.
[0013] Preferably, the environmental obstacle function o(n) is obtained by the following formula:
[0014] o(n)=sum(O×D), where the matrix O represents the obstacle information of multiple nearby nodes with the current node as the center; the matrix D represents the distance weight matrix of the multiple nearby nodes to the current node. The closer the node is to the center point, the greater its distance weight.
[0015] Preferably, in a 12% low obstacle density map, the value range of ω is [0.2, 0.4]; in a 24% high obstacle density map, the value range of ω is [0.8, 1.0].
[0016] Preferably, the improved A* algorithm executes the following key point search strategy when planning the global path:
[0017] Assume that the path node set P is known k = {P1,P2......P N} and its coordinate information; P1 is the starting point, P N is the target point, for the known path node set P k Any node P i , i=1,2,3,...,N, perform the following steps:
[0018] Calculated by the node P i The vector composed and vector The angle between them is determined to be 0:
[0019] If the angle is 0, it means and Collinear, three points are on a straight line, then P i Redundant nodes on the same line need to be removed;
[0020] If the angle is not 0, it means that they are not collinear. i It is a turning point, please solve The equation of the line segment and determine whether it intersects with the obstacle: If there is no obstacle in the line segment, then P i is a redundant turning point, remove it; if there is an obstacle, then P i It is a key turning point and is retained.
[0021] Preferably, performing dynamic path planning on the planning object based on the improved A* algorithm includes the following steps:
[0022] Using the improved A* algorithm to perform global path planning and extract key points in the global path;
[0023] According to the timing of the planning object passing through each key point, each key point is taken as a local target point in turn, and the DWA algorithm is used to plan the local path of the planning object from each key point to the next key point until the planning object reaches the target point of the global path.
[0024] Preferably, the DWA algorithm is used to plan the local path of the planning object moving from each key point to the next key point, which specifically includes the following steps:
[0025] For any i-th key point P i and its next key point P i+1 ; When the planning object moves to the key point P i When the key point P i+1 as a local key point; when the planning object encounters an unknown obstacle or a dynamic obstacle, local path planning begins, the current speed of the planning object is sampled, and the current motion posture of the planning object is calculated based on the current sampled speed and the pre-built motion model of the planning object. At the same time, the motion posture is compared with the posture of the global path planning in the current area, and the direction weight N is calculated according to the comparison result. Based on the direction weight N, the posture of the global path planning in the current area is used to plan the local path of the planning object moving from each key point to the next key point.
[0026] Preferably, the evaluation function of the DWA algorithm is:
[0027] G(v,w)=σ(N×heading(v,w)+β×dist(v,w)+γ×velocity(v,w))
[0028] Among them, heading(v,w) is the direction factor, which indicates the angle between the azimuth of the planned object and the target point when moving to the end point of the current trajectory. The larger the angle, the lower the score; dist(v,w) indicates the minimum distance to the obstacle on the trajectory. If there is no obstacle on the trajectory, it is a larger constant; velocity(v,w) indicates the score of the motion linear velocity; N is the direction angle score weight after integrating the motion posture ratio, β and γ indicate the score weights of the obstacle distance and the motion linear velocity respectively; σ indicates the normalization operation.
[0029] A computer system comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the steps of the above method are implemented when the processor executes the computer program.
[0030] The present invention has the following beneficial effects:
[0031] 1. In view of the problem that the traditional A* path planning algorithm only considers the distance factor when performing global path planning, which may cause the path to pass through dense obstacle areas, the present invention proposes an improved A* algorithm that introduces the number of obstacles around the path into the evaluation function. The global path planned by the improved A* algorithm can effectively bypass the obstacle-dense areas and reduce the risk of collision between the planned object and the obstacles.
[0032] 2. In the preferred embodiment, the present invention conducts experiments in maps with different obstacle densities to explore the influence of the obstacle coefficient ω on the number of obstacles around the path, the path length and the search nodes, determine the priority obstacle coefficients for different obstacle densities, and further reduce the number of obstacles around the planned path.
[0033] 3. In the preferred embodiment, the present invention studies the method of removing redundant nodes and connecting key nodes to solve the problem that the traditional A* algorithm has many turning points in the path, which easily causes a sudden change in speed of the robot movement. In an obstacle density environment of 6%, the number of turning points is reduced by about 50% compared with the original algorithm, and the path length can be reduced by about 3%; in an obstacle density environment of 12%, the number of turning points is reduced by about 28% compared with the original algorithm, and the path length is reduced by about 3%; in a higher obstacle density environment of 24%, the number of turning points is reduced by about 25% compared with the original algorithm, and the path length can be reduced by about 1%;
[0034] 4. In the preferred embodiment, the present invention explores dynamic path planning based on the fusion of DWA algorithm and A* algorithm, performs global path planning by improving A* algorithm, and performs local path planning by DWA algorithm. At the same time, a method of segmenting the global path and improving the orientation evaluation function is proposed to improve the problem that the traditional DWA algorithm may deviate from the global path when avoiding obstacles. The dynamic path planning simulation experiment shows that the fusion algorithm can effectively avoid the problem of deviating from the global path when avoiding obstacles.
[0035] In addition to the above-described purposes, features and advantages, the present invention has other purposes, features and advantages. The present invention will be further described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings constituting a part of this application are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0037] Figure 1 This is a test graph when ω is [0, 30] in a low obstacle density map provided by an embodiment of the present invention, wherein (a) is a schematic diagram of the number of search nodes, (b) is a schematic diagram of the path length, and (c) is a diagram showing the change in the number of surrounding obstacles; (d) is a typical test graph when ω is 15;
[0038] Figure 2 A test diagram when ω is [0, 5] in a low obstacle density map provided by an embodiment of the present invention, wherein (a) is a schematic diagram of the number of search nodes, (b) is a schematic diagram of the path length, and (c) is a diagram showing the change in the number of surrounding obstacles; (d) is a typical test diagram when ω is 2.5;
[0039] Figure 3 This is a test graph when ω is [0, 1.5] in a low obstacle density map provided by an embodiment of the present invention, wherein (a) is a schematic diagram of the number of search nodes, (b) is a schematic diagram of the path length, and (c) is a diagram showing the change in the number of surrounding obstacles; (d) is a typical test graph when ω is 0.2;
[0040] Figure 4 Schematic diagram of the influence of different ω on path planning in the same low obstacle density random map provided in an embodiment of the present invention, wherein (a) and (b) represent two different low obstacle density random maps respectively;
[0041] Figure 5 This is a test graph when ω is [0, 30] in a high obstacle density map provided by an embodiment of the present invention, wherein (a) is a schematic diagram of the number of search nodes, (b) is a schematic diagram of the path length, and (c) is a diagram showing the change in the number of surrounding obstacles; (d) is a typical test graph when ω is 15;
[0042] Figure 6 A test diagram when ω is [0, 5] in a high obstacle density map provided by an embodiment of the present invention, wherein (a) is a schematic diagram of the number of search nodes, (b) is a schematic diagram of the path length, and (c) is a diagram showing the change in the number of surrounding obstacles; (d) is a typical test diagram when ω is 2.5;
[0043] Figure 7This is a test diagram when ω is [0, 1.5] in a high obstacle density map provided by an embodiment of the present invention, wherein (a) is a schematic diagram of the number of search nodes, (b) is a schematic diagram of the path length, and (c) is a diagram showing the change in the number of surrounding obstacles; (d) is a typical test diagram when ω is 0.2;
[0044] Figure 8 Schematic diagram of the impact of different ω on path planning in the same high obstacle density random map provided by the embodiment of the present invention, wherein (a) and (b) represent two different high obstacle density random maps respectively;
[0045] Fig. 9 A schematic diagram of a traditional A* search neighborhood provided by an embodiment of the present invention;
[0046] Fig.10 A comparison diagram of the paths planned by the present invention and the traditional A* algorithm when the obstacle density is 6% provided in the embodiment of the present invention;
[0047] Fig.11 A comparison diagram of the paths planned by the present invention and the traditional A* algorithm when the obstacle density provided by the embodiment of the present invention is 12%;
[0048] Fig.12 A comparison diagram of the paths planned by the embodiment of the present invention and the traditional A* algorithm when the obstacle density is 24%;
[0049] Fig.13 A comparison chart of the number of inflection points and path length between the present invention and the traditional A* algorithm when the obstacle density provided in the embodiment of the present invention is 6%;
[0050] Fig.14 A comparison chart of the number of inflection points and path length between the present invention and the traditional A* algorithm when the obstacle density provided in the embodiment of the present invention is 12%;
[0051] Fig.15 A comparison chart of the number of inflection points and path length between the present invention and the traditional A* algorithm when the obstacle density provided in the embodiment of the present invention is 24%;
[0052] Fig.16 A flowchart of the improved A* fusion DWA algorithm provided by an embodiment of the present invention;
[0053] Fig.17 The experimental initialization map and path planning schematic diagram provided in the embodiment of the present invention, wherein Figure (a) shows the initialization map, and Figure (b) shows the path planning schematic diagram;
[0054] Fig.18 Schematic diagrams of two different typical cases of a robot avoiding a static unknown obstacle provided by an embodiment of the present invention, (a) represents typical case 1, and (b) represents typical case 2;
[0055] Fig.19 Schematic diagrams of two different typical cases of a robot avoiding a dynamic unknown obstacle provided by an embodiment of the present invention, (a) represents typical case 1, and (b) represents typical case 2;
[0056] Fig. 20 A schematic diagram of a situation where the fusion algorithm path provided in an embodiment of the present invention deviates from the global path;
[0057] Fig.21 A schematic diagram of obstacle avoidance results of a traditional DWA and an improved DWA when encountering a dynamic obstacle provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The embodiments of the present invention are described in detail below with reference to the accompanying drawings, but the present invention can be implemented in many different ways as defined and covered by the claims.
[0059] Embodiment 1:
[0060] This embodiment discloses a dynamic path planning method based on an improved A* algorithm, comprising the following steps:
[0061] The evaluation function of the traditional A* algorithm is added with the environmental obstacle influence term to construct an improved A* algorithm; the environmental obstacle influence term is determined by the obstacle density around the current node and the global obstacle density; dynamic path planning is performed on the planning object based on the improved A* algorithm.
[0062] In addition, in this embodiment, a computer system is also disclosed, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above method when executing the computer program.
[0063] In order to solve the problem that the traditional A* path planning algorithm only considers the distance factor when performing global path planning, which may cause the path to pass through dense obstacle areas, the present invention proposes an improved A* algorithm that introduces the number of obstacles around the path into the evaluation function. The global path planned by the improved A* algorithm can effectively bypass the obstacle-dense areas and reduce the risk of collision between the planned object and obstacles.
[0064] Embodiment 2:
[0065] Embodiment 2 is a preferred embodiment of Embodiment 1. The difference between Embodiment 2 and Embodiment 1 is that the specific steps of the dynamic path planning method based on the improved A* algorithm are introduced in detail:
[0066] This embodiment discloses a dynamic path planning method based on an improved A* algorithm, including the following contents:
[0067] 1. Build an improved A* algorithm
[0068] 11) Model construction of evaluation function:
[0069] The traditional A* algorithm evaluates the path planning based on distance, without considering the need to bypass dense obstacle areas. A slight deviation in the dense obstacle area will cause a collision risk. To address this problem, this chapter adds the influence of obstacles near the object to the heuristic function, and introduces the influence of obstacles in the surrounding environment on the evaluation function f(n) during the search process.
[0070] The evaluation function of the traditional A* algorithm consists of actual cost and heuristic cost, which is defined as shown in formula (1):
[0071] f(n)=g(n)+h(n) (1)
[0072] Among them, n represents the node, g(n) is the true cost, which represents the distance from the starting point to the current node; h(n) is the heuristic function, which represents the remaining distance from the current node to the target node; since the heuristic function h(n) only contains the distance information from the current node to the target node, it does not consider the surrounding environment and directionality. Therefore, the improved heuristic function after adding the environmental obstacle influence term to the evaluation function is shown in formula (2):
[0073] f(n)=g(n)+h(n)+d sg ×ω×o(n) (2)
[0074] g(n) and h(n) remain unchanged, d sg Indicates the straight-line distance between the current node and the target node o(n) is the environmental obstacle function, which is defined as shown in formula (3), and w is the obstacle weight factor.
[0075] o(n)=sum(O×D) (3)
[0076] Among them, O and D are 3×3 matrices. The matrix O is shown in formula (4), which represents the obstacle information of the 8 nearby nodes with the current node as the center. In the matrix, 1 indicates an obstacle and 0 indicates no obstacle.
[0077]
[0078] The matrix D is shown in formula (5), which represents the distance weight. The closer the point is to the center point, the greater the distance weight.
[0079]
[0080] sum(O×D) represents the operation of multiplying the elements of the corresponding positions of the O and D matrices and then summing them up. The more obstacles there are around the current point, the more non-zero elements there are in the O matrix, the greater the value of sum(O×D), and the value of the evaluation function f(n), thereby reducing the possibility of selecting these points with more environmental obstacles as paths. Conversely, when the obstacles around the current point are sparse, there are few non-zero elements in the O matrix, the value of sum(O×D) will decrease, and the value of the evaluation function f(n) will also decrease, thereby increasing the possibility of selecting these points with fewer environmental obstacles as paths.
[0081] 12) Determination of static weight ω
[0082] The A* evaluation function after introducing the obstacle influence term and the direction influence term is shown in formula (6). The static weight ω controls the influence of the number of obstacles on the path selection. The larger the ω, the greater the contribution of the obstacle term to the evaluation function, and the system will be sensitive to the number of obstacles when selecting nodes.
[0083] f(n)=g(n)+h(n)+d sg ×ω×o(n) (6)
[0084] In order to study the impact of the specific assignment of the static weight ω on path selection, the number of search nodes, path length, and number of surrounding obstacles are used as evaluation indicators and tested in environments with 10% obstacle density and 20% obstacle density. A path with a small number of search nodes, a small path length, and a small number of surrounding obstacles is the most ideal choice. However, in order to reduce the number of obstacles around the path, it is inevitable to increase the search range, the number of search nodes will increase, and in order to bypass the obstacle-dense area, the path length will inevitably increase.
[0085] 121) Determination of static weight ω in low obstacle density environment
[0086] For the improved heuristic function, the optimal value of ω needs to be determined. Three intervals of ω are tested, with the values of ω being the large interval [0, 30], the refined interval [0, 5], and the small interval [0, 1.5]. Each interval is divided into 10 data values for the experiment.
[0087] Because ω controls the density of obstacles around the path, the number of search nodes is selected to reflect the calculation time, the number of obstacles around the route node is selected to reflect the obstacle avoidance effect, and the path length is selected to reflect the effect of path planning. To this end, 10 randomly generated 50×50 grid maps are selected, and 300 grids are randomly set as obstacle points to experimentally find the optimal static weight ω under low obstacle density. The first set of experimental results are shown in Figure 1. Figure 1In the typical test graph, the solid line is the traditional A* algorithm without adding the obstacle influence term, and the dotted line is the algorithm in this paper with the obstacle influence term added.
[0088] First, different ω values are selected in a large range for testing. A test value is selected every 5 in [0, 30] for testing, and the average value of ten tests is taken. Figure 5 (d) It can be seen that when ω is 15, the path (solid line) planned by the traditional A* algorithm is shorter than the path planned by the proposed algorithm. However, the traditional algorithm passes through the area with the most dense obstacles in the center of the map, and there are 7 obstacles on its path; while the proposed algorithm bypasses the area with the most dense obstacles, and only 1 obstacle is on the path. It can be seen that when the obstacle coefficient is large, the planned path length will increase significantly, but it is safer. From the result graph, it can be seen that with the increase of ω, the number of searched nodes and the path length increase significantly at the beginning, and then the number of nodes and the path length also decrease and tend to be stable. This is because the influence of the obstacle term is increased, and the distance is no longer the optimal standard. The search range is increased, and bypassing the obstacle-dense area means an increase in the length of the path. With the increase of ω, the number of obstacles around the path begins to decline significantly, and then fluctuates slightly and tends to be stable. This is because the obstacle term evaluation suppresses the probability of selecting an obstacle-dense area and selects a path with less dense obstacles. However, since the obstacle term has a limited effect and is not the only criterion for judging the path, there are still a small number of obstacles around the path. However, the larger the obstacle coefficient is, the better it is. From the experimental data, we can see that as the obstacle coefficient increases, the number of searched nodes and the path length increase significantly, but the number of obstacles around the path does not continue to decrease, but tends to stabilize with small fluctuations. If only the number of surrounding obstacles is used as the evaluation criterion for path planning, in order to minimize the number of surrounding obstacles, more search nodes and path length need to be added.
[0089] Therefore, setting the optimal ω in the interval of [0, 5] can significantly reduce the number of obstacles around the path without increasing the search nodes and path length too much. In order to further determine the optimal value, the test range of ω is further narrowed to [0, 5], and 10 sample data are taken at equal intervals for testing. The test results are as follows: Figure 2 The solid line path in the typical test diagram is the traditional A* algorithm without adding the obstacle influence term, and the dotted line path is the algorithm in this paper with the obstacle influence term added.
[0090] Take a test value every 0.5 units in the interval [0, 5] and perform the same ten rounds of testing, and take the average value. Figure 6(d) It can be seen that when ω is 2.5, the path (solid line) planned by the traditional A* algorithm is shorter than the path planned by the proposed algorithm. However, the traditional algorithm passes through the area with the most dense obstacles in the center of the map, and there are 9 places on its path that are close to obstacles; while the proposed algorithm bypasses the area with the most dense obstacles, and only 3 places on the path are close to obstacles. It can be seen that when the obstacle coefficient is reduced to 2.5, the planned path can also obviously bypass the area with the most dense obstacles. Compared with the obstacle coefficient of 15, the bypass path is not long. Although the planned path length has also increased, the difference between the two path lengths has been reduced. From the result graph, it can still be found that when ω changes close to 0, the search nodes and path lengths change greatly, and there is a significant increase. The reason is that the introduction of obstacle evaluation suppresses the probability of selecting the obstacle-dense area, which bypasses the obstacle-dense area; at the same time, when ω changes close to 0, the slope of the number of surrounding obstacles is also large, indicating that the obstacle coefficient does not need to be very large to affect the choice of path. From the result graph, we can see that in the interval [0, 1.5], the number of surrounding obstacles decreases the fastest. When ω increases in the range greater than 1.5, the effect of decreasing the number of surrounding obstacles is not obvious, but the number of search nodes and the path length are still increasing. If the number of surrounding obstacles is to be further reduced, more search nodes will be added and the path length will be increased, and the path planning result will become less efficient.
[0091] Therefore, setting the optimal ω in the interval of [0, 1.5] can significantly reduce the number of obstacles around the path without increasing the search nodes and path length too much. In order to further determine the optimal value, the test range of ω is further narrowed to [0, 1.5], and 10 sample data are taken at equal intervals for testing. The experimental results are as follows: Figure 3 In the typical test diagram, the red path is the traditional A* algorithm without adding the obstacle influence term, and the green path is the algorithm in this paper with the obstacle influence term added.
[0092] In the interval [0, 1.5], a value is taken every 0.2 for testing and the average is taken. Figure 3(d) It can be seen that when ω is 0.8, the path (solid line) planned by the traditional A* algorithm is shorter than the path planned by the proposed algorithm. However, the traditional algorithm passes through the area with the most dense obstacles in the center of the map, and there are 7 places on its path that are close to obstacles; while the proposed algorithm bypasses the area with the most dense obstacles, and only 4 places on the path are close to obstacles. It can be seen that when the obstacle coefficient is reduced to 0.8, the planned path can also obviously bypass the area with the most dense obstacles. Compared with the obstacle coefficient of 2.5, the path growth is not much, but it deviates in the most dense area, but the difference between the two path lengths is further reduced. From the results, it can be seen that when ω is in the interval [0.2, 0.4], the number of obstacles decreases fastest with the increase of ω. In the interval [0.4, 1.5], the number of obstacles decreases slowly, but the number of nodes and path length still increase rapidly. Reducing the number of surrounding obstacles will increase more search nodes and increase the path length. Therefore, the obstacle coefficient ω is selected in the interval [0.2, 0.4] to achieve the best effect. When ω is 0.2, the number of obstacles around the path is reduced by about 58%.
[0093] like Figure 4 The effect of different ω values on path selection in the same low obstacle density map is shown. As the obstacle coefficient ω increases, the trend of path selection to bypass obstacles becomes more obvious, the number of obstacles around the path is significantly reduced, but the path length also increases. The reason is that the increase in the obstacle coefficient increases the sensitivity of path planning to obstacles. When the obstacle coefficient is small, the path planning evaluation is still dominated by the distance factor, but when the obstacle coefficient increases, the distance factor is no longer dominant, and even becomes dominated by the number of obstacles around the path. At this time, the path will detour to avoid obstacles. Although safety has increased, the path length has also been greatly increased. Through experimental comparison, the obstacle coefficient ω is selected in the interval of [0.2,0.4] to achieve the effect of reducing obstacles while not significantly increasing the path.
[0094] 122) Determination of static weight ω in high obstacle density environment
[0095] The above analysis is based on a map with 12% obstacle density (300 obstacles). To further explore the impact of maps with higher obstacle density on static weights, 10 randomly generated 50×50 grid maps are selected, and 300 grids are randomly set as obstacle points to experimentally find the optimal static weight ω in a high obstacle density environment. The first set of experimental results is shown in Figure 2. Figure 5 The solid line path in the typical test diagram is the traditional A* algorithm without adding the obstacle influence term, and the dotted line path is the algorithm in this paper with the obstacle influence term added.
[0096] Depend on Figure 5As shown, a test value is selected every 5 seconds in [0, 30] for testing, and the average value of ten tests is taken. Figure 5 (d) It can be seen that when ω is 15, the distance of the path (solid line) planned by the traditional A* algorithm is much different from the length of the path planned by the algorithm in this paper. The reason is that in a high obstacle density environment, there are more obstacles that need to be bypassed. A larger ω makes the path very sensitive to obstacles and consumes more distance to bypass. It can be seen from the result graph that as ω increases, the number of searched nodes and the path length increase significantly at the beginning, and then the changes in the number of nodes and the path length also decrease and tend to stabilize. As ω increases, the number of obstacles around the path begins to decline sharply, and then the decline slows down and tends to stabilize. A larger ω causes the path to have a large range of detours, sacrificing a lot of path length. In order to further determine a better value, the test range of ω is narrowed to [0, 5], and 10 sample data are taken at equal intervals for testing. The test results are as follows Figure 6 The red path in the typical test diagram is the traditional A* algorithm without adding the obstacle influence term, and the dotted line is the algorithm in this paper with the obstacle influence term added.
[0097] Depend on Figure 6 As shown, a test value is taken every 0.5 units in the interval [0, 5] and the same ten rounds of testing are performed, and the average value is taken. Figure 6 (d) It can be seen that when ω is 2.5, the path (solid line) planned by the traditional A* algorithm is shorter, but there are more obstacles near the path, while the algorithm in this paper bypasses the dense obstacle area. It can be seen that when the obstacle coefficient is reduced to 2.5, the planned path can also obviously bypass the area with the most dense obstacles. Compared with the obstacle coefficient of 15, the planned path is still very long, but the difference between the two path lengths is decreasing. From the result graph, it can still be found that when ω changes close to 0, the search node and path length change greatly, and there is a significant increase. The reason is that the introduction of obstacle evaluation suppresses the probability of selecting dense obstacle areas, bypassing dense obstacle areas; at the same time, when ω changes close to 0, the slope of the number of surrounding obstacles is also large, indicating that the obstacle coefficient does not need to be very large to affect the choice of path. From the result graph, we can see that in the interval [0, 1.5], the number of surrounding obstacles decreases the fastest. When ω increases in the range greater than 2.5, the effect of decreasing the number of surrounding obstacles is not obvious, but the number of search nodes and the path length are still increasing. If we want to further reduce the number of surrounding obstacles, we will add more search nodes and increase the path length, and the path planning result will also become less efficient. Therefore, in order to test the optimal value, the test range of ω is narrowed to [0, 1.5], and 10 sample data are taken at equal intervals for testing. The test results are shown in the figure below. Figure 7The solid line path in the typical test diagram is the traditional A* algorithm without adding the obstacle influence term, and the dotted line path is the algorithm in this paper with the obstacle influence term added.
[0098] Depend on Figure 7 As shown, a test value is taken every 0.2 units in the interval [0, 1.5] and the same ten rounds of testing are performed to obtain the average value. Figure 7 (d) It can be seen that when ω is 0.6, the path (solid line) planned by the traditional A* algorithm is not much different from the improved path length, but the algorithm in this paper bypasses the dense obstacle area. From the result graph, it can still be found that when ω changes close to 0, the number of surrounding obstacles decreases most significantly, but the search nodes and path length change greatly, with a substantial increase. When ω is greater than 0.6, the growth of the number of search nodes slows down, but the path length still keeps growing; when ω is greater than 1.0, the downward trend of the number of surrounding obstacles slows down, but the number of search nodes and path length still increase. Therefore, setting ω in the interval [0.8, 1.0] can achieve a better global obstacle avoidance effect. When ω is 0.8, the number of obstacles around the path is reduced by about 18%.
[0099] Figure 8 It shows the impact of different ω values on path selection in the same map with high obstacle density.
[0100] Depend on Figure 8 As shown in the figure, as the obstacle coefficient ω increases, the trend of path selection to bypass obstacles becomes more obvious. Because in a high obstacle density environment, there are many obstacles, and the path length required to bypass obstacles also increases. The increase in the obstacle coefficient increases the sensitivity of path planning to obstacles. At this time, the path will detour to avoid obstacles. Although safety has increased, the path length has also increased significantly, and even become unattainable. Through experimental comparison, the obstacle coefficient ω is selected in the range of [0.8, 1.0] to achieve the effect of reducing obstacles while not significantly increasing the path.
[0101] 13) Determination of key point search strategy
[0102] In order to solve the problem that the path planned by the traditional A* algorithm has many turning points, which affects the normal movement of the robot, this paper proposes a method to eliminate redundant points and connect the turning points to generate new paths to reduce the turning points and smooth the path. In the traditional A* algorithm, the center of each grid in the grid map is the node for searching the path. After the search is completed, the nodes are connected to obtain the complete path result. Fig. 9 As shown, the A* algorithm searches only along 8 points around the center point, so the path only exists in four directions: horizontal, vertical, 45 degrees, and 135 degrees. This will inevitably limit the path length and add unnecessary paths.
[0103] Secondly, this connection method will inevitably have some redundant turning points (inflection points). Every time the robot encounters an inflection point, it has to change its heading angle and speed, which seriously affects the safe operation of the robot. Therefore, in order to reduce the inflection points and maximize the safety and stability of the robot's operation, this section uses the key node strategy to optimize, remove redundant nodes, leave only the key necessary nodes, and connect them, so as to reduce the inflection points and reduce the path length.
[0104] 131) Key point search strategy content:
[0105] Known path node P k = {P1,P2......P N} and its coordinate information. The starting point is P1 and the target point is P N In order to determine whether it is collinear or turning, we calculate it by finding the angle between the vectors. and vector The angle between.
[0106] If the angle is 0, it means and Collinear, the three points are on a straight line, then P2 is a redundant node on the collinear line and needs to be removed.
[0107] If the angle is not 0, it means that they are not collinear and P2 is the turning point. The equation of the line segment is obtained and whether it intersects with the obstacle. If there is no obstacle in the line segment, P2 is a redundant turning point and is removed; if there is an obstacle, P2 is a key turning point and is retained.
[0108] 132) Verification Experiment
[0109] In order to verify the help of improving the removal of redundant nodes for actual path planning, three cases of obstacle density from sparse to dense were tested. The map used in the test is a 50×50 grid map, and the obstacle density is set to 6%, 12% and 24% respectively. The 10 maps in each group of experiments are generated by random matrices. Fig.10 , 11 , 12 show the results of path planning of the proposed algorithm and traditional A* algorithm when the obstacle density is 6%, 12% and 24%, respectively.
[0110] Depend on Fig.10 It can be seen that when the obstacle density is low, the proposed algorithm has a more obvious inflection point optimization than the traditional A* algorithm. As can be seen in the rectangle in the figure, by connecting the key nodes, the straight line is used instead of the broken line, which greatly reduces the number of inflection points.
[0111] Depend on Fig.11It can be seen that when the obstacle density increases to 12%, the increase in obstacles brings more necessary turning points, but compared with the traditional A* algorithm, the number of turning points is still significantly reduced.
[0112] Depend on Fig.12 It can be seen that when the obstacle density continues to increase to 24%, the algorithm's improvement on the path turning point in the obstacle-dense area gradually becomes less obvious. The reason is that when the straight line connects the key points, the path will pass through the obstacle point. However, in the open areas of the map, the optimization effect can still be achieved.
[0113] By statistically sorting out the inflection point and path length data in the 6% obstacle density experimental group, we can get Fig.13 It can be seen that in a low obstacle density environment, the proposed algorithm reduces the turning points by 55.07% and the path length by 3.4% compared with the traditional algorithm.
[0114] By statistically sorting out the inflection point and path length data in the 12% obstacle density experimental group, we can get Fig.14 ,It can be seen that in the medium obstacle density environment, the proposed algorithm reduces the inflection points by 28.40% and the path length by 2.95% compared with the traditional algorithm.
[0115] By statistically sorting out the inflection points and path length data in the 24% obstacle density experimental group, we can get Fig.15 ,It can be seen that in a high obstacle density environment, the proposed algorithm reduces the inflection points by 17.02% and the path length by 2.60% compared with the traditional algorithm.
[0116] The test results show that compared with the traditional A* algorithm, the proposed algorithm has obvious improvements in reducing search nodes, reducing turning points in the path, reducing path length, and avoiding obstacle-dense areas.
[0117] 2. Combining the improved A* algorithm with the DWA algorithm to perform path planning for the planning object
[0118] The DWA algorithm can sample the speed during motion and quantitatively evaluate the trajectory corresponding to each set of speeds to output the optimal local obstacle avoidance path. The improved A* algorithm can quickly output the global path and avoid areas with dense obstacles, but it can only handle situations where obstacles are known. In view of the shortcomings of the A* algorithm that can only be applied to situations where global obstacles are known but cannot handle unknown local obstacles, the DWA algorithm is integrated into it, and local path planning is responsible for solving the problem of avoiding unknown local obstacles.
[0119] 21) Fusion algorithm content
[0120] First, perform A* path planning. If an obstacle is encountered while running along the global path, the DWA algorithm is used for local obstacle avoidance. First, extract the key points in the A* path. These key points decompose the path into several local points. The key points are used as local target points of the DWA algorithm. Then, perform velocity sampling and trajectory simulation to avoid local obstacles. When the robot moves to a key point, set the local target point as the next key point, and repeat this cycle until the robot reaches the target point of the global path. The process of A* fusion DWA algorithm is as follows: Fig.16 shown.
[0121] 22) Verification experiment
[0122] In order to verify the help of A* algorithm in DWA algorithm for actual path planning, this paper uses Matlab2021 for simulation experiments. Fig.17 As shown in (a), set the starting point and the end point respectively; Fig.17 (b) Set the trajectory of unknown static obstacles and unknown dynamic obstacles respectively. The black ones are known static obstacles, the gray ones are static unknown obstacles, the blue dotted line is the A* global planning path, the red dotted line is the position dynamic obstacle motion trajectory, and the blue solid line is the motion trajectory of A* combined with the DWA algorithm.
[0123] 221) Unknown static obstacle simulation experiment
[0124] During the experiment, in order to ensure that the moving target will encounter unknown static obstacles, such as Fig.18 As shown in (a, b), several unknown static obstacles (gray) are set on the global path planned by A* (blue dashed line) to test the response effect of the DWA algorithm to unknown static obstacles. Typical test results are shown in Fig.18 As shown;
[0125] The test results show that after integrating the DWA algorithm, the robot can effectively detect unknown static obstacles around it during movement, and effectively avoid obstacles through local path planning, such as Fig.18 As shown in (a, b), the object changes its path to bypass the static obstacle while still moving along the global path. The reason is that after the introduction of the DWA algorithm, the system has the ability to plan and avoid obstacles along a local path. By sampling and simulating the speed, it can sense the existence of static obstacles in the movement process and select a speed group that can bypass the obstacles. Compared with the problem that the traditional A* algorithm can only plan known obstacles, this paper solves the problem that the A* algorithm cannot handle unknown static obstacles by integrating the DWA algorithm into the A* algorithm.
[0126] 221) Dynamic unknown obstacle simulation experiment
[0127] During the experiment, in order to ensure that the moving target will encounter dynamic obstacles, such as Fig.19 As shown in (a, b), the motion trajectory of the unknown dynamic obstacle (yellow) is set to intersect with the global path planned by A* to ensure that it will collide with the robot, in order to test the system's response to the unknown dynamic obstacle after integrating the DWA algorithm. Typical test results are shown below:
[0128] From the experimental results, we can see that after integrating the DWA algorithm, the robot can effectively detect unknown dynamic obstacles in the surrounding area during movement. When there is a possibility of collision with a dynamic obstacle, the original trajectory will be changed to bypass the dynamic obstacle while still moving along the global path. The reason is that after integrating the DWA algorithm, the system has the ability to plan and avoid obstacles on a local path. Sampling the speed and simulating the trajectory during movement can sense the existence of dynamic obstacles and select the speed that can avoid the obstacles in advance. Compared with the traditional A* algorithm that can only solve static known obstacles, this paper integrates the DWA algorithm into the A* algorithm to solve the problem that it cannot handle unknown dynamic obstacles.
[0129] The fusion of the A* algorithm and the DWA algorithm improves the robot's ability to avoid dynamic obstacles and unknown static obstacles. However, during the obstacle avoidance process, there is also the possibility that the path after obstacle avoidance deviates from the global planning path, such as Fig. 20 As shown in the figure, after encountering a static obstacle in a local position, the system performed obstacle avoidance processing, but encountered a new obstacle after avoiding the obstacle and avoided it again, causing the path (dotted line in the figure) to deviate significantly from the global planned path (dashed line in the figure), and the path length was greatly increased.
[0130] The reason for this phenomenon is that the weight of the direction factor in the DWA algorithm evaluation function is not large enough. It only considers choosing a safe path to avoid obstacles, and the path to avoid obstacles may encounter obstacles again, causing the path to deviate further. Therefore, in the process of speed evaluation by the DWA algorithm, the proportion of the direction term should be increased to ensure that the obstacle avoidance process does not deviate from the global path. In order to solve this problem, the DWA algorithm is improved as follows:
[0131] S1 divides the global path planning into multiple segments and takes the key nodes in the global path. Each key node is the target point of the current local path planning area and the starting point of the next local path planning area. The method of setting key points in segments can increase the stability of the system and avoid the problem of falling into a local loop in a complex environment;
[0132] When S2 encounters an unknown obstacle or a dynamic obstacle, it starts local path planning. According to the current sampling speed, it can calculate the robot's current motion posture according to the robot motion model, and compare the motion posture with the posture of the global path planning in the current area to obtain a new direction weight N. This helps the robot avoid obstacles while avoiding excessive deviations from the motion trajectory of the global path planning.
[0133] The improved DWA algorithm evaluation function is shown as follows:
[0134] G(v,w)=σ(N×heading(v,w)+β×dist(v,w)+γ×velocity(v,w)) (4-12)
[0135] Among them, heading(v,w) is the direction factor, which indicates the angle between the robot's azimuth and the target point when it moves to the end of the current trajectory. The larger the angle, the lower the score. dist(v,w) indicates the minimum distance to obstacles on the trajectory. If there are no obstacles on the trajectory, it is a larger constant. velocity(v,w) indicates the score of the linear velocity of the motion. N is the scoring weight of the direction angle after integrating the motion posture ratio. β and γ indicate the scoring weights of the obstacle distance and the linear velocity of the motion, respectively. σ indicates the normalization operation.
[0136] In order to verify the DWA algorithm after incorporating the posture weight, the dynamic and static obstacles encountered by the algorithm were simulated, and the path length was measured for comparison. Fig.21 It shows the situation when encountering dynamic obstacles. The dotted line is the global path, and the points on the line segment are key segmentation points; the dotted line is the obstacle avoidance result of the traditional DWA encountering dynamic obstacles; the solid line is the obstacle avoidance result of the improved DWA encountering dynamic obstacles.
[0137] It can be seen from the simulation results that both algorithms avoid dynamic obstacles, but the traditional DWA algorithm (dotted line) has a path deviation when avoiding obstacles and does not use the global path as a navigation. Although no collision occurs, the path length is greatly increased. The algorithm in this paper (solid line) does not have a large-scale path deviation while avoiding obstacles, which solves the problem of DWA algorithm planning deviating from the original path.
[0138] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A dynamic path planning method based on improved A* algorithm, It is characterized in that The following steps are involved: An environmental obstacle impact item is added to the evaluation function of the traditional A* algorithm to construct an improved A* algorithm; the environmental obstacle impact item is determined by the number of obstacles around the current node; dynamic path planning is performed on the planning object based on the improved A* algorithm; The evaluation function of the improved A* algorithm is: f(n)=g(n)+h(n)+d sg ×ω×o(n); Where n represents the node, g(n) is the true cost, which represents the distance from the starting point to the current node; h(n) is the heuristic function, which represents the remaining distance from the current node to the target node; d sg represents the straight-line distance between the current node and the target node, o(n) is the environmental obstacle function, and its value represents the density of obstacles around the current point; ω is the obstacle weight factor, which determines the sensitivity of the planned path to obstacles; The environmental obstacle function o(n) is obtained by the following formula: o(n)=sum(O×D), where the matrix O represents the obstacle information of multiple nearby nodes with the current node as the center; the matrix D represents the distance weight matrix of the multiple nearby nodes to the current node. The closer the node is to the center point, the greater its distance weight.
2. The dynamic path planning method based on the improved A* algorithm according to claim 1, It is characterized in that In the 12% low obstacle density map, the value range of ω is [0.2, 0.4]; in the 24% high obstacle density map, the value range of ω is [0.8, 1.0].
3. The dynamic path planning method based on the improved A* algorithm according to any one of claims 1 to 2, It is characterized in that The improved A* algorithm performs the following key point search strategy when planning the global path: Assume that the path node set P is known k = {P 1 ,P 2 ......P N } and its coordinate information; where P 1 As the starting point, P N is the target point, for the known path node set P k Any node P i , i=1,2,3,...,N, perform the following steps: Calculated by the node P i The vector composed and vector The angle between them is determined to be 0: If the angle is 0, it means and Collinear, three points are on a straight line, then P i Redundant nodes on the same line need to be removed; If the angle is not 0, it means that they are not collinear. i It is a turning point, please solve The equation of the line segment and determine whether it intersects with the obstacle: If there is no obstacle in the line segment, then P i is a redundant turning point, remove it; if there is an obstacle, then P i It is a key turning point and is retained.
4. The dynamic path planning method based on the improved A* algorithm according to claim 3, It is characterized in that Dynamic path planning for the planning object based on the improved A* algorithm includes the following steps: Using the improved A* algorithm to perform global path planning and extract key points in the global path; According to the timing of the planning object passing through each key point, each key point is taken as a local target point in turn, and the DWA algorithm is used to plan the local path of the planning object from each key point to the next key point until the planning object reaches the target point of the global path.
5. The dynamic path planning method based on the improved A* algorithm according to claim 4, It is characterized in that The DWA algorithm is used to plan the local path of the object moving from each key point to the next key point, which includes the following steps: For any i-th key point P i and its next key point P i+1 ; When the planning object moves to the key point P i When the key point P i+1 as a local key point; when the planning object encounters an unknown obstacle or a dynamic obstacle, local path planning begins, the current speed of the planning object is sampled, and the current motion posture of the planning object is calculated based on the current sampled speed and the pre-built motion model of the planning object. At the same time, the motion posture is compared with the posture of the global path planning in the current area, and the direction weight N is calculated according to the comparison result. Based on the direction weight N, the posture of the global path planning in the current area is used to plan the local path of the planning object moving from each key point to the next key point.
6. The dynamic path planning method based on the improved A* algorithm according to claim 5, It is characterized in that The evaluation function of the DWA algorithm is: G(v,w)=σ(N×heading(v,w)+β×dist(v,w)+γ×velocity(v,w)) Among them, heading(v,w) is the direction factor, which indicates the angle between the azimuth of the planned object and the target point when moving to the end point of the current trajectory. The larger the angle, the lower the score; dist(v,w) indicates the minimum distance to the obstacle on the trajectory. If there is no obstacle on the trajectory, it is a larger constant; velocity(v,w) indicates the score of the motion linear velocity; N is the direction angle score weight after integrating the motion posture ratio, β and γ indicate the score weights of the obstacle distance and the motion linear velocity respectively; σ indicates the normalization operation.
7. A computer system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Indoor mobile robot path planning method fusing improved A* and DWA algorithms
CN114675649A
Vehicle parking planning method and apparatus, and device and computer storage medium
WO2022148441A1
