Next Article in Journal
Seafood Object Detection Method Based on Improved YOLOv5s
Previous Article in Journal
A Lightweight Privacy-Enhanced Federated Clustering Algorithm for Edge Computing
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Novel Method of Path Planning for an Intelligent Agent Based on an Improved RRT* Called KDB-RRT*

1
School of Automobile and Transportation, Tianjin University of Technology and Education, Tianjin 300222, China
2
National and Local Joint Engineering Research Center for Intelligent Vehicle Road Collaboration and Safety Technology, Tianjin 300222, China
*
Author to whom correspondence should be addressed.
Sensors 2025, 25(24), 7545; https://doi.org/10.3390/s25247545
Submission received: 15 July 2025 / Revised: 9 August 2025 / Accepted: 22 August 2025 / Published: 12 December 2025
(This article belongs to the Section Intelligent Sensors)

Abstract

To address challenges in agent path planning within complex environments—particularly slow convergence speed, high path redundancy, and insufficient smoothness—this paper proposes KDB-RRT*, a novel algorithm built upon RRT.* This method integrates a bidirectional search strategy with a three-layer optimization framework: ① accelerated node retrieval via KD-tree indexing to reduce computational complexity; ② enhanced exploration efficiency through goal-biased dynamic circle sampling and a bidirectional gravitational field guidance model, coupled with adaptive step size adjustment using a Sigmoid function for directional expansion and obstacle avoidance; and ③ trajectory optimization employing DP algorithm pruning and cubic B-spline smoothing to generate curvature-continuous paths. Additionally, a multi-level collision detection framework integrating Separating Axis Theorem (SAT) pre-judgment, R-tree spatial indexing, and active obstacle avoidance strategies is incorporated, ensuring robust collision resistance. Extensive experiments in complex environments (Z-shaped map, loop-shaped map, and multi-obstacle settings) demonstrate KDB-RRT’s superiority over state-of-the-art methods (Optimized RRT*, RRT*-Connect, and Informed-RRT*), reducing average planning time by up to 97.9%, shortening path length by 5.5–21.4%, and decreasing inflection points by 40–90.5%. Finally, the feasibility of the algorithm’s practical application was further verified based on the ROS platform. The research results provide a new method for efficient path planning of intelligent agents in unstructured environments, and its three-layer optimization framework has important reference value for mobile robot navigation systems.

1. Introduction

The rapid advancement of artificial intelligence has led to the widespread application of agents as flagship products across diverse fields. Path planning technology [1] stands as a core component of agent research, directly determining the quality of an agent’s movement trajectory and consequently impacting its task execution efficiency and success rate. Therefore, research into autonomous path planning for agents holds significant importance for the development of the AI industry.
Current path planning methodologies primarily include the A* algorithm [2], artificial potential field method [3], randomized sampling algorithms [4], ant colony optimization [5], and genetic algorithms [6]. In recent decades, the Rapidly exploring Random Tree (RRT) algorithm [7], based on randomized search strategies, has gained extensive adoption in agent path planning due to its probabilistic completeness and scalability. However, it suffers from drawbacks such as excessive planning time, high path cost, and low path quality, failing to guarantee planning speed and efficiency. To address these limitations, researchers globally have proposed various RRT variants. Karaman and Frazzoli [8] introduced the asymptotically optimal RRT* algorithm, which enhances path quality through parent node reselection and rewiring, converging towards the asymptotic optimum, albeit at the expense of higher computational cost, relatively lower efficiency, and longer search times. Akgun and Stilman [9] proposed the Bi-RRT algorithm, employing bidirectional expansion by growing trees simultaneously from the start and goal points until connection, improving search efficiency and stability by balancing tree growth, yet it still incurs significant computation and may be constrained by complex environments. LaValle and Kuffner [10] developed the RRT-Connect algorithm, combining RRT with a greedy heuristic by alternately growing trees from start and goal configurations; although it offers high search efficiency, its path quality may be inferior to RRT*, and it can become trapped in local optima in certain scenarios. Xie Gaoyang et al. [11] presented an improved RRT algorithm matching vehicle speed to expansion step size, offering a novel solution for path planning of unmanned target vehicles at different speeds, though path quality may degrade in complex situations. Lim Subin et al. [12] proposed the Ex-RRT* algorithm, incorporating a cost function based on the distance from each node to the nearest obstacle to ensure adequate clearance, thereby enhancing path safety. Gu Zilv et al. [13] introduced a goal-biased node selection strategy, reducing algorithm randomness, but convergence efficiency remains slow in complex environments. Ma Xiaoqun et al. [14] developed an IRRT*-Connect algorithm dependent on environmental complexity, improving adaptability to complex settings, yet the issue of low computational efficiency persists. Li Wenjun et al. [15] addressed problems in RRT* such as excessive redundant points, jagged paths, and proximity to obstacles in multi-obstacle environments with their Safe-Smooth RRT* algorithm, enhancing path smoothness, although performance may decline as obstacle density increases. Liu Wenguang et al. [16] proposed an RRT variant with parent reselection within a constrained range, but search times can become lengthy in multi-obstacle environments.
To address the issues of high computational cost, low search efficiency, and suboptimal path quality in RRT, this paper proposes a KD-tree-based Goal-biased Dual RRT* (KDB-RRT*) algorithm. Leveraging the asymptotic optimality of RRT* and incorporating a bidirectional search strategy, KDB-RRT* achieves performance breakthroughs through a three-layer optimization framework: (1) Spatial Indexing Acceleration: utilizing a KD-tree to expedite nearest-neighbor queries, significantly reducing computational complexity; (2) Guided Sampling and Expansion: employing a dynamic circular sampling strategy and bidirectional target-biased gravitational field guidance, combined with adaptive step size adjustment based on the Sigmoid function, enhancing directional bias during path expansion and obstacle avoidance capability in complex regions; (3) Path Morphology Optimization: applying the Douglas–Peucker (DP) algorithm for path pruning and employing cubic B-spline curves to achieve curvature-continuous smoothing, optimizing both path length and smoothness. And a multi-level collision detection framework integrating Separating Axis Theorem (SAT) pre-judgment, R-tree spatial indexing, and active obstacle avoidance strategies is incorporated, ensuring robust collision resistance. Comparative experiments against Optimized RRT*, RRT-Connect, and Informed-RRT* demonstrate that KDB-RRT* significantly enhances planning efficiency and trajectory quality while preserving probabilistic completeness.

2. Related Work

2.1. Basic Principle of RRT* Algorithm

Path expansion in the conventional RRT algorithm is guided by random sampling points. Its core mechanism explores potential paths through stochastic spatial growth of the path tree. As illustrated in Figure 1, the algorithm first identifies a start node P start in free space and generates a random sample point P rand . It then locates the nearest node P near to P rand within the existing tree and attempts to connect P near and P rand . If the connecting segment is collision-free, a new node P new is generated by extending a fixed step size ε in this direction and added to the tree. This process repeats until the goal node (or a node within its proximity) is incorporated. The final path is generated by backtracking from P goal to P start .
RRT* achieves asymptotic optimality through dynamic parent-node reselection and path-tree rewiring, comprising two stages:
Stage 1: Parent Node Reselection. As depicted in Figure 2a, after generating P new , a neighborhood ball of radius r (green circle) forms a node set N . The node in N yielding minimal path cost to P new is selected as its new parent.
Stage 2: Path Tree Rewiring. To further reduce the global path cost, as shown in Figure 2b, a neighborhood ball of radius r (green circle, analogous to Stage 1) delimits the scope of neighboring nodes P i to be checked. Neighboring nodes P i are traversed; if rerouting P i through P new reduces its path cost, P new becomes P i ’s parent. Iterative optimization continues until no further cost reduction is possible.

2.2. Basic Principle of B-RRT* Algorithm

The B-RRT* (Bidirectional Rapidly exploring Random Tree Star) algorithm enhances the search efficiency of the RRT* algorithm by incorporating a bidirectional search strategy. Its core concept involves constructing two separate path trees originating from the start and goal configurations, respectively—in Figure 3, the tree rooted at P start is represented in blue, while the tree rooted at P goal is shown in green. These trees alternately expand until they connect, as illustrated in Figure 3. This strategy balances the bidirectional search scope, reducing inefficient exploration in a single direction. Particularly in complex environments, it can significantly shorten search time. However, its inherent random sampling nature may still lead to insufficient convergence efficiency, necessitating further optimization through goal-biasing mechanisms.

3. Multi-Layer Optimization Architecture of KDB-RRT* Algorithm

Although the B-RRT* algorithm improves search efficiency, each iteration requires traversing all nodes in the search tree and selecting suitable nodes based on Euclidean distance, resulting in substantial computational overhead that severely impacts planning efficiency during iterations. To address this, this paper proposes the KDB-RRT* algorithm. By integrating the bidirectional search framework with multi-dimensional optimization strategies, it constructs a three-layer technical architecture comprising Spatial Indexing Acceleration, Dynamic Sampling Guidance, and Path Morphology Optimization. This architecture significantly enhances path planning efficiency and trajectory quality in complex environments.

3.1. KD-Tree Indexing for Nearest-Neighbor Query Optimization

