Hybrid Assembly Path Planning for Complex Products by Reusing a Priori Data

: Assembly path planning (APP) for complex products is challenging due to the large number of parts and intricate coupling requirements. A hybrid assembly path planning method is proposed herein that reuses a priori paths to improve the efﬁciency and success ratio. The assembly path is initially segmented to improve its reusability. Subsequently, the planned assembly paths are employed as a priori paths to establish an a priori tree, which is expanded according to the bounding sphere of the part to create the a priori space for path searching. Three rapidly exploring random tree (RRT)-based algorithms are studied for path planning based on a priori path reuse. The RRT* algorithm establishes the new path exploration tree in the early planning stage when there is no a priori path to reuse. The static RRT* (S-RRT*) and dynamic RRT* (D-RRT*) algorithms form the connection between the exploration tree and the a priori tree with a pair of connection points after the extension of the exploration tree to a priori space. The difference between the two algorithms is that the S-RRT* algorithm directly reuses an a priori path and obtains a new path through static backtracking from the endpoint to the starting point. However, the D-RRT* algorithm further extends the exploration tree via the dynamic window approach to avoid collision between an a priori path and obstacles. The algorithm subsequently obtains a new path through dynamic and non-continuous backtracking from the endpoint to the starting point. A hybrid process combining the RRT*, S-RRT*, and D-RRT* algorithms is designed to plan the assembly path for complex products in several cases. The performances of these algorithms are compared, and simulations indicate that the S-RRT* and D-RRT* algorithms are signiﬁcantly superior to the RRT* algorithm in terms of the efﬁciency and success ratio of APP. Therefore, hybrid path planning combining the three algorithms is helpful to improving the assembly path planning of complex products.

APP consumes considerable time when there is a significant number of parts. Thus, some methods have been researched to improve its efficiency [20]. APP finds collision-free short paths from the initial location to the final position [20,21], which is similar to path planning for robots, vehicles, and drones, among other technologies [22][23][24][25][26][27]. Hassan et al. proposed a novel near-optimum APP algorithm based on the particle swarm optimization approach to solve the obstacle-free APP process in a 3D haptic-assisted environment [28]. Wei et al. proposed a centroidal Voronoi tessellation (CVT) for the intelligent control of self-assembly path planning of swarm robots [29]. Masehian et al. presented a new simple greedy heuristic method to solve the assembly sequence and path planning problem; the method tries to locally minimize geometric interference between parts being assembled along the main directions in each iteration, and it employs a sampling-based stochastic path planner to arrange short paths for parts while avoiding workspace obstacles [20]. Morato et al. presented a technique that combines motion planning and part interaction clusters based on multiple rapidly exploring random trees to improve the generation of assembly precedence constraints [30]. These studies are beneficial for improving the efficiency of path planning. However, most of the APP methods mentioned above involve a large amount of repeated computation, leading to low planning efficiency and high costs when generating the assembly path through all parts.
In these studies, the rapidly exploring random tree (RRT) is a typical random sampling algorithm in path planning which explores free space by generating leaf nodes randomly and uniformly to expand a tree structure. A collision-free path is obtained by backtracking from the leaf node to the parent node in sequence when a leaf node reaches the target area [30,31]. The randomness of the sampling points makes it difficult to obtain the optimal path even if the number of sampling points is sufficient. Therefore, the rapidly exploring random tree star (RRT*) algorithm is one algorithm that has been proposed to improve the RRT algorithm, making the path cost lower by improving the nearest point selection strategy [23,32]. 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 assembly planning, the final positions of the assembled parts are in close proximity, although their initial positions are different. Hence, most of the assembly paths overlap or partially overlap, meaning that parts of these paths are repeatedly planned. Therefore, finding and reusing the planned paths is a feasible way to reduce repeated planning and improve planning efficiency [33,34]. The difference in initial part positions in the assembly presents a challenge for the direct reuse of the planned paths as a whole. Accordingly, the assembly paths must be segmented for effective reuse. Therefore, a hybrid path planning method based on the improved RRT* algorithm is proposed in this paper to plan the motion segments as paths with different starting points and the same target point by reusing the planned paths.
The rest of this paper is organized as follows. The establishment of the configuration space for path planning is introduced in Section 2. In Section 3, the static RRT* (S-RRT*) and dynamic RRT* (D-RRT*) algorithms are proposed, and the hybrid path planning method based on the improved RRT* algorithm is illustrated in detail. A case study is provided in Section 4 to compare and analyze the RRT*, S-RRT*, and D-RRT* algorithms. Section 5 concludes the paper.

