A Method of Enhancing Rapidly-Exploring Random Tree Robot Path Planning Using Midpoint Interpolation

: It is difﬁcult to guarantee optimality using the sampling-based rapidly-exploring random tree (RRT) method. To solve the problem, this paper proposes the post triangular processing of the midpoint interpolation method to minimize the planning time and shorten the path length of the sampling-based algorithm. The proposed method makes a path that is closer to the optimal path and somewhat solves the sharp path problem through the interpolation process. Experiments were conducted to verify the performance of the proposed method. Applying the method proposed in this paper to the RRT algorithm increases the efﬁciency of optimization by minimizing the planning time.


Introduction
Recent path planning research for the robot has encompassed a wide range of topics [1,2]. Path planning is an important capability for autonomous mobile robots. A robot must be able to identify a path from its current position to its destination in order to move successfully. A mobile robot must be able to discover an optimal or sub-optimal collision-free path in the environment from the starting position to the destination [3].
Path planning is the formulation of a route for a mobile robot to proceed from a starting point to a destination point in Euclidean space as efficiently as possible while avoiding both static and dynamic obstacles and maintaining optimality, clearance, and completeness [4]. An optimal path is one with the ideal path length, a clear path is one without obstacles for the mobile robot to collide with, and a complete path is one in which the robot can move from the start point to the destination point without colliding with obstacles. Furthermore, it is indeed possible for the robot to be able to optimize its path by determining the quickest and safest path to its destination point in order to save time and energy. However, an algorithm that generates the optimal path increases the computation, and an algorithm that quickly generates a path does not guarantee the optimal path [5].
It is difficult to ensure optimality with the sampling-based rapidly-exploring random tree (RRT) algorithm [6]. As shown in Figure 1a, the RRT algorithm is a path planning algorithm that involves repeatedly adding a randomly sampled position as a child node in a tree with the starting point as the root node until the destination point is reached. The tree extends out in the shape of a stochastic fractal, as shown in Figure 1b, and has an algorithm used to locate the destination point.
The RRT algorithm and other sampling-based algorithms [7,8] offer the benefit of planning a path in a shorter time with less computing than traditional path planning algorithms like the visibility graph- [9], cell decomposition- [10], and potential field-based algorithms [11]. On the other hand, it does not ensure optimality and has the drawback of having probabilistically assured completeness. The latter is also known as probabilistic completeness [12], which implies that completeness is assured when the number of random samples is infinite but not always when the number of random samples is limited. The completeness [12], which implies that completeness is assured when the number of random samples is infinite but not always when the number of random samples is limited. The goal of this research is to enhance the RRT algorithm, which ensures completeness and performs better than the related algorithms.
(a) (b) Figure 1. Overview of the rapidly-exploring random tree (RRT) algorithm: (a) planned path R from starting point qstart through waypoints q1, q2, q6 to destination qgoal (qi is a point on the path); (b) process of finding destination point by stochastic fractal shape from the root node (S) as a starting point.
To solve these problems, the main idea of the proposed post triangular processing of midpoint interpolation method is effective in path planning algorithms that do not guarantee optimality, such as the RRT algorithm that has a locally piecewise linear shape and can be used as a post-processing method after a path has been planned using one of these algorithms. It may also be used for different route planning methods since it is a postprocessing technique that has no impact on calculation time.
The sampling-based path planning algorithm's primary strength is the fast planning speed based on the small amount of computation compared to the traditional path planning algorithms [7].
Performance verification using simulation in various environments and mathematical modeling were used to validate the performance of the proposed method in this paper. The case in which the proposed algorithm is applied to the sampling-based path planning method and the case in which it is not applied are compared through simulation. Here, the planning time and path length of the first complete path to reach a destination point from a starting point are evaluated. This paper is organized as follows: Section 2 reviews some related works. Section 3 introduces the proposed post triangular processing of the midpoint interpolation method. Various experimental environments are constructed for path planning in Section 4 to examine the effectiveness and improvements of the proposed method. Finally, the conclusions are presented in Section 5.

Related Works
In this section, we introduce the previous works about the RRT algorithm in Section 2.1 and the Triangular Rewiring Method for the RRT Algorithm in Section 2.2, respectively.

RRT
This section shows the pseudocode of the RRT algorithm used in the experiment of this paper that was designed based on [6] in which the RRT algorithm was proposed. In 1998, LaValle proposed the RRT algorithm, which is a representative sampling-based path planning algorithm [6]. It is designed to have many degrees of freedom and is useful for planning a path under non-holonomic constraints. Overview of the rapidly-exploring random tree (RRT) algorithm: (a) planned path R from starting point q start through waypoints q 1 , q 2 , q 6 to destination q goal (q i is a point on the path); (b) process of finding destination point by stochastic fractal shape from the root node (S) as a starting point.
To solve these problems, the main idea of the proposed post triangular processing of midpoint interpolation method is effective in path planning algorithms that do not guarantee optimality, such as the RRT algorithm that has a locally piecewise linear shape and can be used as a post-processing method after a path has been planned using one of these algorithms. It may also be used for different route planning methods since it is a post-processing technique that has no impact on calculation time.
The sampling-based path planning algorithm's primary strength is the fast planning speed based on the small amount of computation compared to the traditional path planning algorithms [7].
Performance verification using simulation in various environments and mathematical modeling were used to validate the performance of the proposed method in this paper. The case in which the proposed algorithm is applied to the sampling-based path planning method and the case in which it is not applied are compared through simulation. Here, the planning time and path length of the first complete path to reach a destination point from a starting point are evaluated. This paper is organized as follows: Section 2 reviews some related works. Section 3 introduces the proposed post triangular processing of the midpoint interpolation method. Various experimental environments are constructed for path planning in Section 4 to examine the effectiveness and improvements of the proposed method. Finally, the conclusions are presented in Section 5.