As an efficient multi-dimensional spatial indexing structure, the KD-tree (K-Dimensional Tree) has been widely used in recent years to optimize the computational efficiency of data-intensive algorithms. Its core value lies in significantly reducing computational complexity through spatial partitioning. Chen et al. [17] introduced the KD-tree into the DBSCAN algorithm (KD-DBSCAN). By pre-partitioning datasets to construct neighborhood object sets, redundant computations are avoided, providing a new approach for processing large-scale spatiotemporal data such as GPS trajectories. Xue et al. [18] proposed a single KD-tree-based approximate nearest neighbor algorithm and a multi-KD-tree cross-search algorithm, addressing the bottleneck of iterative computation efficiency in big data scenarios. Sun et al. [19] innovatively integrated the R*-tree with the KD-tree to build a hybrid index, and combined multi-dimensional histograms and hash functions to achieve efficient join queries for Linked Open Data. Xiu et al. [20] proposed the Grid KD-Tree (GKDT) structure, which, at the cost of partial storage space, significantly improved the online point location speed in explicit model predictive control. These studies collectively demonstrate that the KD-tree, leveraging its hierarchical spatial partitioning property, has become a key technology for optimizing the spatiotemporal complexity of algorithms. Its innovative applications have expanded from cluster analysis to data querying and real-time control, with the core contribution being “trading space for time” to effectively address the computational efficiency bottleneck in high-dimensional, large-scale data scenarios. Therefore, to tackle the high computational complexity of node retrieval in the B-RRT* algorithm, this paper intends to introduce the KD-tree (K-Dimensional Tree) structure to achieve fast localization of nearest neighbor nodes.

3.1.1. KD-Tree Organization

Consider constructing a KD-Tree for a node set on a random tree T: {A (1,8), B (8,7), C (6,3), D (3,4), E (4,6), F (9,1)}. The construction process (as shown in Figure 4) is as follows:
In Figure 4a, the green vertical line represents the partitioning plane along the x-dimension in Step 2, the yellow horizontal line denotes the partitioning plane along the y-dimension in Step 3, and the blue color indicates the subsequent partitioning planes in Step 4, visually illustrating the alternating partitioning axes at different levels.
  • Select Splitting Axis: Calculate the variance for both the x and y dimensions. Compare the variances and select the dimension with the larger variance as the splitting axis. Using Equation (1), the variances for the x and y dimensions in this example are calculated as σ x 2 = 7.81 and σ y 2 = 5.56 , respectively. Since σ x 2 > σ y 2 , the x-dimension is chosen as the first splitting axis.
    σ 2 = x 1 x ¯ 2 + x 2 x ¯ 2 + + x n x ¯ 2 n
  • Determine Median Point on Axis: Sort the data points based on the selected splitting dimension and choose the median point as the root node. Sorting all points by the x-dimension yields: A (1,8), D (3,4), E (4,6), C (6,3), B (8,7), F (9,1). The median point is C (6,3), which becomes the root node.
  • Determine Left and Right Subtrees: Using the selected splitting axis and the median point as the splitting plane, construct the left and right subtrees. In this example, the left subtree contains {A (1,8), D (3,4), E (4,6)} and the right subtree contains {B (8,7), F (9,1)}.
  • Recurse on Subtrees: Repeat steps (1) to (3) recursively for each subtree until each contains only one data point. Note: The splitting axis is typically selected by cycling through dimensions sequentially. Since the x-dimension was used at the first level, the y-dimension is used at the second level, the x-dimension again at the third level, and so on. In this example, step (4) proceeds as follows:
    • For the left subtree {A, D, E}, select the y-dimension as the splitting axis. The median point on this axis is E (4,6). This splits the subtree into left child A (1,8) and right child D (3,4).
    • For the right subtree {B, F}, select the y-dimension as the splitting axis. Point B (8,7) is chosen as the root node for this subtree (as it has the larger y-coordinate). This splits the subtree into right child F (9,1).

3.1.2. KD-Tree Nearest Neighbor Search

Utilizing the constructed KD-Tree, the process of finding the nearest neighbor node P near for a query point is as follows (refer to Figure 5):
In Figure 5, red, blue, yellow, and green circles respectively correspond to the search spheres in Steps 1–4, illustrating the iterative refinement of the nearest neighbor during backtracking.
  • Start at the root node C. Assume C is the current nearest neighbor. Define a red search circle centered at O with radius OC (Figure 5a). This circle intersects the hyperplanes y = 6 and y = 7. Since 6 < 7, search the right subspace of C first.
  • Find E (4,6) in 1. The splitting hyperplane at C is y = 6. As O’s y-coordinate is 6.5, proceed to the right subspace, finding D (3,4). The search path is C (6,3) → E (4,6) → D (3,4). Set D as the current nearest neighbor. Define a new (blue) search circle centered at O with radius OD (Figure 5b).
  • Backtrack to E (4,6), and calculate OC. Since OE < OD, update the current nearest neighbor to E (4,6). Define a new (yellow) search circle with radius OE (Figure 5c).
  • The yellow circle intersects the hyperplane y = 4. Therefore, search the other subspace of E (4,6) (the left subtree). Calculate OA. Since OA < OC, update the current nearest neighbor to A (1,8) and the distance to OA. Define a new (green) search circle (Figure 5d).
  • Backtrack to the root C (6,3). The green circle does not intersect the hyperplane x = 6, so searching the right subspace of C (6,3) is unnecessary. The search concludes, returning A (1,8) as the nearest neighbor O with distance OA.
Once node A is identified as the nearest neighbor P near to the query point, it is added to the current tree. The KD-tree is dynamically updated to incorporate A into its structure. Subsequently, new nodes are generated through expansion based on the growth guidance model (Section 3.3) and adaptive step size (Section 3.4). During each iteration, a new random sample point is generated, and an independent nearest-neighbor search is executed using the updated KD-tree.

3.1.3. Complexity Analysis

For a two-dimensional dataset containing n nodes, the time complexity of a single-level partition is O n , analyzed as follows:
  • Select Splitting Axis: Cyclic dimension switching ( x y x ) requires O 1 time, as the number of dimensions d = 2 for 2D path planning) is fixed and independent of the dataset size n .
  • Determine Median Point on Axis: The randomized quickselect algorithm achieves average-case O n complexity, avoiding worst-case O n 2 performance through randomized pivot selection.
  • Determine Left and Right Subtrees: Distributing the remaining n 1 nodes into left/right subtrees requires O n time.
Thus, the total time for a single-level partition is O 1 + O n + O n = O n .
Let T n denote the time complexity for constructing a KD-tree with n nodes. Since each partition splits the dataset into two roughly equal subsets (size of n 2 for each), the recurrence relation is:
T n = O n + 2 T n 2 = O n + 2 O n 2 + 2 T n 4 = O n + O n + 4 T n 4 = O n + O n + + O n = O n log n
The average-case time complexity for KD-tree construction is therefore O n log n .
In contrast, traditional exhaustive search methods exhibit O n per-query complexity equivalent to the worst-case per-query complexity of KD-tree nearest-neighbor searches. For large n , the per-query complexity of traditional methods ( O n ) significantly exceeds that of KD-tree-based approaches ( O n log n ). Consequently, KD-trees represent a widely adopted efficient solution for multidimensional search problems.
Efficiency is particularly enhanced when n 2 d for d -dimensional data. In this study, agent path planning operates in two-dimensional space ( d = 2 ), a condition readily satisfied.
Integrating KD-trees into nearest-neighbor searches during path planning directly reduces the computational bottleneck of RRT-based algorithms. By accelerating the critical “nearest node” retrieval step from O n to O n log n , KD-trees minimize redundant computations, thereby enhancing overall path planning efficiency, especially in cluttered environments with large node sets.

3.2. Target-Biased Dynamic Circular Sampling Strategy

Although the KDB-RRT* algorithm incorporating the KD-Tree significantly improves path planning efficiency, it is still unavoidable to prevent the problem of low convergence speed caused by the strong randomness of sampling in complex environments. To address the blindness of uniform sampling, this paper proposes a Dynamic Circle Sampling Strategy with Goal Bias. The dynamic sampling radius R d is defined as:
R d = R 0 × 1 d D k k 1
where R 0 is the initial sampling radius; d = P i P goal i = 1 , 2 , is the Euclidean distance from the current node to the goal; D = P s t a r t P g o a l is the Euclidean distance from start to goal, used to normalize d ; k is a scaling factor controlling the rate of radius change with distance. When d D (the current node is far from the goal), R d increases to accelerate exploration towards the goal region. When d 0 (the current node is close to the goal), R d decreases to enable localized refinement.
During iteration, a dynamic sampling region Ω is established centered on the current node P n e a r , as defined in Equation (4). The random sample P rand is constrained within Ω . The dynamic sampling process throughout path planning is depicted in Figure 6.
The dynamic sampling process throughout path planning is depicted in Figure 6, where yellow dashed circles represent the dynamic sampling regions Ω centered on different P n e a r ; their varying sizes illustrate how R d adapts to the distance between the current node and the goal (larger circles correspond to greater distances, consistent with Equation (3)).
Ω = P 2 P P n e a r R d

3.3. Bidirectional Growth Guidance Model Based on Potential Field

