Rapid Planning of an Assembly Path by Reusing the Prior Path

: Assembly path planning of complex products in virtual assembly is a necessary and com-plicated step, which will become long and inefﬁcient if the assembly path of each part is completely planned in the assembly space. The coincidence or partial coincidence of the assembly paths of some parts provides an opportunity to solve this problem. A path planning algorithm based on prior path reuse (PPR algorithm) is proposed in this paper, which realizes rapid planning of an assembly path by reusing the planned paths. The core of the PPR algorithm is a dual-tree fusion strategy for path reuse, which is implemented by improving the rapidly exploring random tree star (RRT *) algorithm. The dual-tree fusion strategy is used to ﬁnd the nearest prior node, the prior connection node, the nearest exploring node, and the exploring connection node and to connect the exploring tree to the prior tree after the exploring tree is extended to the prior space. Then, the optimal path selection strategy is used to calculate the costs of all planned paths and select the one with the minimum cost as the optimal path. The PPR algorithm is compared with the RRT * algorithm in path planning for one start node and multiple start nodes. The results show that the total time and the number of sampling points for assembly path planning of batch parts using the PPR algorithm are far less than those using the RRT * algorithm.


Introduction
Digital assembly is one of the key technologies in the design and manufacturing of complex products [1][2][3][4]. Some technologies, such as virtual reality (VR), augmented reality (AR), digital prototyping (DP), and digital twin (DT) assembly, are used to realize the design, verification, and optimization of an assembly in a virtual environment by virtual reality fusion and interactive control and to improve the assembly quality and efficiency of complex products [5][6][7][8][9][10][11][12][13].
Assembly planning (AP) is one of the most important bases and premises of the assembly process and has some main subproblems: assembly sequence planning (ASP), assembly motion planning (AMP), assembly resource planning (ARP), assembly path planning (APP), etc. These problems have proven to be either non-deterministic polynomial hard (NP-hard) or non-deterministic polynomial complete (NP-complete), and many studies have been conducted to solve them efficiently [14][15][16][17][18][19].
The APP of a complex product takes much time due to the large number of parts; thus, the optimization of APP will improve assembly efficiency [33]. In addition to the above-mentioned APP methods, there have also been some studies on robot path planning [34][35][36], vehicle path planning [37][38][39], UAV path planning [40][41][42], etc. For most of the APP methods mentioned above, it takes a large amount of repeated computation and leads to low planning efficiency and high costs if generating the assembly path through all parts.
In these studies, rapidly exploring random tree (RRT) and probabilistic roadmap planners (PRM) are two typical random sampling algorithms in path planning. The PRM algorithm constructs the road map in the space by random sampling and seeks a feasible solution based on graph searching [43,44]. However, the PRM algorithm consumes high costs and is not suitable for a dynamic environment [45].
The RRT algorithm is an effective method which explores free space by expanding a tree structure with the leaf nodes generated randomly and uniformly. When a leaf node reaches the target area, a collision-free path is obtained by backtracking from the leaf node to the parent node in sequence [23,46].
Although the RRT algorithm is an efficient algorithm in path planning, the randomness of the sampling points makes it difficult to obtain the optimal path even if the number of sampling points is sufficient. Therefore, some algorithms have been proposed to improve the RRT algorithm in terms of random point generation, nearest point selection, interference detection, and node connection [47][48][49]. One of them is the rapidly exploring random tree star (RRT *) algorithm, which makes the path cost lower by improving the nearest point selection strategy [50,51].
However, the RRT * algorithm cannot obtain a low-cost assembly path in a short time, or even a valid assembly path when the number of sampling points is small.
In fact, the assembly paths of many parts of a complex product are coincident or partially coincident, resulting in a large number of repeated calculations in path planning. Therefore, a path planning algorithm based on prior path reuse (PPR algorithm) is proposed as follows: (1) the assembly path is segmented and the configuration space is constructed, and (2) the prior path is reused, and the dual-tree fusion strategy and the optimal path selection strategy are performed. The proposed method in this paper performs well with a small sampling size which reduces repeated calculations by reusing planned assembly paths and improves the efficiency of new path planning.

