## 2 Materials and Methods
### Experimental Design and Introduction
#### 2.1.2 Robotic Arm's Forward Kinematics  
To analyze the motion of the robot arm, the coordinate system relationship of the robot arm must be defined first. The homogeneous transformation matrix proposed by [PERSON] (the D-H method) is commonly used to analyze the coordinate system transformation between each axis of the robot arm. In this study, the robotic arm has four degrees of freedom, and the relationship between the coordinate systems is shown in Figure 4. The coordinate system \((XYZ)_{i}\)\(i=0\ldots N\) on each rotary axis is defined according to the D-H method and the parameters recorded in the D-H parameter table, as shown in Table 2.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline \(\theta_{i}\) (Degree) & **d (Meter)** & **a (Meter)** & **\(\alpha\) (Degree)** \\ \hline \(\theta_{1}-90\) & 0 & 0 & 90 \\ \(\theta_{2}+90\) & 0 & 0 & \(-90\) \\ \(\theta_{3}\) & 0.29 & 0 & 90 \\ \(\theta_{4}+90\) & 0 & 0.27 & 0 \\ \hline \hline \end{tabular}
\end{table}
Table 2: D-H parameter table for four-degrees-of-freedom robot arm.  
Figure 4: Schematic diagram of the relationship of the robotic arm coordinate system.  
Figure 3: Schematic diagram of the complete structure of the robotic arm.  
As an example in this paper, the four-degrees-of-freedom robotic arm is defined as a matrix with the coordinate conversion relationship, and the D-H homogenous transform matrix \({}^{i}A_{i+1}\) is shown in (1):  
\[{}^{i}A_{i+1} =Rot(Z_{i-1}\theta_{i})\times Trans(0,0,d_{i})\times Trans(a_{i},0, 0)\times Rot(X_{i-1}a_{i}) \tag{1}\] \[=\left[\begin{array}{cccc}\cos(\theta_{i})&-\sin(\theta_{i}) \cos(\alpha_{i})&\sin(\theta_{i})\sin(\alpha_{i})&a_{i}\cos(\theta_{i})\\ \sin(\theta_{i})&\cos(\theta_{i})\cos(\alpha_{i})&-\cos(\theta_{i})\sin(\alpha _{i})&a_{i}\sin(\theta_{i})\\ 0&\sin(\alpha_{i})&\cos(\alpha_{i})&d_{i}\\ 0&0&0&1\end{array}\right]\]  
where:  
\(\theta_{i}:Z_{i-1}\)-axis rotation angle,  
\(d_{i}:Z_{i-1}\)-direction, distance of translation,  
\(a_{i}:X_{i-1}\)-direction, distance of translation,  
\(\alpha_{i}:X_{i-1}\)-axis rotation angle.  
By using (1), the homogeneous transformation matrix of each joint is constructed, and the transformation matrix of each joint is multiplied in order to calculate the transformation relationship between the end-point coordinate system and the origin (\(P_{0}\)), as in Equation (2):  
\[P_{0}={}^{0}A_{1}{}^{1}A_{2}{}^{2}A_{3}{}^{3}A_{4}P_{4} \tag{2}\]  
where:  
\[{}^{0}A_{1}=\begin{bmatrix}\cos(\theta_{1})&0&\sin(\theta_{1})&0\\ \sin(\theta_{1})&0&-\cos(\theta_{1})&0\\ 0&1&0&0\\ 0&0&0&1\end{bmatrix} \tag{3}\]  
\[{}^{1}A_{2}=\begin{bmatrix}\cos(\theta_{2})&0&-\sin(\theta_{2})&0\\ \sin(\theta_{2})&0&\cos(\theta_{2})&0\\ 0&-1&0&0\\ 0&0&0&1\end{bmatrix} \tag{4}\]  
\[{}^{2}A_{3}=\begin{bmatrix}\cos(\theta_{3})&0&\sin(\theta_{3})&0\\ \sin(\theta_{3})&0&-\cos(\theta_{3})&0\\ 0&1&0&d_{3}\\ 0&0&0&1\end{bmatrix} \tag{5}\]  
\[{}^{3}A_{4}=\begin{bmatrix}\cos(\theta_{4})&-\sin(\theta_{4})&0&a_{4}\cos( \theta_{4})\\ \sin(\theta_{4})&\cos(\theta_{4})&0&a_{4}\sin(\theta_{4})\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix} \tag{6}\]  
To calculate the end position vector of the robot arm, substitute into Equation (2) to obtain the coordinates of its end, as shown in Equation (7):  
\[\begin{bmatrix}x\\ y\\ z\\ 1\end{bmatrix}=\begin{bmatrix}-a_{4}\cos(\theta_{4})(\sin(\theta_{1})\sin( \theta_{3})-\cos(\theta_{1})\cos(\theta_{2})\cos(\theta_{3}))-d_{3}\cos( \theta_{1})\sin(\theta_{2})-a_{4}\cos(\theta_{1})\sin(\theta_{2})\sin(\theta_{4 })\\ a_{4}\cos(\theta_{4})(\cos(\theta_{1})\sin(\theta_{3})+\cos(\theta_{2})\cos( \theta_{3})\sin(\theta_{1}))-d_{3}\sin(\theta_{1})\sin(\theta_{2})-a_{4}\sin( \theta_{1})\sin(\theta_{2})\sin(\theta_{4})\\ d_{3}\cos(\theta_{2})+a_{4}\cos(\theta_{2})\sin(\theta_{4})+a_{4}\cos(\theta_{3}) \cos(\theta_{4})\sin(\theta_{2})\end{bmatrix} \tag{7}\]