In the B-RRT* algorithm, the two trees ( T s t a r t and T g o a l ) grow towards each other’s root ( P s t a r t or P g o a l ) as their respective targets. New node expansion follows Figure 7 and Equation (5):
P n e w = P n e a r + s F
where F = P r a n d P n e a r P r a n d P n e a r is a unit vector in a random direction, and s is a fixed step size. However, this expansion is highly random and lacks strong goal directionality. To enhance directional bias, this paper introduces an attractive field-based growth guidance model into the bidirectional search. For T s t a r t and T g o a l , attractive vectors are defined:
G 1 = λ × P g o a l P n e a r P g o a l P n e a r , G 2 = λ × P s t a r t P n e a r P s t a r t P n e a r
where λ 0 λ 1 is an attractive gain factor. Considering convex polygonal obstacles O = O 1 , O 2 , , O m , the repulsive force exerted by obstacle O i on node q is:
H = O i O ξ 1 d i 1 d 0 p q i d i 3 , d i d 0 0 ,   d i > d 0  
where ξ is the repulsive gain coefficient; q i is the point on the obstacle O i that is closest to the current node p (determined by calculating the shortest distance from p to each edge of the obstacle O i ); d i = p q i is the Euclidean distance from the node p to the nearest point q i on the obstacle; d 0 is the repulsion force influence range threshold, beyond which obstacles do not generate a repulsion force. The repulsion force direction is opposite to the direction from p to (i.e., away from the obstacle), and its magnitude decreases with d i increasing distance, ensuring that the repulsion force is significant at close distances. The new node generation strategy is then modified as shown in Figure 8 and Equation (8):
P n e w = P n e a r + s F + G i
where s is a dynamically adjusted step size (see Section 3.4). This mechanism provides target-oriented growth while preserving random exploration capability, significantly increasing the probability of tree connection.

3.4. Adaptive Step Size Based on Obstacle Density

To handle uneven obstacle distributions, an adaptive step size method based on the Sigmoid function [21] is proposed:
s = s max 1 1 + e α d o b s h
where s max is the maximum fixed step size, d o b s is the distance from the node to the nearest obstacle, h is a safety threshold, and α is a scaling factor. When d o b s h (sparse obstacles), s approaches s max to enhance expansion efficiency. When d o b s < h (dense obstacles), s nonlinearly decreases towards a minimum value, mitigating collision risk from large steps and reducing path detours.

3.5. Obstacle Avoidance and Collision Detection Mechanism

Obstacle avoidance and collision detection are core technologies for ensuring the safe movement of intelligent agents in complex environments, directly affecting the reliability and practicality of path planning. This section details how the KDB-RRT* algorithm combines a multi-level collision detection framework with an active obstacle avoidance strategy to efficiently generate collision-free paths.

3.5.1. Collision Detection Framework

The core objective of collision detection is to determine whether there is a spatial intersection (including contact) between the path segment and the obstacle boundary, providing strict verification of path safety. KDB-RRT* uses a precise geometric detection method based on polygon boundaries, balancing detection accuracy and computational efficiency. The key steps are as follows:
  • Obstacle Modeling: In the 2D planning space, all obstacles are modeled as a set of polygons O = O 1 , O 2 , , O k . Each obstacle O i is defined by an ordered sequence of vertices v 1 , v 2 , , v m (vertices are arranged in a clockwise order to ensure polygon closure, with v m + 1 = v 1 ).
  • Collision Criterion: For any path segment L = P a P b (where P a and P b are consecutive nodes on the path), the necessary and sufficient condition for a collision with obstacle O i is that L intersects with any boundary edge of O i (including endpoint contact) or L lies entirely inside O i . Mathematically, it can be formalized as:
    C o l l i s i o n L , O i = t r u e ,     i f j 1 , m   s . t .   L v j v j + 1 f a l s e ,   o t h e r w i s e
    where v j v j + 1 denotes the j boundary edge of obstacle O i ; the operator represents the intersection relationship of geometric line segments (including endpoint contact). If the judgment is true, the path segment L is invalid with a collision.
  • Detection Acceleration Technologies: To address the inefficiency of detection in large-scale obstacle scenarios, this study introduces two key optimizations:
  • Separating Axis Theorem (SAT) Pre-judgment: For polygonal obstacles, SAT is used to achieve fast collision judgment through projection analysis. Calculate the projection intervals of L and O i on multiple feature axes (including the normal vectors of each edge of O i and the normal vector of L ). If there exists any axis where the projection intervals do not overlap, it can be directly determined that L and O i are collision-free without verifying all boundary edges. This method reduces the average time complexity of single obstacle detection from O m (where m is the number of edges of the obstacle) to O 1 .
  • Spatial Index Filtering (R-tree): In the preprocessing phase, an R-tree spatial index structure for obstacle boundary edges is constructed, partitioning them into several sub-regions based on the spatial coordinates (bounding boxes) of the boundary edges. When detecting path segment L , the R-tree is first used to quickly retrieve the set of candidate boundary edges that are spatially intersecting or adjacent to L (with a distance less than a preset threshold). Only these candidate edges are subjected to precise intersection verification and inner point judgment using SAT.

3.5.2. Active Obstacle Avoidance Mechanism

In addition to passive collision detection, KDB-RRT* introduces a three-level active obstacle avoidance strategy to dynamically adjust expansion behavior during path tree growth, achieving a “safety-efficiency” balance:
  • Potential Field-Guided Growth Control: As described in Section 3.3, the repulsive force component generated by the potential field directly guides new nodes away from obstacles in the node expansion direction (Equation (7)), proactively avoiding potential collision areas.
  • Adaptive Step-Size Control Based on Obstacle Density: As described in Section 3.4, the adaptive step size is dynamically adjusted according to the distance from the current node to the nearest obstacle. When approaching an obstacle, the step size is automatically reduced to lower the probability of path segments crossing obstacles due to excessively large step sizes and improve path quality in narrow areas.
  • Safety Buffer Expansion: Considering the agent’s own physical size and uncertainty factors such as motion control and positioning errors, the original obstacle boundaries are expanded to construct a safety buffer zone, ensuring that the planned path maintains a minimum safe distance d s a f e _ min from the original obstacles. The minimum safe distance is defined as:
    d s a f e _ min = R r o b + δ s
    where R r o b denotes the radius of the agent (since the agent is modeled as a mass point in this study, R r o b = 0 ), and δ s is an additional safety margin to cope with uncertainties.
For each vertex v j of each obstacle O i , calculate the unit normal directions n j 1 and n j of its adjacent edges ( v j 1 v j and v j v j + 1 ), and extrapolate a distance d s a f e _ min to obtain a new vertex v j n e w . The new vertex v j n e w is defined as shown in Equation (12). The schematic diagram of the safety buffer zone is shown in Figure 9, where the blue circles indicate some of the vertices of the polygon; the yellow pentagon represents the original obstacle (obs); and red dashed circles depict the safety buffer zone, with the enlarged circle at the vertex highlighting the expansion effect near sharp edges.
v j n e w = v j + d s a f e _ min n j 1 + n j n j 1 + n j
Connecting all new vertices forms the new polygonal boundary O i b u f f e r e d . Collision detection (Section 3.5.1) is entirely performed based on this expanded safety boundary O i b u f f e r e d , thereby physically ensuring the safety of the agent’s movement and avoiding mechanical collisions caused by paths adhering too closely to the original obstacles.

3.6. Path Optimization

3.6.1. Pruning

While the aforementioned optimization strategies significantly reduce redundant path points, some remain. Therefore, the Douglas–Peucker (DP) algorithm [22] is employed for path simplification.
The core idea of the DP algorithm is to recursively simplify a polyline into a polyline with fewer points, while retaining the main features of the original polyline as much as possible.
Suppose a path point sequence Q i i = 0 n , a tolerance threshold D , start point Q 0 , and end point Q n 1 . The process of pruning using the DP algorithm is as follows, as shown in Figure 10.
In Figure 10, the solid red line represents the connection between the start point and end points, i.e., the line linking Q 0 Q n 1 . The dashed green line indicates the perpendicular distance from an intermediate point to this line segment. The solid blue and orange lines depict the subpaths generated during recursive division (blue represents the first division, while orange denotes subsequent divisions).
  • Q 0 and last point Q n 1 of the curve;
  • Calculate the perpendicular distance d i from each intermediate point Q i 1 i n 2 to the line segment Q 0 Q n 1 . Find the point Q max with the maximum distance d max ;
  • If d max D , simplify the path to Q 0 , Q n 1 . If d max > D , split the path at Q max into two sub-paths: Q 0 , Q 1 , , Q max and Q max , , Q n 1 ;
  • Repeat steps 1–3 for all path curve segments until all d max values are less than D . This completes the thinning process.
The geometric simplification process of the DP algorithm may lead to path intrusion into obstacle regions. Therefore, the following obstacle avoidance and safety guarantee mechanisms are introduced:
  • Injection of safety constraints: When calculating the maximum perpendicular distance d max , the minimum distance between the simplified path segment and obstacles is simultaneously verified. If a simplification operation results in the distance d o b s from the path segment to the nearest obstacle falling below the safety threshold d s a f e _ min (Equation (11)), the current simplification operation is aborted.
  • Spatial index acceleration: A pre-constructed R-tree spatial index is utilized to quickly retrieve candidate obstacle edges within the neighborhood of the path segment. Only the candidate set undergoes precise distance calculation, avoiding global traversal of all obstacles.

