# Solution to the Inverse Problem of the Angular Manipulator Kinematics with Six Degrees of Freedom
## 2 Methods and Algorithms
### Numerical Solution of Inverse Problem of Manipulator Kinematics  
In the above considerations, an assumption was made about the intersection of the rotation axes of the output links of the manipulator, the wrist and the gripper, and even the forearm. However, assembly errors or design features may lead to the fact that the proposed analytical solution to the inverse problem of the kinematics of the manipulator under consideration may produce unacceptable errors in the positioning and performance of production operations by the working tool. In this case, it is necessary to clarify the solution obtained on the basis of Equations (9), (10) and (15). It seems effective to use [PERSON]'s iterative method here with an initial approximation for the positioning problem obtained from the given analytical solution. The solution of the problem for the operational process can be formulated using the parameter continuation method, which consists of the fact that in a time cycle at each step, the values of the angles in the joints of the manipulator from the previous step are taken as an initial approximation, or by using the proposed analytical algorithm and refined using [PERSON]'s method. Let us present the expressions necessary to implement this method. At each step of the computational process we have an initial approximation, which can be formulated as a vector  
\[\mathbf{q}_{0}=\{\varphi_{10},\varphi_{20},\varphi_{30},\varphi_{40},\varphi_{5 0},\varphi_{60}\}\]  
The required position and orientation of the working tool, which can be set, by Cartesian coordinates of the edge and geographical spherical coordinates, are as follows  
\[ \begin{array}{ll}\tilde{X}_{D}=\tilde{X}_{D}(t),&\tilde{Y}_{D}=\tilde{Y}_{D}( t),&\tilde{Z}_{D}=\tilde{Z}_{D}(t),\\ \tilde{\lambda}_{E}=\tilde{\lambda}_{E}(t),&\tilde{\varphi}_{E}=\tilde{\varphi }_{E}(t),&\tilde{\psi}_{E}=\tilde{\psi}_{E}(t).\end{array} \]For solving the direct problem of the kinematics of the manipulator for three characteristic points of the output link, for example, points \(K\), \(E\), \(D\) (see Figure 2), and from them the values of the angles \(\lambda_{E}\), \(\varphi_{E}\), \(\psi_{E}\) (using Equations (1)-(4)) are considered. Then, as a vector function that should be reset at each step of the iterative process in [PERSON]'s method by searching for the values \(\mathbf{q}=\{\varphi_{1},\varphi_{2},\varphi_{3},\varphi_{4},\varphi_{5}, \varphi_{6}\}\) of the vector components, we select  
\[\mathbf{U}(\mathbf{q})= \begin{cases}X_{D}(\mathbf{q})-\bar{X}_{D},&Y_{D}( \mathbf{q})-\bar{Y}_{D},&Z_{D}(\mathbf{q})-Z_{D},\\ \lambda_{E}(\mathbf{q})-\bar{\lambda}_{E},&\varphi_{E}(\mathbf{q})-\bar{ \varphi}_{E},&\psi_{E}(\mathbf{q})-\bar{\psi}_{E}\end{cases} ^{T} \tag{18}\]  
The Jacobian of Function (18) is most conveniently constructed using computer algebra programs for a specific model of the mechanism. In this paper, a special description of mechanical systems and a special computer algebra system proposed in [25] is used. However, there is one problem related to calculating the angle difference \(\lambda_{E}-\bar{\lambda}_{E}\), \(\varphi_{E}-\bar{\varphi}_{E},\psi_{E}-\bar{\psi}_{E}\). If the given angles \(\bar{\lambda}_{E},\bar{\varphi}_{E},\bar{\psi}_{E}\) are taken to be already normalized to their varying ranges, then the values obtained as a result of [PERSON]'s method can have unlimited values, although close in essence, not necessarily in the range of one revolution. However, even in this range, ambiguity is possible, which significantly complicates the search for solutions. Normalizing the angle to the range \([0,2\pi)\) or to the range \((-\pi,+\pi]\) can be performed in different ways. The most common are those based on the mathematical operation mode, such as calculating the remainder of division. However, this operation is strictly defined only for positive integers, so using its implementation in different programming languages may give unpredictable results.