Related Works
In this section, we introduce the previous works about the RRT algorithm in Section 2.1 and the Triangular Rewiring Method for the RRT Algorithm in Section 2.2, respectively.

RRT
This section shows the pseudocode of the RRT algorithm used in the experiment of this paper that was designed based on [6] in which the RRT algorithm was proposed. In 1998, LaValle proposed the RRT algorithm, which is a representative sampling-based path planning algorithm [6]. It is designed to have many degrees of freedom and is useful for planning a path under non-holonomic constraints.
As shown in Figure 2, when a random sample is generated in the configuration space, the node nearest to the position of the random sample is identified among the nodes Appl. Sci. 2021, 11, 8483 3 of 18 constituting the tree with the starting point as the root node. A new node is generated at the random sample position and inserted into the tree if the random sample position is nearer than the step length. The process of tree extension is repeated until the destination point is reached. The RRT algorithm implemented for the proposed method and comparison experiment is Algorithm 1.

Algorithm 1 Pseudocode of RRT Algorithm
Input: q start ← start point q goal ← goal point λ ← step length C ← position set of all (measured) boundary points in all (known) obstacles N ← number of random samples Output: Generate n-th random sample 4 q rand ← position of n-th random sample 5 q near ← position of the nearest node in T from q rand 6 If not isInside(q near , q rand , λ) Then 7 q new ← intersection point between line segment connecting q rand and q near , and circle with radius λ centered at q near 8 Else q new ← q rand 9 If not isTrapped(q new , q near , C) Then 10 T ← Insert node<q new > and edge<q new , q near > to T 11 If isInside(q new , q goal , λ) Then 12 T ← Insert node<q goal > and edge<q new , q goal > to T 13 P ← path from last inserted node{q goal } to root node{q start } in T 14 If  In order to overcome the limitations on optimality and convergence time [6], RRT-Connect can find a connected path more quickly by setting the start point and the destination point as the root of a separate tree, and further expanding the two trees alternately [7]. Rapidly-exploring Random Tree Star (RRT*) [13] was developed to overcome the limitation that the path generated from RRT does not guarantee convergence to the optimal path. Informed-RRT* that can find a connected path quickly by enhancing the sampling probability inside the elliptical region with the start point and the destination point as the respective focal points [14]. The RRT*-Connect algorithm combines the advantages of RRT-Connect and RRT* [15]. RRT*-Smart [16], Quick-RRT* [17], and the proposed algorithm in [8] can show closer optimality by finding and connecting linearly connectable In order to overcome the limitations on optimality and convergence time [6], RRT-Connect can find a connected path more quickly by setting the start point and the destination point as the root of a separate tree, and further expanding the two trees alternately [7]. Rapidly-exploring Random Tree Star (RRT*) [13] was developed to overcome the limitation that the path generated from RRT does not guarantee convergence to the optimal path.
Informed-RRT* that can find a connected path quickly by enhancing the sampling probability inside the elliptical region with the start point and the destination point as the respective focal points [14]. The RRT*-Connect algorithm combines the advantages of RRT-Connect and RRT* [15]. RRT*-Smart [16], Quick-RRT* [17], and the proposed algorithm in [8] can show closer optimality by finding and connecting linearly connectable ancestor nodes to random samples through triangular inequality in the process of adding random samples.

Triangular Rewiring Method for the RRT Algorithm
This section shows the principle and pseudocode of the Triangular Rewiring Method for the RRT algorithm.
The triangular rewiring method is used to rewire the component based on the triangular inequality concept [8]. The triangular inequality-based RRT algorithm is a rewiring of the RRT method that is based on the concept of triangular inequality between nodes in path planning; thus, it is closer to the optimum than the RRT.
The triangular rewiring method not only can find a better initial solution but also can converge to a better solution rapidly.
The pseudocode for the triangular rewiring method is shown in Algorithm 2. This iterative process continues until no q ancestor exists (when no parent node exists for the previous q ancestor , i.e., when q ancestor is q start ) or an obstacle exists between q child and q ancestor . The method for triangular rewiring is as follows: the node with the position q parent and the edge connecting the q child and q ancestor nodes are deleted. After the edge is deleted, the q ancestor node is updated with the q parent node, and the parent node of the q ancestor is updated with the q ancestor node. The existing q parent node is then deleted. Then, the Trapped method is used to check if it collides with an obstacle between the q child node and the updated q parent node. Then, in tree T, the last created q parent is inserted as the parent node of q child .