Segmentation of the Assembly Path
The assembly paths of different parts in a complex product are varied; thus, it is difficult to reuse an assembly path completely. A feasible method is to segment the assembly path and then reuse it [52]. Based on a method of segmenting the assembly path into two phases, the assembly path of a part is divided into three phases in turn by four key positions of the part from the shelf to assembly in this paper, as shown in Figure 1. The four positions are the initial point, the start point, the end point, and the target point, and the three phases are the handling phase, the logistics phase, and the assembly phase.
In the handling phase, the part is transferred from the initial point (the position where the part is stored on the shelf) to the start point (the position where the part is waiting to be transported near the shelf). In the logistics phase, the part is transported from the start point to the end point (the position where the part is waiting to be assembled near the assembly), bypassing various obstacles. In the assembly phase, the part is transferred from the end point to the target point (the final position where the part is assembled) after position-posture transformation.
Since the initial point, the start point, and the target point of each part are typically different, it is difficult to plan the handling phase and the assembly phase of a new assembly path by reusing the corresponding phases of other planned paths. However, in the logistics phase, all the parts can be moved to the same position before assembly, which means that their end points are the same. Two assembly paths with the same end point may coincide within a certain range even if their start points are different, which makes the reuse of the logistics phase of planned paths possible. Therefore, the path reuse in this paper focuses on the logistics phase.

Transformation from Assembly Space to Configuration Space
A large number of parts, assembly tools, workbenches, and various auxiliary equipment in the assembly space are obstacles that need to be bypassed in APP, which leads to a high complexity of collision detection and a low efficiency of path planning.
Therefore, the configuration space method is usually used to model the assembly space [53], which maps the assembly space into a two-dimensional configuration space containing the obstacle space and the free space. The assembly path can be solved by using a two-dimensional path planning algorithm in the configuration space, which is helpful to reduce the difficulty and improve the efficiency of path planning.
In this paper, in addition to the obstacle space and the free space, the configuration space also contains the prior path space constructed by the planned assembly paths. The paths in the prior space constitute a prior path set, which is described by a tree structure, as shown in Figure 2. Each prior path is composed of the nodes in sequence from the start node (the leaf node) x start_i (i = 1, . . . , m) to the end node (the root node) x end with some nodes p ij (i = 1, . . . , m; j = 1, . . . , n) between them. Therefore, the path planning for the logistics phase in the assembly space is converted into a non-interference path search from the start node to the end node in the configuration space. A path planning algorithm based on RRT expands the path by generating random points in the configuration space and detects collision interference by connecting the points with lines. If a prior path is represented only by some nodes of the tree, the probability that the sampling points happen to be generated on these nodes is extremely small. Therefore, a prior path tree is inflated into a prior path space [54] which is helpful for improving the reusability of a prior path.
There are two steps to inflate a path tree into a path space. First, each node of the tree is expanded into a circle, where the radius of the circle is positively related to the number of parts that appear at the node and the size of their bounding volume. In the process of moving parts from the start node to the end note, the size of parts consumes some space along the assembly path which cannot be ignored. Therefore, this virtual space is applied to simulate the real space which is consumed by the size of each part, and the radius of each circle can be changed to adjust the envelope of the path space in a real application. Second, the outer common tangents of each two adjacent circles are connected in sequence to construct the prior path space. The prior path tree shown in Figure 2 is inflated into the prior path space shown in Figure 3.

Prior Path Reuse in the PPR Algorithm
The PPR algorithm proposed in this paper improves the RRT * algorithm by developing some prior path reuse strategies to rapidly generate an asymptotically optimal assembly path by reusing the prior paths after the path exploring tree is expanded to the prior path space.
The main steps of assembly path reuse in the PPR algorithm are as follows: Step 1. A new node x new is generated with a given step S on the line connecting the random node x rand and the nearest node x near , as shown in Figure 4. Step 2. The position of x new in the configuration space is detected to determine the next step: (1) in the obstacle space C obs , return to Step 1; (2) in the free space C free , optimize the exploring tree with the RRT * algorithm; and (3) in the prior space C prior , proceed to Step 3 for path reuse planning.
Step 3. Two connection nodes p connect and x connect are identified for path reuse by using a dual-tree fusion strategy on the prior path tree T prior and the exploring tree T exploring , respectively, as shown in Figure 5. Step 4. The new branch connecting x connect and p connect is added to T exploring , and a path Γ i obtained by backtracking is added to the prior path set ψ, as shown in Figure 6. Step 5. The minimum cost path Γ min is selected as the final path from ψ of all prior paths obtained after sampling N times. The cost of a path Γ is defined by the path length cost as Cost(Γ) = ∑ n−1 i=1 dis(q i , q i+1 ), where dis(q i , q i+1 ) denotes the Euclidean distance. The above-mentioned steps illustrate the prior path reuse method in path planning from the start node x start to the end node x end . After the exploring tree is expanded to the prior space, the node pair (x connect , p connect ) connecting the exploring tree and the prior path tree is determined by the dual-tree fusion strategy, and then a path expressed as x start -x connect -p connect -x end is obtained by backtracking from the end node x end to the start point x start .
The pseudo-code of the PPR algorithm (Algorithm 1) is as follows: The PPR method greatly reduces the number of samplings by reusing the prior path, which is helpful to improve the efficiency of APP.

