4.1. Overall Algorithmic Framework
This section presents the EAC-Bi-RRT* algorithm. The proposed method adopts bidirectional RRT* as the basic framework and embeds environment-aware mechanisms into key stages including sampling, tree expansion, near-obstacle correction, and path postprocessing, thereby forming an integrated planning pipeline for complex 3D obstacle environments.
During the sampling stage, the algorithm partitions the local 3D directional space around the expansion node into spherical sectors and assigns differentiated sampling probabilities by jointly considering obstacle distribution and goal-direction information. A distance-adaptive goal bias is further introduced to suppress invalid expansions when the goal direction is obstructed. During the dual-tree expansion stage, the expansion step size is adaptively adjusted according to the local environmental complexity. The leader/follower roles are assigned once at initialization based on a local expandability assessment, so as to enhance the coordination between the two trees and promote rapid connection. In near-obstacle regions, a local potential field containing only a repulsive term corrects the expansion direction, while a climb-angle constraint ensures the physical executability of each expansion. After the two trees are successfully connected, the initial polyline path is further processed by curvature-constrained B-spline smoothing with collision-safe fallback, so as to improve path quality and kinematic feasibility.
Figure 2 illustrates the overall workflow of EAC-Bi-RRT*.
On this basis, Algorithm 6 presents the main pseudocode of EAC-Bi-RRT* in order to further clarify the calling relationships and execution order of the constituent modules within the overall planning loop. The following subsections describe the design principles and implementation details of each key mechanism.
| Algorithm 6 EAC-Bi-RRT* |
| Input:
, , (obstacles), (workspace), N (max iterations)
|
| Output:
Optimized path |
|
1:
{Initialization}
|
|
2:
; |
|
3:
|
|
4:
{Global complexity assessment, Equation (14)}
|
|
5:
{Environment-aware role assignment}
|
|
6:
; {Equation (18)}
|
|
7:
if
then |
|
8:
; |
|
9:
else |
|
10:
; |
|
11:
end if |
|
12:
{Main loop}
|
|
13:
for
N
do |
|
14:
|
|
15:
if then |
|
16:
{Greedy path pruning}
|
|
17:
{Curvature-constrained smoothing, Equation (28)}
|
|
18:
return |
| 19:
end if |
| 20:
end for |
| 21:
return ∅ {Failure}
|
4.2. Adaptive Directional Sampling Strategy
We define a local spherical coordinate system centered at the current expansion node . A spatial direction is described by an azimuth angle and an elevation angle . Here, measures the horizontal direction counterclockwise from the positive x-axis, and gives the angular deviation from the horizontal plane, with upward taken as positive. This local frame is used only to parameterize the candidate expansion directions, while all node positions and collision-free checks remain in the global Cartesian frame.
This partition follows the classical 26-neighborhood connectivity in discrete 3D space. The spherical space is divided into five elevation layers. The upper, middle, and lower layers each contain eight azimuthal sectors spaced at
, while the two polar caps are not further subdivided.
Table 1 gives the partitioning scheme, and
Figure 3 shows the overall structure.
The center direction vector
specifies sector
. The center directions of the top and bottom polar caps are
and
, respectively. For the upper, middle, and lower layers, the sector center direction depends on the layer elevation parameter
and the azimuth index
:
where the upper layer takes
, the middle layer takes
, and the lower layer takes
.
The sampling probability assigned to each sector depends on the obstacle distribution within that sector. To this end, obstacles are first counted within the spherical region centered at
with radius
and denoted as
where
is the center coordinate of the
j-th obstacle. For each
, the vector from the expansion node to the obstacle center is defined as
. Its azimuth and elevation angles are computed as
The angle
determines the elevation layer of obstacle
. Within that layer,
determines its azimuthal sector. In this way,
is assigned to the corresponding sector
. After all obstacles are assigned to sectors, the obstacle density of each sector can be written as
where
is the number of obstacles assigned to sector
, and
is the total number of obstacles in the sensing region. A larger
means that the direction of sector
is more crowded with obstacles.
Obstacle distribution alone is not sufficient to determine the sampling probability, and the goal direction also needs to be taken into account. To measure the alignment between each sector and the goal direction, the cosine between the sector center direction
and the goal direction is computed as
where
is the unit vector pointing from the current node to the goal.
Combining the sector obstacle density
and the goal-direction cosine
, the sampling probability of each sector is defined as
where
is the obstacle sensitivity coefficient and
is the goal orientation coefficient.
The sampling process consists of two stages: sector selection and intra-sector sampling. First, a target sector
is selected according to the probability distribution
via roulette wheel selection. Then, the azimuth angle
and elevation angle
are uniformly sampled within the angular range of
, and the radial distance
(
) is computed with a cube-root transformation to ensure volumetric uniformity inside the sphere. The resulting sample point is
On top of the sector-based directional bias sampling, a distance-adaptive goal-bias probability is further introduced. Before each sampling step, the algorithm selects the goal point directly as the sample with probability
and enters the sector-based directional bias sampling procedure with probability
. The value of
is dynamically adjusted according to the distance from the current search tree to the goal:
where
is the initial distance from the start to the goal,
is the distance from the nearest node in the current search tree to the goal, and
and
are the lower and upper bounds of the goal-bias probability, respectively.
The sector-based directional bias sampling and the distance-adaptive goal-bias strategy together constitute the adaptive directional sampling strategy. The complete procedure is summarized in Algorithm 7.
| Algorithm 7 Adaptive directional sampling |
| Input:
T (search tree), (sampling target), , |
| Output:
Sampled point |
|
1:
{Stage 1: Distance-adaptive goal-bias probability}
|
|
2:
|
|
3:
{Equation (11)}
|
|
4:
if
then |
|
5:
return
|
|
6:
end if |
|
7:
{Stage 2: 26-sector direction-biased sampling}
|
|
8:
|
|
9:
|
|
10:
for to 25 do |
|
11:
{Obstacle density of sector }
|
|
12:
{Goal alignment, from Equation (4)}
|
|
13:
{Equation (9)}
|
|
14:
end for |
|
15:
{Normalize}
|
|
16:
{Stage 3: Sector selection and intra-sector sampling}
|
|
17:
|
|
18:
Sample , uniformly within the angular range of |
|
19:
{Cube-root for volumetric uniformity}
|
| 20:
{Equation (10)}
|
| 21:
return |
4.3. Environment-Adaptive Variable-Step-Size Mechanism
A large step size increases the risk of collision when the search tree expands through narrow passages or obstacle-dense regions. A small step size improves local obstacle avoidance, but it also creates many redundant nodes in open areas and reduces overall search efficiency. The expansion step size therefore follows a three-level adjustment scheme and changes with the local environment.
The 3D volumetric occupancy ratio of the workspace is defined at initialization as
where
and
denote the volume of the
i-th obstacle and the total workspace volume, respectively.
An obstacle number density is further introduced as
where
is the total number of obstacles and
is the unit volume.
This gives the global upper bound of the step size as
where
is a nominal step size related to the map scale.
At each expansion step, the 3D distance from the current node
to the nearest obstacle surface is computed as
. Let this distance be denoted by
d. The locally adaptive step size is then written as
where
sets the safety distance threshold,
controls the curvature of the mapping, and
sets the minimum step size.
If multiple obstacles fall within the sensing range, a local density correction further reduces the step size:
where
counts the obstacles within the safety distance range, and
controls the local density decay.
When an expansion results in a collision, a bisection search along the expansion direction is performed to find the farthest collision-free point:
The algorithm halves the step size progressively and accepts the first expansion point that is collision-free and satisfies . If no valid point is found after iterations, the current expansion attempt is abandoned.
4.4. Cooperative Dual-Tree Expansion Strategy
In conventional bidirectional RRT*, the two search trees adopt symmetric expansion behavior, sharing the same step size, sampling strategy, and expansion rules without any division of labor. To address this limitation, a cooperative dual-tree expansion strategy is developed that enhances the collaboration efficiency of the two trees through a one-time asymmetric role assignment and a dynamic connection threshold.
During algorithm initialization, the adaptive step sizes at the start and goal states are computed as
The role assignment is then determined as follows:
where the tree with the larger step size is designated as the leader and the other as the follower.
During the planning process, the step sizes of both trees are independently computed by the variable step-size mechanism based on the local environment of their respective current nodes:
The leader tree uses the sampling strategy described in
Section 4.2 to sample toward its natural target direction. The follower tree selects the most recently expanded node of the leader tree
as its sampling target with probability
, and performs random sampling with probability
. The connection test between the two trees uses a dynamic threshold that is coupled with the current step sizes:
where
is the connection threshold coefficient.
The role assignment, sampling target selection, and dynamic connection test together constitute the cooperative dual-tree expansion strategy. The complete procedure is summarized in Algorithm 8.
4.6. Repulsive-Only Local Potential Field Correction
Since the sampling strategy in
Section 4.2 already provides global directional guidance, this paper removes the attractive term from the conventional APF formulation and activates the repulsive correction only when a node enters the influence range of an obstacle (
). This design avoids the functional overlap between the attractive term and the sampling strategy, as well as the path oscillation that arises near the goal region.
The repulsive force is defined as
where
denotes the distance from the current node to the nearest obstacle, and
denotes the repulsive influence radius.
is the repulsive gain coefficient, and
is the unit vector pointing from the obstacle toward the current node.
The goal influence factor
can be written as
where
is the distance from the current node to the goal and
n is the shape parameter.
Within the near-obstacle range, the correction strength follows a distance-decaying weight
where
represents the distance from the current node to the nearest obstacle. The corrected expansion direction is obtained by
where
stands for the normalized sampling direction returned by the sampling strategy.
4.7. Path Smoothing and Safety Fallback
The piecewise-linear path generated by RRT* usually contains large turning-angle changes, which can affect the smoothness of trajectory tracking in UAV flight. A cubic B-spline is therefore used to smooth the planned path.
Using the waypoint sequence
of the piecewise-linear path as control points, the cubic B-spline curve is expressed as
where
is the cubic B-spline basis function, and
t serves as the curve parameter.
The smoothed curve must satisfy the maximum curvature constraint . The curve is then discretized at equal arc-length intervals, and the sampled points are checked against the free space. If a smoothed segment intersects an obstacle, that segment is discarded and replaced with the corresponding segment of the original piecewise-linear path so that the final output path remains collision-free.
4.8. Computational Complexity Analysis
The time cost of the proposed EAC-Bi-RRT* algorithm is primarily affected by the nearest-node search, the near-node search, obstacle density estimation, collision detection, and local rewiring. Let T denote the maximum number of iterations, N the number of nodes in the bidirectional trees, M the number of obstacles in the environment, and the fixed sector count of the adaptive directional sampling. In each iteration, the nearest-node search and the near-node search are performed via a linear traversal of the tree nodes, with a per-iteration cost of . The obstacle density estimation, collision detection, and local repulsive potential field correction scale linearly with the obstacle count, yielding a worst-case complexity of . The adaptive directional sampling only computes sampling probabilities over a fixed set of 26 sectors, giving a constant complexity of . The cost of local rewiring is determined by the number of near nodes, and is already absorbed into the near-node search and collision detection steps above.
Consequently, the overall time complexity of EAC-Bi-RRT* can be expressed as , where T represents the maximum number of iterations. The proposed adaptive directional sampling, variable step-size, climb-angle constraint, and repulsive-only APF correction modules primarily introduce constant or local environment evaluation overhead, and therefore do not change the asymptotic order of complexity relative to standard RRT* and Bi-RRT*. If spatial indexing structures such as k-d trees or R-trees are introduced, the practical computational cost of the nearest-node search and obstacle queries can be further reduced.