## 5 Kinematic Analysis of the Hexapod Robot
### Inverse Kinematics  
In this subsection, the inverse kinematics problem for the hexapod robot is addressed. The goal of inverse kinematics is to determine the joint angles \(q_{1}\), \(q_{2}\), and \(q_{3}\) such that the position of the end effector \(\mathbf{r}_{0,5}\) matches the desired position \(\mathbf{r}_{0,p}\) on the trajectory. By applying the Directed Angular Restitution (DAR) method, the joint angles can be calculated to ensure the correct alignment and movement of the hexapod leg. The process involves solving for \(q_{1}\), \(q_{3}\), and \(q_{2}\) sequentially, ensuring that the resulting configuration achieves the target position while maintaining smooth and continuous motion. First, to obtain \(\Delta q_{1}\), the vectors \(\mathbf{r}_{2,5}\) and \(\mathbf{r}_{2,p}\) are calculated as:  
\[\mathbf{r}_{2,5} =\mathbf{r}_{0,5}-\mathbf{r}_{0,2}, \tag{22}\] \[\mathbf{r}_{2,p} =\mathbf{r}_{0,p}-\mathbf{r}_{0,2},\] \[\Delta q_{1} =d_{z}\bigg{|}\cos^{-1}\Bigg{(}\frac{x_{2,5}x_{2,p}+y_{2,5}y_{2,p }}{\left\lVert x_{2,5},y_{2,5}\right\rVert\left\lVert x_{2,p},y_{2,p}\right\rVert }\Bigg{)}\bigg{|}. \tag{23}\]  
where these vectors are the focal point of the DAR method. Next, the following equation is applied (23), which represents the directed angular compensation in the \(xy\) plane. For a better understanding of these expressions, refer to Figure 18.  
Once \(\Delta q_{1}\) is defined, the posture is updated so that the calculation of \(\Delta q_{3}\) takes this modification into account. The vectors \(\mathbf{r}_{3,5}\) and \(\mathbf{r}_{3,p}\) are calculated next, (24). The analysis of \(\Delta q_{3}\) involves adjusting the magnitude of the vector \(\mathbf{r}_{3,5}\) to match the magnitude of \(\mathbf{r}_{3,p}\). This adjustment is performed using Equation (25), which represents the difference between  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Point** & **Position Vector** & **Matrix** & **Orientation** \\ \hline \(\mathbf{r}_{0,1}\) & \( \begin{bmatrix}0&0&0\end{bmatrix} ^{T}\) & \(R_{0,1}\) & \(R_{z}(q_{4})\) * \\ \(\mathbf{r}_{1,2}\) & \( \begin{bmatrix}x_{1,2}&0&0\end{bmatrix} ^{T}\) & \(R_{1,2}\) & \(R_{z}(q_{1})\) \\ \(\mathbf{r}_{2,3}\) & \(\begin{bmatrix}x_{2,3}&0&0\end  
the current angle \(\beta\) and the angle \(\beta\) that ensures the equality of both magnitudes. This approach is illustrated in Figure 19.  
\[\mathbf{r}_{3,5} =\mathbf{r}_{0,5}-\mathbf{r}_{0,3},\] \[\mathbf{r}_{3,p} =\mathbf{r}_{0,p}-\mathbf{r}_{0,3}, \tag{24}\] \[\Delta q_{3}=\cos^{-1}\!\left(\frac{\left\|r_{4,5}\right\|^{2}+ \left\|r_{3,4}\right\|^{2}-\left\|r_{3,p}\right\|^{2}}{2\left\|r_{4,5}\right\| \left\|r_{3,4}\right\|}\right)-\cos^{-1}\!\left(\frac{\left\|r_{4,5}\right\|^ {2}+\left\|r_{3,4}\right\|^{2}-\left\|r_{3,5}\right\|^{2}}{2\left\|r_{4,5} \right\|\left\|r_{3,4}\right\|}\right)\!. \tag{25}\]  
The posture is updated with the value of \(\Delta q_{3}\). Finally, \(\Delta q_{2}\) is determined as (26). This expression involves a directed angular compensation in the \(xz\) plane (see Figure 20). \[\Delta q_{2}=d_{y}\left|\cos^{-1}\!\left(\frac{x_{3,5}x_{3,p}+z_{3,5}z_{3,p}}{ \left\|x_{3,5},z_{3,5}\right\|\left\|x_{3,p},z_{3,p}\right\|}\right)\right|. \tag{26}\]  
With \(\Delta q_{2}\) calculated, the inverse kinematics problem is fully resolved, providing the necessary joint angles \(q_{1}\), \(q_{2}\), and \(q_{3}\) to position the hexapod leg correctly. By applying the Directed Angular Restitution (DAR) method, the angles are obtained in a manner that ensures smooth and continuous motion, while also maintaining precise alignment with the desired trajectory. The sequential approach, starting from \(\Delta q_{1}\) and progressing through \(\Delta q_{3}\) to \(\Delta q_{2}\), allows for a systematic adjustment of the leg's posture, accounting for each rotational transformation required to achieve the target position \(\mathbf{r}_{0,p}\). This methodology not only enhances the accuracy of the hexapod's movements but also optimizes its performance in dynamic environments.