Dual-Tree Fusion Strategy
The key aspect of the dual-tree fusion strategy is the determination of the node pair (x connect , p connect ) connecting the path exploring tree T exploring and the prior path tree T prior after the exploring tree is expanded into the prior space.
The main steps of the dual-tree fusion strategy are as follows: Step 1. The prior nodes on the prior path in the circle with x new as the centre and S as the radius are selected to create a nearest prior node set P near , as shown in Figure 7, where P near = {p 2 , p 3 }. Step 2. If the costs of nodes in P near are different, the node with minimum cost is selected as the connection node p connect on the prior path; otherwise, the nearest node is selected. In Figure 7, p 2 is selected as p connect , as shown in Figure 8. Step 3. After the prior connection node p connect is obtained, the exploring nodes on the exploring tree in the circle with p connect as the center and S as the radius are selected to create a nearest exploring node set X near , as shown in Figure 9, where X near = {x new , x 1 , x 2 }. Step 4. If the costs of nodes in X near are different, the node with minimum cost is selected as the connection node x connect on the exploring tree; otherwise, the nearest node is selected. In Figure 9, x 1 is selected as x connect , as shown in Figure 10.

The Optimal Path Selection Strategy
The path obtained according to the dual-tree fusion strategy is divided into the following two segments by the connection point pair (x connect , p connect ): the prior path segment Γ prior from the end node x end backtracking to the connection node p connect on the prior path tree T prior and the exploring path segment Γ exploring from the connection node x connect backtracking to the start node x start on the exploring path tree T exploring , as shown in Figure 11. As the number of sampling points increases, the cost of Γ exploring is made asymptotically optimal by rewiring the exploring tree, and the shortest Γ exploring can be obtained if the number of sampling points is sufficient, as shown in Figure 12. Since x new is randomly generated in the prior space, the connection node pair (x connect , p connect ) obtained by using the dual-tree fusion strategy may be different, such as (x 1 , p 1 ), (x 2 , p 2 ), and (x i , p i ) shown in Figure 13; thus, the paths obtained according to these pairs are also different, indicated by Γ 1 , Γ 2 , and Γ i , respectively, as shown in Figure 14.  Therefore, a planned path Γ i based on reuse is expressed as Γ i = Γ prior_i + Γ connect_i + Γ exploring_i , where Γ prior_i is the prior path segment from p i to x end , Γ connect_i is the path segment from x i to p i , and Γ exploring_i is the exploring path segment from x i to x start , i = 1, . . . , m.
According to the composition of the path Γ i , the cost of the path Γ i is the sum of the costs of Γ prior_i , Γ connect_i and Γ exploring_i . Since Γ connect_i includes only two connection points and is determined by the minimum cost strategy, the cost of Γ connect_i is negligible due to its small impact on the total cost. Therefore, the cost of Γ i is simplified to the sum of the costs of Γ prior_i and Γ exploring_i .
Considering that different parts have different dependences on paths Γ prior and Γ exploring , the weight coefficients ξ prior and ξ exploring are assigned to Γ prior and Γ exploring , respectively, and ξ prior + ξ exploring = 1. With an increase in ξ prior , the optimal path asymptotically approaches the shortest prior path segment. With an increase in ξ exploring , the optimal path asymptotically approaches the shortest exploring path segment.

Examples and Comparison
In this section, two case studies of assembly path planning are given to validate and demonstrate the application of the PPR algorithm, and the comparisons of results are illustrated as shown in Figures 15 and 16. The start node, end node, and prior path of each case study are marked in the figures.