3.6.2. Smoothing

To reduce the curvature of the path and make it smoother, this paper uses cubic B-spline curves [23] to smooth the pruned path. A cubic B-spline curve is inserted between path segments, connecting discrete points into a smooth curve. By adjusting the positions and weights of control points, the path shape can be further refined. Given the path point sequence H i i = 0 n , construct the parametric curve:
C u = P 0 , P 1 , , P n N 0 , 3 u N 1 , 3 u N 2 , 3 u N 3 , 3 u = j = 0 n P j N j , 3 u
where N j , 3 are the cubic B-spline basis functions, and the control points P j j = 0 , 1 , , m are fitted to the pruned path using least squares. A curvature constraint optimization model is introduced:
min p i = 0 n P u i H i 2 + γ 0 1 κ 2 u d u
where κ u = C u × C u C u 3 is the curvature at P i , and γ is a smoothness weighting coefficient. Four control points from the random tree are used within the cubic B-spline function to generate control points. Connecting these points in sequence produces the smooth path shown in Figure 11, where the green polyline represents the pruned discrete path (before smoothing), and the blue curve denotes the cubic B-spline-generated smooth path, effectively modifying local curvature while preserving the overall path topology.

3.7. Algorithm Implementation

Based on the aforementioned improvements, a KD-tree-based goal-biased dual RRT* algorithm (KDB-RRT*) is proposed to ensure rapid planning of collision-free, near-optimal paths for agents. Referring to the KDB-RRT* flowchart (Figure 12) and schematic (Figure 13), the key steps of the KDB-RRT* algorithm are outlined below:
Where in Figure 12, the yellow rectangular box represents the growth process of T s t a r t and T g o a l , as detailed in the procedure outlined within the green rectangular box on the left; and in Figure 13, the yellow polygons represent obstacles, the blue and green rectangular boxes denote the construction of T s t a r t and T g o a l , the blue and green dashed lines indicate the growth directions of T s t a r t and T g o a l , the blue and green circles represent the nodes in T s t a r t and T g o a l .
  • Initialize: Map information, parameters, start ( P s t a r t ), and goal ( P g o a l ) are loaded. Initialize trees: T s t a r t with P s t a r t and T g o a l with P g o a l .
  • Sample: For the current tree (e.g., T s t a r t ), generate sampling points within the dynamic circular sampling region Ω with center P i and radius R d (Section 3.2, Equations (3) and (4)).
  • Find Nearest Neighbor ( P near ): Using the KD-Tree (Section 3.1) built for the current tree, perform a nearest neighbor search to find P near closest to P r a n d .
  • Steer: Generate a new node P new using the growth guidance model (Section 3.3 and Section 3.4, Equations (6)–(8)) with the adaptive step size (Equation (9)).
  • Collision Check: Verify if P new is collision-free and if the path segment connecting P near to P new is collision-free (Section 3.5).
  • Re-select Parent: If collision-free, use the KD-Tree to find the set of potential parent nodes N p a r e n t near P new . Select the node P nearest that provides the minimum cost path to P new and set it as the parent of P new .
  • Add Node: Add the valid P nearest to the current tree.
  • Rewire the tree: For nodes P near in N p a r e n t , check if connecting them to P new provides a lower-cost path. If so, rewire their parent to P new .
  • Check Connection: Check if the latest added node in T s t a r t and the latest added node in T g o a l can connect (distance between them less than or equal to connection threshold or the latest added node in T s t a r t is near a node in T g o a l or the latest added node in T g o a l is near a node in T s t a r t ) via a collision-free path.
  • Tree Connection: If connected, merge the trees T s t a r t and T g o a l at the connection point to form the initial path P a t h _ i n i t i a l . If not connected, return to Step 2 and continue constructing two trees.
  • Path Pruning: Apply the DP algorithm (Section 3.6) to P a t h _ i n i t i a l using threshold D to remove redundant points, yielding the simplified path P a t h _ p r u n e d .
  • Path Smoothing: Apply cubic B-spline fitting (Section 3.6, Equations (13) and (14)) to P a t h _ p r u n e d generate the final smooth path P a t h _ s m o o t h .
  • Output: Return the optimized path P a t h _ s m o o t h .

3.8. Computational Complexity Analysis of KDB-RRT*

The time complexity of KDB-RRT* is systematically compared with classical RRT* in Table 1. The analysis considers N as the number of nodes in the search tree(s), M as the number of obstacle edges, k as the number of iterations, and L as the number of path nodes in the final solution.

4. Algorithm Testing and Simulation

4.1. Simulation Experiment Design

This study employs MATLAB R2022a and the ROS Noetic (Robot Operating System) robotic experimental platform to validate the performance of the proposed algorithm across multiple dimensions, including feasibility, superiority, and reliability. The laptop specifications are: Windows 11 operating system, 13th Gen Intel®® CoreTM i7-13700H 2.40 GHz processor, 16.0 GB RAM (Intel, Santa Clara, CA, USA); utilizing a virtual machine with Ubuntu 20.04.6.
To verify the feasibility of the KDB-RRT* algorithm, two simulation environments were established, as shown in Figure 14. The map dimensions for both environments were set to 500 × 500. Black regions represent obstacles, while white regions denote free space.
“Z-Shaped” Map (Figure 14a): Start point (green circle) at (1, 500), goal point (red circle) at (500, 1).
“Loop-Shaped” Map (Figure 14b): Start point (green circle) at (20, 20), goal point (red circle) at (480, 480).
To demonstrate the superiority of the KDB-RRT* algorithm, four simulation environments were established, as shown in Figure 15. The map dimensions were set to 500 × 500, with the start point (red circle) at (1, 500) and the goal point (green circle) at (500, 1) for all environments.

4.2. Feasibility of KDB-RRT*

Path planning tasks were executed on the “Z-Shaped” and “Loop-Shaped” maps (Section 4.1, Figure 14) using both the proposed KDB-RRT* algorithm (incorporating the KD-Tree) and the Optimized RRT* algorithm. Parameters were set as: goal connection threshold = 20, safety threshold = 1, maximum step size = 30, and maximum iterations = 5000. Each experiment was repeated 50 times, and average values were computed. The simulation results (Figure 16 and Figure 17) demonstrate that the KDB-RRT* algorithm exhibits robust path planning capabilities in both typical complex environments. Core metrics are summarized in Table 2 and Table 3.
Z-Shaped Map (Figure 16): KDB-RRT* (Figure 16a): The planned path navigates the narrow “Z” corridor with minimal adjustments primarily at key turning points. This indicates the algorithm’s ability to rapidly identify geometric features of narrow passages, reducing redundant exploration. The path maintains precise clearance from obstacles without local oscillations, demonstrating an effective balance between smoothness and safety in unstructured narrow channels. Optimized RRT* (Figure 16b): The path exhibits frequent zig-zag turns within the corridor, resulting from redundant node expansion due to random sampling. Some segments show extreme proximity to obstacles (especially at entrances), indicating that the lack of dynamic biasing leads to conservative but suboptimal paths. The average planning time of KDB-RRT* (4.10 s) was 70.2% shorter than that of the Optimized RRT* (13.77 s). The average path length of KDB-RRT* (1258.25 cm) was 4.8% shorter than that of the Optimized RRT* (1321.92 cm). The average number of path nodes of KDB-RRT* decreased by 67.5%, and the node utilization rate increased by 16.2%. The average distance to obstacles (5.23 cm) of KDB-RRT* was 2.36 cm greater than that of Optimized RRT* (2.17 cm). The minimum distance to obstacles was 4.69 cm, which meets the safety threshold, representing an increase of 3.33 cm compared to the Optimized RRT*.
Loop-Shaped Map (Figure 17): KDB-RRT* (Figure 17a): The path successfully traverses the nested obstacle gaps within the loop environment, forming a globally optimized trajectory from the start (green point) to the goal (red point). Turns exhibit uniform curvature without sharp corners, making it suitable for agent motion control. Optimized RRT * (Figure 17b): The path shows multiple detours near the middle obstacle layer, reflecting entrapment in local minima requiring backtracking to escape invalid regions. The total path length is significantly longer than KDB-RRT*, incurring extra cost, particularly when navigating the outer loop structure. The average planning time of KDB-RRT* (0.85 s) was only 28.0% of that of the Optimized RRT* (3.04 s). The average path length of KDB-RRT* (646.47 cm) was 10.4% shorter than that of the Optimized RRT* (721.68 cm). The average number of path nodes of KDB-RRT* decreased by 69.6%, and the node utilization rate increased by 13.5%. The average distance to obstacles (4.36 cm) of KDB-RRT* exceeded that of Optimized RRT* (1.89 cm) by 2.47 cm, demonstrating superior obstacle-awareness in the nested loop structure. The minimum distance of 3.74 cm further confirmed stable collision avoidance, contrasting with the marginal 1.27 cm of Optimized RRT*.

4.3. Superiority of KDB-RRT*

4.3.1. Superiority of KD-Tree Integration

