Analysis of computational efficiency for the solution of inverse kinematics problem of anthropomorphic robots using Gröbner bases theory

This article presents an analysis of computational efficiency to solve the inverse kinematics problem of anthropomorphic robots. Two approaches are investigated: the first approach uses Paul’s method applied to the matrix obtained by the Denavit–Hartenberg algorithm and the second approach uses Gröbner bases theory. With each approach, the problem of inverse kinematics for an anthropomorphic robot will be solved. When comparing each method, this article will demonstrate that the method using Gröbner bases theory is more computationally efficient.


Introduction
Two classic problems in the kinematics of robotic manipulators are forward kinematics (FK) and inverse kinematics (IK). In FK, the position and orientation of the end-effector are calculated from the joint variables. In the IK, the movements of individual joints are calculated from the position and orientation of the end-effector of a robotic manipulator.
According to Daya et al., 1 one of the biggest problems in kinematics and robot control lies in determining the solution of IK. Still, according to the same authors, as the complexity of the robotic manipulator increases, obtaining the IK is difficult and computationally expensive. Traditional methods, such as geometric, iterative, and algebraic, are inadequate as the geometric structure of the manipulator becomes more complicated.
Paul et al. 2 used matrix algebra to obtain a solution to the IK problem of a specific manipulator robot. Lee 3 and Yih and Youm 4 used a geometric approach to solve this problem. Subsequently, Huang and Milenkovic 5 and Manseur and Doty 6 developed iterative procedures to solve the IK problem.
Denavit and Hartenberg 7 introduced a convention to standardize the reference coordinate systems for spatial links; after a decade, the same authors presented an algorithm for solving the kinematics problems of articulated systems. 8 The importance of this algorithm for the kinematics analysis of robotic systems was studied by Paul 9 16 years ago.
An alternative method for the solution of IK will be used in this article, namely the Gröbner bases theory. The computational performance data obtained in this article will prove that this choice will reduce the computational cost for the solution of the IK problem of serial robotic manipulators compared to Paul's method.
The Gröbner bases theory, developed by Bruno Buchberger in his PhD thesis, consists of an algebraic algorithm that can be applied to a given set of nonzero polynomials, producing a finite set of generators, so that it is possible to identify from these generators when a specific polynomial belongs to the original given set. 10 When finding solutions for this set of generators, those are also solutions for the whole set. With the aid of MAPLE, an algebraic computing software, all these solutions can be calculated, including cases not so easily solved using matrix algebra or geometric applications due to the complexity of the geometry of some manipulator robots. Kendricks,11 in her PhD thesis, compared the algorithm of Denavit and Hartenberg with Gröbner bases theory for the solution of the IK problem. Her analysis focused on the robot Fanuc A-510, a SCARA type robot, with three degrees of freedom.
To familiarize the reader with each method, the anthropomorphic robot Unimation PUMA 560, a manipulator with six rotary joints, will be used as a case study applying Paul's method from the Denavit-Hartenberg matrix and the method proposed in this work to solve the IK problem. The main goal of this article is to analyze the computational efficiency in solving the problem of the IK of anthropomorphic robots using both methods.
Guzmán-Giménez et al. 12 presented a systematic procedure for the solution of IK problem of nonredundant openchain robotic systems using Gröbner bases theory after solving the FK from the Denavit-Hartenberg algorithm; however, it is worth mentioning that the authors restricted themselves to the first three joints of the anthropomorphic robot Unimation PUMA 560.
Ni and Wu 13 presented an algorithm to solve the IK of a generic 6R robot based on matrix employing quaternions as spatial operators and the Gröbner bases theory. Through the algorithm presented by the authors, 16 different solutions are determined, but, among these, only four solutions are real. As this method is not compared to any other, its computational efficiency could not be confirmed.
Unlike Wang et al., 14 who also presented a solution for the IK of a 6R serial manipulator using Gröbner bases theory, a base with a reduced number of polynomials will be determined in this article, since these authors, using the solution method of the kinematics of mechanisms proposed by Duffy and Crane, 15 produced a Gröbner basis with 72 polynomials. With a reduced number of polynomials, which will be presented in this article, this base will increase the computational efficiency of the calculations to obtain all the joint configurations.
El-Sherbiny et al. 16 presented a comparative study between different soft-computing-based methods (artificial neural network, adaptive neuro-fuzzy inference system, and genetic algorithms) applied to the problem of IK. Their analysis focused on a serial manipulator with five degrees of freedom, and the results of the analysis demonstrate that the methods are not accurate and computationally efficient at the same time. The choice of method depends on the application, being necessary to decide which one has more priority, the calculation time or the accuracy.
However, the present work intends to go further. It brings an analysis of the computational efficiency in the solution of the IK problem of a serial manipulator with six degrees of freedom using Grö bner bases theory. The obtained results will be compared with those obtained by Paul's method from the matrix obtained by the Denavit-Hartenberg algorithm, demonstrating that the Grö bner bases theory method is more computationally efficient and that the solutions obtained from this method are accurate.