Segmentation of the Assembly Path
A position near the product assembly is defined as the target position. All the parts are moved from their initial positions to the target position and then assembled in the final positions. Therefore, an assembly path is divided into two segments: a motion segment from the initial position to the target position and an assembly segment from the target position to the final position, as shown in Figure 1.
The motion segment is arranged by reusing the planned path, and the assembly segment is directly planned. Combining the planning results of the two segments reduces repeated planning of the same or similar paths and improves the success ratio.

Part Shrinkage and Obstacle Expansion
There are many parts and obstacles in the assembly space of a complex product, which leads to high-complexity collision detection. Consequently, the assembly space is typically mapped to a configuration space for unified modelling before path planning. However, a substantial number of components with different shapes and sizes makes path planning a sizeable task if a new configuration space is created for each part. Therefore, the configuration space must be constructed reasonably and efficiently to support reusable path planning.
In path planning based on collision detection, a part is typically described with a bounding volume. The circumscribed sphere of a part is selected as its bounding sphere to simplify the description and calculation. In the equivalent transformation from the assembly space to the configuration space, the part shrinks according to the radius of its bounding sphere. All obstacle outlines are correspondingly expanded with the same radius (see Figure 2). In this way, path planning for a part in the assembly space is transformed into finding a noninterference path in the configuration space.

Establishment of the a Priori Path and a Priori Tree
An a priori path P prior is a planned assembly path for a part, which is expressed as a linked list as shown in Equation (1): where each p i is a node of the a priori path, and p 1 and p n are the start and end nodes corresponding to the part's initial position and target position, respectively. A priori paths with different start nodes and the same end node form an a priori tree, where the leaf node is the start node of each path, the root node is the end node of all paths, and a branch from the leaf node to the root node is an a priori path, as shown in Figure 3. The reuse of an a priori path can be transformed into the search for an appropriate node of the a priori tree. A node on the a priori tree may belong to different paths, and the number of such paths reflects its "importance", which is defined as the weight of the node. The weight increases as the number of paths increases. The weight w i of node p i is defined as where n i is the number of a priori paths crossing node p i , and n is the total number of a priori paths. As shown in Equation (2), when the number of a priori paths crossing node p i becomes bigger, the weight of node p i also becomes bigger, which means that node p i becomes more "important" among all the a priori paths.

Expansion of the a Priori Space
The path planning algorithm based on random sampling extends the path by generating random points in the configuration space. If the a priori tree is only described using its nodes, the probability that the sampling points generated randomly coincide with the nodes is notably small, which makes finding and reusing the planned paths challenging. To solve this problem, the a priori tree is converted to an a priori space by expanding its nodes and branches, improving the reusability of the a priori paths.
Since the weight of a node expresses its "importance", the expansion radius r i of node p i is positively related to its weight; that is, where d is the minimum distance between the nodes of the a priori path. According to Equation (3), when the weight of a node increases, this means that the number of a priori paths crossing node p i increases, the radius of node p i is greater, and the part of the a priori space of this node is larger. Node p i is expanded by constructing a circle with p i as the center and r i as the radius. External common tangents of every two adjacent circles are connected in turn. Figure 4 displays the space composed of all circles and common external tangents, which is the a priori space expanded from the a priori tree.

Algorithms for Path Reuse
The RRT algorithm is widely used in path planning; it randomly generates sampling points in the configuration space based on a tree structure and explores the configuration space according to the given steps. In theory, any point in the configuration space can be reached through the nodes of the tree in a specific sequence. Therefore, the RRT algorithm was used as the basis of the algorithms studied in this paper.