Path planning tasks were executed on Map 1 (Section 4.1, Figure 15a) using the Optimized RRT* algorithm and the KDB-RRT* algorithm incorporating the KD-Tree. Parameters: goal threshold = 20, safety threshold = 1, initial step size = 30, max iterations = 5000. Each experiment was repeated 50 times. Results are shown in Figure 17.
Figure 18 demonstrates that the KDB-RRT* algorithm with KD-Tree optimization (Figure 18b) exhibits significantly fewer node exploration attempts (number of lines other than the blue path) compared to the optimized RRT* (Figure 18a), where the blue lines represent paths, the lines outside the blue lines represent the search process, and the two colors of lines in Figure 18a represent two tree searches. The KDB-RRT* path also displays higher smoothness and directional continuity. The fewer red and green lines in Figure 18b correspond intuitively to the greater number of red lines in Figure 18a, as well as the sparsification of path inflection points in Figure 18b compared to the dense, sawtooth-like fluctuations in the path of Figure 18a. This optimization is achieved through the KD tree’s dynamic hierarchical indexing mechanism in high-dimensional space. By dynamically adjusting the connection strategy between neighboring nodes, it prioritizes the directionally optimal connection from the parent node to the target point, thereby reducing path complexity while improving search efficiency. This makes the path more suitable for the stringent requirements of real-time performance, low energy consumption, and stable movement during the agent’s operation. The comparison of core metrics before and after optimization is shown in Table 4. Comparative data shows: Average planning time was reduced from 12.95 s (Optimized RRT*) to 1.13 s (KDB-RRT*), representing a 91.3% improvement. Average path length was reduced from 790.79 cm to 747.06 cm, a reduction of 43.73 cm (5.5%). Average iterations were reduced by 91.0%. Average node utilization rate exhibited a 39.39% increase. Additionally, KDB-RRT* achieves a 2.56 cm average distance to obstacles, 57% higher than Optimized RRT* (1.63 cm), and a 1.38 cm minimum distance, 11% higher than Optimized RRT* (1.24 cm). The KD-Tree’s efficient neighbor search enables the algorithm to implicitly bias sampling toward “safe-optimal” regions, avoiding the marginal safety (1.24 cm, only 0.24 cm above the threshold) observed in Optimized RRT*.

4.3.2. Superiority of DP Pruning

The initial path planned by the KDB-RRT* algorithm (incorporating the KD-Tree) on Map 1 (Section 4.1, Figure 15a) was processed using the DP algorithm for pruning. The pruned path using DP, the path pruned using triangular pruning, and the original unpruned path are compared in Figure 19.
Figure 19 shows that in the complex environment with dense black geometric obstacles, both DP pruning (Figure 19a) and triangular pruning (Figure 19b) effectively remove redundant inflection points present in the unpruned path (Figure 19c), significantly improving overall path smoothness and continuity. However, compared to triangular pruning, the DP-pruned path demonstrates greater advantages: in terms of path length: 742.23 cm, 1.97% shorter than triangular pruning and 2.7% shorter than the unpruned path; in terms of the number of inflection points: 5, a reduction of 54.5% compared to triangular pruning and 72.2% compared to the unpruned path; in terms of average processing time: 0.67 s, 39.3% faster than triangular pruning. DP pruning achieves a 2.48 cm average distance to obstacles (6.8% lower than triangular pruning’s 2.65 cm, but 4.6% higher than the unpruned path’s 2.37 cm) and a 1.65 cm minimum distance (3.5% lower than triangular pruning’s 1.71 cm, but 1.8% higher than the unpruned path’s 1.62 cm). This indicates DP pruning reduces unnecessary safety margins (compared to triangular pruning) while maintaining a stable buffer above the 1 cm threshold.
These results stem from DP’s safety-constrained simplification logic: during pruning, the algorithm checks the minimum distance of each path segment to obstacles; if the distance approaches the safety threshold, pruning is terminated for that segment. This ensures the simplified path retains geometric optimality without compromising collision resistance. Thus, DP pruning simultaneously reduces energy consumption (via fewer turns) and enhances navigation stability, while preserving a robust safety margin. Core path metrics before and after optimization are compared in Table 5.

4.3.3. Simulation Experiment Based on KDB-RRT*

To validate the superiority of the proposed KDB-RRT* algorithm, comparative experiments were conducted across diverse simulation environments (Section 4.1, Figure 15b–d) against Optimized RRT*, RRT*-Connect, and Informed-RRT*. Performance was analyzed based on four key metrics: average planning time, average path length, average number of inflection points, and number of planning failures. Parameters: goal threshold = 20, safety threshold = 1, max step size = 30, max iterations = 5000. Each experiment was repeated 50 times. Results for different maps are shown in Figure 20, Figure 21 and Figure 22.
Figure 20 shows the path planning results of the four algorithms in Map2 (Section 4.1, Figure 15b) under consistent basic parameters. From the experimental results, it can be seen that KDB-RRT* (Figure 20a) generates a continuous, smooth curve navigating dense obstacle gaps, with necessary turns only at critical bottlenecks. Optimized RRT* (Figure 20b) exhibits frequent backtracking in narrow passages. RRT*-Connect (Figure 20c) produces paths with numerous sharp turns. Informed-RRT* (Figure 20d) reduces curvature changes but still features large-angle turns.
Core metrics are summarized in Table 6. All algorithms achieved a 100% planning success rate, validating the navigability of Map 2’s complex obstacle layout. For KDB-RRT*, its average planning time of 1.11 s represents a 95.8% (vs. Optimized RRT*), 95.4% (vs. RRT*-Connect), and 77.2% (vs. Informed-RRT*) reduction, underscoring superior computational efficiency. In path quality, the average path length of 774.89 cm is 1.1% shorter than Optimized RRT*, 7.27% shorter than RRT*-Connect, and 0.67% shorter than Informed-RRT*, while the average number of inflection points (9) decreases by 65.4%, 78.0%, and 10.0% compared to the three algorithms, respectively—indicating smoother trajectory generation. Critical to safety, KDB-RRT* exhibits a 2.05 cm average distance to obstacles, which is 19.2% and 21.9% higher than Optimized RRT* (1.72 cm) and RRT*-Connect (1.68 cm), respectively, demonstrating a more robust global safety margin. Its 1.39 cm minimum distance to obstacles exceeds Optimized RRT* (1.33 cm) by 0.06 cm and RRT*-Connect (1.31 cm) by 0.08 cm, while remaining only 0.02 cm lower than Informed-RRT* (1.41 cm). This near-parity with Informed-RRT* (a safety-focused algorithm) highlights KDB-RRT*’s ability to balance safety and optimality: via the dynamic gravitational field (Section 3.3), it steers paths to maintain just-sufficient clearance (avoiding excessive detours) while ensuring compliance with the 1 cm safety threshold. Thus, KDB-RRT* simultaneously achieves faster planning, shorter paths, and competitive obstacle-aware safety—critical for real-time agent navigation in cluttered environments.
Map3 (Section 4.1, Figure 15c) is more complex than Map2. Figure 21 shows the path planning results of the four algorithms in Map3 under consistent basic parameters. From the experimental results, it can be seen that KDB-RRT* generates superior paths characterized by continuous smooth curves, adjusting direction only at critical narrow passages. Optimized RRT* paths show zig-zag fluctuations upon local magnification. RRT*-Connect paths exhibit numerous high-curvature turns. Informed-RRT* reduces turn count, but turn angles remain large.
Core metrics are summarized in Table 7. As shown in Table 7, KDB-RRT* demonstrates significant performance improvements: the average planning time of KDB-RRT* (1.17 s) is reduced by 97.5% compared to Optimized RRT*, by 96.9% compared to RRT*-Connect, and by 85.8% compared to Informed-RRT*—this is due to the nearest neighbor search of the KD tree (Section 3.1) and the dynamic circular sampling strategy with target bias (Section 3.2), which minimizes redundant node exploration. The average path length (792.48 cm) is 8.5% shorter than Optimized RRT*, 6.16% shorter than RRT*-Connect, and 2.45% shorter than Informed-RRT*, with only 4 turns—reductions of 84%, 90.5%, and 60%, respectively. This ensures smooth motion control, which is critical for real-world agent navigation. KDB-RRT* exhibits a 4.12 cm average distance to obstacles—a 2.14 cm (108%) and 2.27 cm (114%) increase over Optimized RRT* (1.98 cm) and RRT*-Connect (1.85 cm), respectively. Its 3.69 cm minimum distance to obstacles maintains a 2.69 cm margin above the 1 cm safety threshold, far outperforming the marginal safety of Optimized RRT* (0.35 cm above threshold) and RRT*-Connect (0.32 cm above threshold). While slightly lower than Informed-RRT* (4.37 cm average, 3.82 cm minimum), this near-parity confirms KDB-RRT* balances safety with efficiency: the adaptive step size mechanism (Section 3.4) compresses redundant clearance in constrained spaces without compromising collision resistance, avoiding the excessive detours inherent to purely safety-focused algorithms.
Notably, KDB-RRT* and Informed-RRT* achieve a 100% success rate, whereas Optimized RRT* (68%) and RRT*-Connect (72%) suffer frequent failures. This stark contrast highlights KDB-RRT*’s ability to avoid entrapment in local minima, enabled by the potential field’s goal-biased sampling (Section 3.3). By dynamically weighting repulsive forces from obstacles and attractive forces toward the goal, the algorithm prioritizes feasible paths through cluttered regions, even in complex topologies.
Map4 (Section 4.1, Figure 15d) is the most complex of the three maps. Figure 22 shows the path planning results of the four algorithms in Map4 under consistent basic parameters. Core metrics are summarized in Table 8. From the experimental results, it can be seen that KDB-RRT*, KDB-RRT* achieves a 100% planning success rate, significantly outperforming Optimized RRT* (28%), RRT*-Connect (36%), and even Informed-RRT* (98%). This robustness stems from the bidirectional growth model based on potential fields (Section 3.3): by leveraging the repulsive force of obstacles and the attractive force of the goal, the algorithm prioritizes feasible paths in cluttered areas, avoiding getting stuck in local optima—a critical advantage in the nested obstacle topology of Map 4. The average planning time of KDB-RRT* (1.96 s) is reduced by 97.9% compared to Optimized RRT*, by 95.9% compared to RRT*-Connect, and by 77.2% compared to Informed-RRT* by 77.2%—this is due to the KD-tree index-based nearest neighbor query optimization (Section 3.1), which minimizes redundant node exploration; and the target-biased dynamic circle sampling strategy (Section 3.2), which reduces the algorithm’s randomness. The average path length (791.88 cm) is 8.6% shorter than optimized RRT*, 21.4% shorter than RRT*-Connect, and 2.15% shorter than Informed-RRT*, with only 9 turns—reductions of 62.5%, 84.7%, and 40%, respectively. This smoothness is critical for motion control, stemming from pruning in the dynamic programming algorithm (Section 3.6), which removes redundant nodes while maintaining safety constraints. The average distance between KDB-RRT* and obstacles is 3.05 cm—43.2% higher than Optimized RRT* (2.13 cm) and 54.8% higher than RRT*-Connect (1.97 cm). Its minimum obstacle distance of 2.42 cm provides a safety margin of 1.42 cm, far exceeding the marginal safety levels of Optimized RRT* (0.57 cm) and RRT*-Connect (0.38 cm). Although Informed-RRT* has an average obstacle distance of 2.68 cm and a minimum distance of 2.04 cm, KDB-RRT* demonstrates a more balanced trade-off: The adaptive step size mechanism (Section 3.4) compresses redundant gaps in narrow passages without sacrificing collision resistance, avoiding the excessive detouring issues inherent in Informed-RRT*’s purely heuristic-driven sampling.
In summary, across diverse complex environments—including Z-shaped corridors, loop-shaped nested obstacles, and multi-obstacle cluttered maps—the proposed KDB-RRT* consistently outperforms state-of-the-art algorithms (Optimized RRT*, RRT*-Connect, and Informed-RRT*) in comprehensive performance metrics. In terms of planning efficiency, KDB-RRT* achieves a 70.2–97.9% reduction in average planning time (Table 2, Table 3, Table 4, Table 5, Table 6, Table 7 and Table 8), indicating that it can rapidly respond to path planning requests even in highly constrained scenarios. For path quality, KDB-RRT* generates 4.8–21.4% shorter paths with 40–90.5% fewer inflection points (Table 2, Table 3, Table 4, Table 5, Table 6, Table 7 and Table 8) compared to benchmark algorithms. This improvement stems from DP algorithm pruning (removing redundant nodes) and cubic B-spline smoothing, ensuring curvature-continuous trajectories suitable for stable agent motion control. Critically, in safety performance, KDB-RRT* maintains robust obstacle clearance: its average distance to obstacles and minimum distance to obstacles all exceed the 1 cm safety threshold (Table 2, Table 3, Table 4, Table 5, Table 6, Table 7 and Table 8). While its minimum distance is slightly lower than Informed-RRT* in some cases (e.g., 1.39 cm vs. 1.41 cm in Map 2), it achieves a superior balance between safety and optimality—avoiding excessive detours via gravitational field-guided repulsion and adaptive step size adjustment. Moreover, KDB-RRT* demonstrates 100% planning success rates across all environments, outperforming Optimized RRT* and RRT*-Connect in high-complexity maps (Table 7 and Table 8). These results collectively validate that KDB-RRT* integrates efficiency, optimality, and safety, making it a robust solution for agent path planning in unstructured and cluttered real-world scenarios.