Input:
q ancestor ← Position of Parent Node of q parent in T 2 If Not isTrapped(q ancestor , q child , C) then 3 T ← Delete Node<q parent >, Edge<q parent , q child > and Edge<q parent , q ancestor > from T 4 q parent ← q ancestor 5 q ancestor ← Position of Parent Node of q ancestor in T 6 While Not q ancestor = Null do 7 If Not isTrapped(q ancestor , q child , C) then 8 T ← Delete Node<q parent > and Edge<q parent , q ancestor > from T 9 q parent ← q ancestor 10 q ancestor ← Position of Parent Node of q ancestor in T 11 Else 12 Break 13 T ← Insert Edge<q parent , q child > to T 14 Else 15 T ← Insert Node<q child > and Edge<q child , q parent > to T End triangular Rewiring Procedure

Proposed Post Triangular Processing of the Midpoint Interpolation Method
The proposed post triangular processing of the midpoint interpolation method can be applied to path planning algorithms that do not guarantee optimality, such as the RRT algorithm, and rewiring and midpoint interpolation based on the triangular inequality principle. The assumptions of the proposed method are as follows: 1.
The destination point may change gradually over time, but there is only one start point and one destination point for each tree.

2.
If the mobile robot cannot perform the omnidirectional motion, local planning or kinodynamic planning is performed separately on the path planning result.
The basic principle is that the node serving as a waypoint in the planned path checks whether an obstacle collides with its own grandparent node, and if it is free from obstacle collision, the grandparent node rewires to the parent node. If it is not free from obstacle collision, as shown in Figure 3, the locally piecewise linear path created between the node, its parent node, and its grandparent node is made a more optimal path through the interpolation process. In this process, a new node is interpolated into the path and deviates from the piecewise linear path, so it has the advantage of being able to somewhat solve the sharp path problem (the problem facing a mobile robot that has kinematic constraints because the slope is not smooth).
Appl. Sci. 2021, 11, x FOR PEER REVIEW 6 of 18 Here, ξ() is a function that receives the node as a variable and returns the parent node of that node. The n-squared (n ≥ 0) of the ξ() function can be expressed as ( ) ∶= ( ∘ ∘ … ∘ ) ( ), and if n is 0, ( ) ∶= holds. For the waypoint qi, the value of d decreases by 1/2 as interpolation proceeds (n). The initial value d0 is the height of the triangle formed by the three line segments α, β, and γ (γ < α + β), and the value of dn becomes (dn−1)/2. Based on qi, let α be the line segment from itself to the parent node, β be the line segment from the parent node to the grandparent node, and γ be the line segment from itself to the grandparent node. This d value serves as a measure to confirm the clearance of the obstacle compared to ε. This is because the smaller the d, the closer the path is to the obstacle.
(a) (b) Figure 3. Summary of post triangular processing of the midpoint interpolation method: (a) line segment γ with node q0 and its grandparent node q2 in tree R is not free from obstacle collision; (b) Parent node q1 of q0 is deleted, and qa between q0 and q1, and qb between q1 and q2 are inserted as waypoints of a new path between q0 and q2.
(a) (b) Figure 4. Interpolation function of post triangular processing of the midpoint interpolation method: (a) height d0 of the triangle formed by waypoints q0, q1, and q2 of the path is greater than ε (interpolation continuation); (b) height d1 of the triangle formed by midpoints mF(q0,1) and q1 of q0 and q1 and midpoint mF(q0,1) is the midpoint of q0 and q1, also mF(q1,1) is the midpoint of q1 and q2.
Equation (1) converges to 0 when n becomes infinitely large in dn, so epsilon receives only a value greater than 0 (positive number) from the user. ε is always greater than dn when n is infinitely large. i.e., d is always smaller than epsilon at some point when n becomes infinitely large. This can be expressed as Equations (2) and (3) as follows: ∴ lim Figure 3. Summary of post triangular processing of the midpoint interpolation method: (a) line segment γ with node q 0 and its grandparent node q 2 in tree R is not free from obstacle collision; (b) Parent node q 1 of q 0 is deleted, and q a between q 0 and q 1 , and q b between q 1 and q 2 are inserted as waypoints of a new path between q 0 and q 2 .
This post triangular processing of the midpoint interpolation method was designed based on the polygon approximation algorithm [18,19], so, as shown in Figure 4, the path is calculated through a constant value called ε (the threshold of minimum clearance) (ε > 0). It determines how closely the obstacle is approximated or, in other words, how close to the optimal path it is. Here, in Figure 4, d follows Equation (1): Here, ξ() is a function that receives the node as a variable and returns the parent node of that node. The n-squared (n ≥ 0) of the ξ() function can be expressed as ( ) holds. For the waypoint qi, the value of d decreases by 1/2 as interpolation proceeds (n). The initial value d0 is the height of the triangle formed by the three line segments α, β, and γ (γ < α + β), and the value of dn becomes (dn−1)/2. Based on qi, let α be the line segment from itself to the parent node, β be the line segment from the parent node to the grandparent node, and γ be the line segment from itself to the grandparent node. This d value serves as a measure to confirm the clearance of the obstacle compared to ε. This is because the smaller the d, the closer the path is to the obstacle.
(a) (b) Figure 3. Summary of post triangular processing of the midpoint interpolation method: (a) line segment γ with node q0 and its grandparent node q2 in tree R is not free from obstacle collision; (b) Parent node q1 of q0 is deleted, and qa between q0 and q1, and qb between q1 and q2 are inserted as waypoints of a new path between q0 and q2.
(a) (b) Equation (1) converges to 0 when n becomes infinitely large in dn, so epsilon receives only a value greater than 0 (positive number) from the user. ε is always greater than dn when n is infinitely large. i.e., d is always smaller than epsilon at some point when n becomes infinitely large. This can be expressed as Equations (2) and (3) as follows: formed by waypoints q 0 , q 1 , and q 2 of the path is greater than ε (interpolation continuation); (b) height d 1 of the triangle formed by midpoints m F (q 0 ,1) and q 1 of q 0 and q 1 and midpoint m F (q 0 ,1) is the midpoint of q 0 and q 1 , also m F (q 1 ,1) is the midpoint of q 1 and q 2.
Here, ξ() is a function that receives the node as a variable and returns the parent node of that node. The n-squared (n ≥ 0) of the ξ() function can be expressed as For the waypoint q i , the value of d decreases by 1/2 as interpolation proceeds (n). The initial value d 0 is the height of the triangle formed by the three line segments α, β, and γ (γ < α + β), and the value of d n becomes (d n−1 )/2. Based on q i , let α be the line segment from itself to the parent node, β be the line segment from the parent node to the grandparent node, and γ be the line segment from itself to the grandparent node. This d value serves as a measure to confirm the clearance of the obstacle compared to ε. This is because the smaller the d, the closer the path is to the obstacle.
Equation (1) converges to 0 when n becomes infinitely large in d n , so epsilon receives only a value greater than 0 (positive number) from the user. ε is always greater than d n when n is infinitely large. i.e., d is always smaller than epsilon at some point when n becomes infinitely large. This can be expressed as Equations (2) and (3) as follows: However, since optimality and clearance are opposite attributes, the closer ε is to 0 as shown in Figure 5, the more similar the path or path length is to the visibility graph, but it is not a smooth path [20]. The farther away it is from 0 (within a significant value where the path is modified), the farther it is from the optimum, but a smooth (kinetic) path is made, so ε should be set to a suitable value according to the environment. However, since optimality and clearance are opposite attributes, the closer ε is to 0 as shown in Figure 5, the more similar the path or path length is to the visibility graph, but it is not a smooth path [20]. The farther away it is from 0 (within a significant value where the path is modified), the farther it is from the optimum, but a smooth (kinetic) path is made, so ε should be set to a suitable value according to the environment.
The following Algorithm 3 shows the pseudocode of the proposed post triangular processing of the midpoint interpolation method. It is mainly composed of the post triangular function (Algorithm 4) and interpolation function (Algorithm 5).
(a) (b) (c) Figure 5. Variations according to ε values in post triangular processing of midpoint interpolation method (ε value of (a) >ε value of (b) >ε value of (c)): (a) When ε value is set relatively large; (b) When ε value is set relatively medium (smooth path); (c) When ε value is set relatively small (closer to the optimal path).  ε value of (b) > ε value of (c)): (a) When ε value is set relatively large; (b) When ε value is set relatively medium (smooth path); (c) When ε value is set relatively small (closer to the optimal path).
The following Algorithm 3 shows the pseudocode of the proposed post triangular processing of the midpoint interpolation method. It is mainly composed of the post triangular function (Algorithm 4) and interpolation function (Algorithm 5).
The input values of the post triangular processing of the midpoint interpolation method consist of the path R planned through a path planning algorithm, such as the RRT algorithm, the obstacle area information C, and the threshold value ε of the minimum clearance.
The f modify is a variable that determines whether the input path R has been modified by this method, and if the path is modified even once, the entire process is repeated. If the path modification does not occur in the process of repeating, the algorithm is terminated. t refers to the index of the currently focused waypoint of R. That is, if t is 0, it is the starting point, which is the first point of R. q parent ← next point of q child in R 6 While not [q parent is the last point in R] Do 7 q ancestor ← next point of q parent in R 8 If not isTrapped(q child , q ancestor , C) Then 10 R ← postTriangular(R, ε, t, f modify ) 11 In R, when the first focusing point is q child , the next point of that point q child is q parent , and the next point of that point q parent is q ancestor . It is determined whether the distance between q child and q ancestor is free from obstacle collision (isTrapped() function). If it is free from collision, it is called postTriangular(); otherwise, it is called interpolation(). postTriangular() connects q child and q ancestor as in the triangular rewiring method [8], and the q parent between them is deleted from the path. interpolation() finds (interpolates) the points between q child and q parent and between q parent and q ancestor that are free from obstacle collision when connected and rewires q child , q ancestor , and those two points are found. If R and t are updated due to postTriangular() or interpolation(), q child (the t-th waypoint of R), q parent, and q ancestor are updated accordingly. If q parent is the last point in R, f modify is checked. Otherwise, the above process is repeated for the updated q child and q ancestor .
Here, path modification by postTriangular() deletes the waypoints and makes a more optimal path but has the effect of sharpening the path shape, and path modification by interpolation() creates a new waypoint between the waypoints. Adding/inserting has the effect of making a more optimal path while also smoothing the path shape. Of course, due to the effect of making a more optimal path, path modification by postTriangular() is more efficient than that by interpolation().
The input values of postTriangular() of the post triangular processing of the midpoint interpolation method consist of the path R, the focusing point index t, and the path modification f modify from the post triangular processing of midpoint interpolation method.
Rewiring is performed on the t-th waypoint q child of R, the next point q parent , and the next point q ancestor of that point again. First, the path between q child and q parent and the path between q parent and q ancestor are deleted. Then the path is inserted between q child and q ancestor . Finally, f modify returns "true" because the path has been modified. Here, Path <A, B> means a partial path from Waypoint A to Waypoint B in the complete path.

