# Optimization Algorithm for 3D Smooth Path of Robotic Arm in Dynamic Obstacle Environments
## 3 Method Description
### Static Path Planning Module
If obstacles exist between a newly expanded node of the random tree and its parent node, it indicates that obstacles are present in this direction. At this point, the expansion deviation angle is initialized, and as the number of consecutive collisions to escape obstacles increases, the expansion deviation angle is gradually increased in the direction of the random sampling point. Here, \(q_{\text{init}}\) represents the initial point, \(q_{\text{new}}\) is the next node of the random tree, \(q_{\text{near}}\) is the node closest to the random point, \(s\) is the step size, \(q_{\text{goal}}\) is the target point, \(q_{\text{rand}}\) is the random sampling point, \(\beta_{\text{init}}\) is the initial deviation angle, and \(j\) is the number of consecutive collisions. As shown in Figure 2, the position of the new node \(q_{\text{new}}\) is obtained by taking unit step sizes of \(s\times\cos\beta\) and \(s\times\sin\beta\) from \(q_{\text{near}}\) along the directions of \(q_{\text{goal}}\) and \(q_{\text{rand}}\), respectively. The aforementioned adaptive angle guidance strategy for the search tree enhances the directionality of the tree's expansion by increasing sensitivity to the target direction, thereby reducing blind expansion into ineffective areas in space. However, there may still be removable redundant nodes in the generated path. In this paper, we perform redundancy removal on the initial path obtained through the adaptive angle guidance of the search tree, aiming to identify and remove redundant nodes on the path. The specific operational process is as follows:  
1. After successfully planning a path from the start point to the target end point using the aforementioned method, we proceed with the redundancy removal operation. The target end point is regarded as the initial reference point. Since there are no obstacles between it and its parent node, we begin the redundancy detection with its second-level parent node (i.e., the parent of the parent node). At this point, the second-level parent node is called the redundancy detection end point, the parent node is called the point to be tested for redundancy, and the initial reference point is called the redundancy detection start point. 2. Connect the redundancy detection end point with the redundancy detection start point and check if there are any obstacles on the connecting path. 3. If it is determined that there are no obstacles on the connecting path, the point to be tested for redundancy is deemed to be in an optimizable state and is deleted. The redundancy detection end point is then set as the new redundancy detection start point. Conversely, if obstacles are present, the point to be tested for redundancy is considered to be in a non-deletable state and is taken as the new redundancy detection start point, while its parent node becomes the new point to be tested for redundancy. 4. Repeat steps 2 and 3 cyclically until the point to be tested for redundancy is the start point. 5. Connect the remaining nodes one by one to obtain the final path without redundant nodes after applying the back-to-source update strategy. The schematic diagram of path simplification is shown in Figure 3. The initial path is \"source node->1->2->3->4->target point\", and the path after removing redundant points is \"source node->1->2->3->target point\", which reduces the number of path nodes and achieves the path simplification strategy. Figure 2: Random search tree node expansion. After applying efficient guided search tree node optimization and path simplification strategies, there may still be some turning points in the generated path that can affect the stability of a robotic arm, potentially causing vibrations and shortening its operational lifespan. To address this issue, after using the improved rapidly exploring random tree star (RRT*) algorithm for path planning, the Catmull-Rom trajectory modification algorithm is employed to smooth the path. Catmull-Rom achieves curve processing by controlling the natural transition between control points.