4.4. Agent Path Planning Experiments Based on KDB-RRT*

To validate the feasibility and reliability of the KDB-RRT* algorithm in practical agent applications, this study utilized the TARKBOT series ROS robot (Figure 23) as the experimental platform. The Simultaneous Localization and Mapping (SLAM) tools provided by ROS were used for environmental map modeling, and the Adaptive Monte Carlo Localization (AMCL) algorithm enabled real-time agent localization. Two typical static scenarios were designed to test the algorithm’s path planning capability under different obstacle distributions.
Scenario 1 (Figure 24a): A 4 m × 2 m area with 3 fixed obstacles arranged dispersedly, forming narrow passages. Start point (green) at the UGV’s initial position/origin (0,0), goal point (blue). The UGV’s right direction is the positive X-axis; the front direction is the positive Y-axis.
Scenario 2 (Figure 24b): A 10 m × 8 m area with 10 obstacles forming dense clusters and a “C-shaped” bend, simulating a complex indoor environment. Start and goal definitions same as Scenario 1.
To avoid experimental randomness, each scenario was tested 20 times, and average values were computed.
In Scenario 1 (Figure 24a), the UGV initiates path planning based on the SLAM map depicted in Figure 25a, with the resultant path shown in Figure 25b, and the red arrows denote the travel direction of the Unmanned Ground Vehicle (UGV), and the green curve represents the planned path. Departing from the start point, the UGV effectively navigates obstacles during motion (Figure 25c), ultimately reaching the goal along a smooth trajectory (Figure 25d).
For Scenario 2 (Figure 24b), which requires traversal through dense obstacles including a “C-shaped” bend, planning commences using the SLAM map in Figure 26a. The generated path (Figure 26b) exhibits continuous curvature, enabling successful obstacle avoidance during movement (Figure 26c) and arrival at the goal via a smooth path (Figure 26d).
These results demonstrate consistent generation of near-optimal, collision-free paths with continuous curvature across both scenarios. Table 9 summarizes performance metrics from 20 experimental trials per scenario, including two critical distance-based indicators (unit: dm) to quantify obstacle-aware safety:
In Scenario 1 (sparse obstacle distribution), collision-free navigation was achieved with an average path length of 3.23 m, average planning time of 0.78 s, and average UGV travel time of 1.46 s. The average distance to obstacles reached 3.5 dm, with a minimum distance of 2.8 dm—both values far exceeding the predefined safety threshold (1 dm), indicating ample safety margins in less constrained environments.
For Scenario 2 (dense obstacles with a “C-shaped” corridor), collision-free operation was maintained with an average path length of 6.72 m, an average planning time of 1.64 s, and an average travel time of 3.08 s. Here, the average distance to obstacles decreased to 2.7 dm (27 cm) and the minimum distance to 1.3 dm (13 cm), yet both remained well above the safety threshold. This adaptive reduction in average distance reflects the algorithm’s ability to balance path optimality and safety via dynamic repulsion in the potential field model (Section 3.3), which compresses redundant clearance in constrained spaces without compromising collision-free constraints.
Collectively, these results confirm that the proposed KDB-RRT* algorithm generates near-optimal, collision-free paths across environments with varying obstacle densities. The consistent superiority of distance metrics over the safety threshold validates its robust obstacle-aware planning capability, underscoring feasibility for diverse agent path-planning scenarios.

5. Conclusions

Path planning stands as a core technology for intelligent agent navigation, directly determining the efficiency and safety of task execution in complex environments. Although RRT*-based algorithms possess probabilistic completeness, they typically suffer from high computational complexity, excessive path redundancy, and insufficient smoothness, limiting their practical application in unstructured scenarios. To address these limitations, this study proposes the KDB-RRT* algorithm, which employs a three-layer optimization framework and is complemented by dedicated obstacle avoidance and collision detection mechanisms to achieve synergistic improvements in planning efficiency and trajectory quality.
The algorithm’s innovations include
(1) KD-tree-accelerated neighbor queries, reducing the computational complexity of critical retrieval steps from O N to O N log N .
(2) Target-biased dynamic circular sampling integrated with a bidirectional potential field guidance model, enhanced by a Sigmoid-based adaptive step size to reduce blind exploration and improve directional growth.
(3) Path morphology optimization via DP pruning and cubic B-spline smoothing, generating curvature-continuous trajectories with minimal redundant inflection points.
(4) A multi-level collision detection framework incorporates the Separating Axis Theorem (SAT) pre-check, R-tree spatial indexing, and active avoidance strategies, collectively ensuring robust collision resistance.
Extensive experiments across diverse environments (Z-shaped corridors, nested loop obstacles, and multi-obstacle maps of varying complexity) and ROS platform validation demonstrate KDB-RRT*’s superior performance: compared with state-of-the-art algorithms (Optimized RRT*, RRT*-Connect, and Informed-RRT*), the average planning time is reduced by 70.2–97.9%, path length is shortened by 4.8–21.4%, and the number of inflection points is decreased by 40–90.5%. Notably, KDB-RRT* achieved 100% success rates in high-complexity scenarios, outperforming benchmark algorithms (28–72% success rates). These results verify that KDB-RRT* effectively balances efficiency, optimality, and safety, providing a robust solution for agent path planning in unstructured environments. While validated using unmanned ground vehicles (UGVs), the algorithm’s adaptability to 2D path planning enables extension to other ground mobile agents (e.g., automated guided vehicles [AGVs] and autonomous navigation robots) requiring efficient, safe, and smooth path planning in unstructured settings.
Despite significant performance improvements in complex environments, KDB-RRT* faces challenges:
(1) Analysis has been limited to static environments without considering static–dynamic obstacle interactions.
(2) Adaptability to unstructured terrain (e.g., high-roughness surfaces) requires enhancement.
Future research will extend to dynamic obstacle avoidance and terrain adaptability optimization to improve robustness in real-world complex scenarios.