Algorithm 4 Pseudocode of Proposed Post Triangular Function
Input: R ← path R from postTriProcOfMidInterpolation t ← point index t from postTriProcOfMidInterpolation f modify ← boolean f modify from postTriProcOfMidInterpolation Output: R ← modified path R f modify ← result of boolean f modify //return by reference Procedure postTriangular From postTriProcOfMidInterpolation Begin 1 q child ← t-th point in R 2 q parent ← next point of q child in R 3 q ancestor ← next point of q parent in R 4 R ← Delete path<q child , q parent > and path<q parent , q ancestor > from R 5 R ← Insert path<q child , q ancestor > to R 6 f modify ← true End The goal of the proposed post triangular processing of midpoint interpolation method is to find an interpolation point (m F (q 0 ), m F (q 1 )) free from obstacle collisions between waypoints (q 0~q1 , q 1~q2 ) while descending in the direction of the midpoint (q 1 ), as shown in Figure 6 in the interpolation process. Finally, fmodify returns "true" because the path has been modified. Here, Path <A, B> means a partial path from Waypoint A to Waypoint B in the complete path. The goal of the proposed post triangular processing of midpoint interpolation method is to find an interpolation point (mF(q0), mF(q1)) free from obstacle collisions between waypoints (q0~q1, q1~q2) while descending in the direction of the midpoint (q1), as shown in Figure 6 in the interpolation process.
However, the interpolation point mF follows Equation (4): When the k-th interpolation point of the interpolation point qi is mF(qi,k), the 0-th interpolation point becomes itself qi, and the first interpolation point is the midpoint of qi and the point ξ(qi) next to qi, and the second interpolation point becomes the midpoint of mF (qi,1) and ξ(qi). That is, mF(qi,k) (k > 0) becomes the midpoint between mF(qi,k − 1) and ξ(qi). The following Algorithm 5 shows the pseudocode of interpolation() of the proposed post triangular processing of the midpoint interpolation method.  . Details of post triangular processing of the midpoint interpolation method: (a) midpoint m F (q 0 ,1) of waypoint q 0 , q 1 of path and midpoint m F (q 1 ,1) of q 1 , q 2 are not free from obstacle collision; (b) midpoint m F (q 0 ,2) of interpolation point m F (q 0 ,1), q 1 and midpoint m F (q 1 ,2) between q 1 , interpolation point m F (q 1 ,1) is free from obstacle collision.
However, the interpolation point m F follows Equation (4): When the k-th interpolation point of the interpolation point q i is m F (q i ,k), the 0-th interpolation point becomes itself q i , and the first interpolation point is the midpoint of q i and the point ξ(q i ) next to q i , and the second interpolation point becomes the midpoint of m F (q i ,1) and ξ(q i ). That is, m F (q i ,k) (k > 0) becomes the midpoint between m F (q i ,k − 1) and ξ(q i ). The following Algorithm 5 shows the pseudocode of interpolation() of the proposed post triangular processing of the midpoint interpolation method.

