3.1. Improved A* Algorithm
In complex environments, the conventional A* algorithm suffers from node redundancy, ineffective search behavior and generated paths with excessive turning points, which are not conducive to the practical operation of mobile robots. To overcome these limitations, the A* algorithm is improved in this paper from three perspectives: the search-direction strategy, the evaluation function, and turning-point processing.
- (1)
Improved Search-Direction Strategy
The conventional A* search strategy ensures that all possible neighboring child nodes are explored. However, in complex environments or environments with dense obstacles, this strategy may result in ineffective searches, thereby reducing search efficiency and increasing memory usage. To address this issue, the conventional eight-neighbor search strategy is improved in this paper according to the directional relationship between the current node and the target node. Let the current node and the target node be (
xs,
ys) and (
xt,
yt) respectively, and let the angle between the line connecting these two nodes and the positive
X-axis be denoted by
α.
The planar direction is divided into eight regions
N(
P) with an interval of 45°. According to the interval in which
α falls, only the six directional nodes aligned with or close to the target direction are retained, while the redundant node set
Nr(
P) is discarded. Thus, the resulting effective search node set is denoted by
Ne(
P).
The specific relationships between the angle intervals and the retained and discarded node directions are listed in
Table 1.
Therefore, the proposed method essentially pre-screens the eight-neighbor expansion nodes according to the target direction, reducing the number of candidate nodes in each expansion from eight to six. This approach effectively reduces the redundancy of nodes in the open list, minimizes the occurrence of ineffective search operations, and enhances the search efficiency of the A* algorithm in complex environments, while concurrently decreasing memory consumption. Because the retained six nodes still cover the main search region near the target direction, the proposed method can reduce redundant expansion and improve search efficiency in the tested environments. However, this strategy should be understood as an efficiency-oriented pruning mechanism rather than a strict preservation of all theoretical properties of the classical eight-neighborhood A* algorithm. Its effectiveness depends on the obstacle configuration of the environment, especially on whether a feasible path can still be found without requiring large reverse-direction detours.
In particular, the proposed six-neighborhood strategy is more suitable for environments in which the feasible path generally maintains directional consistency toward the goal. In highly cluttered maps or in scenarios requiring substantial detours, the reduced neighborhood set may weaken the search flexibility of the algorithm and may lead to suboptimal solutions. Therefore, the practical performance of this strategy should be evaluated together with the obstacle distribution of the environment.
- (2)
Improvement of the Evaluation Function
In order to improve the adaptability of the conventional A* evaluation mechanism in complex environments, both the heuristic term and the actual cost term are revised in this study. The main idea is to first characterize the obstacle density between the current node and the target node, and then use this information to adaptively adjust the heuristic influence. Meanwhile, the turning complexity of the path is incorporated into the actual cost term to improve path smoothness.
To quantify the obstacle density in the current search region, the obstacle ratio
P(
n) is introduced and defined as follows:
where (
xs,
ys) and (
xt,
yt) denote the coordinates of the current node and the target node, respectively, and
N is the total number of obstacle grid cells in the rectangular region formed by taking these two nodes as diagonal vertices. Thus,
P(
n) represents the local obstacle density between the target node and the current node. A larger value of
P(
n) indicates a more cluttered search region and a potentially higher search difficulty.
Since the heuristic term
h(
n) determines the goal-directed tendency of the search process, an adaptive weighting factor related to the obstacle ratio is introduced to adjust its influence under different environmental conditions. Accordingly, the improved heuristic function is expressed as:
where
h(
n) denotes the conventional heuristic cost from node
to the target node,
P(
n) denotes the obstacle ratio defined above, and
h′(
n) denotes the adaptively weighted heuristic term. When
P(
n) is small,
e−P(n) is close to 1, and the heuristic term maintains strong goal orientation. When
P(
n) is large, the weighting factor decreases, thereby weakening the heuristic influence and reducing blind expansion in dense obstacle regions.
The exponential form is adopted because it provides a smooth and monotonically decreasing attenuation of the heuristic influence with respect to obstacle density. Compared with a linear penalty, the exponential weighting can preserve stronger goal-directed guidance when P(n) is small, while producing a progressively stronger suppression when the obstacle density becomes higher. In this way, abrupt changes in the search behavior can be avoided.
It should be noted that the proposed adaptive heuristic strategy is not intended to completely suppress the heuristic term. Its purpose is to reduce overly aggressive goal-directed expansion in cluttered regions. However, when the obstacle ratio becomes very high, the heuristic influence may be significantly weakened, and the search process may become more dependent on the accumulated path cost. In this case, the search behavior may partially approach a Dijkstra-like expansion. Therefore, the proposed strategy should be interpreted as an adaptive heuristic adjustment mechanism with certain environmental applicability, rather than a universally optimal heuristic design under all obstacle-density conditions.
In the conventional A* algorithm, the actual cost term mainly reflects path length and does not explicitly consider the turning complexity of the path. As a result, the generated path may contain excessive turning points. To address this problem, the number of turns from the start node to the current node is introduced into the actual cost term, and the improved actual cost is defined as:
where
g(
n) denotes the conventional accumulated path cost from the start node to node
n,
M(
n) denotes the number of turns along the path from the start node to node
n, and
g′(
n) denotes the improved actual cost. Here,
M(
n) is determined according to the directional change between consecutive path segments so that paths with more turning points receive a higher actual cost. Accordingly, the improved evaluation function
f′(
n) can be obtained:
In summary, in the proposed improved evaluation function, g′(n) characterizes the actual path cost, while h′(n) adaptively adjusts the influence of the heuristic function under different environmental conditions. In this way, path length, path smoothness, goal-directedness, and environmental complexity are considered in an integrated manner, thereby improving the search performance of the algorithm in complex grid environments.
Different from Weighted A*, which uses a fixed weight to strengthen the heuristic term, the proposed method adaptively adjusts the heuristic influence according to the obstacle ratio P(n). Weighted A* can improve goal-directed search efficiency in relatively open environments, but it may still guide the search too aggressively toward the target in cluttered maps. In contrast, the proposed adaptive heuristic strategy reduces the heuristic influence when the local obstacle ratio increases, thereby improving the balance between search efficiency and environmental complexity.
- (3)
Turning-Point Smoothing Strategy
To mitigate the issue of excessive turning points in the path generated by the A* algorithm, resulting in unsatisfactory path quality, an improved turning-point smoothing strategy is adopted in this section. While maintaining path stability, this strategy generates a path that demonstrates improved performance in terms of both path length and the number of turns, thus offering a more dependable global path for subsequent real-time obstacle avoidance.
A turning point is defined as a point on the path where the current node, its parent node, and at least one child node are present, but these three nodes are not collinear. Based on this characteristic, the key turning points along the path can be identified. Let the coordinates of the current node be (
xi,
yi), and let the grid width be
b. Then, the turning-point matrix
Ki can be expressed as:
To eliminate redundant turning points, each turning point can be folded toward the turning direction. The specific procedure for this determination is shown in
Figure 3.
As illustrated in
Figure 3, the grid containing the yellow point denotes the start point, while the grid containing the green point denotes the target point. The line connecting these two points represents the planned path. According to the matrix
Pi, the entire path contains four turning points, denoted by
A,
B,
C and
D. The turning direction of each turning point is determined by the quadrant in which the line segments connecting the turning point to its adjacent upper and lower nodes are located in the coordinate system.
Turning-point smoothing means that each turning point is folded toward its turning direction and expanded along the diagonal direction of the rectangle formed by the two adjacent nodes of the current node, so as to reduce the number of turning points. Let the current turning point be
Pi, and let its folding direction vector be denoted by
di. Then, the new node after the
m-th folding operation can be expressed as:
The detailed folding and expansion process is shown in
Figure 4.
In
Figure 4, the grid containing the yellow point denotes the start point, whereas the grid containing the green point denotes the target point. The black polyline represents the initial path, and point A is a turning point. Panels (a), (b), (c) and (d) illustrate the complete folding process of the turning point. Since the turning direction of turning point A is toward the third quadrant, the folding operation is performed in that direction. In each step, the turning point is folded by one grid cell. Each folding operation introduces a new turning point, and the newly generated turning point is then continuously folded in the same turning direction until the next folding step is blocked by an obstacle and can no longer be executed. Therefore, the termination condition of the folding process can be expressed as:
where
Obs denotes the set of obstacle grid cells.
The path obtained after the folding process may still contain turning points and therefore requires further smoothing. During multiple folding operations on the initial path, each folded path partially overlaps with the original path. The non-overlapping portion generated during the entire folding process is defined as the turning-point smoothing improvement region. Taking the common points of the paths after each folding operation as vertices, a rectangular region is formed, which corresponds to the turning-point smoothing improvement region. The non-overlapping portions between the folded path and the initial path form two sides of this rectangle, while the diagonal connecting the rectangle vertices constitutes the improved path after turning-point smoothing. Let the initial path be
L0, and let the folded path after improvement be
L1. Then, the final improved path
L can be expressed as:
where
Lc denotes the turning-point path segment in the original path. The improved path after turning-point smoothing is illustrated in
Figure 5.
As shown in
Figure 5, after turning-point folding and smoothing, the redundant turning points in the original path are effectively reduced. While preserving path feasibility, the improved path further decreases the number of turns and enhances path smoothness and executability.
The proposed turning-point smoothing strategy is a constrained post-processing step applied to an already feasible global path. Its purpose is not to re-search the global route, but to locally simplify the turning structure while preserving path feasibility. During the folding process, each candidate folded segment is accepted only when it does not intersect any obstacle cell. Therefore, the smoothing operation is always performed under explicit obstacle constraints, and the resulting path remains in the feasible free space of the grid map. Since only local turning segments are adjusted, the global connectivity between the start point and the goal point is not changed.
To improve reproducibility, the turning-point folding process is performed under explicit geometric and collision-free constraints. First, each candidate folded node must remain inside the valid map boundary; otherwise, the current folding process is terminated. Second, the smoothing operation is carried out on the inflated obstacle map, in which the obstacle region has been expanded according to the robot size and the required safety margin. Therefore, the feasibility check is not limited to the candidate node itself but also includes the newly generated connection segment. A candidate folded segment is accepted only when it does not intersect any inflated obstacle cell and does not cross obstacle corners in a way that would make the smoothed path infeasible.
The folding process is terminated when one of the following conditions is met:
the next candidate folded node lies outside the map boundary;
the candidate node intersects the inflated obstacle region;
the newly generated segment is not collision-free;
the smoothed segment crosses an obstacle corner and becomes infeasible;
further folding no longer reduces the local turning structure.
Once any of these conditions is reached, the current feasible folding result is taken as the final smoothing state for the corresponding turning point. We compared several path smoothing methods, as summarized in
Table 2.
As shown in
Table 2, compared with curve-based smoothing methods such as B-spline and Bezier curves, the proposed method is more conservative because it only modifies local turning structures under explicit grid-based collision constraints. Compared with Theta* and line-of-sight smoothing, the proposed method is implemented as a post-processing strategy and does not change the main A* search process. Therefore, it is suitable for improving the geometric quality of grid-based paths while maintaining obstacle feasibility.
3.2. Improved DWA Algorithm
While the evaluation function of the DWA algorithm performs reliably in standard environments, it may encounter difficulties in complex or constrained spaces. In particular, it provides only limited safety margins when the robot moves close to obstacles. Meanwhile, the empirical setting of evaluation function parameters introduces subjectivity, which may easily cause oscillatory paths when the trajectory approaches obstacles and prevents the algorithm from dynamically balancing motion speed and obstacle-avoidance capability as a response to environmental changes. To overcome these limitations, this paper develops a DWA evaluation function improved by a genetic algorithm (GA) to enhance adaptability and safety. The main steps are as follows.
The optimization variable is the DWA evaluation-weight vector, expressed as
xi = [
αi,
βi,
γi]. For each candidate parameter vector, the complete planning procedure is executed once, and the returned scalar planning cost is taken as the objective value. Therefore, the optimization problem is formulated as:
where
αi,
βi and
γi denote the DWA evaluation weights of the
-th individual. For each candidate vector
xi, the corresponding DWA weights are assigned to the planner, and the complete path planning process is executed once to evaluate its performance. The objective value is defined as:
where
J(
xi) denotes the scalar comprehensive planning cost returned by the planning program under the weight vector
xi, and 10
6 is a large penalty value assigned to failed planning cases.
In the present implementation, a failed planning case refers to the situation in which the planning program cannot return a valid scalar cost value. In such a case, a large penalty value is directly assigned to the objective function to suppress infeasible or unsuccessful parameter combinations during the evolutionary process. Therefore, the GA optimization is carried out at the level of the complete planning-process output, rather than by separately recombining several manually defined sub-indicators in the optimization layer.
If the path planning result is better, the corresponding value of
F(
xi) becomes smaller; otherwise, when planning fails or the performance is unsatisfactory, a larger penalty value is assigned. Through this objective function, the quality of the DWA weighting parameters can be converted into a comparable numerical indicator. During the genetic algorithm search process, an initial population of parameter sets is first generated randomly, and the fitness of each parameter set is then evaluated. Since the optimization objective in this study is minimization, the fitness of the
-th individual, denoted by
fi, can be defined as:
The best individual in the current population is denoted by
xbest and can be expressed as:
To improve the retention probability of superior individuals, the selection operation adopts a probability assignment strategy based on the reciprocal of the fitness value, denoted by
pi.
where
ε is a very small positive constant introduced to avoid division by zero.
Subsequently, the crossover operation is performed to recombine superior parameter sets, while the mutation operation is used to enhance population diversity and prevent the algorithm from getting trapped in a local optimum. As the iteration proceeds, the population gradually converges toward a better region, and an optimal set of weighting parameters, denoted by
x′, is finally obtained:
By substituting
x′ into the DWA evaluation function in Equation (10), the improved evaluation model
G′(
v,
w) can be obtained:
Compared with the conventional DWA method, which relies on repeated empirical parameter tuning, the genetic algorithm is capable of searching for a better combination of evaluation function parameters in the global search space. This reduces the blindness of parameter selection and improves the local obstacle-avoidance capability, trajectory smoothness, and operational stability of DWA in dynamic environments, thereby providing a more rational parameter basis for the efficient integration of global path planning and local planning.
In this study, the GA optimization is implemented with a population size of 20 and a maximum generation number of 30. The decision variables are the DWA evaluation weights [α, β, γ], and their lower and upper bounds are set as [0, 0, 0] and [1, 1, 1], respectively. Roulette-wheel selection based on inverse fitness is adopted, while one-point crossover and random-reset mutation are used with probabilities of 0.8 and 0.2, respectively. The optimization process is terminated when the maximum generation number is reached. The GA optimization is performed offline, and the optimized weight set is then used in the subsequent DWA-based local planning process.
The performance of the DWA algorithm is influenced not only by the evaluation function weights but also by velocity sampling resolution, prediction horizon, trajectory generation model, velocity constraints, acceleration constraints, and obstacle cost design. Therefore, the present study does not claim that weight optimization alone can fully determine the performance of DWA in all dynamic environments. Instead, the proposed GA-based strategy focuses on improving the balance among heading, obstacle clearance, and velocity evaluation under a fixed DWA configuration.
3.3. Fusion Algorithm
In practical applications, relying exclusively on global path planning may result in collisions with dynamic obstacles and unknown static obstacles within the environment, thereby increasing safety risks. By contrast, relying only on local path planning may lead to insufficient directional guidance because of the lack of global guidance. Therefore, a hybrid path planning method that combines global and local planning is required. Specifically, the global algorithm is applied to generate a global path based on known environmental information, after which the local algorithm is applied to avoid unknown and moving obstacles encountered during navigation. In this way, the mobile robot can maintain stronger directionality while performing real-time local obstacle avoidance and ultimately reach the target point successfully.
This paper presents a hybrid path planning algorithm that integrates the improved A* and DWA methods. Initially, the enhanced A* algorithm is employed for global path planning, guiding the robot along an optimal path from the starting point to the target. Next, sub-target points are set along the global path, and the DWA algorithm is employed to carry out segmented local path planning, avoid obstacles, and prevent the robot from falling into a local optimum. Finally, the performance of the DWA algorithm is further improved by introducing a genetic algorithm-based evaluation function to select the optimal path, thereby effectively enhancing the adaptability and safety of the proposed algorithm.
In this study, the key nodes are defined as the turning points extracted from the global path generated by the improved A* algorithm. A path node is regarded as a key node when the direction of the path changes at this node. Therefore, the key-node sequence preserves the main geometric structure of the global path and provides intermediate sub-goals for the DWA-based local planner. The key-node sequence can be expressed as:
where
K denotes the ordered key-node set, and
kj denotes the
j-th turning point used as a temporary sub-goal during local planning. The final target point is also included in the sequence to ensure that the robot can eventually reach the destination.
During local planning, the DWA algorithm uses the current key node
kj as the temporary sub-goal. When the robot reaches the current key node, the next key node
kj+1 is selected as the new sub-goal. In the implementation, the switching condition is defined as:
where
pr denotes the current robot position,
kj denotes the current key node, and
dth denotes the distance threshold for determining whether the robot has reached the current key node. This procedure is reiterated until the final target point is reached.
By using turning points as sub-goals, the local planner does not directly pursue the final target over a long distance. Instead, it follows the main directional structure of the global path step by step. This strategy strengthens the consistency between global planning and local obstacle avoidance, reduces unnecessary deviation after local replanning, and helps the robot return to the global path more effectively.
Figure 6 illustrates the flowchart of the fusion algorithm.
The proposed A*-GA-DWA framework consists of several improvement modules, and each module contributes to the final planning performance from a different perspective. In the improved A* stage, the direction-based six-neighborhood pruning strategy mainly reduces redundant node expansion by preferentially retaining the search directions closer to the target. This module is closely related to the reduction in expanded nodes observed in the experiments. The obstacle-ratio-based adaptive heuristic weighting strategy further adjusts the influence of the heuristic function in accordance with the local obstacle distribution, which helps the algorithm balance goal-directed search and obstacle-aware expansion in complex maps. The turning-point smoothing strategy mainly improves the geometric quality of the global path by reducing sharp turns and large-angle direction changes, and it is, therefore, related to the reduction in turning angle and the enhancement of path smoothness.
In the local planning and fusion stage, the GA-based DWA weight optimization improves the selection of the evaluation function weights α, β, and γ, thereby improving the balance among heading consistency, obstacle clearance, and velocity preference during local trajectory evaluation. The key-node guidance strategy extracts turning points from the global path and uses them as intermediate sub-goals for DWA. This prevents the local planner from directly pursuing the final target over a long distance and helps the robot return to the global path after local obstacle avoidance. Therefore, the reduction in path redundancy and navigation execution time in the dynamic-obstacle scenario is attributed to the combined effect of improved global path quality, GA-optimized local evaluation, and key-node-guided global–local coordination.
In contrast to existing hybrid A*-DWA methods, which primarily integrate a global planner with a local obstacle-avoidance module in a sequential manner, the proposed A*-GA-DWA framework introduces coordinated enhancements at three interconnected levels: global path generation, local trajectory evaluation, and path recovery after obstacle avoidance. Therefore, the contribution of this paper lies not only in improving A* and DWA separately, but also in strengthening the coupling between global planning and local replanning. This enables the robot to better maintain path quality, improve adaptability in dynamic environments, and reconnect more efficiently with the global path after obstacle avoidance.