## 4 Methodology
### Kinematic Modeling and Inverse Kinematics  
The structure of our 5-DOF robotic arm is a simple open structure. This structure makes it possible to bring the end device into the desired position [31]. Our robotic arm has 5-DOF and is articulated because it has a series manipulator having all joints as revolute. It is structured as so: base rotation, shoulder, elbow, wrist and gripper, as shown in Figure 6.  
* Direct Geometric Model  
The direct geometric model of a robot provides the location of the end-effector in terms of the joint coordinates. To determine it, we will use the Denavit Hartenberg (DH) method shown in Table 1. Those parameters reveal the related five joints parameters of the robotic arm manipulator to find the end-effector position in comparison with the base of the arm, where,  
* \(a_{i}\): the distance from \(z_{i}\) to \(z_{i+1}\) measured along \(z_{i}\);
* \(\alpha_{i}\): the twist angle between \(z_{i}\) and \(z_{i+1}\) measured about \(x_{i}\);
* \(d_{i}\): the offset distance from \(x_{i}\) to \(x_{i+1}\) measured along \(z_{i}\);
* \(\theta_{i}\): the angle between \(x_{i}\) and \(x_{i+1}\) measured about \(z_{i}\). \begin{table}
\begin{tabular}{l c c c c c} \hline
**Link** & \(\mathbf{i}\) & \(\mathbf{d_{i}}\)**mm** & \(\mathbf{\theta_{i}}\)**Degree** & \(\mathbf{a_{i}}\)**mm** & \(\mathbf{\alpha_{i}}\)**Degree** \\ \hline
0-1 & 1 & \(d_{1}=45\) & \(\theta_{1}\) & 0 & 0 \\
1-2 & 2 & 0 & \(\theta_{2}\) & 0 & \(\alpha_{2}=90\) \\
2-3 & 3 & 0 & \(\theta_{3}\) & \(a_{3}=120\) & 0 \\
3-4 & 4 & 0 & \(\theta_{4}\) & \(a_{4}=145\) & 0 \\
4-5 & 5 & \(d_{5}=30\) & \(\theta_{5}\) & 0 & \(\alpha_{5}=-90\) \\ \hline \end{tabular}
\end{table} 
Table 1: D-H parameters of our 5-DOF robotic arm. Figure 6: The robotic arm in the real world and its coordinate frame. To find the direct geometric model, we solve the following equation, which represents the transformation matrix from joint 0 to joint 5 (\(T_{5}^{0}\)):  
\[T_{5}^{0}=T_{1}^{0}*T_{2}^{1}*T_{3}^{2}*T_{4}^{3}*T_{5}^{4}= \begin{bmatrix}n_{x}& o_{x}&a_{x}&p_{x}\\ n_{y}&o_{y}&a_{y}&p_{y}\\ n_{z}&o_{z}&a_{z}&p_{z}\\ 0&0&0&1\end{bmatrix}  \tag{6}\]  
where \(T_{i+1}^{i}=Tr(z,d_{i+1})*Rot(z,\theta_{i+1})*Tr(x,a_{i+1})*Rot(x,\alpha_{i+1})\). \(T_{i+1}^{i}\) represents the transformation matrix from joint \(i\) to joint \(i+1\). \(Tr(z,d_{i+1})\) and \(Tr(x,a_{i+1})\) represent the translation matrices along the z axis with respect to the d parameter of the \(i+1\) joint and the x axis with respect to the parameter of the \(i+1\) joint, respectively. \(Rot(z,\theta_{i+1})\) and \(Rot(x,\alpha_{i+1})\) represent the rotation matrices around the z axis with respect to the \(\theta\) parameter of the \(i+1\) joint and the x axis with respect to the \(\alpha\) parameter of the \(i+1\) joint, respectively. In addition, \(p_{x},p_{y},p_{z}\) represent the position and \((n_{x},n_{y},n_{z}),(o_{x},o_{y},o_{z}),(a_{x},a_{y},a_{z})\) represent the orientation of the end-effector. The direct geometric model is represented by the equations below:  
\(n_{x}=C_{345}C_{12}\)  
\(n_{y}=C_{345}S_{12}\)  
\(n_{z}=S_{345}\)  
\(o_{x}=-S_{12}\)  
\(o_{y}=C_{12}\)  
\(o_{z}=0\)  
\(a_{x}=-C_{12}S_{345}\)  
\(a_{y}=-S_{12}S_{345}\)  
\(a_{z}=C_{345}\)  
\(p_{x}=S_{12}d_{5}+(a_{4}C_{34}+C_{3}a_{3})C_{12}\)  
\(p_{y}=-C_{12}d_{5}+(a_{4}C_{34}+C_{3}a_{3})S_{12}\)  
\(p_{z}=d_{1}+S_{34}a_{4}+S_{3}a_{3}\)  
With \(C_{i}=Cos(\theta_{i})\) and \(S_{i}=Sin(\theta_{i})\)  
* Inverse kinematics  
We consider that the inverse kinematic case of the robot arm has five links. Based on this method, the joint angles can be calculated for any desired position and orientation in Cartesian space. We obtain the angles \(\theta_{i}(i=1,2,3,4,5)\) of each joint when we are given the position \(p(p_{x},p_{y},p_{z})\) and orientation \(R(\phi,\theta,\psi)\) of the end-effector.