Algorithm 5 Pseudocode of Proposed Interpolation Function
Input: R ← path R from postTriProcOfMidInterpolation C ← position set C from postTriProcOfMidInterpolation ε ← threshold value ε from postTriProcOfMidInterpolation t ← point index t from postTriProcOfMidInterpolation f modify ← boolean fmodify from postTriProcOfMidInterpolation Output: R ← modified path R t ← updated point index t // return by reference f modify ← result of boolean fmodify // return by reference Initialize: q child ← t-th point in R q parent ← next point of q child in R q ancestor ← next point of q parent in R Procedure interpolation From postTriProcOfMidInterpolation Begin 1 d ← altitude of the triangle consisting of q child , q parent , and q ancestor with base <q child , q ancestor > 2 m a ← midpoint between q child and q parent 3 m b ← midpoint between q parent and q ancestor 4 While true Do 5 If d >= ε Then 6 If not isTrapped(m a , m b , C) Then 7 R ← Delete path<q child , q parent > and path<q parent , q ancestor > from R 8 R ← Insert path<q child , m a >, path<m a , m b >, and path<m b , q ancestor > to R 9 f modify ← true 10 Break 11 m a ← midpoint between m a and q parent 14 m b ← midpoint between m b and q parent 15 The input values of interpolation() of the post triangular processing of midpoint interpolation method consist of the path R, the obstacle area information C, the focusing point index t, and the path modification f modify from the post triangular processing of the midpoint interpolation method.
From the t-th waypoint q child of R, the next point q parent , and the next point q ancestor of that point, the height d of the triangle is obtained, m a is the midpoint of q child and q parent , and m b is the midpoint of q parent and q ancestor . If the path between m a and m b is free from obstacle collision (isTrapped()), the path between q child and q parent is deleted, and the path between q child and m a , the path between m a and m b , and the path between m b and q ancestor are inserted. Moreover, since the path is modified, f modify returns "true," and the method terminates. If the line segment between m a and m b is not free from obstacles, the value of d decreases by 1/2, m a is updated to the midpoint of m a and q parent , and m b is updated to the midpoint of m b and q parent . It is then determined whether m a and m b are free from obstacles again. This repeated process proceeds until a case is found in which m a and m b are free from obstacles or d becomes smaller than ε. If d becomes smaller than ε, the value of t is increased by 1 and the method is terminated. Figure 7 shows the overall flowchart of the proposed post triangular processing of the midpoint interpolation method. Here, ξ t (q goal ) denotes the t-th next waypoint from the starting point q goal of the path R, and ξ t+n (q goal ) is the n-th next waypoint in the ξ t (q goal ). That is, there are n waypoints between ξ t (q goal ) and ξ t+n (q goal ). In the flowchart shown in Figure 7, the stop condition follows the sequence:

