## 3 Materials and Methods
This step only defines the idea of generating multiple points, located on a circle, using nested loops without limiting how they are obtained. Depending on the programming language used, the implementation can be adapted accordingly. Step 6. Solution of the inverse kinematics problem for the two-link mechanism. Finding solutions for a two-link mechanism is a classic problem that has been studied in numerous books and articles. However, most articles do not consider all possible solutions [2; 4; 5]. Figure 9 shows a block diagram of the complete algorithm that determines the type of IK solution for a two-link mechanism, according to Definitions 1-3. Figure 8: Reachable points without taking into account joint constraints. \(d_{O,\,P_{2}}=\left|\sqrt{\left(P_{2x}-O_{x}\right)^{2}+\left(P_{2y}-O_{y}\right)^ {2}}\right|\) is the distance between points \(O\) and \(P_{2}\). It is assumed that the base is located at point \(O\)(0,0) which is in the origin of a fixed coordinate system. The block \"Compute two solutions\" (from Figure 9) can be done in different ways. Appendix A presents a geometric solution that uses built-in functions of Visual Lisp for AutoCAD and avoids trigonometric functions. The idea boils down to determining the intersection points (\(P_{1R}\) and \(P_{1L}\)) of two circles with radii \(R_{1}=a_{1}\) and \(R_{2}=a_{2}\), located according to Figure 10. First the distance \(L=\overline{OP_{2}}\) between points \(O\) and \(P_{2}\) is determined. From the law of cosines, it follows:  
\[a_{2}^{2}=a_{1}^{2}+L^{2}-2a_{1}Lcos(\beta) \tag{11}\]  
Figure 10: Determination of IK for a two-link mechanism using a geometric approach. Figure 9: Algorithm for finding an IK solution for a two-link mechanism and determining its type according to Definitions 1–3. Distance \(\overline{OP_{h}}=t=a_{1}cos(\beta)\) and, considering (11), for \(t\) it follows that:  
\[t=\frac{a_{1}^{2}+L^{2}-a_{2}^{2}}{2L} \tag{12}\]  
The height \(h=\overline{P_{h}P_{1R}}=\overline{P_{h}P_{1L}}\) is found from the Pythagorean theorem. Figure 7:0  
Using the Visual LISP commands Polar and Angle, the points \(P_{1R}\) and \(P_{1L}\) are found. The Angle command allows you to determine the angle of inclination of a segment, defined by two points (see Appendix A). Step 7. Check for joint constraints and configuration type. After performing step 6, two configurations \(q_{1L}=[\theta_{1L},\theta_{2L},\theta_{3},\theta_{4}\ldots]^{T}\) and \(q_{1R}=[\theta_{1R},\theta_{2R},\theta_{3},\theta_{4}\ldots]^{T}\) are obtained, which claim to be an IK solution. We note that the angles \(\theta_{i}\) are relative, i.e., are measured with respect to the axis of the previous link in a counter-clockwise direction. Thus, depending on definition 1 to 3, the remaining joint angles \(\theta_{3},\theta_{4}\ldots\) can also be classified by assigning them indices L, R, \(S_{o}\) or \(S_{\pi}\). A check is made to see if the joint angles fall within the permissible limits. As a result, one or both solutions can be rejected or accepted. Here it can also be checked for collision with an obstacle and self-collision of the robot links, if necessary. The type of configuration is taken into account and the angles \(\theta_{i}\) of the approved solutions are recorded. Defining collisions between bodies is a separate topic that is beyond the scope of this work. Thus, after executing one cycle of the algorithm, one of the following results is obtained:  
* The reviewed configuration is not an IK solution. * There is only one solution, classified according to definitions 1, 2 and 3; for example: \(q_{1L}=[\theta_{1L},\theta_{2L},\theta_{3R},\theta_{4L},\ \theta_{5 0}\ldots]^{T}\). * There are two solutions, classified according to definitions 1, 2 and 3; for example: \(q_{1L}=[\theta_{1L},\theta_{2L},\theta_{3R},\theta_{4L}\ldots]^{T}\) and \(q_{1R}=[\theta_{1R},\theta_{2R},\theta_{3R},\theta_{4L},\theta_{5 5\pi}\ldots]^{T}\).