Grö bner bases theory
The core of Gröbner bases theory is an algorithm used to solve systems of polynomial equations. It is known as Buchberger's algorithm and applies computational algebra techniques to polynomial ideals, producing a so-called Gröbner basis, a new polynomial set.
Briefly, a Gröbner basis for a polynomial equation system is a new collection of polynomials in which the null set coincides with the solution set of the original system; however, this new system is simpler to solve. This definition justifies the choice of Gröbner bases theory to solve the IK of serial manipulators with the reduction of computational cost.
Gröbner bases theory is widely applied in other areas besides mathematics. For example, Cox et al. 17 have dedicated their work to the applications of Gröbner bases theory in geometry, graph theory, and robotics.
According to Sturmfels, 18 a Gröbner basis can be computed in order that the polynomials have a property known as the elimination property. This elimination property makes the computation of solutions of a polynomial system, which is a Gröbner basis to be mathematically efficient because, through retroactive substitutions, a solution can be found for the remaining set of variables, with a reduction in the number of floating-point operations.
For polynomials with several variables, the complexity for the determination of a Gröbner basis depends not only on the number of polynomials in the set but also on how their terms are ordered. The lexicographic order is particularly suitable for solving systems of polynomial equations. In a lexicographic order, a variable dominates any monomial involving only minor variables, regardless of the total degree. For example, for the lexicographic order x 1 y 1 z, thus x 2 1 lex y 12 z 8 .
It can be seen in Figure 1 that all variables can be solved consecutively because the obtained Gröbner basis is a triangular equation system.
In some cases, one chooses to consider the total degree of a monomial and to order the monomials of larger degrees first. In this specific case, the graduated lexicographical order (grlex) is used. Another order is given by the reverse graduated lexicographic order (grevlex), which is commonly used because it generally provides the basis more quickly due to a reduction in computational cost.
Buchberger's algorithm constructs a Gröbner basis starting from a finite set of polynomials. According to Cox et al., 17 to develop Buchberger's algorithm, it is necessary to understand the nature of S-polynomials.
Let f and g be two nonzero polynomials and consider L ¼ lcm lp f ð Þ; lp g ð Þ ð Þ , where lcm is the least common multiple among the leading power products lp ð Þ of polynomials. The combination S f ; ð Þ g is called the S-polynomial of f and g, where (lt) stands for the leading term of each polynomial.
As an example, f ¼ x 3 y 2 À x 2 y 3 þ x, g ¼ 3x 4 y þ y 2 2 R x; y ½ , with lexicographical order x 1 y, it is intended to determine: S f ; g ð Þ. To solve this problem, it is necessary Note that the S-polynomial is produced to cancel the leading terms of the polynomials involved. The Buchberger's algorithm receives as input a finite set F ¼ f 1 ; f 2 ; Á Á Á ; f n f gof polynomials and provides a set G, which is a Gröbner basis of F: According to Stifter,19 this algorithm can be described as follows.
Faugère 20 presented an efficient algorithm for computing Gröbner bases: the F4 algorithm. This algorithm computes successive truncated Gröbner bases, and it replaces the classical polynomial reduction found in the Buchberger's algorithm by the simultaneous reduction of several polynomials. This powerful reduction mechanism utilizes symbolic precomputation and sparse linear algebra methods.
With the help of algebraic computing software, a Gröbner basis can be calculated more quickly. Many algebraic computing systems include packages to deal with Gröbner bases, for example, MAPLE, Singular, muMath, AXIOM, Mathematica, Macaulay, CoCoA, and Reduce.