1.
Check whether the t-th ancestor node and the (t + 2)-th ancestor node of q goal are collision-free (Here, when t is 0, the 0-th ancestor means itself(q goal )).

2.
If the result of Step 1 is not collision-free, compare the d k (ξ t (q goal )) value of the t-th ancestor node of q goal with ε.

3.
If d k (ξ t (q goal )) is less than ε, the value of t is incremented by 1, and if the parent node (t + 1) of the t-th ancestor node of q goal after t is incremented is q start , the algorithm is stopped (if f is False).

Experimental Results
The path between the RRT in various environment maps through simulation and the RRT algorithm to which the proposed post triangular processing of the midpoint interpolation method is applied were used to validate the performance of the method proposed in this paper, and the path planning results were compared.
The performance measures compared were the average values after repeating the trial 100 times (sampling position was changed for each trial) of the path length (px) and the planning time (ms) of the first complete path (the first complete path to reach a destination point from a starting point).
Various environment maps have been examined and used to validate the performance of the proposed path planning algorithms in related works. Since the efficiency of the performance measures expected during the experiment varies somewhat based on the composition of obstacles (e.g., number, location, shape), it is important to choose which environment map to utilize carefully.
The four environment maps used in the experiment are shown in Figure 8. The four environment maps were created by partially referring to the experimental environment proposed by Han in 2017 [21]. All environment maps were 600 × 600 px in size, with a 30 px step length. The start points (S) are represented by green circles, while the destination points (G) are represented by purple circles. Obstacles are black polygons with yellow contours (blue in the experimental results).
Map 1 of Figure 8a appears to be an efficient environment for validating optimality and completeness but a weak environment for sampling-based path planning algorithms like the RRT algorithm. Many samplings are required since the probability of finding a The stopping criterion of the proposed algorithm is based on ε. As shown in Figures 4 and 7, when the value of d k (ξ t (q goal )) becomes smaller than the ε, the algorithm stops the loop. As Equations (1) and (2) and Figure 6 show, the value d k (ξ t (q goal )) decreases deterministically.

Experimental Results
The path between the RRT in various environment maps through simulation and the RRT algorithm to which the proposed post triangular processing of the midpoint interpolation method is applied were used to validate the performance of the method proposed in this paper, and the path planning results were compared.
The performance measures compared were the average values after repeating the trial 100 times (sampling position was changed for each trial) of the path length (px) and the planning time (ms) of the first complete path (the first complete path to reach a destination point from a starting point).
Various environment maps have been examined and used to validate the performance of the proposed path planning algorithms in related works. Since the efficiency of the performance measures expected during the experiment varies somewhat based on the composition of obstacles (e.g., number, location, shape), it is important to choose which environment map to utilize carefully.
The four environment maps used in the experiment are shown in Figure 8. The four environment maps were created by partially referring to the experimental environment proposed by Han in 2017 [21]. All environment maps were 600 × 600 px in size, with a 30 px step length. The start points (S) are represented by green circles, while the destination points (G) are represented by purple circles. Obstacles are black polygons with yellow contours (blue in the experimental results).
Appl. Sci. 2021, 11, x FOR PEER REVIEW 12 of 18 The number of samples and planning time required increase drastically when the path to the destination point is narrow or there are few entrances since the sampling-based path planning algorithm depends on probabilistic completeness. The specification of the computer used in the simulation is shown in Table 1. The simulator used for the simulation [8] was developed based on C# WPF (Microsoft Visual Studio Community 2019 Version 16.1.6 Microsoft .NET Framework Version 4.8.03752), and only a single thread was used for calculations except for the visual part. Generally, depending on the specification of the computer, the result of performance measurements, such as planning time, may vary during the simulation.