RRT* algorithm for new path planning
It is difficult for the RRT algorithm to find the optimal path due to the randomness of the sampling points. As a result, the RRT* algorithm was proposed to lower the path cost by improving the nearest point selection strategy [31] of the RRT algorithm. The basic process of the RRT* algorithm is consistent with that of the RRT algorithm, and the main improvement is the strategy of adding new nodes and branches to the exploration tree.
In the early stage of APP, the RRT* algorithm is adopted because there is no a priori path to be reused. The key steps of the RRT* algorithm are as follows: Step 1: Point p rand is randomly generated in the configuration space C.
Step 2: Node p near closest to p rand is selected from the exploration tree with a connecting line, and a point on this line with a distance s (extension step of the exploration tree) from p near is subsequently taken as a new leaf node, p new .
Step 3: The nearest node set ps near is constructed with the nodes of the exploration tree in a certain range centered on p new .
Step 4: Node p min is found as the parent of p new by traversing ps near , through which p new is connected to the exploration tree with the minimum path cost.
Step 5: p new and p min are added to the node set, and the branch connecting them is added to the branch set.
Compared to the RRT algorithm, it is similarly difficult for the RRT* algorithm to plan an assembly path with lower cost in a short time due to the excessive calculations.

2.
S-RRT* algorithm for static reuse of a priori paths In the assembly of a new part, if there is an assembled part whose bounding sphere is not smaller than that of the new part, its configuration space can be utilized for path planning of the new part without any modification. Therefore, the path of the part can be directly reused as an a priori path to improve the planning efficiency. An S-RRT* algorithm (an improved RRT* algorithm statically reusing the a priori paths) is proposed in this case.
The main improvement of the S-RRT* algorithm is reusing the a priori paths after the exploration tree T explore is extended to the a priori space C prior . The S-RRT* algorithm aside from this reuse is consistent with the RRT* algorithm. The main steps of the S-RRT* algorithm are as follows: Step 1: A new leaf node p new is generated on the line that connects the random point p rand and its nearest node p near , with a distance of s (expansion step) from p near .
Step 2: p new is checked to confirm whether it is in the obstacle space C obstacle . If so, the algorithm returns to Step 1; otherwise, the algorithm continues to the next step.
Step 3: p new is checked to verify whether it is in C prior . If so, the exploration tree has been extended to the a priori space, and the algorithm goes to the next step; otherwise, the algorithm returns to Step 1.
Step 4: Two nodes p connect1 and p connect2 are selected from the a priori tree T prior and the exploration tree T explore , respectively, according to p new to connect the two trees.
Step 5: The new branch E new connecting p connect1 and p connect2 is added to T explore , and a new path p new is planned by backtracking from the end node p end to the start node p start and added to the a priori path set PS prior .
Step 6: After sampling N times, the cost of each new path in PS prior is calculated, and the path with the lowest cost P min is selected as the final path.
The pseudo-code of the S-RRT* algorithm is shown in Algorithm 1.

Algorithm 1
The static rapidly exploring random tree star (S-RRT*) algorithm.
Input: C plan , C obstacle , C prior , p start , p end , S, N, T prior , T explore Result: A path P min with the minimum cost from p start to p end T explore .init (); PS prior .init (); for n = 1 to N do { p rand ←Sample (C plan ); p near ←Near (p rand , T explore ); p new ←Steer (p rand , p near , S); if CollisionFree(C obstacle , p new ) then { P near ←Near (x new , T explore ); p min ←SelectParentNode (P near , p near , p new ); T explore .AddEdge (Edge (x min , p new )); T explore .Rewire(); if InPriorSpace (C prior , p new ) then { p connect1 , p connect2 ←ConnectNode (T explore , T prior , p new ); E new .AddEdge (p connect1 , p connect2 ); p new ←PathBacktrack (T explore , T prior , p connect1 , p connect2 ) PS prior .AddPath (p new ); } } } P min ←MinCostPath (PS prior ); return P min ; A path planned using the S-RRT* algorithm is shown in Figure 5. In this figure, a new assembly path is established, the part of the a priori path from p connect1 to p end is reused, and the path from p start through p connect1 to p end is the final path generated by the S-RRT* algorithm. Compared with the RRT* algorithm, the S-RRT* algorithm generates a path with fewer sampling times by reusing the a priori path, which helps to improve the efficiency and success ratio of APP for complex products.