Author Contributions

Conceptualization, W.W.; methodology, W.W.; software, W.W.; validation, W.W.; writing—original draft preparation, W.W.; writing—review and editing, K.W.; visualization, W.W.; supervision, K.W.; project administration, J.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Data are contained within the article.

Acknowledgments

The authors thank Kun Wei for his helpful discussions in the experiment preparation and express their gratitude to Junhui Zhang and Shuo Zhou for their support in this paper.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Aggarwal, S.; Kumar, N. Path planning techniques for unmanned aerial vehicles: A review, solutions, and challenges. Comput. Commun. 2020, 149, 270–299. [Google Scholar] [CrossRef]
  2. Guo, Z.J.; Yin, Y.K.; Li, Y.X.; Yu, X.T.; Zhang, P. Mobile robot path planning integrating improved A and TEB algorithms. J. Henan Univ. Sci. Technol. 2023, 44, 57–65+7. [Google Scholar]
  3. Sun, L.Y.; Fu, Z.M.; Tao, F.Z.; Si, P.J.; Song, S.Z. Research on intelligent vehicle obstacle avoidance algorithm based on improved artificial potential field. J. Henan Univ. Sci. Technol. 2022, 43, 28–34+41+5–6. [Google Scholar]
  4. Zuo, G.Y.; Guan, H.S.; Zheng, B.G. Improved RRT path planning algorithm based on multi-sampling heuristic strategy. Comput. Meas. Control 2024, 32, 280–287. [Google Scholar]
  5. Wang, M.; Shi, M.H.; Han, Y.X.; Li, Y.S.; Tian, Z.K. Global route planning model for unmanned surface vehicle based on improved ant colony algorithm. J. Henan Univ. Sci. Technol. 2024, 45, 50–56+118. [Google Scholar]
  6. Wang, Y.Q.; Ni, X.C.; Li, J.; Zhou, J.; Du, B.W. Research progress of mobile robot path planning algorithms. Intell. Comput. Appl. 2024, 14, 211–217. [Google Scholar]
  7. Deng, Y.Z.; Tu, H.Y.; Song, M.J. Robot path planning algorithm based on improved RRT. Modul. Mach. Tool Autom. Manuf. Tech. 2024, 6, 6–11. [Google Scholar]
  8. Meng, B.H.; Godage, I.S.; Kanj, I. RRT*-based path planning for continuum arms. IEEE Robot. Autom. Lett. 2022, 7, 6830–6837. [Google Scholar] [CrossRef]
  9. Wang, W.; Gao, H.; Yi, Q.; Zheng, K.; Gu, T. An improved rrt* path planning algorithm for service robot. In Proceedings of the 2020 IEEE 4th Information Technology, Networking, Electronic and Automation Control Conference (ITNEC), Chongqing, China, 12–14 June 2020; IEEE: New York, NY, USA, 2020; Volume 1, pp. 1824–1828. [Google Scholar]
  10. Chen, J.; Zhao, Y.; Xu, X. Improved RRT-connect based path planning algorithm for mobile robots. IEEE Access 2021, 9, 145988–145999. [Google Scholar] [CrossRef]
  11. Xie, G.Y.; Fang, L.Q.; Li, Y.N.; Su, X.J. Research on unmanned target vehicle path planning based on improved RRT algorithm. J. Gun Launch Control 2024, 45, 80–86. [Google Scholar]
  12. Lim, S.; Sangrok, S. Safe Trajectory Path Planning Algorithm Based on RRT* While Maintaining Moderate Margin from Obstacles. Int. J. Control. Autom. Syst. 2023, 21, 3540–3550. [Google Scholar] [CrossRef]
  13. Gu, Z.L.; Liu, Y.; Yue, G.; Sun, S.W.; Li, T.S.; Fu, Y.Y. Fast path planning based on improved RRT algorithm. J. Ordnance Equip. Eng. 2022, 43, 294–299. [Google Scholar]
  14. Ma, X.Q.; Wang, H.; Liu, L.; Li, S. Adaptive path planning algorithm based on IRRT-Connect. Electron. Meas. Technol. 2024, 47, 82–88. [Google Scholar]
  15. Li, W.J.; Li, Z.W.; Luo, C. Safe and smooth path generation for mobile robot based on RRT algorithm. Electron. Meas. Technol. 2024, 47, 51–60. [Google Scholar]
  16. Liu, W.G.; Liu, H.W.; Luo, T.; Wang, Z.M. RRT algorithm path optimization and simulation verification. J. Chongqing Univ. Technol. 2022, 36, 1–7. [Google Scholar]
  17. Chen, W.L.; Shi, H.W. Improved DBSCAN clustering algorithm based on KD-tree. Comput. Syst. Appl. 2022, 31, 305–310. [Google Scholar]
  18. Xue, D.W.; Li, J.Z. Optimization of k-means clustering algorithm based on KD-tree. Intell. Comput. Appl. 2021, 11, 194–197. [Google Scholar]
  19. Sun, Y.; Zhao, T.; Yoon, S.; Lee, Y. A Hybrid Approach Combining R*-Tree and k-d Trees to Improve Linked Open Data Query Performance. Appl. Sci. 2021, 11, 2405. [Google Scholar] [CrossRef]
  20. Xiu, X.J.; Zhang, J. Grid k-d tree approach for point location in polyhedral data sets—Application to explicit MPC. Int. J. Control 2020, 93, 872–880. [Google Scholar] [CrossRef]
  21. Chen, Y.W. Research on Path Planning and Tracking Control for Automatic Parking in Complex Environments; Jilin Institute of Chemical Technology: Jilin, China, 2024. [Google Scholar]
  22. Xiao, S.; Lyu, Y.M.; Wu, H.B. An interactive learning method for robot obstacle avoidance based on DP-KMP. Chin. J. Sci. Instrum. 2024, 45, 65–78. [Google Scholar]
  23. Chen, D.; Hou, M.; Zhang, X.D. Path planning for mobile robots based on improved RRT combined with B-spline. Electron. Meas. Technol. 2022, 45, 38–44. [Google Scholar]
