# Design of a Four-Axis Robot Arm System Based on Machine Vision
## 2 Kinematic Analysis and Design of Robotic Arms
### Robotic Arm Inverse Kinematics Analysis  
In contrast to the positive kinematic analysis of the arm, the inverse kinematic analysis of the arm uses calculations to solve for the angle of rotation at each joint when the relevant parameters of the connecting rod and the position of the end of the arm concerning the reference coordinate system have been obtained [23]. Geometric analysis based on the structure of the robotic arm: for the robotic arm involved in this paper, it is necessary to find the angle of rotation at each joint when the end of the robotic arm is moved from O to O\({}^{\prime}\), i.e., to find \(\gamma\), \(\alpha\), and \(\beta\), according to the inverse kinematics requirements.  
Firstly, the geometric relationship between the rotation angle of the base and the coordinates of the end of the arm is analyzed, i.e., \(\gamma\).  
Assuming that the base coordinate system is O, the end coordinate system is O\({}^{\prime}\), the coordinates are (x, y, z), and the arm length is H. When the rotation angle of the base of the arm is \(\gamma\), the following equation can be obtained according to the Pythagorean theorem:  
\[L=\sqrt{x^{2}+y^{2}} \tag{11}\]  
where \(L\) is the projection in the xoy plane of the coordinate system O\({}^{\prime}\) at the end of the robotic arm concerning the base coordinate system O. The following equation is obtained from the sine theorem:  
\[\gamma=\sin^{-1}\Bigl{(}\frac{x}{L}\Bigr{)} \tag{12}\]  
where \(\gamma\) is the angle at which the base of the arm needs to be rotated relative to the base coordinate system when the end of the arm moves to O\({}^{\prime}\).  
Next, we will discuss \(\alpha\). There are two cases for \(\alpha\), as shown in Figure 6.  
When \(z>0\), according to the Pythagorean theorem, we can obtain:  
\[L^{\prime}=\sqrt{L^{2}+z^{2}} \tag{13}\]  
Since the lengths of the two arms OA and O\({}^{\prime}\)A of the robotic arm are the same and known, the following equation can be driven according to trigonometric relationship:  
\[\theta=2*\cos^{-1}\biggl{(}\frac{L^{\prime}}{2*H}\biggr{)} \tag{14}\]  
And:  
\[\omega=\biggl{(}\frac{\pi}{2}-\frac{\theta}{2}\biggr{)} \tag{15}\]  
\[\lambda=\cos^{-1}\biggl{(}\frac{L}{L^{\prime}}\biggr{)} \tag{16}\]  
where \(\omega\) is the angle formed by the robotic arm OA and \(L^{\prime}\) in space and \(\lambda\) is the angle formed by \(L\) and \(L^{\prime}\) in space. Therefore, it can be obtained that, at \(z>0\), when the end of the robotic arm moves to O\({}^{\prime}\), the angle \(\alpha\) that the robotic arm polar coordinates need to be rotated is  
\[\alpha=\Bigl{(}\frac{\pi}{2}-\lambda-\omega\Bigr{)} \tag{17}\]  
The final formula for calculating the alpha angle is  
\[\alpha=\biggl{(}\cos^{-1}\biggl{(}\frac{\sqrt{x^{2}+y^{2}+z^{2}}}{2*H}\biggr{)} -\cos^{-1}\biggl{(}\frac{\sqrt{x^{2}+y^{2}}}{\sqrt{x^{2}+y^{2}+z^{2}}}\biggr{)} \tag{18}\]  
When \(z<0\), according to the Pythagorean theorem and Equations (5) and (6):  
\[\alpha=\Bigl{(}\frac{\pi}{2}+\lambda-\omega\Bigr{)} \tag{19}\]  
The formula for calculating the \(\alpha\) angle is obtained as:  
\[\alpha=\biggl{(}\cos^{-1}\biggl{(}\frac{\sqrt{x^{2}+y^{2}+z^{2}}}{2*H}\biggr{)} +\cos^{-1}\biggl{(}\frac{\sqrt{x^{2}+y^{2}}}{\sqrt{x^{2}+y^{2}+z^{2}}}\biggr{)} \tag{20}\]  
The final beta angle is easily obtained as:  
\[\beta=\pi+\alpha-\theta \tag{21}\]  
Figure 6: Angle diagram of the robotic arm: (**a**) \(z>0\), (**b**) \(z<0\).  
The above is the process of finding the inverse motion of the robotic arm based on the geometric method. The conversion from spatial coordinates to the rotation angle of the robotic arm motor can be completed by converting the above formula into code and embedding it in the lower computer.