Inverse kinematics using Paul's method
The PUMA 560 is a robotic manipulator with six degrees of freedom and has only rotary joints, that is, it is a 6R mechanism. According to Ghosal, 21 PUMA 560 is a robotic manipulator extensively seen in textbooks, industry, and academic and research institutions.
The PUMA 560 is shown in Figure 2, with its six frames attached to the links.
It can be seen that the reference system 0 f g, not shown in Figure 2, coincides with the reference system 1 f g when q 1 is null. It is also noted that for the Puma 560 manipulator, as for other industrial robots, the axes of joints 4, 5, and 6 intersect at a common point, and that point of intersection coincides with the origin of frames 4 f g, 5 f g, and 6 f g, the axes of these three joints being mutually orthogonal.
According to Craig,23 to determine a general transformation matrix T for the solution of the FK of the Puma 560 .

Output:
( ) manipulator, it is necessary to construct a transformation that defines the system i f g in relation to the system i À 1 f g; that is, it is intended to determine iÀ1 A i . By defining a reference system for each link, the kinematic problem is divided into n subproblems, and to solve them, each subproblem is further broken up into four others. Initially, three intermediate frames P f g, Q f g, and R f g are defined for each link of the manipulator. It can be seen in Figure 3 that the reference system R f g differs from the reference system i À 1 f g only by a rotation of a iÀ1 , the reference system Q f g differs from R f g by a translation a iÀ1 , the reference system P f g differs from Q f g by a rotation q i , and the reference system i f g differs from P f g by a translation d i . Thus It is used s q for sin q ð Þ and c q for cos q ð Þ. All Denavit-Hartenberg parameters of this manipulator are listed in Table 1, where i represents the joint number.
After constructing all six transformation matrices using the Denavit-Hartenberg parameters and multiplying them (5), the homogeneous transformation matrix (6) is obtained    where the entries of T are given by It is used s 23 for sin q 2 þ q 3 ð Þand c 23 for cos q 2 þ q 3 ð Þ . According to Craig,23 for the solution of IK of a robotic manipulator with six degrees of freedom, there are 12 equations and 6 unknowns. However, among the nine equations that arise from the portion of the rotational matrix of T ; only three are independent. These, added to the equations of the portion of the position vector of T, result in six equations with six unknowns. Such equations are nonlinear, transcendental, which can be quite difficult to solve.
The systematic approach to solve kinematic equations, proposed by Paul, 9 rewrites FK equations in several different ways. Thus, both sides of the FK matrix equation are left and right multiplied by inverse transformation matrices. In doing so, one gets equivalent equations having the same solutions. Each matrix equation provides 12 nonlinear equations from the three main matrix lines. The fourth line of the matrix is always trivial. The main problem is to find, in this universe, suitable equations that can be solved analytically.
The solution of IK of this robotic manipulator, as determined by Craig, 23 is given by equations to All the equations of the FK and IK of the PUMA 560 manipulator were deduced in detail by Craig 23 and Ghosal. 21 The tree structure in Figure 4 represents the order of computations to determine all eight joint configurations of the PUMA 560.
To measure the computational cost to determine all joint configurations to position and orient the end-effector arbitrarily in the space, the following joint values: q ¼ À 5p 6 ; p 2 ; 0; p; p 2 ; p 6 Â Ã rad and the nonzero parameters: a 2 ¼ 432, a 3 ¼ 20, d 3 ¼ 125, and d 4 ¼ 430 were replaced in equation (5) From this point, equations (7) to (18) have been rewritten by substituting n x , n y , n z , o x , o y , o z , a x , a y , a z , x, y, and z by the respective values of the obtained numerical matrix.
The Solve command in MAPLE is used to find all the values of q ¼ q 1 ; q 2 ; q 3 ; q 4 ; q 5 ; q 6 ½ , which allow the robot to assume the configuration given by equation (27).
This article will prove that using Gröbner bases theory, the computational cost to determine the solution of the IK of serial manipulators is considerably reduced.