Figure 1. Basic principle diagram of RRT.
Figure 1. Basic principle diagram of RRT.
Sensors 25 07545 g001
Figure 2. Basic principle diagram of RRT*. (a) Stage 1: Re-select Parent Nodes; (b) Stage 2: Rewire the random tree.
Figure 2. Basic principle diagram of RRT*. (a) Stage 1: Re-select Parent Nodes; (b) Stage 2: Rewire the random tree.
Sensors 25 07545 g002
Figure 3. Basic principle diagram of B-RRT*.
Figure 3. Basic principle diagram of B-RRT*.
Sensors 25 07545 g003
Figure 4. KD-tree organization and 2D space division. (a) Construction of KD-tree in 2D space; (b) organizational construction of KD-tree.
Figure 4. KD-tree organization and 2D space division. (a) Construction of KD-tree in 2D space; (b) organizational construction of KD-tree.
Sensors 25 07545 g004
Figure 5. KD-tree nearest neighbor search. (a) Take C as the nearest neighbor; (b) Update D as the nearest neighbor; (c) Update E as the nearest neighbor; (d) Update A as the nearest neighbor.
Figure 5. KD-tree nearest neighbor search. (a) Take C as the nearest neighbor; (b) Update D as the nearest neighbor; (c) Update E as the nearest neighbor; (d) Update A as the nearest neighbor.
Sensors 25 07545 g005
Figure 6. Generation of dynamic circular sampling region.
Figure 6. Generation of dynamic circular sampling region.
Sensors 25 07545 g006
Figure 7. Principal diagram of new node expansion in B-RRT*.
Figure 7. Principal diagram of new node expansion in B-RRT*.
Sensors 25 07545 g007
Figure 8. Schematic diagram of new node expansion based on potential field guidance.
Figure 8. Schematic diagram of new node expansion based on potential field guidance.
Sensors 25 07545 g008
Figure 9. Schematic diagram of safety buffer zone.
Figure 9. Schematic diagram of safety buffer zone.
Sensors 25 07545 g009
Figure 10. DP algorithm pruning.
Figure 10. DP algorithm pruning.
Sensors 25 07545 g010
Figure 11. B-spline curve.
Figure 11. B-spline curve.
Sensors 25 07545 g011
Figure 12. KDB-RRT* algorithm flowchart.
Figure 12. KDB-RRT* algorithm flowchart.
Sensors 25 07545 g012
Figure 13. Basic principle diagram of KDB-RRT*.
Figure 13. Basic principle diagram of KDB-RRT*.
Sensors 25 07545 g013
Figure 14. Simulation Environment 1. (a) “Z-shaped” map; (b) “loop-shaped” map.
Figure 14. Simulation Environment 1. (a) “Z-shaped” map; (b) “loop-shaped” map.
Sensors 25 07545 g014
Figure 15. Simulation Environment 2. (a) Map1; (b) Map2; (c) Map3; (d) Map4.
Figure 15. Simulation Environment 2. (a) Map1; (b) Map2; (c) Map3; (d) Map4.
Sensors 25 07545 g015
Figure 16. Experimental Results for the “Z-shaped” Environment. (a) KDB-RRT*; (b) Optimized RRT*.
Figure 16. Experimental Results for the “Z-shaped” Environment. (a) KDB-RRT*; (b) Optimized RRT*.
Sensors 25 07545 g016
Figure 17. Experimental Results for the “Loop-shaped” Environment. (a) KDB-RRT*; (b) Optimized RRT*.
Figure 17. Experimental Results for the “Loop-shaped” Environment. (a) KDB-RRT*; (b) Optimized RRT*.
Sensors 25 07545 g017
Figure 18. Comparative experimental results of path superiority with the introduction of the KD-tree. (a) KDB-RRT*; (b) optimized RRT*.
Figure 18. Comparative experimental results of path superiority with the introduction of the KD-tree. (a) KDB-RRT*; (b) optimized RRT*.
Sensors 25 07545 g018
Figure 19. Comparative experimental results on the superiority of path pruning with the DP algorithm. (a) DP algorithm pruning; (b) triangular pruning; (c) before pruning.
Figure 19. Comparative experimental results on the superiority of path pruning with the DP algorithm. (a) DP algorithm pruning; (b) triangular pruning; (c) before pruning.
Sensors 25 07545 g019
Figure 20. Comparative experimental results of different algorithms for Map 2. (a) KDB-RRT*; (b) Optimized RRT*; (c) RRT*-Connect; (d) Informed-RRT*.
Figure 20. Comparative experimental results of different algorithms for Map 2. (a) KDB-RRT*; (b) Optimized RRT*; (c) RRT*-Connect; (d) Informed-RRT*.
Sensors 25 07545 g020
Figure 21. Comparative experimental results of different algorithms for Map 3. (a) KDB-RRT*; (b) Optimized RRT*; (c) RRT*-Connect; (d) Informed-RRT*.
Figure 21. Comparative experimental results of different algorithms for Map 3. (a) KDB-RRT*; (b) Optimized RRT*; (c) RRT*-Connect; (d) Informed-RRT*.
Sensors 25 07545 g021
Figure 22. Comparative experimental results of different algorithms for Map 4. (a) KDB-RRT*; (b) Optimized RRT*; (c) RRT*-Connect; (d) Informed-RRT*.
Figure 22. Comparative experimental results of different algorithms for Map 4. (a) KDB-RRT*; (b) Optimized RRT*; (c) RRT*-Connect; (d) Informed-RRT*.
Sensors 25 07545 g022
Figure 23. XTARK TARKBOT Series ROS Robot.
Figure 23. XTARK TARKBOT Series ROS Robot.
Sensors 25 07545 g023
Figure 24. Experimental scenario setup for UGV path planning. (a) Scenario 1; (b) Scenario 2.
Figure 24. Experimental scenario setup for UGV path planning. (a) Scenario 1; (b) Scenario 2.
Sensors 25 07545 g024
Figure 25. Path planning for UGV in scenario 1. (a) Initial diagram; (b) planning diagram; (c) process diagram; (d) result diagram.
Figure 25. Path planning for UGV in scenario 1. (a) Initial diagram; (b) planning diagram; (c) process diagram; (d) result diagram.
Sensors 25 07545 g025
Figure 26. Path planning for UGV in scenario 2. (a) Initial diagram; (b) Planning diagram; (c) Process diagram; (d) Result diagram.
Figure 26. Path planning for UGV in scenario 2. (a) Initial diagram; (b) Planning diagram; (c) Process diagram; (d) Result diagram.
Sensors 25 07545 g026
Table 1. Computational complexity comparison: KDB-RRT* vs. RRT*.
Table 1. Computational complexity comparison: KDB-RRT* vs. RRT*.
Algorithmic StepKDB-RRT*RRT*Optimization Mechanism
Nearest-neighbor query O log N O N KD-tree spatial partitioning
(Section 3.1)
Collision detection O log M O M R-tree indexing + SAT pre-check (Section 3.5)
Rewiring operation O log N O N Optimized neighborhood retrieval (Steps 6 & 8)
Total per iteration O log N + log M O N + M Hierarchical spatial indexing
Asymptotic O k log N + log M O k N + M Bidirectional search +
multi-layer optimization
Path pruning O L log L ~Douglas–Peucker algorithm
(Section 3.6.1)
Path smoothing O L ~Cubic B-spline fitting (Section 3.6.2)
Table 2. Comparative experimental data for the “Z-shaped” environment.
Table 2. Comparative experimental data for the “Z-shaped” environment.
AlgorithmKDB-RRT*Optimized RRT*
Average planning time/s4.1013.77
Average path length/cm1258.251321.92
Average number of path nodes269827
Node utilization54.7%38.5%
Average distances to obstacles/cm5.232.17
Minimum distances to obstacles/cm4.691.36
Table 3. Comparative experimental data for the “Loop-shaped” environment.
Table 3. Comparative experimental data for the “Loop-shaped” environment.
AlgorithmKDB-RRT*Optimized RRT*
Average planning time/s0.853.04
Average path length/cm646.47721.08
Average number of path nodes70230
Node utilization81.4%67.9%
Average distances to obstacles/cm4.361.89
Minimum distances to obstacles/cm3.741.27
Table 4. Comparative experimental data of path superiority with KD-tree integration.
Table 4. Comparative experimental data of path superiority with KD-tree integration.
AlgorithmKDB-RRT*Optimized RRT*
Average planning/s1.1312.95
Average path/cm747.06790.79
Average971075
Node utilization80.41%41.02%
Average distances to obstacles/cm2.561.63
Minimum distances to obstacles/cm1.381.24
Table 5. Comparative experimental data on the superiority of paths introduced into the DP algorithm pruning.
Table 5. Comparative experimental data on the superiority of paths introduced into the DP algorithm pruning.
AlgorithmDP PruningTriangle PruningBefore Pruning
Average path length/cm742.23757.18762.74
Average number of
inflection points
51118
Average processing time/s0.671.12~
Average distances to obstacles/cm2.482.652.37
Minimum distances to obstacles/cm1.651.711.62
Table 6. Comparative experimental data (Map 2).
Table 6. Comparative experimental data (Map 2).
AlgorithmKDB-RRT*Optimized RRT*RRT*-ConnectInformed-RRT*
Average planning time/s1.1126.6824.344.86
Average path length/cm774.89783.60835.66780.14
Average number of inflection points9264110
Average distances to obstacles/cm2.051.721.682.23
Minimum distances to obstacles/cm1.391.331.311.41
Planning success rate100%100%100%100%
Table 7. Comparative experimental data (Map 3).
Table 7. Comparative experimental data (Map 3).
AlgorithmKDB-RRT*Optimized RRT*RRT*-ConnectInformed-RRT*
Average planning time/s1.1746.7637.168.26
Average path length/cm792.48866.32844.52812.37
Average number of inflection points4254210
Average distances to obstacles/cm4.121.981.854.37
Minimum distances to obstacles/cm3.691.351.323.82
Planning success rate100%68%72%100%
Table 8. Comparative experimental data (Map 4).
Table 8. Comparative experimental data (Map 4).
AlgorithmKDB-RRT*Optimized RRT*RRT*-ConnectInformed-RRT*
Average planning time/s1.9694.7748.578.58
Average path length/cm791.88866.131007.24809.31
Average number of inflection points9245915
Average distances to obstacles/cm3.052.131.972.68
Minimum distances to obstacles/cm2.421.571.382.04
Planning success rate100%28%36%98%
Table 9. Experimental data for intelligent agent path planning.
Table 9. Experimental data for intelligent agent path planning.
AlgorithmScenario 1Scenario 2
Average path length/m3.236.72
Average planning time/s0.781.64
Average traveling time of UGV/s1.463.08
Average distances to obstacles/dm3.52.7
Minimum distances to obstacles/dm2.81.3
Whether a collision occursNoNo
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wei, W.; Wei, K.; Zhang, J. A Novel Method of Path Planning for an Intelligent Agent Based on an Improved RRT* Called KDB-RRT*. Sensors 2025, 25, 7545. https://doi.org/10.3390/s25247545

AMA Style

Wei W, Wei K, Zhang J. A Novel Method of Path Planning for an Intelligent Agent Based on an Improved RRT* Called KDB-RRT*. Sensors. 2025; 25(24):7545. https://doi.org/10.3390/s25247545

Chicago/Turabian Style

Wei, Wenqing, Kun Wei, and Jianhui Zhang. 2025. "A Novel Method of Path Planning for an Intelligent Agent Based on an Improved RRT* Called KDB-RRT*" Sensors 25, no. 24: 7545. https://doi.org/10.3390/s25247545

APA Style

Wei, W., Wei, K., & Zhang, J. (2025). A Novel Method of Path Planning for an Intelligent Agent Based on an Improved RRT* Called KDB-RRT*. Sensors, 25(24), 7545. https://doi.org/10.3390/s25247545

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Article metric data becomes available approximately 24 hours after publication online.
Back to TopTop