Comparison of Results of PPR Algorithm with Different Numbers of Sampling Points
The PPR algorithm is used to plan the assembly path from x start to x end with different maximum numbers of sampling points N = 1000 and N = 2000, where ξ prior = 0.8, ξ exploring = 0.2, and S = 2. The results of Case Studies 1 and 2 are shown in Figures 17 and 18. The start nodes, connection nodes, and the end nodes are marked in the figure and the x, y-axes denote the horizontal and vertical coordinates in a plane space, respectively.  Figures 17 and 18 show that path planning using the PPR algorithm is completed even when the number of sampling points is small. Moreover, as the number of sampling points increases, the exploring path segment becomes asymptotically optimal. Since the weight of the prior path is greater than that of the exploring path, the connection node gradually approaches the end node, and the prior path segment of the final path is asymptotically the shortest. The paths planned by using the two algorithms are random due to the small number of sampling points, resulting in different results for each algorithm when planning the same path. Therefore, the number of sampling points, the path length, and the running time when the path is successfully planned for the first time are calculated for the two algorithms, and the average values of 100 sets of planning results of Case Study 1 are compared, as shown in Table 1. Table 1. Average values of the planning results obtained by the rapidly exploring random tree star (RRT *) algorithm and path planning algorithm based on prior path reuse (PPR).

Algorithm
Number  Table 1 shows that the average number of sampling points of the PPR algorithm is only 1/4 that of the RRT * algorithm in path planning, and the path length and running time of the PPR algorithm are also less than those of the RRT * algorithm.
(2) The comparison of success rates of results In the virtual assembly of complex products, the start positions of the parts are different; thus, 50 starting points are randomly generated in the configuration space, and the assembly path for each starting point is planned by using the RRT * algorithm and the PPR algorithm. The number of successful plans with different maximum numbers of sampling points is taken as the success rate of each algorithm, as shown in Figure 19. When the success rate equals 1, it means that every starting point finds an assembly path successfully. Figure 19. Success rate of the PPR algorithm and the RRT * algorithm of Case Study 1. Figure 19 shows that the success rate of both algorithms increases as the number of sampling points increases. However, the success rate of the PPR algorithm is much larger than that of the RRT * algorithm when the maximum number of sampling points is small.
The curves in Figure 19 show the relationship between the maximum number of sampling points and the success rate. For example, when the maximum number of sampling points is 500, the success rates of PPR and RRT * are about 0.7 and 0.05, which means 0.7 and 0.05 of starting points find their assembly paths by performing PPR and RRT *, respectively. The number of sampling points need to be 12,000 and 2500 at least by RRT * and PPR to make the success rates become 1.
(3) The comparison of the minimum number of sampling points The above-mentioned path planning results presented in Table 2 show that the minimum number of sampling points and the calculation time required by the PPR algorithm are much smaller than those of the RRT * algorithm, which verifies the effectiveness of the PPR algorithm.

Conclusions
The large number of parts in a complex product makes the repetition of path planning inevitable, which leads to low assembly efficiency. To solve this problem, this paper proposes a rapid APP method by reusing the prior path based on the RRT * algorithm.
First, an assembly path is divided into three phases to reduce the difficulty of reuse, and the logistics phase of the path is taken as the main object of reuse. Second, the path planning of a part in the assembly space is converted to searching for a non-interference path in the configuration space. Third, a dual-tree fusion strategy and the optimal path selection strategy are designed to implement the PPR algorithm. Finally, the PPR algorithm and the RRT * algorithm are compared by example analysis.
The examples and comparison list the comparison of results with different numbers of sampling points and ones with of RRT * and PPR, which conclude the advantage of the proposed method as follows: (1) The results with different numbers of sampling points show that the PPR algorithm is completed when the number of sampling points is small, which means the proposed method performs well in the case of small sampling sizes; (2) the results of RRT * and PPR show that if the maximum number of sampling points is small, the success rate of path planning by using the PPR algorithm is much greater than that of the RRT * algorithm; (3) the results of path planning with one and multiple start points show that the planning time and the number of sampling points of the PPR algorithm are much smaller than those of the RRT * algorithm, which means that the proposed method performs much better than the RRT * algorithm.
Future work will focus on the application of the PPR algorithm on a dynamic environment and the situation which is the prior path is interrupted by moving obstacles. The improvement of the algorithm efficiency is a next research direction. What is more, the method in this paper has been decided to be conducted in other realms, and more applications will be given in the future research.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author.

Conflicts of Interest:
The authors declare no conflict of interest.