D-RRT* algorithm for dynamic reuse of a priori paths
When assembling a new part, if the bounding sphere of the assembled part is smaller than that of the new part, its configuration space cannot be used for path planning of the new part. This is because the expansion of the new part's obstacles is more extensive than that of the assembled part. The more formidable obstacles may interfere with the a priori path and lead to the failure of path planning using the S-RRT* algorithm. Therefore, a D-RRT* algorithm (an improved RRT* algorithm dynamically reusing the a priori path) is proposed to solve this problem. The main improvement of the D-RRT* algorithm is the utilization of the dynamic window approach [32] and further extension of the exploration tree to avoid interference between the a priori path and the obstacles after the connection node pair is found. The a priori path is reused non-continuously through dynamic backtracking to obtain the new path. The main steps of the dynamic backtracking of the a priori path are as follows: Step 1: Two connection nodes p connect1 and p connect2 are selected from the a priori tree T prior and the exploration tree T explore , respectively, as for the S-RRT* algorithm.
Step 2: p connect1 and its parent node p parent are connected with a line to check whether the line interferes with obstacles. If there is no interference, p parent is added to the new path, and the algorithm goes to Step 4; otherwise, the algorithm proceeds to Step 3.
Step 3: The local path from p connect1 to p parent is planned and added to the new path.
Step 4: p connect1 and p parent are updated with p parent and its parent node, respectively, which expands the exploration tree along the a priori path.
Step 5: p connect2 is checked to determine whether it is the end node. If the end node is identified, a new path P new is planned by backtracking from the end node p end to the start node p start ; otherwise, the algorithm returns to Step 2.
The pseudo-code of the dynamic backtracking of the a priori path is shown in Algorithm 2.
Algorithm 2 Dynamic backtracking of the a priori path.
Input: T prior , T explore , p connect1 , p connect2 , C obstacle , S Result: A path P new without collision from p connect1 to p connect2 DynamicBacktracking(T prior , T explore , p connect1 , p connect2 , C obstacle , S) { p current ←p connect1 ; p parent ←p current .parentNodeInPriorTree (); for j = 1 to N do { if CollisionFree (C reusable , C obstacle , p current , p parent ) then{ P prior .addNode (p current , p parent ); P prior .addEdge (Edge (p current , p parent )); } else{ P local ←LocalPath (p current , p parent ); P prior ←addLocalPath (P local ); } p current ←p parent ; p parent ←p parent . parentNodeInPriorTree (); if p parent = p connect2 then { return P prior ; } } } A path planned using the D-RRT* algorithm is shown in Figure 6. There is an obstacle in Figure 6 that did not appear in Figure 5, which occurs in the part of the a priori path from p connect1 to p end , and the D-RRT* algorithm can establish new assembly paths in this situation. Thus, a new assembly path was generated by D-RRT* from p start through p connect1 to p end . The D-RRT* algorithm avoids obstacles by using dynamic backtracking and local path planning, which helps efficiently obtain an optimal assembly path without additional interference.

4.
Hybrid process of the three algorithms Using the three abovementioned algorithms, a hybrid process based on a priori path reuse was designed for assembly path planning, as presented in Figure 7.

