2.1. Traditional DWA Algorithm
The DWA algorithm (Dynamic Window Approach) is a commonly used local obstacle avoidance method. This algorithm confines the sampling space for velocity within a dynamically adjustable window. Through optimization based on an evaluation function, it can directly plan the optimal speed for the vehicle. This approach helps avoid potential collisions with obstacles within the speed search space. The algorithm simulates the vehicle’s trajectory over a specified period under these selected speeds.
The DWA algorithm primarily involves three steps: firstly, sampling the vehicle’s velocity based on the environment and the vehicle’s own information; secondly, predicting multiple trajectories based on the sampled velocity information; and finally, selecting the optimal trajectory for path planning according to a predefined evaluation function [
16,
17].
The DWA algorithm heavily relies on velocity space sampling, with the sampling process being primarily constrained by linear velocity and angular velocity.
In this context,
represents the velocity space of the unmanned vehicle,
denotes the minimum linear velocity of the vehicle,
represents the maximum linear velocity,
denotes the minimum angular velocity, and
signifies the maximum angular velocity of the unmanned vehicle. Additionally, the unmanned vehicle is also influenced by its own motor performance:
In this context, represents the achievable velocity range of the unmanned vehicle. represents the current linear velocity of the unmanned vehicle, represents the current angular velocity, denotes the maximum acceleration/deceleration of the linear velocity, represents the maximum acceleration/deceleration of the angular velocity, and is the time interval.
To prevent collisions between the unmanned vehicle and obstacles, it is necessary to decelerate the moving vehicle to zero before any collision with obstacles occurs. Ensuring the safety of the unmanned vehicle is influenced by environmental safety considerations:
In this equation, represents the distance between the estimated trajectory corresponding to the velocity and the nearest obstacle.
Figure 1.
Trajectory sampling model
Figure 1.
Trajectory sampling model
Based on the three constraints mentioned above, the velocity
of the unmanned vehicle at time
can be expressed as:
Building upon the aforementioned three constraints, multiple trajectories are generated using the robot’s kinematic model. These trajectories are then evaluated to identify the optimal one. The guiding principle in designing the evaluation function is to ensure that within the velocity space
, the robot avoids obstacles and reaches the destination quickly. Based on these requirements, the evaluation function can be formulated as follows:
In this equation, represents the difference between the heading angle of the robot at the end of the sampled trajectory and the direction angle to the target point. A smaller angle results in a higher score. denotes the distance from the end of the sampled trajectory to the nearest obstacle, where a greater distance leads to a higher score. is the speed evaluation function, with a higher score for greater velocities. represents the weighted coefficients for the three evaluation functions.
2.2. DWA Algorithm Improvement
From formula (
5), it can be observed that the traditional DWA algorithm only considers the evaluation functions for orientation, distance, and velocity. It is evident that the score for the velocity evaluation function increases with higher speeds. This implies that the DWA algorithm tends to select faster speeds for path planning. However, due to uncertainties in the road surface, unknown obstacles may appear. If the vehicle speed is too high, the chosen path by the DWA algorithm might collide with obstacles. Therefore, this paper proposes a collision risk evaluation function. This function assesses the score based on the braking distance corresponding to the current vehicle speed and the distance to obstacles. It aims to determine whether the vehicle can brake in time or avoid obstacles. The earlier the braking or obstacle avoidance, the higher the score.
Figure 2.
Schematic diagram of the angle between unmanned vehicles, obstacles, and target points
Figure 2.
Schematic diagram of the angle between unmanned vehicles, obstacles, and target points
In the figure,
represents the angle between the line connecting the unmanned vehicle’s trajectory endpoint and the obstacle center and the line connecting the unmanned vehicle’s trajectory endpoint and the target point.
represents the angle between the line connecting the unmanned vehicle’s trajectory endpoint and the obstacle center and the horizontal line.
represents the angle between the line connecting the unmanned vehicle’s trajectory endpoint and the target point and the horizontal line.
can be used to assess the relationship between the unmanned vehicle, the target point, and the obstacle. If
, it indicates that the obstacle is between the unmanned vehicle and the target point. Define
as the minimum distance between the unmanned vehicle and the obstacle, and
as the braking distance. The following formula can be used to calculate it:
If
, it is determined that the unmanned vehicle can safely brake, and the collision risk is 0. If
and
, there is a collision risk. In this case, the collision risk function is defined as:
Therefore, the final collision risk function is:
At the same time, due to the integration with the A* algorithm, the nodes from global path planning need to be incorporated into the evaluation function. Therefore, the redesigned evaluation function is as follows:
In the equation, represents the closest distance from the current trajectory endpoint to a known static obstacle, represents the closest distance from the current trajectory endpoint to an unknown obstacle, and represents the collision risk evaluation function.
2.3. Traditional A* Algorithm and Improvements
The A* algorithm, as a classic traditional path planning algorithm, demonstrates excellent performance in computing globally optimal paths and plays a crucial role in fields such as robot navigation. Serving as a fusion of Dijkstra’s algorithm and Breadth-First Search (BFS), A* incorporates the application of a heuristic function, which is a core feature of the algorithm. The evaluation function expression for A* algorithm is:
In the equation,represents the cost estimate from the start point to the target point, represents the cost from the start point to the current node, and represents the cost estimate from the current node to the target node. The traditional A* algorithm may experience a decline in efficiency due to redundant searches of nodes, prompting this paper to optimize the search direction and evaluation function. Additionally, the bidirectional A* search method is employed to further enhance efficiency.
From the perspective of A* algorithm’s search nodes, the traditional approach involves examining nodes in all eight directions around the current node to ensure optimal solutions. However, for a fixed grid map and a fixed endpoint, this method increases the search space and reduces efficiency. Therefore, this paper reduces the number of search directions from eight to five.
Figure 3 represents the child nodes that the current node needs to search in the A* algorithm. It is evident that if the endpoint is to the right of the parent node at this point, child nodes 1, 7, and 8 do not need to be searched and can be directly discarded. It is not difficult to observe that the specific node to be discarded depends solely on the positions of the start and end points. Therefore, the specific discard rules are shown in the following table:
Figure 3.
Child node diagram
Figure 3.
Child node diagram
Table 1.
Abandoning search direction rules.
Table 1.
Abandoning search direction rules.
|
Reserved search directions |
Discarded search direction |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In the table, represents the included angle between the line connecting the starting point and the point and the true north direction, represents the child node 1, represents the child node 2, represents the child node 3, represents the child node 4, represents the child node 5, represents the child node 6, represents the child node 7, and represents the child node 8.
According to equation (
10), when
is 0, the algorithm degenerates into the Dijkstra algorithm. When
is always less than or equal to the cost of node n to the endpoint, the A * algorithm ensures that it can always find the shortest path. But the smaller the value of
, the more nodes the algorithm will traverse, which leads to a slower algorithm. When
is completely equal to the cost of node n to the endpoint, the A * algorithm will find the best path. When the value of
is greater than the cost of node n to the endpoint, the A * algorithm cannot guarantee finding the shortest path. Therefore, this article introduces weights into the evaluation function and controls the size of
through dynamic weights to ensure search efficiency. The evaluation function is optimized to:
In the formula,
r represents the distance from the current node to the target point, and
R represents the distance from the starting point to the target point. Through equation (
11), it can be seen that as the distance approaches the target point, the weight of the heuristic function
increases, and the algorithm traverses fewer nodes, resulting in improved efficiency.
Meanwhile, this article uses a bidirectional A * method to improve the efficiency of the A * algorithm and reduce planning time. The specific and brief steps are as follows:
Using the dual A * algorithm, become A1 and A2 respectively;
A1 starts from the starting point, A2 starts from the endpoint;
A1 extends to the grid with the smallest F value in the open table of A2 as the endpoint;
A2 extends to the grid with the smallest F value in the open table of A1 as the endpoint;
If the open tables of A1 and A2 are empty, it means there is no path, exit;
Repeat (3), (4), and (5) until A1 and A2 meet, indicating successful path finding and exit.