# Orbital-Based Automatic Multi-Layer Multi-Pass Welding Equipment for Small Assembly Plates
## 3 Equipment Debugging and Simulation Analysis
### Simulation Analysis of the Robotic Arm
#### 3.2.1 Kinematic Analysis of the Robotic Arm
 \tag{25}\]  
In Equation (22), \(Rot(z,\theta_{i})\) and \(Rot(x,\alpha_{i})\) represent the transformation matrices for rotations about the Z and X axes by certain joint angles, respectively. \(Trans(z,d_{i})\) and \(Trans(x,\alpha_{i})\) represent the transformation matrices for translations along the Z and X axes by certain distances, respectively. In Equation (25), \(p_{x}\), \(p_{y}\), and \(p_{z}\) are spatial vectors that indicate the position of the robotic arm along the X, Y, and Z axes in space, forming spatial coordinate points. By expanding and solving the above analytical equations, we obtain the unique solution (26):  
\[{}_{6}^{0}T= \begin{bmatrix}-1&0&0&0\\ 0&-1&0&0\\ 0&0&1&939\\ 0&0&0&1\end{bmatrix}  \tag{26}\]  
To solve the inverse kinematics, the method of separating variables is employed. Both sides of the equation are multiplied by the inverses of the corresponding matrices to compute the solutions. The solved joint angles \(\theta_{1}-\theta_{6}\) are (\(30^{\circ}\), \(30^{\circ}\), \(45^{\circ}\), \(45^{\circ}\), \(60^{\circ}\), \(60^{\circ}\)), and the solutions are shown in Table 7.  
Discarding inaccurate solutions, we select the optimal solution that best fits the robotic arm's pose, which is the first set of solutions. Another method for obtaining the inverse solution is the Newton-Raphson iterative method. First, we establish the nonlinear kinematic equations as shown in (27):  
\[F(x)=f(x)-P_{d}=0 \tag{27}\]  
In Equation (27), \(f(x)\) represents the forward kinematics of the robotic arm, and \(P_{d}\) represents the desired pose of the end effector. Let \(\mathbf{r}\) be the root of \(F(x)=0\), and \(x_{0}\) is chosen as the initial approximation of \(\mathbf{r}\). By drawing the tangent line \(\mathbf{L}\) to the curve \(y=f(x)\) at the point \((x_{0},f(x_{0}))\), which intersects the \(x\)-axis, we obtain the tangent Equation (28):  
\[y=f(x_{0})+f^{\prime}(x_{0})(x-x_{0}) \tag{28}\]  
The intersection point \(x_{1}\) with the \(x\)-axis is calculated, and then subsequent intersection points are iteratively found until the value approaches zero. The iterative formula for the k-th iteration is given by the following Equation (29):  
\[x_{k+1}=x_{k}-\frac{F(x_{k})}{F^{\prime}(x_{k})} \tag{29}\]  
In Equation (29), \(F^{\prime}(x_{k})\) represents the Jacobian matrix of the equation. In MATLAB 2022a, the maximum number of iteration steps and the error threshold are defined, and the current joint angles are set as the initial iteration angles to obtain a nonlinear twelve-dimensional error equation set. Running the iteration of Equation (29) computes the next joint angles and updates the nonlinear equations; the while loop exits when the maximum number of iterations is reached. The transformed Equation (25) is expressed as Equation (30):  
\[{}^{0}_{6}T={}^{0}_{1}T{}^{1}_{2}T{}^{2}_{3}T{}^{3}_{4}T{}^{4}_{5}T{}^{5}_{6}T = \begin{pmatrix}{}^{0}_{6}R&{}^{0}_{6}P\\ {}^{0}_{6}R&{}^{0}_{6}P\\ {}^{0}_{6}R&{}^{0}_{6}P\end{pmatrix}  \tag{30}\]  
In Equation (30), \({}^{0}_{6}R\), and \({}^{0}_{6}P\) represent the rotational component and positional component of the robotic arm's end-effector pose relative to the base, respectively. They are used to construct twelve-dimensional nonlinear equations of forward kinematics. The Jacobian matrix is constructed as shown in Equation (31):  
\[Jac= \begin{bmatrix}\frac{\delta p_{x}}{\delta p_{1}}&\frac{\delta p_{x}}{ \delta p_{2}}&\dots&\frac{\delta p_{x}}{\delta p_{6}}\\ \frac{\delta p_{y}}{\delta p_{1}}&\frac{\delta p_{y}}{\delta p_{2}}&\dots& \frac{\delta p_{y}}{\delta p_{6}}\\ \frac{\delta p_{1}}{\delta p_{1}}&\frac{\delta p_{2}}{\delta p_{2}}&\dots& \frac{\delta p_{y}}{\delta p_{6}}\\ \frac{\delta p_{1}}{\delta p_{1}}&\frac{\delta p_{1}}{\delta p_{2}}&\dots& \frac{\delta p_{y}}{\delta p_{6}}\\ \vdots&\vdots&\dots&\vdots\\ \frac{\delta p_{y}}{\delta p_{1}}&\frac{\delta p_{y}}{\delta p_{2}}&\dots& \frac{\delta p_{y}}{\delta p_{6}}\\ \end{bmatrix}  \tag{31}\]