# Three-Dimensional Active Magnetic Levitation Actuating and Control System for Curved Pipes
## 6 Trajectory Planning Method of Three-Dimensional Actuation  
The center line of the curved pipes is used as the original trajectory of trajectory planning, and the motion of the end of the mechanical arm in three dimensions is taken as the absolute position change, and the motion of the mechanical structure of the two-dimensional maglev actuating system in three dimensions is taken as the relative position change. Based on these standards, the original trajectory of the magnetic ball is planned in three dimensions. The actuating process is as follows:  
1. The levitating positions of the two-dimensional maglev actuating system and the magnetic ball are roughly adjusted by the driving of the mechanical arm.
2. The positions of the ball are fine-adjusted in the form of compensation by the two-dimensional maglev actuating system.
3. In the right-angle bending, the translation and rotation of the mechanical arm are adopted to realize the actuation.  
The algorithm of \"rough adjustment of the ball position initially, fine adjustment of the ball position for position compensation, alternately actuation by rotation and translation in the bending\" is adopted in this paper. The core idea of the algorithm is as follows:  
1. The shape of the pipe is judged, and the core line of the pipe is taken as the target curve of the magnetic ball.
2. First, the actual coordinates (\(X_{V}\), \(Y_{V}\), \(Z_{V}\)) are compared with the destination coordinates (\(X_{E}\), \(Y_{E}\), \(Z_{E}\)) to determine the step feeds in the \(X\), \(Y\), and \(Z\) directions. Then, the actual positions of \(X\), \(Y\), and \(Z\) directions are adjusted by the system according to the step feed. Repeat the above process until the \(X\), \(Y\), and \(Z\) coordinates of the ball reach the target position in the curve.
3. When the target curve is \(90^{\circ}\) right-angle bending, the iterative step number \(N\) is calculated according to the starting position, the target position, and the step length of the mechanical arm. The single-step rotation angle \(\theta_{\rm single}\) is calculated according to the iteration step number \(N\). The cycle iteration of \(N\) times is carried out with \"one step forward in \(Y\) direction, one rotation at \(\theta_{\rm single}\), and one step forward in \(X\) direction\" as a cycle so that the ball reaches the target coordinates of \(X\), \(Y\), and \(Z\) directions.  
The algorithm flow chart is shown in Figure 16, where step\({}_{\rm m}\) denotes the unit step length of the mechanical arm; step\({}_{V}\) denotes the unit step length of the ball offset in the two-dimensional maglev actuating system; step\(X_{M}\), step\(Y_{M}\), and step\(Z_{M}\) represent the feed step of the mechanical arm in \(X\), \(Y\), and \(Z\) directions; step\(X_{V}\), step\(Y_{V}\), and step\(Z_{V}\) represent the relative offset feed step of the ball in \(X\), \(Y\), and \(Z\) directions in the two-dimensional maglev actuating system; (\(X_{\rm MS}\), \(Y_{\rm MS}\), \(Z_{\rm MS}\)) denote the starting position of the mechanical arm; and (\(X_{\rm ME}\), \(Y_{\rm ME}\), \(Z_{\rm ME}\)) denote the target position of the mechanical arm. (\(X_{\rm VS}\), \(Y_{\rm VS}\), \(Z_{\rm VS}\)) denote the relative starting position of the ball in the two-dimensional maglev actuating system, (\(X_{\rm VE}\), \(Y_{\rm VE}\), \(Z_{\rm VE}\)) denote the relative target position of the ball in the two-dimensional maglev actuating system, and (\(X_{\rm E}\), \(Y_{\rm E}\), \(Z_{\rm E}\)) = (\(X_{\rm MS}+X_{\rm VS}\), \(Y_{\rm MS}+Y_{\rm VS}\), \(Y_{\rm MS}+Y_{\rm VS}\)).  
Figure 16: Algorithm flow chart.