## 3 Inverse and Forward Kinematics Problems
### Forward Kinematics  
In the case of the inverse kinematics problem, the external coordinates are known, but if it is necessary to determine the external coordinates based on the known lower lever orientation, it would require solving the forward kinematics problem. The forward kinematics of this system is very complex and a lot of effort has been invested in solving it analytically and numerically. The Jacobian matrix (matrix of all functions' first-order partial derivatives) maps the change of internal coordinates to the change of external coordinates with respect to time [34]. Based on the principle of virtual work, the Jacobian matrix, as a relationship between joint velocities and the platform velocities is also a direct relation between the necessary torque of actuators and applied load to the platform [35]. For each leg of the mechanism, the equation of the loop closure (shown in Figure 10) is given by:  
\[\mathbf{O_{b}B_{i}}+\mathbf{B_{i}A_{i}}+\mathbf{A_{i}P_{i}}=\mathbf{O_{b}O_{p}}+\mathbf{O_{p}P_{i}} \tag{24}\]  
By differentiating Equation (24) with respect to time, the following equation is obtained:  
\[\mathbf{\omega_{a,i}}\times\mathbf{B_{i}A_{i}}+\mathbf{\omega_{u,i}}\times\mathbf{A_{i}P_{i}}= \mathbf{v_{p}}+\mathbf{\omega_{p}}\times\mathbf{O_{p}P_{i}}, \tag{25}\]  
where \(\mathbf{v_{p}}\) is platform linear velocity, \(\mathbf{\omega_{a,i}}\), \(\mathbf{\omega_{u,i}}\), and \(\mathbf{\omega_{p}}\) are angular velocities of the actuator (and lower lever), upper lever, and platform, respectively. By introducing the unit vector of the upper lever as \(\mathbf{A_{i}P_{i}}=\mathbf{si_{u,i}}\), multiplying both sides of the equality with it, and using characteristics of the cross product, the equation becomes:  
\[\mathbf{i_{u,i}(\mathbf{\omega_{a,i}}\times\mathbf{B_{i}A_{i}})}+\mathbf{\omega_{u,i}}\big{(} \mathbf{si_{u,i}}\times\mathbf{i_{u,i}}\big{)}=\mathbf{i_{u,i}}\,\mathbf{v_{p}}+\big{(}\mathbf{O_{ p}P_{i}}\times\mathbf{i_{u,i}}\big{)}\mathbf{\omega_{p}} \tag{26}\]  
By introducing the unit vector of rotary actuator \(\mathbf{i_{m,i}}\) and his angular velocity \(\hat{\alpha_{i}}\) with \(\mathbf{\omega_{a,i}}\ =-\sigma_{l,i}\,\hat{a_{i}}\,\mathbf{i_{m,i}}\) and by eliminating the second member of the equation, the following equation is obtained:  
\[-\sigma_{l,i}\,\mathbf{i_{u,i}}\big{(}\mathbf{i_{m,i}}\times\mathbf{B_{i}A_{i}}\big{)}\, \hat{\alpha_{i}}=\mathbf{i_{u,i}}\,\mathbf{v_{p}}+\big{(}\mathbf{O_{p}P_{i}}\times\mathbf{i_{ u,i}}\big{)}\mathbf{\omega_{p}} \tag{27}\]  
Based on the previous equation, the Jacobian matrix of external coordinates \(\mathbf{J_{x}}\) and internal coordinates \(\mathbf{J_{x}}\) can be defined as follows:  
\[\mathbf{J_{x}}\mathbf{\dot{x}}=\mathbf{J_{x}}\mathbf{\dot{x}} \tag{28}\]  
\[\mathbf{J_{x}}= \begin{bmatrix}\mathbf{i_{u,1}}&\mathbf{O_{p}P_{1}}\times\mathbf{i_{u,1}}\\ \vdots&\vdots\\ \mathbf{i_{u,6}}&\mathbf{O_{p}P_{6}}\times\mathbf{i_{u,6}}\end{bmatrix}  \tag{29}\]  
Figure 10: Single leg loop closure. \[\mathbf{J}_{\mathbf{a}}= \begin{bmatrix}-\sigma_{l,1}\,\mathbf{i}_{nl,1}(i_{m,1}\times B_{1} \mathbf{A}_{1})&&\\ &\ddots&\\ &&&-\sigma_{l,6}\,\mathbf{i}_{nl,6}(\mathbf{i}_{m,6}\times B_{6}\mathbf{A}_{6})\end{bmatrix}  \tag{30}\]  
\[\dot{\mathbf{x}}= \begin{bmatrix}v_{px}&v_{py}&v_{pz}&\omega_{px}&\omega_{py}&\omega _{pz}\end{bmatrix} ^{T},\quad\dot{\mathbf{x}}= \begin{bmatrix}\dot{\alpha}_{1}&\cdots& \dot{\alpha}_{6}\end{bmatrix} ^{T} \tag{31}\]  
Finally, the Jacobian matrix \(\mathbf{J}\) can be expressed with the following equation:  
\[\mathbf{J}=\mathbf{J}_{\mathbf{x}}^{-1}\mathbf{J}_{\mathbf{a}} \tag{32}\]  
If \(\mathbf{\alpha}^{*}\) is a vector of desired angles, then based on [PERSON]'s method, the solution of the forward kinematics problem would be:  
\[\mathbf{x}^{k+1}=\mathbf{x}^{k}-\mathbf{J}\Big{(}\mathbf{\alpha}(\mathbf{x}^{k})-\mathbf{\alpha}^{*} \Big{)} \tag{33}\]  
In this way, the simple iterative numerical solution to the forward kinematics problem of the rotary Stewart platform is obtained.