Comparison and Analysis
To analyze the performance of the RRT*, S-RRT*, and D-RRT* algorithms in the same case, a comparison is provided in this section. D-RRT* can also be applied in a situation in which there is no obstacle in the prior path, since it is an algorithm based on S-RRT* which can establish new path plans in the presence of obstacles, illustrated in detail in Section 3. Thus, a suitable case must be prepared to test the performance and make comparisons for the three algorithms. Assuming some a priori paths in the configuration space, the three algorithms mentioned above were used to plan the assembly path from the same starting point to the same endpoint, and one of the results is shown in Figure 8. Information relating to Figure 8 is presented in Table 1.  The randomness of sampling points in the three algorithms leads to large differences in the results of path planning, even with the same start and end points. Therefore, each algorithm was executed 100 times, and the averages of the minimum number of sampling points, the path length, and the running time of the three algorithms were compared, as illustrated in Table 2.  Table 2 demonstrates that the minimum numbers of sampling points for the S-RRT* algorithm and the D-RRT* algorithm were only 1/4 and 1/3 that for the RRT* algorithm, respectively, and their path length and running time were also less than those of the RRT* algorithm. The performance of the D-RRT* algorithm means that it is not as useful as the S-RRT* algorithm due to the additional sampling strategy.
Considering that the start position of each part of a complex product is different in the assembly space, 50 starting points were randomly generated in the configuration space for the path planning simulation. The RRT*, S-RRT*, and D-RRT* algorithms were used to plan the assembly path for each starting point with different maximum numbers of sampling points. The number of successfully planned paths was used to calculate the path planning success ratio for multiple starting positions with the specified maximum number of sampling points, as shown in Table 3.  Table 3 confirms that as the maximum number of sampling points increased, the success ratios of the three algorithms also increased. When the maximum number of sampling points was small, the success ratios of the S-RRT* algorithm and the D-RRT* algorithm were considerably greater than those of the RRT* algorithm. The success ratios of these three algorithms are also shown in Figure 9. The minimum numbers of sampling points and the total running times of the three algorithms are specified in Table 4 for the aforementioned path plans.  Table 4 shows that the minimum numbers of sampling points and the total running times of the S-RRT* and D-RRT* algorithms in APP for batch parts are much smaller than those of the RRT* algorithm.
Thus, the results of the figures and tables above can explain the advantages and disadvantages of RRT*, S-RRT*, and D-RRT*. The RRT* algorithm is employed to establish an assembly path without any a priori data, which requires many more sampling points and much more computing time than S-RRT* and D-RRT*. The S-RRT* algorithm is the fastest and the most efficient when compared to RRT* and D-RRT*, but it strictly demands a priori paths and stability in the sizes of new parts. The D-RRT* algorithm can establish assembly paths when there are new obstacles interfering with the a priori paths. However, D-RRT* still needs more sampling data and calculating time than S-RRT*, and a priori paths are required as well.

Conclusions
APP for complex products is tedious and repetitive work. A hybrid planning method that reuses a priori paths was proposed in this paper to improve the efficiency and success ratio of path planning. In this method, the assembly path is divided into motion segments and assembly segments to improve the reusability of the path, and the feasibility of the motion segment is analyzed. An a priori path set is established according to the planned assembly paths; on this basis, an a priori tree is established. An a priori space is created by expanding the a priori tree according to the bounding sphere of the part to be assembled, which establishes a foundation for path reuse.
Three algorithms improving upon the RRT algorithm were examined for path planning based on a priori path reuse. The RRT* algorithm establishes the exploration tree of the new path in the early planning stage when there is no a priori path to reuse. The S-RRT* and D-RRT* algorithms are utilized after the exploration tree of the new path is extended to the a priori space according to a comparison of bounding spheres between the part to be assembled and the part corresponding to the a priori path. If the former's bounding sphere is not greater than the latter's, the S-RRT* algorithm finds a pair of connection points to establish a connection between the exploration tree and the a priori tree and obtain a new path through direct backtracking from the endpoint to the starting point. Otherwise, the D-RRT* algorithm extends the exploration tree via the dynamic window approach after finding the connection point pair to avoid interference between the a priori path and the obstacles, and a new path is obtained through dynamic and non-continuous backtracking.
The RRT*, S-RRT*, and D-RRT* algorithms were compared in terms of their minimum number of sampling points, path length, and running time in single-start assembly path planning. The success ratio, minimum number of sampling points, and running time in multistart assembly path planning were also compared. The results show that the S-RRT* and D-RRT* algorithms are significantly better than the RRT* algorithm due to the reuse of the a priori paths. Therefore, hybrid path planning combining the three algorithms is helpful to improving the efficiency and success ratio of the assembly path planning of complex products.

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