CPU
Intel Core i7-6700k 4.00 GHz (8 CPUs) Map 1 of Figure 8a appears to be an efficient environment for validating optimality and completeness but a weak environment for sampling-based path planning algorithms like the RRT algorithm. Many samplings are required since the probability of finding a solution is low. Map 2 of Figure 8b appears to be an efficient environment for validating the optimality and completeness of the path planning algorithm. Map 3 of Figure 8c is an environment that is efficient for validating the optimality and the planning time of the path planning algorithm, as it consists of obstacles (50 vertices) that approximate circles. Map 4 of Figure 8d is an environment that is efficient for validating the optimality and the planning time of the path planning algorithm but a weak environment for sampling-based path planning algorithms such as the RRT algorithm.
The number of samples and planning time required increase drastically when the path to the destination point is narrow or there are few entrances since the sampling-based path planning algorithm depends on probabilistic completeness.
The specification of the computer used in the simulation is shown in Table 1. The simulator used for the simulation [8] was developed based on C# WPF (Microsoft Visual Studio Community 2019 Version 16.1.6 Microsoft .NET Framework Version 4.8.03752), and only a single thread was used for calculations except for the visual part. Generally, depending on the specification of the computer, the result of performance measurements, such as planning time, may vary during the simulation. We validate the experimental results (path length, planning time) in the four environment maps in which the post triangular processing of the midpoint interpolation method (ε: 50, 30, 10 px) is applied to the RRT algorithm and its path planning results. Since ε requires a higher amount of computation as it gets smaller, it was set to a value close to the 30 px step length of the experimental environment.
The experimental results for each map consist of a figure and table. The figure is a path planning result for each algorithm shown in the case of a single trial (the figure for each algorithm is not the result of repeated trials). The table shows an average value of the results of planning time and path length from the path planning repeated trials. There may be a significant difference between the performance observed visually and the numerical results in the table for one of the repeated trials. The form of the planned path for each algorithm is shown in the figure for visual reference. Furthermore, the proposed post triangular processing of the midpoint interpolation method is used to see whether there is a region where the piecewise linear path is smoothed.
The path planning results are shown in Figure 9 for Map 1 among the specified environment maps for each algorithm. In terms of appearance, the one to which the post triangular processing of the midpoint interpolation method (ε: 10 px) was applied seems to have a smoother slope compared to those of the other algorithms, and the path length with the method (ε: 10 px) seems to be the shortest. triangular processing of the midpoint interpolation method is used to see whether there is a region where the piecewise linear path is smoothed.
The path planning results are shown in Figure 9 for Map 1 among the specified environment maps for each algorithm. In terms of appearance, the one to which the post triangular processing of the midpoint interpolation method (ε: 10 px) was applied seems to have a smoother slope compared to those of the other algorithms, and the path length with the method (ε: 10 px) seems to be the shortest.  The path planning results (average values after repeating the trial 100 times) are shown in Table 2 for Map 1 among the specified environment maps for each algorithm. When applying the post triangular processing of the midpoint interpolation method (ε: 10 px), the path length becomes 62% (1224/1994(%)) compared to the RRT, which is the shortest of all the algorithms, and the planning times are all similar. The path planning results are shown in Figure 10 for Map 2 among the specified environment maps for each algorithm. In terms of appearance, the one to which the post triangular processing of midpoint interpolation method (ε: 10 px) was applied seems to have a smoother slope compared to those of the other algorithms, and the path length with the method (ε: 10 px) seems to be the shortest.
The path planning results (average values after repeating the trial 100 times) are shown in Table 2 for Map 1 among the specified environment maps for each algorithm. When applying the post triangular processing of the midpoint interpolation method (ε: 10 px), the path length becomes 62% (1224/1994(%)) compared to the RRT, which is the shortest of all the algorithms, and the planning times are all similar.
The path planning results are shown in Figure 10 for Map 2 among the specified environment maps for each algorithm. In terms of appearance, the one to which the post triangular processing of midpoint interpolation method (ε: 10 px) was applied seems to have a smoother slope compared to those of the other algorithms, and the path length with the method (ε: 10 px) seems to be the shortest.   The path planning results (average values after repeating the trial 100 times) are shown in Table 3 for Map 2 among the specified environment maps for each algorithm. By applying the post triangular processing of midpoint interpolation method (ε: 10 px), the path length becomes 74% (730/986(%)) compared to the RRT, which is the shortest of all the algorithms, and the planning time is similar to that of the RRT algorithm when the method (ε: 50 px) is applied. However, the absolute time difference is 1 ms, which seems to be large when the method is applied because it is an environment that requires less planning time. The path planning results are shown in Figure 11 for Map 3 among the specified environment maps for each algorithm. In terms of appearance, the one to which the post triangular processing of midpoint interpolation method (ε: 10 px) was applied seems to have a smoother slope compared to those of the other algorithms, and the path length with the method (ε: 10 px) seems to be the shortest. The path planning results (average values after repeating the trial 100 times) are shown in Table 3 for Map 2 among the specified environment maps for each algorithm. By applying the post triangular processing of midpoint interpolation method (ε: 10 px), the path length becomes 74% (730/986(%)) compared to the RRT, which is the shortest of all the algorithms, and the planning time is similar to that of the RRT algorithm when the method (ε: 50 px) is applied. However, the absolute time difference is 1 ms, which seems to be large when the method is applied because it is an environment that requires less planning time.
The path planning results are shown in Figure 11 for Map 3 among the specified environment maps for each algorithm. In terms of appearance, the one to which the post triangular processing of midpoint interpolation method (ε: 10 px) was applied seems to have a smoother slope compared to those of the other algorithms, and the path length with the method (ε: 10 px) seems to be the shortest.  The path planning results (average values after repeating the trial 100 times) are shown in Table 4 for Map 3 among the specified environment maps for each algorithm. By applying the post triangular processing of midpoint interpolation method (ε: 10 px), the path length becomes 82% (505/613(%)) compared to the RRT, which is the shortest of all the algorithms, and the planning time is the most similar to that of the method (ε: 10 px), as it takes 16% more time than the RRT algorithm. However, the absolute time difference is 2 ms, and since it is an environment that requires less planning time, the difference appears to be large when the method is applied. The path planning results are shown in Figure 12 for Map 4 among the specified environment maps for each algorithm. In terms of appearance, the one to which the post triangular processing of the midpoint interpolation method (ε: 30 px) was applied seems to have a smoother slope compared to those of the other algorithms, and the path length with the method (ε: 10 px) seems to be the shortest.  The path planning results (average values after repeating the trial 100 times) are shown in Table 4 for Map 3 among the specified environment maps for each algorithm. By applying the post triangular processing of midpoint interpolation method (ε: 10 px), the path length becomes 82% (505/613(%)) compared to the RRT, which is the shortest of all the algorithms, and the planning time is the most similar to that of the method (ε: 10 px), as it takes 16% more time than the RRT algorithm. However, the absolute time difference is 2 ms, and since it is an environment that requires less planning time, the difference appears to be large when the method is applied.
The path planning results are shown in Figure 12 for Map 4 among the specified environment maps for each algorithm. In terms of appearance, the one to which the post triangular processing of the midpoint interpolation method (ε: 30 px) was applied seems to have a smoother slope compared to those of the other algorithms, and the path length with the method (ε: 10 px) seems to be the shortest. The path planning results (average values after repeating the trial 100 times) are shown in Table 5 for Map 4 among the specified environment maps for each algorithm. By applying the post triangular processing of the midpoint interpolation method (ε: 10 px), the path length becomes 77% (1190/1536(%)) compared to the RRT, which is the shortest of all the algorithms, and all the planning times are similar. Table 5. Experimental results of Map 4 (numbers in parentheses to (averages of repeating 100 times) are relative ratios to RRT results (values less than 1 are counted as 1)). Consequently, the post triangular processing of the midpoint interpolation method (ε: 10 px) performed well in the path length aspect for all maps, demonstrating that the proposed method is efficient in terms of optimality.

Conclusions
In this research, the post triangular processing of the midpoint interpolation method minimized the planning time and shortened the path length of the sampling-based algorithm.
The proposed post triangular processing of the midpoint interpolation method was closer to the optimal path and somewhat solved the sharp path problem through the interpolation process. Furthermore, all path planning algorithms that plan a locally piecewise linear path could apply the proposed algorithm. This strength has significance in that it can be applied not only to the algorithm presented in this paper but also to various path planning algorithms. We validated the performance of the proposed method after it was applied to the RRT algorithm and its path planning results through simulation. It was verified that the path length was shortened by 18-38% (average 26%) depending on the threshold ε when applied to the RRT algorithm in the four different environment maps. As a result, the RRT algorithm applying the proposed post triangular processing of the midpoint interpolation method showed a more optimal path.
The proposed post triangular processing of the midpoint interpolation method is based on a general global planning case in which a robot first discovers a global path from its start point to its destination point before beginning to navigate. In dynamic environments, not only local planners but also global planners must deal with kinodynamic problems in real-time. Furthermore, the method proposed in this paper is more efficient in terms of the optimality of robot path planning, but optimality is not guaranteed. Future work should determine how to make a path that is closer to the optimal path.