# Design of a Four-Axis Robot Arm System Based on Machine Vision
## 2 Kinematic Analysis and Design of Robotic Arms
### Positive Kinematic Analysis of the Robotic Arm  
Positive kinematic analysis of the robotic arm refers to obtaining the position of the end of the robotic arm relative to the reference coordinate system based on these angles and information about the connecting rod [22], given that the rotation angles of the motor at each joint between the robotic arms are known. The structure of the four-axis robotic arm in this paper is shown in Figure 5 where Joint0 is the base coordinate system of the robotic arm, Joint1, Joint2, and Joint3 are all rotational joints, and Joint4 is the wrist joint.  
Figure 4: The movement space of the robotic arm.  
Figure 3: Robotic arm workspace.  
The following equation for the positive kinematics of a 4-degree-of-freedom robotic arm is derived. Firstly, according to the transformation matrix, the linkage can be defined as:  
\[\begin{array}{c}{}^{1}_{0}T=R_{Z}(\gamma)=\begin{bmatrix}\cos(\gamma)&\sin( \gamma)&0&0\\ \sin(\gamma)&\cos(\gamma)&0&0\\ 0&0&0&0\\ 0&0&0&1\end{bmatrix}\end{array} \tag{1}\]  
\[\begin{array}{c}{}^{1}_{2}T=R_{x}(90^{\circ})*R_{Z}(\alpha)=\begin{bmatrix} \cos(\alpha)&-\sin(\alpha)&0&0\\ 0&0&1&0\\ -\sin(\alpha)&-\cos(\alpha)&0&0\\ 0&0&0&1\end{bmatrix}\end{array} \tag{2}\]  
\[\begin{array}{c}{}^{2}_{3}T=D_{x}(l_{2})*R_{Z}(\beta)=\begin{bmatrix}\cos( \beta)&-\sin(\beta)&0&l_{2}\\ \sin(\beta)&\cos(\beta)&0&0\\ 0&0&0\\ 0&0&0&1\end{bmatrix}\end{array} \tag{3}\]  
\[\begin{array}{c}{}^{3}_{4}T=D_{x}(l_{3})=\frac{2}{3}T=D_{x}(l_{2})*R_{Z}( \beta)=\begin{bmatrix}1&0&0&l_{3}\\ 0&0&0&0\\ 0&0&0&0\\ 0&0&0&1\end{bmatrix}\end{array} \tag{4}\]  
Based on the already defined linkage coordinate system and the corresponding linkage parameters, the transformation matrix of the tool coordinate system with respect to the base coordinate system can be derived from the following equation:  
\[\begin{array}{c}{}^{0}_{4}T={}^{0}_{1}T*\frac{1}{2}T*\frac{2}{3}T*\frac{3}{4} T\end{array} \tag{5}\]  
Transforming the above equation yields the following equation:  
\[\begin{array}{c}{}^{0}_{4}T=R_{Z}(\gamma)\;*\;R_{x}(90^{\circ})\;*\;R_{Z}( \alpha)\;*\;D_{x}(l_{2})\;*\;D_{x}(l_{2})*R_{Z}(\beta)\;*D_{x}(l_{3})\end{array} \tag{6}\]  
Figure 5: The schematic diagram for positive kinematic analysis of the robotic arm.  
Expanding the above equation yields:  
\[\begin{array}{c}0\\ 4\end{array}T=\begin{bmatrix}c_{1}*c_{23}&-c_{1}*s_{23}&0&c_{1}*(l_{3}*c_{23}+l_{ 2}*c_{2})\\ s_{1}*c_{23}&-s_{1}*s_{23}&c_{1}&s_{1}*(l_{3}*c_{23}+l_{2}*c_{2})\\ s_{23}&c_{23}&0&l_{3}*s_{23}+l_{2}*s_{2}\\ 0&0&0&1\end{bmatrix} \tag{7}\]  
where \(c_{1}\), \(c_{2}\) is shorthand for \(\cos(\theta_{1})\), \(\cos(\theta_{2})\)  
\(s_{1}\), \(s_{2}\) is shorthand for \(\sin(\theta_{1})\), \(\sin(\theta_{2})\),  
\(c_{23}\) is shorthand for \(\cos(\theta_{2}+\theta_{3})\),  
and \(s_{23}\) is shorthand for \(\sin(\theta_{2}+\theta_{3})\).  
From the fourth column of the \({}^{0}_{4}T\) matrix, the position of the wrist joint at the base of the robotic arm Joint0 can be obtained:  
\[x=\cos(\gamma)*(\ l_{2}\ *\ \cos(\alpha))+l_{3}*\cos(\alpha+\beta) \tag{8}\]  
\[y=\sin(\gamma)*(l_{2}\ *\ \cos(\alpha))+l_{3}*\cos(\alpha+\beta) \tag{9}\]  
\[z=-l_{2}\ *\ \sin(\alpha)+l_{3}*\cos(\alpha+\beta) \tag{10}\]  
According to the above equation, the three-dimensional coordinates of the end of the robotic arm in space can be calculated once the rotation angle \(\alpha\), \(\beta\) and the length of each joint of the robotic arm are known.