Inverse kinematics using Grö bner bases theory
The IK problem consists of finding all combinations of joint configurations that will position the end-effector of a robot at a given point in space. 23 To solve this problem, one must determine polynomial equations that model the movement of the robotic arm in each joint configuration. With all these elements, one must seek a set of solutions from the possible movements of each joint.
The joint values are set to q ¼ À 5p 6 ; p 2 ; 0; p; p 2 ; p 6 Â Ã rad, and the parameters are set to a 2 ¼ 432, a 3 ¼ 20, d 3 ¼ 125, and d 4 ¼ 430 in equation (5), exactly as in the third section, to determine all joint configurations to position and orient the end-effector of PUMA 560 robotic manipulator in space.
From this point, equations (7) to (18) are rewritten by substituting n x , n y , n z , o x , o y , o z , a x , a y , a z , x, y, and z by the respective values of the matrix (27). These 12 polynomials, added to the six polynomials obtained from the fundamental trigonometric relation for each joint angle, are used to generate a Gröbner basis.
The same values assigned in the third section are used, intending to compare the computational efficiency to solve the IK problem using Paul's method from the Denavit-Hartenberg matrix and Gröbner bases theory of the same 6R manipulator.
Performing 466 floating-point operations (46 additions, 100 multiplications, and 40 functions), the following Gröbner basis consisting of 12 polynomials is obtained using Faugère's F4 algorithm 20 þ 5521c 1 À 8600s 1 À 4300 ð30Þ À779480780s 1 À 2226636864s 3 À 389740390 ð38Þ It is worth noting that this reduced number of polynomials, compared to the 72 polynomials found by Wang et al., 14 will positively reflect on the computational efficiency for the IK solution of a 6R serial manipulator.
To determine all the values of q ¼ q 1 ; q 2 ; q 3 ; q 4 ; q 5 ; q 6 ½ , the Solve command is used in MAPLE. Eight different joint configurations are obtained, performing 954 floating-point operations (46 additions, 100 multiplications, and 101 functions), as can be seen in Table 3. These are approximately the same configurations obtained in Table 2.
It is worth noting that all the equations presented in the third section, using Paul's method to solve the IK of the PUMA 560 manipulator, were calculated using the computer algebra system MAPLE performing 34,514 floating-point operations to determine the eight different configurations, as given in Table 2.
Adding the 466 floating-point operations to obtain the Gröbner basis to the number of floating-point operations to obtain the eight different joint configurations through the generated Gröbner basis (954 flop), 1420 floating-point operations are obtained. There was a reduction from 34,514 to 1420 in the number of floating-point operations  12 all joint configurations provide the same amount of solutions determined by Paul's method. The two methods were simulated in MAPLE, testing their ability to solve the IK problem, and all the 100 solutions obtained for both methods were compared, testing their efficiency in solving.
Comparisons of the number of mathematical operations performed using the two methods are shown in Figure 5. The x-axis presents a partition of 20 sets used to determine 100 different configurations for the PUMA 560 using Paul's method and Gröbner bases theory, while the y-axis shows the total number of operations performed on a logarithmic scale.
The performance comparisons of the two methods are shown in Figure 6. The x-axis presents a partition of 20 sets used to determine 100 different configurations for the PUMA 560 using both methods, while the y-axis shows the total number of floating-point operations on a logarithmic scale.
It was possible to observe in Figure 5 that there was a significant reduction in the number of mathematical operations to obtain all solutions using Gröbner bases theory. As expected, the number of floating-point operations is reduced, as shown in Figure 6.
The histogram of the RMS errors in the calculations of all six joint angles of the PUMA 560 manipulator in all analyzed configurations is shown in Figure 7. The x-axis presents a partition of 100 sets of the obtained root mean square (RMS) errors in ascending order, while the y-axis shows the frequency of occurrence of each of these error sets. The RMS error is approximately 8:14 Â 10 À10 rad.
It can be verified in the histogram presented that most of the obtained RMS errors occur within the first sets, the ones that represent less error. It can also be seen that the higher sets still represent very insignificant errors. Figure 8 shows the simulation results of joint variable errors in all 100 configurations analyzed.
The comparative analysis of IK solutions is shown in Figure 9. The red dots represent the angles obtained through Paul's method for each joint, while the continuous blue lines represent the angles obtained through Gröbner bases theory. The data show that the outputs follow those obtained by Paul's method with high accuracy and a negligible error.
The histograms of the RMS errors in the calculations of all positions and rotation angles of the end-effector of the PUMA 560 are shown in Figure 10. The x-axis presents a partition of 100 sets of the obtained RMS errors, while the y-axis shows the frequency of occurrence of each of these error sets. The RMS error obtained is 4:34 Â 10 À7 mm for the position and 1:27 Â 10 À9 rad for the orientation of the robot's end-effector.
All the histograms presented (Figures 7 and 10) show that most of the obtained RMS errors occur within the first sets, the ones that represent less error. It can also be seen that the higher sets still represent a completely insignificant error. Figure 11 shows the simulation results of positioning and orientation errors in all 100 configurations analyzed.
The comparative analysis of FK solutions is shown in Figure 12. The green dots represent the x, y, and z coordinates of the points obtained from the angles determined through Paul's method, while the solid orange lines represent the coordinates of the points obtained from the angles determined through Gröbner bases theory. The blue dots represent the rotation angles obtained from the angles determined through Paul's method, while the solid red lines represent the rotation angles obtained from the angles determined through Gröbner bases theory. The data show that the results continue to maintain high accuracy and negligible error. El-Sherbiny et al. 16 presented a comparative study between three different soft-computing-based methods (artificial neural network, adaptive neuro-fuzzy inference system, and genetic algorithms) applied to the problem of IK. The analysis results demonstrate that the methods are not accurate and computationally efficient at the same time.
Using the artificial neural network method with a minimized error function and the adaptive neuro-fuzzy inference system method with the same function, the calculation time is quite similar. The difference is in the accuracy of the end-effector position and the angle of rotation. When the genetic algorithm method is used, the position error is very low, which is less than 10 À3 mm, while the calculation time is high compared to the other methods.  It is worth mentioning that in this work, the RMS error obtained is 4:34 Â 10 À7 mm for the position of the endeffector and 1:27 Â 10 À9 rad for the orientation of the endeffector. As shown in Figure 12, the solutions obtained through Gröbner bases theory produce negligible positioning and orientation errors in all configurations.
Open problem: Analysis of singularities Stifter 19 presented an algorithm to solve the IK of a 2R robot using Gröbner bases theory. The author presented a brief list of subjects that were not yet fully resolved but that could play an essential role in applying Gröbner bases theory for solving the problem of IK. The question about the possibility of determining singular configurations using a Gröbner basis is highlighted in this list.
Kendricks 11 used a Gröbner basis to determine the occurrence of a singularity of the workspace boundary, configuration when the manipulator is fully extended to the outer boundary or fully retracted to the inner boundary of its workspace. Her analysis focused on the robot Fanuc A-510, a SCARA type robot with three degrees of freedom, analyzing the discriminant of quadratic polynomials on the Gröbner basis generated to solve the IK of this serial robot. In this case, the author determined intervals of angles that produce a single real solution,  whose discriminants in the quadratic equations are equal to zero.
The anthropomorphic robot Unimation PUMA 560, used as a case study in this work, has the last three axes intersecting at a point. As a consequence, the position of the end-effector is only a function of q 1 , q 2 , and q 3 . In this way, the following three nonlinear equations in three unknowns are used To check whether it is possible to determine from a Grö bner base whether there is a singularity, equations (41) to (43) are rewritten by substituting x, y, and z by the respective values of the matrix (27). These three polynomials, added to the three polynomials obtained from the fundamental trigonometric relation for each joint variable, are used to generate a Gröbner basis.
However, it is essential to highlight that when all six joint variables are considered in the model, the 6R manipulator presents more than four solutions; however, the Gröbner bases method does not produce analytical solutions, thus requiring numerical methods to find the final solution. In many industry fields, the determination of all rotation angles of the end-effector is indispensable; thus, it justifies the importance of determining all joint angles of a robotic manipulator. Furthermore, although it is possible to determine angular intervals that produce points that are external to the manipulator's workspace, singularities such as boundary singularity or inner singularity remain to be further studied.

Conclusions
When using the Gröbner bases method for the solution of IK of anthropomorphic robots, one notes in the tests performed during this research that it is computationally more efficient than Paul's method since the equations produced for determination of six variables are mathematically simpler to be solved. Since through retroactive substitutions, all joint solutions can be determined to precisely position and orient the robotic manipulator end-effector in space.
According to the performance data obtained (number of floating-point operations) in all the configurations analyzed, it can be stated that the method proposed in this work for the solution of IK of anthropomorphic robots is more efficient computationally than Paul's method.
In future work, it is intended to demonstrate that this method can also be computationally efficient compared to the other methods for solving the IK problem of redundant manipulators.

Code availability
The MAPLE source code data used to support the findings of this study are available from the corresponding author upon request.

Data availability
The data that support the findings of this study are available from the corresponding author upon request.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.

Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This study was supported in part by the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior-Brasil (CAPES) (Finance Code 001).