Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2024 Feb 28.
Published in final edited form as: Adv Comput Sci Eng. 2023 Jun;1(2):123–161. doi: 10.3934/acse.2023006

NUMERICALLY STABLE SOLUTION TO THE 6R PROBLEM OF INVERSE KINEMATICS

Xin Cao 1, Evangelos A Coutsias 1,2,*, Sara Pollock 3
PMCID: PMC10901545  NIHMSID: NIHMS1961292  PMID: 38420147

Abstract

In this paper, a stable and accurate algorithm to compute all solutions of the inverse kinematics problem of a 6 revolute manipulator chain is presented. A system of equations is constructed based on the fundamental closure conditions, leading to a closed algebraic system of 20 equations involving 16 quantities, composed of trigonometric functions of five among the six unknown joint angles. Two among these five are stably eliminated using singular value decomposition (SVD) avoiding the need to consider special cases. The resulting system of equations involving three unknowns is solved by conversion to a generalized eigenvalue problem. The remaining three unknown angles are obtained using the previously computed pseudoinverse. In this formulation we exploit the inherently complex form of the system reducing it to 10 complex equations in 9 quantities, which substantially accelerates the SVD computation. The method’s robustness is demonstrated through a comparison to current methods and several examples including known problematic cases where some axis or link lengths vanish, or some joint angles are 180 degrees, as well as cases where multiple eigenvalues arise.

Keywords: 6R manipulator, Inverse Kinematics, Complex singular value decomposition, Multiple eigenvalues, Molecular chains

2020 Mathematics Subject Classification. Primary: 65H14, Secondary: 65H10

1. Introduction.

The Inverse Kinematics (IK) problem of a linkage, that is positioning the end effector (Arm) given a fixed (Reference) position of the base, is central in the theory of mechanisms and has been extensively studied, both in robotics where the accurate control of robot arms is critical in diverse areas such as medicine, industry and the International Space Station, see e.g. [2] and references therein, as well as in computational structural biology where loop closure analysis has been used in the study of protein loops [9, 19, 20, 6, 16] and large flexible multicyclic molecules [27, 5]. The workspace of a linkage is the set of positions and orientations of the end effector attainable through variation of the linkage degrees of freedom (DoF). It is well known that at least six DoF are required to achieve a workspace that forms a (union of) open neighborhood(s) in R3×𝒮O(3). The problem may be realized without loss of generality as a chain of rigid bodies connected through revolute pairs (R-pairs) between fixed end positions. In this paper we consider the IK problem for a linkage formed by a kinematic chain of N6 rigid objects connected by revolute joints. The linkage may be a loop with fixed base and end effector or a closed ring (Fig. 1).

Figure 1.

Figure 1.

The transformation from cyclic molecule (left) and open manipulator (right) to closed 6R ring. In the left, the atoms in the selected axes are filled and the coordinate systems of complete system show the relationship between reference (R) and arm (A) frames.

For simplicity we focus on the N=6 ring problem, while the extension to redundant linkages of N>6 joints and molecular chains is given in Appendix A. The 6 joint angles are the variables defining the linkage configuration. Together with the twist angles between successive axes and the joint and axis lengths of the resulting orthogonal system, they constitute the Denavit-Hartenberg (DH) coordinates [8] of the linkage. The transformation of an open 6R robot arm to a closed system is accomplished by introducing a virtual link as depicted in the right of Fig. 1.

The first fully algebraic solution of the 6R problem was given by Lee and Liang [14, 13]. Subsequently, several authors ([18], [21]) have commented on the algebraic complexity of the Lee-Liang method and proposed simplifications. All methods are based on the idea that certain of the variables may be eliminated, eventually resulting in a generalized eigenproblem or a univariate polynomial in one of the variables. Key differences among methods are in the details of the elimination process and the precise method of arriving at a univariate system.

As noted by Angeles [2], current algorithms share some robustness issues under certain conditions, such as the occurrence of infinite eigenvalues associated with π angles. In fact, robustness problems may arise at different stages in a typical method: (1) The first stage of the algorithm requires the elimination of some of the variables. The choice of the specific equations to be solved may lead to the inversion of singular matrices. (2) Assuming successful elimination, the solution of the resulting generalized eigenvalue problem may lead to infinite or multiple eigenvalues. (3) The algebraic manipulations for deriving the remaining DoF, once the eigenproblem has been solved may also introduce singularities.

The Lee-Liang method in its original form suffered from its somewhat arbitrary choices for eliminating or back-substituting variables that in special cases lead to singular matrices or vanishing denominators. Specifically, the 16 among the 20 equations chosen for the initial elimination ([13], eq.(50)) are not guaranteed to result in a nonsingular matrix inversion. Moreover, when solving for the remaining variables, vanishing lengths of either axis 3 or axis 4 results in the vanishing of the denominator of expressions F9 and F10 in [13], causing the method to fail. Although most current methods avoid some of the pitfalls in the original algorithm by Lee and Liang, they may still fail for special combinations of the problem parameters which nevertheless do correspond to well posed configurations. As discussed in [2], the method by Raghavan and Roth [21] will fail if the first link length vanishes. Although this problem may be addressed by reindexing generically, this will fail if all link lengths vanish. The method by Renaud [22] achieves efficiency by utilizing a specific linear combination of the equations for the inversion, which again fails for vanishing link lengths. In the Kohli and Osvatic approach [12], the elimination step involves the inverse of a 6 × 6 matrix whose singularity is not determined, for instance that matrix becomes singular when the twist angle at the sixth link is π in a closed linkage. Liu and Zhu [15] follow a similar approach but switch order of solution if singularity is detected.

In addition, the strategy followed by various methods to address possible singularities could deteriorate performance. For example, the methods by [18, 15] use singular value decomposition (SVD) to detect ill conditioning of various inversions, either at the elimination stage or for converting the generalized eigenproblem to an ordinary one, and reformulate in various ways until well conditioned matrices are found. Moreover, some methods arrive at eigenvalue problems of higher dimensionality, again leading to deterioration in performance. The method by Manocha and Canny [18] results in a generalized eigenproblem of size 24 × 24, while as was proven by [13] the system may be reduced to optimal size 16 × 16, as also obtained by [21, 12, 22, 15]. More recently, Husty et al. [10] added clarity to the geometrical structure of the problem, and proposed an elegant algorithm. However the eventual reduction to a univariate polynomial gives a high degree resultant of size 48 × 48 whose resolution substantially increases execution timings. Moreover, as the authors also state, a reformulation may be required until a non-degenerate system may be found, which could further hinder performance. A comparative analysis of the implementation of [10] to that in [15] performed by Angerer and Hofbaur [3] establishes that the former is indeed substantially more robust, but at a high operation time cost, roughly an order of magnitude slower compared to the latter.

The goal of this paper is to formulate a numerically robust algorithm for the solution of the 6R IK problem. Although an earlier version of the algorithm was implemented as part of the BRIKARD molecular modeling suite [5], implementation details were never published. The version of R6B6 presented here incorporates substantial improvements and it is essentially a new algorithm. Contrasted to previous algorithms, R6B6 includes modifications in the elimination and solution process that optimally stabilize the method, avoiding well known pitfalls. Starting with the standard set of equations [2], complex SVD is applied to perform the first elimination. Writing the original real-valued 20 × 16 system as a complex-valued 10 × 8 system accelerates the computation by a factor of 50%. The resultant is then obtained efficiently by multiplication with the left null vectors. By properly accounting for the projective character of the matrix pair formulation in the resulting generalized eigenproblem, infinite eigenvalues are dealt with directly, while the resulting process is augmented to handle cases of multiple eigenvalues. When computing the remaining variables, the singular vectors from the SVD and some symbolic expressions are applied. Utilizing the pseudoinverse as opposed to inverting a subset of the equations lends stability to the computation and solves the issue of accidental singularities in the first elimination, which may require costly reformulations to resolve. We must note here that for 6R systems exhibiting flexibility so that a continuum of solutions may exist, all methods (including the one presented here) designed to determine a finite number of solutions will fail. Such cases require further geometrical analysis, as can be found in [4], [23].

The remainder of the paper is organized as follows: In Sec. 2 we give a brief overview of the key steps in the algorithm, with details provided in the following subsections. Sec. 2.1 presents the fundamental closure equations and introduces the main formalism used throughout the paper. Sec. 2.2 presents the details of the first elimination via complex SVD. In Sec. 2.3 we discuss the resultant of the 4 polynomial equations in the half-tangents of the three remaining variables, extended as 8 equations in the same three variables and then posed as a 16 × 16 generalized eigenvalue problem. In Sec. 2.4 the procedure for extracting the remaining variables and giving the complete solution is presented. In Sec. 3 we discuss implementation details of the solution process, with focus on special cases, such as infinities in the half-tangent variables and multiple eigenvalues. Sec. 4 discusses numerical examples that demonstrate code performance in various exceptional cases, as well as singular cases that may lead to failures. Sec. 5 gives a summary and concluding remarks. In the Appendices we present the details of the DH transformation App. A, give the details of the system of equations App. B, discuss the relation between real and complex SVD App. C and discuss the treatment necessary in the presence of multiple eigenvalues App. D.

2. The loop closure equations: algebraic solution.

As preparation for our algorithm, an open chain is firstly converted to a closed 6R chain. In a redundant chain of N>6 rotors, six rotors are selected (associated with unknown joint angles) and the intervening structure between two consecutive rotors is rigidified by fixing all intervening joint angles (or torsions in a molecular chain) and then replaced by a common normal link of the two axes of rotors. The DH transformation places a Cartesian frame at either end of each joint (Fig. 2). For an open 6R robot arm, we only need to add one virtual link between the sixth and first joints as shown in the right figure of Fig. 1. This results in a closed 6R DH system as shown in the left figure of Fig. 1. The details can be found in App. A. The closed kinematic chain of six rotors is decomposed into two subchains, in which two joints are selected, separated by two joints along either subchain. We set one as the reference, denoted by a subscript R, and the second as the arm, denoted by a subscript A. Here R can be assigned to any joint 1, …, 6 in the chain with the others assigned in cyclic succession. The six unknown joint angles are θi, i=R, R+1, A1, A, A+1, R1. Applying the notation of [21, 26], we denote ci=cosθi, si=sinθi and half-tangent ti=tan(θi2).

Figure 2.

Figure 2.

Denavit-Hartenberg coordinate frames are at wj±, θj is the joint angle and αj is the twist angle.

We then can formulate closure conditions for the closed DH system and solve the problem accordingly. A set of fourteen closure conditions (Sec. 9.2.2 in [2]), involving the 10 quantities given in Table 1 each evaluated in terms of the unknown θA, or more precisely its half-tangent tA, and the sines and cosines of θA+1, θR1 and θR+1, θA1, are extended into a set of twenty equations with respect to the unknowns. The closure conditions are set up so the unknown θR is absent from all evaluations, and is eliminated by default. Then we can solve the system by following three more steps. The overview of the procedure is as follows and further description of every step will be given in the following subsections:

Table 1.

The fourteen quantities used in closure conditions, presented in complexified form as 4 complex and 6 real expressions. Evaluating these along both subchains joining reference R and arm A results in the fundamental closure equations. Eqs. E5E10 are duplicated after multiplication by tA, resulting in 20 real equations.

E1 zR,xA1+iyA
E2 12r,rzRr,zRr,xA1+iyA
E3 zR×r,xA1+iyA
E4 r,xA1+iyA
E5 zR,zA
E6 12r,rzRr,zRr,zA
E7 zR×r,zA
E8 r,zA
E9 r,zR
E10 r,r2

A. Formulation of the system of equations.

Based on the closure conditions, we can construct and arrange the twenty equations through symbolic preprocessing as

Bb=Pc+qtA+r=(PαtA+Pβ)(c1),whrereb=(tAbb),c=(tAcc)

where B, P, q, r, Pα and Pβ are coefficient matrices: B, P are 20 × 16, q, r are 20 × 1 and Pα, Pβ are 20 × 9. The components in b, c are given by

b=[cR+1cA1,sR+1cA1,cA1,cR+1sA1,sR+1sA1,sA1,cR+1,sR+1]T, (1)
c=[cA+1cR1,sA+1cR1,cR1,cA+1sR1,sA+1sR1,sR1,cA+1,sA+1]T. (2)

B. First elimination using SVD.

The SVD of B is calculated as B=UΣVT, and the transpose of the left null-vectors of B (denoted as UNT which is 4 × 20) is multiplied on both sides of the system to eliminate the terms on the left side completely which contain the variables θR+1 and θA1. Then the resulting right side has four equations and can be arranged as follows:

UNTBb=0=(UNTPαtA+UNTPβ)(c1)=(PαUtA+PβU)(c1),

where PαU, PβU are coefficients matrices with dimension 4 × 9. We note that the SVD is performed in complex form, resulting in a 50% speedup, and the results are converted back into real form.

C. Formulation of generalized eigenvalue problem.

The sines and cosines of θR1 and θA+1 in the resulting 4 × 9 system above are firstly converted by the half-tangent identities sj=2tj(1+tj2) and cj=(1tj2)(1+tj2). Multiplying this first set of equations by tR1 yields a second set which is cubic in tR1 , quadratic in tA+1 and linear in tA. Then the expanded system is sorted into three coefficient matrices by powers of tA+1 as (tA+12H2+tA+1H1+H0) v=0, where H2, H1, H0 are 8 × 8 and

v=(tAh,h)T;h=[tR13,tR12,tR1,1]T. (3)

Then we construct the 16 × 16 generalized eigenvalue problem with notations ΛtA+1, v1v and v2tA+1v,

(OIH0H1)(v1v2)=Λ(IOOH2)(v1v2).

where O denotes an 8 × 8 block of zeros and I is the 8 × 8 identity block. The variables θA+1, θR1 and θA can be obtained from the real eigenvalues and eigenvectors. We also check for multiple eigenvalues and apply extra treatment when necessary.

D. Solving for remaining variables.

The vector b is acquired by multiplying the pseudoinverse B=V^Σ^1U^T on both sides of the original system:

b=B(PαtA+Pβ)(c1).

Then θR+1 and θA1 can be solved with selection of appropriate components of b to achieve accurate solutions, and θR is computed with symbolic expressions.

2.1. Formulation of closure conditions and system of equations.

In this section we describe the formulation of closure conditions for the closed DH system. The arm axis zA has two associated frames: the first locates at the head of zA connecting to link axis xA, QA+={xA,yA,zA} and the second is QA={xA1,yA,zA}, where the tail of zA connects to link axis xA1. Let r be the vector connecting the tail of the reference axis zR to the tail of arm axis zA, so that r and zR are coterminal and r connects zR to the frame origin of QA (left in Fig. 1).

Let us first consider the rotation about θA relating the frame QA to QA+, where

xA1=xAcosθAyAsinθA,yA=xAsinθA+yAcosθA.

Taking the inner product between an appropriate vector w, and the coordinate vectors xA1, and yA, we obtain

w,xA1=w,xAcosθAyAsinθA,w,yA=w,xAsinθA+yAcosθA). (4)

The sines and cosines of θA are next converted to half-tangent relations through the identities for tA=tan(θA2) as sinθAtAcosθA=tA, and tAsinθA+cosθA=1. Multiplying each of the inner-product relations (4) by tA, and adding (respectively subtracting) the other replaces the two unknowns sinθA and cosθA with single unknown tA=tan(θA2) at the cost of coupling the equations (4), resulting in the pair of relations

w,xA1tAyA=w,yAxAtA,w,yAtA+xA1=w,xAyAtA. (5)

Equations in (5) are equivalently expressed in the matrix form

(w,xA1w,yAw,yAw,xA1)(tA11tA)=(w,yAw,xAw,xAw,yA)(1tAtA1), (6)

which is the matrix representation of the complex equation

(w,xA1+iw,yA)(tA+i)=(w,yAiw,xA)(1+itA). (7)

The observation of the complex form of the coupled equations is used to cut the computation by 50% for the first elimination step where the SVD of the matrix of coefficients corresponding to the left-hand side unknowns is computed as a complex 10 × 8 matrix rather than a real 20 × 16 matrix.

The displacement of the arm frame QA with respect to the reference axis zR is fully and redundantly described by 10 quantities in Table 1 and the vectors xA1, yA, zA, zR and r, relating zR and connecting vector r to the arm frame QA. Six of the quantities, those without imaginary parts (E5E10), are already in suitable form to evaluate along both sides of the loop connecting zR to zA to form a set of closure conditions posed as a system of 6 equations where the unknowns are partitioned into two sets: the sines and cosines of θR+1, θA1 and the sines and cosines of θA+1, θR1.

Equating real and imaginary parts of (7), or the first column of the matrix relation (6) with w=zR for (E1), w=12r,rzRr,zRr for (E2), w=zR×r for (E3), and w=r for (E4), we can obtain the other set of 8 equations by writing the real and imaginary parts separately as E1,R,E1,I,,E4,R,E4,I. Details of all the equations are given in App. B. Then the real-valued relations between L, the left-hand expansion into the constants multiplying the sines and cosines of θR+1, θA1, and R, and the right-hand expansion into the sines and cosines of θA+1, θR1, coupled by the half-tangent of θA can be evaluated below. The left evaluation L is formulated by orthogonal transformations through which the vectors xR,,xA1 and zR,,zA1 can be expressed in the coordinates of the arm frame QA. The right evaluation R is similarly formulated by expressing the vectors xA,,xR1 and zA,,zR1 in the coordinates of the arm frame QA+.

The orthogonal transformation between frames connected by a joint axis zi is given by the rotation ui=Aa,iui+, where ui=(u,xi1, u,yi, u,zi)T contains the coordinates of unit vector u expressed in the frame Qi, and ui+=(u,xi, u,yi, u,zi)T contains the coordinates of u expressed in the frame Qi+. Similarly, ui+=Aa,i1ui rotates the opposite direction about an axis, with Aa,i1=Aa,iT, the transpose of the forward rotation. The transformations either way about a link xi are given by ui+=Al,iui+1, and ui+1=Al,i1ui+. The orthogonal matrices Aa,i and Al,i are the 3 × 3 rotation matrices

Aa,i=(cisi0sici0001),andAl,i=(1000λiμi0μiλi), (8)

where λi=cosαi and μi=sinαi and αi is the given twist angle.

Composing transformations in (8), ui=Aiui+1; and transforming the opposite direction around the loop, ui+1=Ai1ui, with

Ai=Aa,iAl,i=(cisiλisiμisiciλiciμi0μiλi),andAi1=AiT. (9)

The left evaluation L proceeds by writing

uA=AA11AR+11Al,R1uR+, (10)
uA=AA11AR+11uR+1, (11)
uA=AA11uA1. (12)

Then the coordinates of zR in frame QA are found by setting uR+=[0,0,1]T in (10); in other words, in the third column of AA11AR+11Al,R1. The connecting vector in terms of the axis lengths Sj and link lengths aj is given by

r=SRzR+aRxR+SR+1zR+1+aR+1xR+1+SA1zA1+aA1xA1.

Each term in the expansion is transformed to the coordinates of QA with zR from (10), xR, zR+1 from (11) and xR+1, zA1 from (12).

The right evaluation R proceeds by writing

uA+=Al,AAA+1AR1uR, (13)
uA+=Al,AAA+1uR1, (14)
uA+=Al,AuA+1. (15)

Then the coordinates of zR in the frame QA+ are found in the third column of Al,AAA+1AR1, that is by setting uR=[0,0,1]T in (13). In the right evaluation, the connection vector r is written as the vector sum proceeding the other way around the loop

r=(aR1xR1+SR1zR1+aA+1xA+1+SA+1zA+1+aAxA+SAzA).

Each term in this expansion is then written in the coordinate frame of QA+, with xR1 from (13), zR1, xA+1 from (14) and zA+1 from (15).

After deriving the vectors and equations symbolically using MAPLE, we seek to eliminate all terms involving monomials in cR+1, cA1, sR+1, sA1 and their products with tA. There are a total of 16 such terms and only 14 equations in the system. An additional six equations, (E11)(E16), are formulated by multiplying both sides of equations (E5)(E10) by tA. This process does not introduce additional monomials as (E5)(E10) do not involve tA. To perform an optimally conditioned first elimination, we compute the SVD [25] of the left coefficient matrix and multiply both sides of the equation by its left null-vectors. We proceed by describing a procedure for computing the null-vectors using a complex version of the SVD, taking advantage of the inherently complex structure of the system.

2.2. Complexifying the first elimination.

The entire system of equations (E1)(E16) is written as a 20 × 16 matrix equation Bb=Pc+qtA+r, given in block form as

(B1B2B30B2B10B3)(tAbb)=(P1P2P30P2P10P3)(tAcc)+(q1q2q30)tA+(r10r3r4), (16)

where b, c are given in (1) and (2). The matrix B denoted in block form with 4 × 8 blocks B1 and B2 from the left evaluations of (E1,R)(E4,R); and the 6 × 8 block B3 from the left evaluations of (E5)(E10), each holding the constant coefficients multiplying the vector of unknowns b. Similarly for the right-hand side coefficient matrix P and vector of unknowns c, corresponding to the sines and cosines of θA+1, θR1. Finally, the 20 × 1 vector q holds all coefficients of each equation that multiply only the unknown tA and r holds all constants. The four equations (E1,R)(E4,R) are written as (B1B2)b=(P1P2)c+q1tA+r1; the six equations (E11)(E16) are written as B3tAb=P3tAc+q2tA; the equations (E1,I)(E4,I) are written as the subsequent four rows of the system, (B2B1)b=(P2P1)c+q3tA+r3; and the last six rows of (16), namely B3b=P3c+r4 hold equations (E5)(E10). This particular ordering of equations is chosen to reveal the complex structure of B.

The coefficient matrix B on the left-hand side of (16) is the real representation of the complex matrix C

B=(B1B2B30B2B10B3),C=(B1B3)i(B20).

We proceed by computing the complex SVD of C, then block multiplying both sides of (16) by the left singular vectors of B reconstructed from the left singular vectors of C. This technique is motivated by the observation that the set of singular values of B are the set of singular values of C, each with twice the multiplicity; moreover, the singular vectors of B are rearrangements of the real and imaginary parts of the singular vectors of C. The reduction of a 20 × 16 to a 10 × 8 matrix decomposition justifies the use of complex arithmetic, as the calculation of the SVD is one of the computationally intensive steps in the entire algorithm. The full description of the relation between the SVD of complex matrix and that of its real representation is discussed in the App. C.

The SVD of C is obtained for instance by the routine ZGESVD in LAPACK [1]. Assume C=UCΣCVCH, with UC and VC complex unitary, and VCH the Hermitian conjugate of VC. ΣC is the real 10 × 8 matrix whose upper left-hand block is the diagonal matrix containing the singular values of C in descending order, with remaining entries of zero. Write UC in explicit complex form as

UC=(UR,1+iUI,1UR,10+iUI,10).

Assume B=UΣVT where U and V are real orthogonal matrices, and Σ is the real 20 × 16 matrix whose upper left-hand block is the diagonal matrix of singular values of B in descending order, with remaining entries of zero. Then U can be obtained from UC as

U=(UR,1UI,1UR,10UI,10UI,1UR,1UI,10UR,10).

The left null-vectors of B are the last 4 columns of U, denoted here as the 20 × 4 matrix UN,

UN=(UR,9UI,9UR,10UI,10UI,9UR,9UI,10UR,10).

Define the 20 × 9 coefficient matrix Pα from the first 8 columns of P concatenated with q, and the 20 × 9 matrix Pβ from the last 8 columns of P concatenated with r,

Pα=(P1q1P3q2P2q300),Pβ=(P2r100P1r3P3r4).

Equation (16) can now be written more compactly as

Bb=(PαtA+Pβ)(c1). (17)

Since UNTB=0, left-multiplying (17) with UNT eliminates the sines and cosines of θR+1 and θA1, as contained in b. The resulting 4 × 9 system

(UNTPαtA+UNTPβ)(c1)=(PαUtA+PβU)(c1)=0, (18)

is optimally conditioned, and the process allows a stable elimination of the first set of variables and computation of the resultant for the remaining ones. c was defined in (2).

2.3. Formulation of the generalized eigenvalue problem.

The next step in the solution process is the conversion of the sines and cosines of θA+1 and θR1 to their respective half-tangents in order to reformulate the system as a 16 × 16 generalized eigenvalue problem for eigenvalue tA+1. The two remaining unknown half-tangents corresponding to (18), tA and tR1, are extracted from the corresponding eigenvector for each real eigenvalue. First, the 4 × 9 system (18) is transformed into an 8 × 8 polynomial system in the half-tangents of θA, θA+1 and θR1 as follows. The sines and cosines of θA+1 and θR1 in c (2) are converted by the half-tangent identities sj=2tj(1+tj2) and cj=(1tj2)(1+tj2). Multiplying through by (1+tA+12)(1+tR12) to clear denominators transforms the system (18) to a system of four polynomial equations. Each of these is quadratic in tA+1, quadratic in tR1 and linear in tA. Multiplying this first set of equations by tR1 yields a second set which is cubic in tR1, quadratic in tA+1 and linear in tA. The coefficients of (18) are thereby sorted into three coefficient matrices by powers of tA+1, namely the 8 × 8 matrices H2, H1 and H0 which satisfy

(tA+12H2+tA+1H1+H0)v=0, (19)

with the unknowns held in vector v given in (3).

The matrix polynomial problem (19) is rewritten as the generalized eigenvalue problem

(OIH0H1)(v1v2)=Λ(IOOH2)(v1v2). (20)

An in-depth discussion of the solution to the matrix polynomial (19) posed as the generalized eigenvalue problem (20) may be found in [7, 17, 18], and the references therein. In particular, it is established that {Λk}k=116, the set of eigenvalues of (20) are the solutions of (19), and the real eigenvalues correspond to solutions of the physical problem. Equation (20) is solved for instance using the LAPACK routine DGGEV. The structure of (20) with respect to (19) is revealed by expanding (20) by blocks, yielding

v2=Λv1, (21)
H0v1H1v2=ΛH2v2. (22)

For the eigenvalue Λ=tA+1, applying (21) to (22), we obtain

(tA+12H2+tA+1H1+H0)v1=0, (23)

that is, for each real eigenvalue tA+1, the components of v1 are the unknowns of v in (3). To obtain the correct normalization, take for instance tA=v2,4v2,8, and tR1=v2,7v2,8, where v2,j is the jth component of vector v2=Λv1. The generalized eigenproblem has the optimal size of 16 × 16, and it allows handling of exceptional cases, such as joint angle values equal to π. We also remark that the choice of multiplying tR1 with the first set of equations and expanding the matrix polynomial (19) in terms of tA+1 is arbitrary.

2.4. SolVing for remaining three Variables.

The remaining variables θR+1 and θA1 may be obtained by taking advantage of the previously computed SVD of B in system (17) where the left-singular vectors and right-singular vectors were found. For the last variable θR, we will calculate the joint angle among three vectors by using the expressions in (10)-(15). Since the numerical values of the sines and cosines of θA, θA+1 and θR1 are now considered known, they can be used in the following calculations.

To find θR+1 and θA1, we first substitute three known variables tA, θA+1, θR1 into the system (17) and now the right hand side of (17) is a known 20 × 16 matrix. We next form the pseudo-inverse B of the coefficient matrix B=UΣVT, where the factors U, Σ, V have already been computed in the first elimination step. From the economy SVD, B=U^Σ^V^T where U^ contains the left singular vectors of B, V^ contains the right singular vectors of B, and Σ^ is the (square) diagonal matrix containing the singular values of B, the pseudo-inverse B is given by B=V^Σ^1U^T, and satisfies BBb=b, revealing the remaining unknowns residing on the left-hand side of (17) by

b=B(PαtA+Pβ)(c1). (24)

As the right hand side in the equation above is known, we extract the values for sines and cosines of θR+1, θA1 by selecting appropriate components of b. Applying the arctangent function atan2, we then can get the values for θR+1, θA1. Take for instance θR+1=arctan(b16,b15) and θA1=arctan(b14,b11).

The last unknown θR is recovered using three vectors xR1, zR, xR expressed in the same frame. From equations (10)-(15), we already have the expressions of the vectors zR, xR in the frame QA and xR1+, the expression of the vector xR1 in the frame QA+. Then we only need to apply one more transformation to xR1 and express it in the frame QA:xR1Aa,AxR1+. Now all the three vectors are expressed in the same frame QA and the joint angle θR may be computed among xR1, zR, xR and then all 6 of the unknown joint angles may be identified for each real solution of the generalized eigenvalue problem (20).

3. Computational details and discussion of special cases.

The stable implementation of the method requires further consideration. Let us start from the first identified variable tA+1. The solutions for θA+1 will be obtained once we get the eigenvalues. After obtaining the eigenvalues tA+1, we will use eigenvectors (which have 16 components) to calculate tA, tR1. In the case of a simple eigenvalue the eigenvector V is comprised of constant multiples of various monomials in these variables:

V=[v1;v2=tA+1v1],v1=[tAh;h],h=[tR13,tR12,tR1,1]T.

The key here is that in the eigenproblem solver the eigenvector will be scaled by the largest component. To obtain the solution as accurately as possible, we will select the octad containing the maximal component. Either the first 8 components v1 or the last 8 components v2 will be used.

If tA+1>1, the maximum is found among the last 8 components and v2 will be selected to calculate tA, tR1. Otherwise, v1 will be chosen. This holds also in the limits tA+1 and tA+10. Here we denote the 8 component vectors as vm, m=1 or 2. The index of the maximal component in vm depends on the magnitude of tA, tR1 as shown in Table 2 where details of the computation for each case are given. Cases where at least one of the variables θA, θA+1, θR1 is close to π and the corresponding tA, tA+1, tR1 goes to require no additional treatment.

Table 2.

Computing variables. Double vertical lines indicate separate tests, with all cases hinging on the magnitude of tA: first, tA and tR1 found from eigenvector components, depending on the magnitude of tR1; then θR+1 and θA1 are found depending on relative sizes of certain components in b.

Max tA tR1 tA tR1 b θR+1 b θA1
vm,1 ≥ 1 ≥ 1 vm,1vm,5 vm,1vm,2 b3>b6 atan(b2b3,b1b3) b7>b8 atan(b4b7,b1b7)
vm,4 ≥ 1 < 1 vm,4vm,8 vm,3vm,4 b3<b6 atan(b5b6,b4b6) b7<b8 atan(b5b8,b2b8)
vm,5 < 1 ≥ 1 vm,1vm,5 vm,5vm,6 atan(b16,b15) atan(b14,b11)
vm,8 < 1 < 1 vm,4vm,8 vm,7vm,8 ”” ””

After solving for the first three variables, the pseudoinverse is used to calculate θA1, θR+1 in (24). Since the vector b also contains tA which might be large in magnitude, the maximal component of b must be determined. If tA<1 and the maximal entry appears among the last 8 components of b, we will calculate θR+1, θA1 as θR+1=arctan(b16,b15) and θA1=arctan(b14,b11). Otherwise we will apply the first 8 components of b. One more test is needed to determine which components are selected. If b3>b6 (that is, cA1>sA1), then θR+1=arctan(b2b3,b1b3). Otherwise θR+1=arctan(b5b6,b4b6). If b7>b8 (that is, cR+1>sR+1) then θA1=arctan(b4b7,b1b7). Otherwise θA1=arctan(b5b8,b2b8). The results are summarized in the last four columns of Table 2. The procedures given above will produce the final solutions correctly for all regular cases.

Discussion of the difficulty of the possible singular case where one variable is close to π without further analysis has appeared e.g. in [18, 20, 10], and this case can spontaneously arise in the study of macromolecular chains [6, 16] as was also pointed out in [11]. Following the method in [12], Kim and Chirikjian [11] introduce a Jacobian-based method to handle this issue, presumably due to failure of the basic method. However, in the present formulation, the case where certain joint angles are equal to π is naturally handled by the general approach.

In contrast, the presence of multiple eigenvalues requires special consideration. It was mentioned in [18] that multiple eigenvalue cases may arise in exceptional situations. The key difficulty, given a stable computation of the invariant subspace of a multiple eigenvalue, is that the corresponding eigenvectors may not follow the algebraic monomial pattern as expected and the formulas above will not produce the correct solutions. One way to address this problem is to change the reference (R) and arm (A) in the 6R6B system: there exist 6 possible choices for the reference and the eigenproblem might be simple for one of them. However, as shown in the examples, special cases can exist for which regardless of reference some of the eigenvalues are still multiple. Then we must resort to the modification procedures as discussed in the Appendix. LAPACK 3.10.0 used in the computations presented here can handle multiple eigenvalues stably, while that was not the case for earlier versions. As a result, it is now possible to take advantage of basic linear space theory to transform the eigenvector basis of the invariant subspace to a basis vector set that is congruent to the required monomial structure from which the other variables may be extracted. In robotics, continuous movement of the system is desired as a result of parameter perturbation. When changes in the system may cause an instance of a multiple crossing of eigenvalues, our method can still maintain accuracy so that different solutions could be tracked continuously through the crossing. By comparison, the Jacobian continuation method discussed in [11] can identify the changing process of specific eigenvalues and correctly follow the movement of the system, however at the price of increased computational cost.

Consider a double eigenvalue ρ1ρ2 as an example. One tolerance tol1, typically less than 1e-14, is used to determine the equality of eigenvalues. Numerical accuracy can also be at issue, as the tolerance to identify equality may be dependent on the matrix pencil of the eigenproblem. The solver will produce two basis vectors V1 and V2 for the two dimensional subspace, and in general we will need to apply extra treatment in order to uncover the unique basis pair possessing the required algebraic monomial structure. An additional complication results from the presence of several variables of higher multiplicity or the presence of infinity and zero in tA, tR1. Then we need to determine if it is a special case by checking certain components in V1, V2. Here we only show the determination for ‘regular double’ and ‘double-double’ cases where tA, tR1 are not zero or infinity. The detailed description and pseudocode for the determination of all cases is given in the App. D. The ‘regular double’ means that the eigenvalue tA+1 is double and tR1 is not, while ‘double-double’ means tR1 is double as well. Because of our construction, the double eigenvalue with only double tA is treated as regular double. Double-double cases are identified by checking if certain ratios between components in V1, V2 are within another tolerance tol2 (typically 5e-12), as follows:

!Test if eigenvaluesρ1,ρ2are equal,defineDIFij=V1,iV1,jV2,iV2,jIFρ1ρ2<tol1or1ρ11ρ2<tol1IFDIF78,DIF58,DIF34,DIF14<tol2V1,3V1,4V1,7V1,8<tol2THENapply treatment for double-double caseELSEapply treatment for regular double cases

This method also works for the triple case: tol1 will be applied to test if ρ3 is equal to ρ1 and ρ2. In regard to higher multiplicity, we have only considered as far as the triple-double case and provided special treatment. The ‘triple’ in triple-double means the eigenvalue tA+1 is triple and ‘double’ means that among the corresponding three solutions for tR1 two have equal values. Our method to handle triple-double case however is different from double-double case above. The treatment for regular triple case will be applied first and three solutions for tR1 will be obtained, denoted as DT1. Next we choose any two eigenvectors and apply the regular double treatment to them and get two solutions for tR1, denoted as DT2. If two values of DT2 are in DT1, then it is actually triple-double case, otherwise it is regular triple. The logic introduced to treat triple cases is as follows:

!Test if eigenvaluesρ1,ρ2,ρ3are equalIFρiρj<tol1or1ρi1ρj<tol1,for alli<j3apply regular triple treatment,getDT1apply regular double treatment toVi,Vj,getDT2IFDT2inDT1THENapply treatment for triple-double caseELSEapply treatment for regular triple case

We note that cases where all half-tangent variables are simultaneously double – representing a common first-order tangency of the surfaces associated with the underlying polynomial system – can not be treated by this method, as a double eigenvalue would then be defective with only a single eigenvector which cannot be handled by the eigensolver. As a result, defective cases are typically not identifiable by checking the eigenvectors from the solver or solvable by the method. However one special case might be identified through the components in eigenvectors, specifically if tA, tR1 are both double infinity. Such a case will be discussed in Example 5 below.

4. Numerical results.

In our method, we employ the left null vectors of matrix B (16) as obtained from the SVD to efficiently arrive at the resultant (18) while complexifying the SVD increases computational efficiency. The pseudoinverse B is used to stably determine the eliminated variables. The 16 dimensional generalized eigenvalue problem as derived in our method as well as in [13, 21, 12, 15, 22] corresponds to the smallest possible dimension of the problem. The solver for the generalized eigenvalue problem is used in our method, as well as in [18, 21]. An alternative approach is to multiply the inverse of the right matrix (like in [12, 15]) to convert into an ordinary eigenvalue problem. The key advantage of the generalized eigenproblem approach is in enabling the correct handling of the case of infinite eigenvalues, corresponding to a joint angle equal to π. In this section, we first compare the performance of our method with the results from two state of the art methods as analyzed in [3]. Then several special cases are designed to show the stability of our method, for instance the presence of π in the solution and the case of multiple eigenvalues. Two special singular cases are discussed at the end.

4.1. General Performance.

To benchmark the performance of R6B6 in comparison to what may be considered the state of the art methods, we examine four manipulators discussed in [3]: Raghavan and Roth Manipulator (abbreviated as RRM), IACE Laboratory Manipulator (ILM), Paint Manipulator (PTM) and the Manocha and Canny Manipulator (MCM). Detailed description of manipulators can be found in [3]. In that paper, two methods [10, 15] were compared using 2500 tuples of 6 joint angles. The 6-tuples were first randomly chosen and used to construct the end effectors. Based on the end effectors, the two methods were applied respectively to check if the corresponding 6-tuples of joint angles can be recovered. Here we follow the same logic to check the performance of R6B6 with respect to the above manipulators. We choose 2500 random tuples of joint angles in the range [π, π] to construct the end effectors and then solve the inverse kinematics using our algorithm written in C++. The program is compiled on Mac using Clang version 12.0.0. LAPACK 3.10.0 routines written in Fortran 90 are compiled by gfortran version GNU 8.2.0.

All the cases tested were solved correctly by our method. The timings are given in Table. 3. The timings for the three major steps are given separately. The timing of conversion contains the transformation between open chain and closed ring and the timing for calculating the remaining variables. The SVD timing is for the SVD function and the eigenvalue step is for the generalized eigenvalue computation. As can be seen in the table, the average total time for all the manipulators is around 0.5 ms and the average errors for all the joint angles are 8.1e-12, 1.6e-13, 1.3e-12, 6.7e-14 respectively. The maximum errors (not shown in table) are 1.4e-8, 1.1e-10, 1.3e-9, 5.0e-11. To further demonstrate the stability of the algorithm, the closest solution found in each case to the input joint angles was used to compute the closure error, i.e. the difference between the posed end effector and the one found from these angles with a forward kinematic construction. The average Frobenius matrix norm [25] of the difference between the posed and reconstructed end effectors is 1.3e-12, 8.6e-14, 3.8e-13, 3.7e-14 (with maximum values at 1.7e-9, 3.5e-11, 2.2e-10, 6.4e-12), thus verifying the stability of the solution and reconstruction processes. The computations were performed on a Macbook with Intel Core i5 Dual-Core, 2.7 GHz and 8GB RAM.

Table 3.

Computation times (in μs) for the various stages of R6B6 algorithm.

Steps RRM ILM PTM MCM
Conversion 97.38 97.99 96.87 110.57
SVD 102.56 103.24 103.76 107.71
Eigenvalue 165.80 154.76 170.28 166.16
Total (avg.) 482.85 454.33 491.75 507.67
Total (max.) 2222.0 2878.0 2389.0 2526.0
Total (min.) 405.0 388.0 403.0 403.0

According to the results in [3] (performed on a PC with AMD Phenom processor, 3.2 GHz and 4 GB RAM), the timing for the manipulators with the method in [10] and [15] is more than 10 ms and 1 ms respectively. We note that the error results for the later two methods refer to solved cases, while both methods fail for certain cases. The timings, corresponding smallest errors and failure rate (%) of Liu-Zhu (LZ) method and Husty-Pfurner (HP) method are included in Table 4. No failures were observed for our method, even after repeating the test for 25000 random 6-tuples. We discovered one intrinsically singular case in MCM, as discussed in example 7 below.

Table 4.

Comparative results for R6B6, LZ and HP algorithms. Average computation time (in ms), average errors of solved angles in radians and failure rates are given. The results shown for the other two methods are as reported in [3]. The LZ method failed 100% on the ILM and PTM manipulators, so the error reported corresponds to slightly perturbed manipulator parameters.

RRM ILM PTM MCM
Average execution time (ms) R6B6 0.5 0.5 0.5 0.5
LZ 1.2 2.4 2.4 1.9
HP 9.7 9.7 9.6 9.7
Error (rad.) R6B6 8.1e-12 1.6e-13 1.3e-12 6.7e-14
LZ 1.7e-11 4.3e-5 2.8e-6 1.6e-8
HP 1.4e-7 3.9e-8 8.6e-6 2.3e-4
Failure rate (%) R6B6 0 0 0 0
LZ 0.1 100 100 0
HP 0 0.3 0.32 3.7

We next continue testing for some special examples. The list of seven examples is given in Table 5. The first example, involving tA+1=, is shown to follow the general case with no additional treatment, although three of the unknown joint angles in one solution take the value π. We then give four multiple eigenvalues examples, including instances of double and triple eigenvalues with additional multiple variables. The second example, where a double infinite eigenvalue is discussed, is shown to be amenable to the method in App. D.1. There follow two examples, the third one with a double and the fourth with a triple eigenvalue, both including additional double variables, for which the modifications given in App. D.2,D.3,D.4 will suffice. In the fifth example, a case is considered where there exists a double eigenvalue tA+1=0 with tA=tR1=. This case appears to be defective, as discussed in App. D.2. Finally, the sixth and seventh examples discuss the cases of zeros in the input parameters, and possible failures related to singular axes systems. The numerical analysis and discussion of the special features are provided in the corresponding examples.

Table 5.

List of information for all special examples.

Example # Description # solution
π case 1 θA+1, θA, θR1 in one solution are π 6
Multiple 2 Double eigenvalue 8
3 Special double eigenvalues 8
4 Special triple eigenvalues 8
5 Double 0 eigenvalue, adjacent double 4
0 inputs 6 One zero-length parameter 2
7 Many zero-length parameters 10

4.2. Example 1: simple π case.

If one of the variables θA, θA+1, θR1 involved in the eigenproblem through a half-tangent representation is close to π, it is stated in [18] and [11] that the system will be singular and extra iterations are needed to improve the accuracy. This is because the half-tangent of a joint angle approaching π goes to infinity which may introduce errors in the solution process. On the other hand, seen from the perspective of projective space, the point at infinity is just another regular point. In the eigenvalue solver in LAPACK as an example, an eigenvalue is represented by the ratio of a pair of parameters α and β. A vanishing β with nonzero α indicates an infinite eigenvalue, and no additional iterative method is required to obtain an accurate solution. Our method takes advantage of this: as outlined above, we only need to identify appropriate components in the computed eigenvectors to achieve accurate solutions. The input linkage parameters for the first example are shown in Table 6 and solutions are given in Table 7. In the first solution, the 4th, 5th and 6th variables are π which correspond to A, A+1, R1 respectively for reference R=1. This case shows that the eigenvalue goes to while other two variables obtained from the eigenvector also go to . For example 1, the 4 × 4 end effector matrix is

[xyzd0001],withx=[0.935729747639523,0.104687021946279,0.336824088833465]T,y=[0.266206316527123,0.836082865520739,0.479687021946279]T,z=[0.231395843574460,0.538522115997707,0.810215955259964]T,d=[4.712089111505835,10.150881856679735,8.892349540785121]T. (25)

Table 6.

Linkage parameters of example 1.

Joint i ai Si αi(deg)
1 1.00 9.00 90.00
2 4.00 1.00 −90.00
3 8.00 2.00 40.00
4 1.25 3.00 90.00
5 2.00 7.00 30.00
6 3.00 3.00 50.00

Table 7.

Solutions of joint angles (in degrees) for example 1.

No. θ1 θ2 θ3 θ4 θ5 θ6
1 80.0000 80.0000 110.0000 180.0000 −180.0000 180.0000
2 −108.4903 −65.5094 −130.2246 −129.6402 −157.3853 −168.0230
3 119.0163 −152.6296 131.2120 7.9542 −148.4491 5.1112
4 146.9569 −80.0075 155.6435 −11.9434 104.8319 −179.3449
5 6.8777 81.0330 −172.4691 165.2536 −9.9985 −61.1845
6 −126.9544 −42.7833 −64.5878 −141.2330 −63.8036 70.0651

4.3. Examples 2-5: Multiple eigenvalues.

The chains in examples 2-4 are closed chains involving 6 rotors with vanishing links. Here the end effector reaches the origin so its orientation is given by a 4 × 4 identity matrix. We use internal parameters, i.e. bond lengths bl, bond angles ba and torsional angles ta as defined in App. A, to pose these three examples, where the first two parameters define the linkage while the torsional angles are to be determined in the solutions. Example 2 entails a double eigenvalue, demonstrating in addition that an infinite double eigenvalue poses no special difficulties. Examples 3 and 4 correspond to double and triple eigenvalues respectively, both with additional double variables. Example 5 exhibits a case where the variables adjacent to the double eigenvalue are both infinite.

4.3.1. Example 2: Double π case.

Example 2 shows a case containing an infinite eigenvalue of multiplicity two. The internal parameters and transformed DH parameters of the system are given in Table 8 where the torsions ta are left unspecified because they will not be used in the solution process. The solutions are given in Table 9. The system is solved by setting the reference as R=1. The fifth variable in solutions 7 and 8 is π, so that we have a double eigenvalue at infinity. This case can be handled by the treatment for regular double eigenvalues in App. D.1.

Table 8.

Example 2. Left: Internal parameters; Right: DH parameters.

Index i bli bai tai ai Si αi
1 3.00 90.00 0.00 3.00 −90.00
2 2.00 90.00 0.00 2.00 −90.00
3 2.00 90.00 0.00 2.00 −90.00
4 1.00 90.00 0.00 1.00 −90.00
5 3.00 90.00 0.00 3.00 −90.00
6 1.00 90.00 0.00 1.00 −90.00
Table 9.

Solutions of joint angles for example 2.

No. θ1 θ2 θ3 θ4 θ5 θ6
1 99.6641 −64.8363 118.1837 −93.2078 116.6642 −63.2178
2 −99.6641 64.8363 −118.1837 93.2078 −116.6642 63.2178
3 −122.1432 51.4420 35.6079 −100.2152 42.2821 42.5890
4 47.9564 50.6006 −135.6256 77.1011 36.0662 −66.6271
5 122.1432 −51.4420 −35.6079 100.2152 −42.2821 −42.5890
6 −47.9564 −50.6006 135.6256 −77.1011 −36.0662 66.6271
7 0.0000 70.5288 0.0000 −70.5288 180.0000 −38.9424
8 0.0000 −70.5288 0.0000 70.5288 180.0000 38.9424

4.3.2. Example 3: Special double eigenvalue case.

The internal parameters and transformed DH parameters of example 3 are given in Table 10. Solving the system, we get 8 solutions as in Table 11. It may be verified that the second, third, fifth and sixth variables of the solutions have two values that are double. Setting the reference R as any of 1, 2, 4, 5 results in double eigenvalues, while for references 3 or 6 the system can be solved as a regular case. With varying references, the constructed system and the matrix pencil would change, requiring adjustments to the tolerances for determining the equality of eigenvalues. The tolerances for references R=1, 2, 4, 5 are 112e-16, 103e-16, 44e-16, 34e-16, respectively. In fact, this example is a double-double case where two consecutive variables can be both double. In Table 11, the double value in 5th variable correspond to double value in the 6th variable. For reference R=1 (resp. R=4), the eigenvalue (A+1) is the 5th (resp 2nd) variable and the 6th (resp. 3rd) variable, R1, is obtained from the eigenvectors. In these cases, we need one more tolerance check to decide the double-double case by testing equality of certain components in the two eigenvectors (see Appendix, section D.2). The tolerance is 5e-13 and 4e-14 for references 1 and 4 respectively. The reason is that these cases involve a double value for tR1 which requires special treatment. On the other hand references R=2 and R=5 involve a double value for tA which is in fact treatable by the regular double approach.

Table 10.

Example 3. Left:Internal parameters; Right: DH parameters.

Index i bli bai tai ai Si αi
1 3.00 90.00 0.00 3.00 −60.00
2 2.00 120.00 0.00 2.00 −140.00
3 2.00 40.00 0.00 2.00 −60.00
4 3.00 120.00 0.00 3.00 −90.00
5 1.00 90.00 0.00 1.00 −80.00
6 1.00 100.00 0.00 1.00 −90.00
Table 11.

Solutions of joint angles for example 3.

No. θ1 θ2 θ3 θ4 θ5 θ6
1 27.7358 −79.8312 79.8312 −27.7358 −87.5627 87.5627
2 −27.7358 79.8312 −79.8312 27.7358 87.5627 −87.5627
3 107.6847 −79.8312 79.8312 −107.6847 87.5627 −87.5627
4 −107.6847 79.8312 −79.8312 107.6847 −87.5627 87.5627
5 111.3982 36.4769 −36.4769 −111.3982 −41.2381 41.2381
6 −111.3982 −36.4769 36.4769 111.3982 41.2381 −41.2381
7 169.2944 36.4769 −36.4769 −169.2944 41.2381 −41.2381
8 −169.2944 −36.4769 36.4769 169.2944 −41.2381 41.2381

4.3.3. Example 4: Special triple eigenvalue case.

The parameters of example 4 are given in Table 12 and the 8 solutions are given in Table 13, as computed in reference R=1. Any other reference frame, with the exception of reference 4 (see below), could have been used, producing solutions of comparable accuracy. From Table 13, we can see that every variable of the solutions has two values that are triple. Consider solution 2, 4 and 6: the first variable 98.8994 is triple, the second variable in solutions 2 and 4 are double, and the sixth variable in solutions 4 and 6 are double as well. The other variables display a similar pattern. We note that no three consecutive variables exhibit simultaneous double values, which as mentioned earlier would result in an ill-posed system. We refer to this as a triple-double case where extra treatment will be applied to obtain the correct solutions as discussed in the App. D.4. There also exists tolerance for deciding equality of eigenvalues as in example 3 above. The tolerances here are 147e-16, 25e-16, 23e-16, 14e-16, 29e-16, 54e-16 for references R=1 through R=6, respectively. Here we must point out that the accuracy of the eigenvalue solver in C++ is not adequate for R=4, in which some small intermediate values become zero and NaN appears in the final solutions. The tolerance under which this issue arises will vary in other systems or software. To illustrate the triple multiplicity solutions, the reconstructed loops corresponding to solutions 2, 4 and 6 from Table 13 are pictured in Fig. 3 with solid grey, dotted red and dot-dashed black lines respectively. In this diagram, indices I-VI label the joints, which are connected by bonds. The first, second and the sixth bonds coincide because the first torsional angles in the illustrated solutions are equal for three rings. The third bond in the first two solutions and the fifth bond in the first and third still coincide because of double multiplicity of the second and sixth respective variables in the solutions.

Table 12.

Example 4. Left:Internal parameters; Right: DH parameters.

Index i bli bai tai ai Si αi
1 3 30.00 0.00 3 −120.00
2 3 60.00 0.00 3 −150.00
3 1.00 30.00 0.00 1.00 −120.00
4 1.00 60.00 0.00 1.00 −120.00
5 1.00 60.00 0.00 1.00 −120.00
6 1.00 60.00 0.00 1.00 −150.00
Table 13.

Solutions of joint angles for example 4.

No. θ1 θ2 θ3 θ4 θ5 θ6
1 −98.8994 98.8994 −34.7781 −145.2219 145.2219 34.7781
2 98.8994 −98.8994 34.7781 145.2219 −145.2219 −34.7781
3 −98.8994 98.8994 −98.8994 145.2219 −145.2219 98.8994
4 98.8994 −98.8994 98.8994 −145.2219 145.2219 −98.8994
5 −98.8994 −34.7781 98.8994 −145.2219 −81.1006 98.8994
6 98.8994 34.7781 −98.8994 145.2219 81.1006 −98.8994
7 34.7781 98.8994 −98.8994 81.1006 145.2219 −98.8994
8 −34.7781 −98.8994 98.8994 −81.1006 −145.2219 98.8994
Figure 3.

Figure 3.

Triple multiplicity solutions in example 4. Indices I-VI label the joints, subscripts denote the corresponding solutions.

Next we explore the impact of small perturbations on the equal eigenvalues and the tolerances (discussed in Sec. 3). Setting R=1, the eigenvalues correspond to the fifth variable θ5. Perturbing the second bond length in the input parameter, the effect on the eigenvalues corresponding to θ5 (Table 13, solutions 1, 4 and 7) is shown in Fig. 4. As seen in the figure, the eigenvalues coalesce linearly as the parameter is varied, and the slopes of their trajectories are approximately 4.8, 2.4 and 0. Without perturbations, the condition numbers of these eigenvalues are 4.36, 7.66 and 1125.98 calculated by using the eigenvectors from the solver. For the condition number ν of an eigenvalue Λ we used the expression for regular matrix pairs given in [24] (p. 294), ν=x2y2yHx, where x and y are the right and left eigenvectors of the matrix pair corresponding to Λ. The condition numbers for the perturbed system with perturbation 1e-10 are 9.67, 55.39, 48.65, which shows one of the eigenvalues becomes moderately more sensitive as they coalesce. However, the low condition numbers indicate the eigenvectors are stable with respect to this perturbation. Then the method gives an accurate solution for eigenvectors whose components are structured as in (3). As the perturbation increases, the three eigenvalues will diverge and the problem eventually becomes a simple case. We manually set a large tolerance to let close eigenvalues be treated as equal and apply the triple case treatment. When the perturbation to the second length is 1e-13, the tolerance is set to 5e-13 and the correct solutions can be obtained through the treatment to triple double case, while a small tolerance can not produce closed solutions. As the perturbation is up to 1e-10, it becomes a simple case where the closed solutions can be obtained without applying extra treatment. However we can set the tolerance as 5e-10 which will result in the triple case treatment being applied and closed solutions are again found. The difference of the solutions with treatment is on average 1e-5 from the ones without using the treatment. A similar observation appears for larger perturbations and tolerances. Therefore, a tolerance value on the order of 1e-14 which works well for the original, pure triple case may be too small to identify equality of eigenvalues for the slightly perturbed system while too large a value will induce unnecessary treatment that slows down the calculation. Setting the tolerance to a larger value 5e-11 works well for this triple case and the double case above, both in original form as well as under a small perturbation.

Figure 4.

Figure 4.

Converging process of three equal eigenvalues in example 4.

4.3.4. Example 5: a special double 0 case.

Besides the double-double case with finite values above, we may encounter a special case where the eigenvalue is double and corresponding eigenvector contains double infinity. Given two eigenvectors V1, V2, we may detect this special case from the components in V1, V2 and distinguish two main categories. The first category which is actually a double-double case, contains tR1 as double infinity so that only the first and fifth components in V1, V2 are nonzero and it has three subcases: 1. tA has two finite values; 2. tA has one finite and one infinity; 3. tA has double infinity as well, a defective case as discussed above. When we substitute tA+1, tR1 back into the original system, if we can identify zero in the last two components of vector BPα(c,1)T, this implies tA is double infinity and we assign tA=. Otherwise, tA has two finite values that can be handled by our modification. However we may not be able to distinguish the last two subcases and we simply set tA as double infinity, and that presents a limitation of this method. The other category contains tA as double infinity where the last 4 components in V1, V2 are zero. If tR1 is not double , this is a regular case that can be handled by choosing different components to calculate tR1 as shown in the App. D.1.

We designed example 5 to demonstrate a case where the eigenvalue is double and there is a single eigenvector containing both tR1, tA as double . The DH system parameters are shown in Table 14. Solutions, using reference R=5, in which the variables involved in the eigensystem are not all simultaneously double, are given in Table 15. When R=1, the fifth variable corresponds to the eigenvalue which has double 0, and corresponding 4th and 6th variables are double π, so this is the first category discussed above. This is actually a defective case: as expected, we can detect the double in tR1, tA by checking components in the eigenvectors and assign values. The calculation for remaining variables θR+1, θA1 will be done accordingly, leading to two identical solutions.

Table 14.

Linkage parameters of example 5.

Joint i ai Si αi
1 0.00 1.00 −90.00
2 1.00 2.00 0.00
3 0.00 1.00 −63.43494882292196
4 1.00 5 116.5650511770780
5 2.00 4.00 90.00
6 3.00 2.00 −180.00
Table 15.

Solutions of joint angles for example 5.

No. θ1 θ2 θ3 θ4 θ5 θ6
1 180.0000 180.0000 36.8699 −180.0000 36.8699 180.0000
2 177.5864 98.2537 81.1589 −177.3732 0.5874 179.9358
3 −180.0000 90.0000 90.0000 180.0000 0.0000 −180.0000
4 −180.0000 90.0000 90.0000 180.0000 0.0000 −180.0000

4.4. Example 6-7: Zero parameters.

In the last two examples, we want to explore the possible singularity when there exist zeros in the input parameters. In example 6, the length of one link is close to zero and the twist angle at this link is π. The parameters for lengths and angles, given in Table 16, were adopted from an instance of the 19-atom molecular ring shown in the left of Fig. 1, here converted to an open chain with end effector constructed with joint angles in degrees by [150°, 120°, −100°, −130°, −50°, 170°] and the end effector is in same format as (25) with

x=[0.633701650686384,0.306727455336273,0.710169336187001]T,y=[0.772570825541157,0.297759233174306,0.560779598935362]T,z=[0.039452977581008,0.904023067848594,0.425659200954952]T,d=[1.763571453982034,6.200325108507339,8.700810576520498]T.

Table 16.

Linkage parameters of example 6.

Joint i ai Si αi
1 1.00 6.00 90.00
2 5.00 1.00 150.00
3 0.00 0.60 180.00
4 1.00 3.40 80.00
5 1.40 2.40 30.00
6 2.30 3.00 −110.00

In this singular case, a small modification may cause large deviations in the solutions. With the parameters in Table 16 and the given end effector, the system is not solvable, becoming solvable only when a small positive value is assigned to the third link. We want to explore the lower limit of the length where the method may fail. Starting from a small positive length 1e-6 for the third link a3, we record one solution of the system in Table 17 as the length is decreased. As can be seen, the system is still solvable when the length is 1e-13. The method fails when the length is 1e-14. Moreover, as the length decreases, the third and fourth variables exhibit large changes, while the other four variables remain quite stable. Because the joint angle at the third link is 180°, the axes 3 and 4 become collinear as the length of the third link approaches zero. Geometrically, the joint angles at axes 3 and 4 will combine into one and the system now has actually 5 DoF. As can be seen, the third and fourth joint angles maintain a 30° difference, therefore producing the same net rotation. Since at least 6 DoF are required to achieve a workspace of open neighborhoods, the system will become unsolvable if a small change is made to the end effector in this example. We can expect that the case where a link is close to zero length combined with 0° twist angle is also singular with behavior similar to that shown here.

Table 17.

One solution of joint angles for example 6 as length of a3 decreases.

a3 θ1 θ2 θ3 θ4 θ5 θ6
1e-6 150.0000 120.0000 −100.0000 −130.0000 −50.0000 170.0000
1e-7 150.0000 120.0000 −100.0000 −130.0000 −50.0000 170.0000
1e-8 150.0000 120.0000 −100.0002 −130.0002 −50.0000 170.0000
1e-9 150.0000 120.0000 −100.0013 −130.0013 −50.0000 170.0000
1e-10 150.0000 120.0000 −100.0026 −130.0026 −50.0000 170.0000
1e-11 150.0000 120.0000 −100.0422 −130.0422 −50.0000 170.0000
1e-12 150.0000 120.0000 −104.2283 −134.2283 −50.0000 170.0000
1e-13 150.0000 120.0000 −42.8374 −72.8374 −50.0000 170.0000
1e-14 N/A

Example 7 is Manocha-Canny Manipulator from [18] and the parameters are shown in Table. 18. By specifying the values [22°, 34°, 56°, 90°, 90°, −120°] to the joint angles, we can get the end effector. However, the set of angles above cannot be recovered because of singularity. The singularity comes from two consecutive 90° in α3, θ4 and θ5, α5, and from consecutive zero lengths S5, a5, causing the vectors of axes s3, s6 to be collinear. Then the part between s3, s6 will be combined into one continuum unit and only the summation of θ3, θ6 can have direct impact on the end effecor. In the Table. 19, we choose two solutions from our method where the fourth and fifth angles are 90°. As can be seen, the summation of the third and sixth joint angles is −64° which is consistent with the initial joint angles above. In fact, any two values whose summation is −64° can reach the proposed end effector. This is the similar situation in example 6, where one DoF is dropped and the manipulator shows flexibility to some extent. In both examples, the matrix pencil in the generalized eigenvalue problem may become singular, the rank of the matrices is reduced by one and one of the eigenvalues is infinite. There may exist higher-order degenerate cases such as Bricard’s examples [4], in which the rank of the matrices in generalized eigenvalue problem drops by 2 or more. For these flexible cases, working on the polynomial equations will give more hints and it will be the subject of future research.

Table 18.

Linkage parameters of example 7.

Joint i ai Si αi
1 0.3 0.0 90.0
2 1.0 0.0 1.0
3 0.0 0.2 90.0
4 1.5 0.0 1.0
5 0.0 0.0 90.0
6 0.0 0.0 1.0

Table 19.

Two solutions of joint angles for example 7.

No. θ1 θ2 θ3 θ4 θ5 θ6
1 22.0000 34.0000 −66.8696 90.0000 90.0000 2.8696
2 22.0000 34.0000 64.7411 90.0000 90.0000 −128.7411

5. Conclusion.

In this paper, we have presented a novel algorithm for the 6R problem of Inverse Kinematics. It can solve the problem stably even under special conditions which can cause failure in previous methods. As our motivation for this work resulted from the kinematic analysis of arbitrarily long constrained molecular chains such as protein loops and large cyclic molecules, we also included a discussion of the reduction of such chains to DH coordinates. In our method, an arbitrary chain of rotors will be first transformed into a closed chain for which we may easily change the order of solving the 6 variables. The first elimination is performed by computing an SVD of a complex-valued system formed by the full set of closure conditions, and utilizing the pseudoinverse. In addition, the null vectors allow an efficient derivation of the resultant, arriving at an optimally sized 16 × 16 generalized eigenvalue problem. Three joint angles can be determined from the eigenvalues and eigenvectors, even in cases of infinite or multiple eigenvalues. The remaining three angles are subsequently solved using the SVD information. Two types of special cases were discussed in detail. In the first, at least one variable in one solution is π. The second describes cases of higher multiplicity eigenvalues. Although it may be argued that linkage systems may be carefully designed to avoid cases which could challenge previous algorithms, such cases do in fact arise for special manipulators, as discussed in the examples.

In order to reach broader audience, three different kinds of inputs are accepted in our code: DH parameters, Cartesian coordinates of the joint junctions or internal parameters, with outputs consistent with the inputs. Since it is developed based on closed chain and accepts different kinds of inputs, our method can find applications to both robotics and conformational sampling of biopolymers. The open source algorithm, R6B6, is freely available from the authors. In addition, the MAPLE symbolic derivation of the equations as used by our algorithm is also available.

Acknowledgments.

XC and EAC acknowledge support from the Laufer Center for Physical and Quantitative Biology at Stony Brook University. We acknowledge helpful conversations with Drs. Robert Lewis and Michael Wester. We thank an anonymous reviewer for pointing out Ref.[3].

The first two authors are supported by NIH RM1GM135136, NSF DMS2054251.

Appendix A. Formulating the 6R loop from an arbitrary chain.

The algorithm presented here can be applied in the context of transforming an open chain or a redundant chain into closed 6R Denavit-Hartenberg (DH) system or in sampling the alternative conformations of cyclic macromolecules and flexible loop regions of proteins as shown in Fig. 1. That is consistent with the fact that molecular bond lengths and angles are relatively “hard” DoF, while torsional angles among successive tetrads are deformable with low energetic cost. For an arbitrary chain, we need to select six rotor axes as pivots for the solution. The remaining N6 rotor angles are set to fixed values thus rigidifying the structure and the intervening structure between two selected axes will be replaced by a link orthogonal to both axes as shown in the left of Fig. 5. For an open 6R robot arm we only need to do this once to find the link between the sixth axis and first axis. Following shows the detailed procedures to finish the conversion. As the following discussion is mostly useful for the reduction of long molecular chains to DH coordinates, we shall be referring to the rotor angles as “torsions”, keeping the terms “joint angles” and “twist angles” for the system reduced to DH parameters. The notations in this and in each of the subsequent sections are self-contained, relevant only to each particular section.

Consider a chain of n1 vectors {b1,,bn1}. Denote the vertices of the chain {v1,,vn} where vector bi=vivi+1 joins vertex vi to vertex vi+1, i=1,,n1. An arbitrary chain may be considered as a closed loop by constructing link bn connecting vertex vn to vertex v1, and we have a closed loop with n vectors connecting n vertices. For ease of notation we continue the indices cyclically around the loop so that vn+1v1, etc. Suppose there are 6 unknown torsions in the chain indexed by ij, j=1,,6, and denote the axis vectors pjbij. Assume we are given the remaining n6 torsions 𝒯¯i=sgn([bi1,bi,bi+1])(bi1×bi,bi×bi+1), i{ij}j=16 where [a,b,c]=a×bc. Also assumed knowns are {b1,,bn} the lengths of the vectors and {𝒜¯1,,𝒜¯n} the (interior) angles: 𝒜¯i=(bi1,bi). In the context of a molecular chain, the lengths bi would be the bond lengths with 𝒜¯i being the bond angles.

Throughout, we will use the following notation for torsions in terms of the angle between two vectors, τ=(a,b)=cos1((aa)(bb))[0,π], and a sign: t=σ(a,b)=atan(s,c) with σ=±1, c=((aa)(bb)) and s=σ1c2. Here a , b are normal vectors on two oriented planes and the torsion refers to one of the dihedrals between the planes. In the typical situation, we have a vector triplet a, b, c and the torsion at b is computed by a variant of the formula torsion(a,b,c)=sgn([a,b,c])acos((a×b)(b×c)(a×bb×c)).

Figure 5.

Figure 5.

Left: Replacing intervening structure by equivalent orthogonal linkage. Right: Simplified loop with a virtual link and offset for angles.

We proceed by transforming the original loop into a simplified loop with 6 axes, (at most) 6 links. Any existing structure between the vertices vij+1 and vij+1 (structure between the axes) may be replaced by a “virtual” link ljvij+1vij+1 as shown in the right of Fig. 5 so that we now have a loop with at least 6 and at most 12 edges {p1,l1,,p6,l6} (since some or all of the links might vanish). This loop may be parametrized by the lengths {p1,,p6,l1,,l6}, the 6 angles between axes and links, j=(pj,lj); the 6 angles between links and axes, 𝒜j+1=(lj,pj+1); the 6 known torsions about, the links, 𝒯j; and the 6 unknown torsions about the axes,

ϕjsgn(νj)(lj1×pj,pj×lj),νj[lj1,pj,lj],j=1,,6.

For each of the missing torsions in the original problem there holds

𝒯¯ij=ϕjδjϕjδjδj+,

where δj , δj+ are offsets found in the transformation to the 6-axis/6-link loop:

δjsgn(γj)(lj1×pj,bij1×pj),δj+sgn(γj+)(bij+1×pj,lj×pj).

where

γj=[lj1,bij1,pj],γj+=[bij+1,lj,pj].

We transform once more to DH coordinates as shown in Fig. 6. Consider the two (in general oblique) lines in space defined by the vectors pj and pj+1 We introduce the unit vectors along the pj: p^j=pjpj. Let μj be the mutual moment of the axes (also the reciprocal product of their Plücker coordinates), of sign σj, where

μj=p^jlj×p^j+1,σj=sgn(μj).

The torsion at the link lj is given by

𝒯jσj(p^j×lj,lj×p^j+1).

Figure 6.

Figure 6.

Transformation of a simplified loop into the DH parameters at a link.

Each link lj is replaced by the unique link orthogonal to both pj and pj+1, intersecting an extension of pj at wj+ and pj+1 at wj+1. Define the DH axis vectors sj=wjwj+, the length sj=sj and the unit axis vectors zjsjsj, j=1,,6, collinear with the pj. Define the DH link-vectors aj=wj+wj+1, the length aj=aj and the unit-links xj=ajaj. The coordinate systems centered at each wj and wj+ are Qj{xj1,yjzj×xj1,zj} and Qj+{xj,yjzj×xj,zj} respectively, which are all right-handed orthogonal systems by definition.

We note that the orientation of the axes zj of the orthogonal systems may not coincide with the orientation of the axes p^j of the original reduced system since they depend on the placement of both adjacent axes p^j±1. As a result, the mutual moments of adjacent axes may have different signs in the original and DH systems. On the other hand, the orthogonal links xj are unaffected as they depend only on each pair of adjacent axes with no reference to the links adjacent at each side of the pair. The twist angles αj are the rotations between axes sj and sj+1 about link aj and the joint angles θj are the rotations between links aj1 and aj about axis sj. As such, these depend on the orientations of the orthogonal axes zj so the quadrant in which they fall may only be determined after the entire system of orthogonal links has been constructed. We have

zj=ζjp^j,ζj=±1

so that the mutual moments of the zj are

μ^j[zj,xj,zj+1]=ζjζj+1μj

and with ujp^jp^j+1 we have

cosαjzjzj+1=ζjζj+1uj,sinαj=ζjζj+1σj1uj2,

where ζj, the orientations of the zj with respect to the p^j, need to be determined.

Among the selected 12 atoms/nodes in the reduced linkage, we denote the points by Ajvij and Bjvij+1. To determine the location of the orthogonal links we introduce quantities tj+ (resp. tj), the oriented distances along the p^j from the point Bj (resp. Aj) to the orthogonal link junction wj+(resp.wj). Substitute Bjwj+=tj+p^j and Aj+1wj+1=tj+1p^j+1 into the equation Bjwj++wj+wj+1+wj+1Aj+1=lj to get expressions in terms of the p^j:

tj+p^j+aj,j+1tj+1,p^j+1=lj.

Taking dot products with p^j and p^j+1 and using the orthogonality of the link,

tj+ujtj+1=ljcosj,ujtj+tj+1=ljcos𝒜j+1.

with solutions

tj+=lj(ujcos𝒜j+1cosj)(1uj2),tj+1=lj(cos𝒜j+1ujcosj)(1uj2).

Special care must be taken in case the axis vectors are parallel or antiparallel, when the denominator in the above formulas vanishes. In that case, the orthogonal link may be situated arbitrarily. In general, when the mutual moment vanishes we have three cases: (1) parallel/antiparallel axes; (2) coplanar, non-parallel axes; (3) co-terminal axes. We discuss these special cases below. The idea is to choose a unique convention that allows unique forward and inverse DH transformation. We continue with the generic case discussion and we will follow by detailed analysis of the special cases.

In the generic case discussed above, we have for the signed length of the DH axis vector:

Sj=tj+pj+tj+,ζj=sgnSj.

Then sj=Sjp^j=ζjsjp^j.

The length of the linkage, aj is found from the invariant triple product as

aj=ljxj=(lj(1uj2))1uj2cos2𝒜j+1cos2j+1+2ujcos𝒜j+1cosj.

Defining σ^j=sgn(μ^j) where μ^j is the mutual moment of the axes (also the reciprocal product of their Plücker coordinates) defined above μ^jζjζj+1μj, we have

xj={σ^j(zj+1×zj)zj+1×zj,σ^j0(zj+1×zj)zj+1×zj,σ^j=0,non-parallel,co-terminal/coplanar(zj×lj)×zj(zj×lj)×zj,σ^j=0,parallelantiparallel}

so that the twist angle at the orthogonal link is

αj=sgn([zj,xj,zj+1])(zj×xj,xj×zj+1)=sgn([zj,xj,zj+1])(yj,yj+1).

By orthogonality, cosαj=zjzj+1 , sinαj=sgn([zj,xj,zj+1])zj×zj+1. Finally, the (unknown) joint angles about the axes with respect to the orthogonal links,

θj=sgn([xj1,zj,xj])(xj1×zj,zj×xj)

are related to the torsions about the axes in the reduced linkage system,ϕj, by

ϕj=θjΔjθjΔjΔj+

in terms of the offsets Δj± given by:

Δj=sgn([xj1,lj1,zj])(xj1×zj,zj×(lj1)),Δj+=sgn([xj,lj,zj])(xj×zj,zj×(lj)).

Using the moment equation, it is seen also that

ljxjlj=sinjcosΔj+=sin𝒜j+1cosΔj+1.

Appendix B. Details of the system of equations.

Introducing the expression g12r,rzRr,zRr, the equations can be written as

(E1,R)L{zR,xA1tAzR,yA}=R{zR,yAzR,xAtA},(E1,I)L{zR,yAtA+zR,xA1}=R{zR,xAzR,yAtA},(E2,R)L{g,xA1tAg,yA}=R{g,yAg,xAtA},(E2,I)L{g,yAtA+g,xA1}=R{g,xAg,yAtA},(E3,R)L{zR×r,xA1tAzR×r,yA}=R{zR×r,yAzR×r,xAtA},(E3,I)L{zR×r,yAtA+zR×r,xA1}=R{zR×r,xAzR×r,yAtA},(E4,R)L{r,xA1tAr,yA}=R{r,yAr,xAtA},(E4,I)L{r,yAtA+r,xA1}=R{r,xAr,yAtA},(E5)L{zR,zA}=R{zR,zA},(E6)L{g,zA}=R{g,zA},(E7)L{zR×r,zA}=R{zR×r,zA},(E8)L{r,zA}=R{r,zA},(E9)L{r,zR}=R{r,zR},(E10)L{r,r2}=R{r,r2}. (26)

The first eight are combined into 4 complex equations while the remaining six are used as given.

Appendix C. Relation between the SVD of a complex matrix and its real representation.

Here we recall the relation between the SVD of a general n×m complex matrix B=B1+iB2 and that of its real representation, the 2n×2m matrix

AB=(B1B2B2B1). (27)

The SVD of AB is the matrix decomposition AB=UAΣAVAT where UA and VA are real orthogonal matrices, and ΣA is the real 2n×2m matrix whose upper left-hand block is the diagonal matrix of singular values of AB in descending order, with remaining entries of zero. The SVD of B=UΣVH, with U and V complex unitary, and VH the Hermitian conjugate of V. Σ is the real n×m matrix whose upper left-hand block is the diagonal matrix containing the singular values of B in descending order, with remaining entries of zero. The singular values of B are the square roots of the nonzero eigenvalues of BBH, or equivalently of BHB, and the singular values of AB are the square roots of the eigenvalues of ABABT or ABTAB.

To compute the SVD of AB by means of the smaller computation, the SVD of B, we first apply the similarity transformation

AB=Sn(B00B¯)SmH,forSn=12(IniIniInIn),Sm=12(ImiImiImIm), (28)

where In and Im are the n×n and m×m identity matrix respectively, B¯ is the complex conjugate of B, and SnHSn=I2n, SmHSm=I2m. Applying the SVD of B to (28), noting V¯H=VT

AB=Sn(UΣVH00U¯ΣVT)SmH=Sn(U00U¯)(Σ00Σ)(VH00VT)SmH=(Sn(U00U¯)SnHPn)(PnTSn(Σ00Σ)SmHPm)×(PmTSm(VH00VT)SmH), (29)

where Pn, Pm are permutation matrices, PnPnT=I2n, PmPmT=I2m. The first term in the right-hand side product of (29) is UA, the second is ΣA, and the third is VA, as verified below. Block multiplying to verify ΣA

PnTSn(Σ00Σ)SmHPm=PnT12(IniIniInIn)(Σ00Σ)12(ImiImiImIm)Pm=PnT(Σ00Σ)Pm=ΣA,

where the permutation Pn, Pm are chosen to rearrange the singular values in descending order with zeros at the end to satisfy the last equality. Block multiplying again to verify UA, denote the real and imaginary parts of U by U=UR+iUI.

Sn(U00U¯)SnHPn=12(IniIniInIn)(U00U¯)12(IniIniInIn)Pn=12(U+U¯i(UU¯)i(UU¯)U+U¯)Pn=(URUIUIUR)Pn=(UR,1UI,1UR,nUI,nUI,1UR,1UI,nUR,n)=UA,

where UR,j and UI,j are indexed in the last line to indicate agreement with the n singular values σ1,,σn, each with two corresponding left-singular vectors. Similarly for VAH, denoting the real and imaginary part VH=VRH+iVAH and multiplying by blocks

PmTSm(VH00VT)SmH=12PmT(ImiImiImIm)(VH00V¯H)12(ImiImiImIm)=12PmT(V¯T+VTi(V¯TVT)i(V¯T+VT)V¯T+VT)=PmT(VRTVITVITVRT)=VA,

where left multiplication reorders the rows in agreement with ΣA.

Appendix D. The case of multiple eigenvalues.

By solving the generalized eigenvalue problem, we can get tA+1 from eigenvalues and tA, tR1 from corresponding eigenvectors, by taking advantage of the special structure, whereas the components are constant multiples of monomials involving the tA, tR1. However, when higher multiplicity occurs, the numerically computed eigenvectors may no longer have such structure, although they will still form a basis of the invariant subspace of the multiple eigenvalue tA+1. We present the necessary modifications to extract a basis whose elements have the monomial structure from which the remaining variables can be obtained.

D.1. Regular double case.

In the case of one double eigenvalue, suppose two eigenvectors (8 components vm) from the solver are

Vi=[Gi,Fi,Ei,Di,Ci,Bi,Ai,Li]T,i=1,2.

Assume two solutions for tR1 are t1, t3, and two corresponding solutions of tA are t2, t4. Then the two expected eigenvectors are:

V^1=[t13t2,t12t2,t1t2,t2,t13,t12,t1,1]T,V^2=[t33t4,t32t4,t3t4,t4,t33,t32,t3,1]T.

Since V1, V2 are one set of basis for the two dimensional subspace, we want the vectors V^1, V^2 to be the basis for the subspace as well. Assume t1t3, while the special case t1=t3 will be discussed in next subsection. Suppose there exist four real numbers α1, β1, α2, β2 satisfying

α1V^1+β1V^2=V1,α2V^1+β2V^2=V2. (30)

Based on the monomial pattern in V1, V2, there are five possibilities for regular double case in total: 1. all t1, t2, t3, t4 are finite values; 2. one of t1, t3 is and other three will have finite values; 3. one of t2, t4 is ; 4. both of t1, t2 or both of t3, t4 are , and other two are finite values; 5. t1, t4 are and t2, t3 are finite values, or vice versa. The cases may become more complicated when there exist 0 in the eigenvectors. We will order them by difficulty and show the corresponding treatment for each case below. The corresponding pattern in the expected eigenvectors are in Table. 20 including two special cases, and the case number with an additional letter means the case has extra conditions. The finite values (f) in each case are assumed to be nonzero. In the pseudocode Box 1 below, we summarize the determination of all possible double cases based on the components in V1, V2.

Table 20.

Possible double cases and monomial patterns. ‘n’ indicates nonzero which can be finite or infinite.

No. t1 t2 t3 t4 V^1 V^2
1 f f f f [t2h1, h1] [t4h3, h3]
2 f f f [t2, 0, 0, 0, 1, 0, 0, 0] [t4h3, h3]
2a f 0 f [t2, 0, 0, 0, 1, 0, 0, 0] [0, 0, 0, t4, 0, 0, 0, 1]
3 f f f [h1, [0, 0, 0, 0]] [t4h3, h3]
3a f 0 0 [h1, [0, 0, 0, 0]] [0, 0, 0, 0, 0, 0, 0, 1]
3b 0 f 0 [0, 0, 0, 1, 0, 0, 0, 0] [[0, 0, 0, 0], h3]
3c f f 0 [h1, [0, 0, 0, 0]] [[0, 0, 0, 0], h3]
4 f f [1, 0, 0, 0, 0, 0, 0, 0] [t4h3, h3]
4a 0 0 [1, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 1]
4b f 0 [1, 0, 0, 0, 0, 0, 0, 0] [[0, 0, 0, 0], h3]
5 f f [t2, 0, 0, 0, 1, 0, 0, 0] [h3, [0, 0, 0, 0]]
5a f 0 [t2, 0, 0, 0, 1, 0, 0, 0] [0, 0, 0, 1, 0, 0, 0, 0]
6 f f f f [t2h1, h1] [t4h1, h1]
6a 0 n 0 f [0, 0, 0, t2, 0, 0, 0, 1] [0, 0, 0, t4, 0, 0, 0, 1]
6b n n [t2, 0, 0, 0, 1, 0, 0, 0] [t4, 0, 0, 0, 1, 0, 0, 0]
6c 0 0 defective case
7 f [1, 0, 0, 0, 0, 0, 0, 0] [h3, [0, 0, 0, 0]]

First, we test the 8th components L1, L2. If both are nonzero, then this can be case 1-4. The equality and following equality between terms are determined within one tolerance. Define the ratio RjkiVi,jVi,k, i=1,2. If R781=V1,7V1,8R782=V2,7V2,8, then it is case 1 and the treatment is given as follows. We can first pick out the last three rows from either equation in (30)

αi(t12t11)+βi(t32t31)=(BiAiLi),i=1,2.

Using the last row to delete the terms of t1 and t12, we get

βi(t32t12t3t1)=(BiLit12AiLit1),i=1,2.

Substitute the second row into the first row to remove β1 and obtain

t3+t1=BiLit12AiLit1,and thent3=BiAit1AiLit1,i=1,2.

With two equalities containing two variables, one quadratic equation in terms of t1 is obtained: (A1L2A2L1)t12+(B2L1B1L2)t1+(A2B1A1B2)=0. Notice that t3 is also one solution to this equation. Two solutions correspond to t1, t3. With t1, t3, we could select the third, fourth and last two rows from the first equation in (30) to solve t2, t4:

α1(t1t2t2t11)+β1(t3t4t4t31)=(E1D1A1L1).

Then use the last row to delete the term t2 in the second row and use the second to last row to delete the term t1t2 in the first row,

β1(t3t4t3t2t4t2)=(E1A1t2D1L1t2).

With these two row, we obtain t3=E1A1t2D1L1t2 and then t2=E1D1t3A1L1t3. Also, t4=E1D1t1A1L1t1.

For the 2nd case, if R781=R782, we then check the ratios R58i in V1, V2. If R581R582, we can expect one of t1, t3 goes to . We set t1 as and t3=R781, t4=R481, t2=G1F1t3C1B1t3.

For the 3rd case, if R781=R782, R581=R582, we next calculate the ratios R34i. If R341R342, we know that one of t2, t4 is and we set it as t2 and t3=R781. Then we can pick out the second to fourth rows from the either equation in (30) to calculate two values for tR1 as follows:

αi(t12t2t1t2t2)+βi(t32t4t3t4t4)=(FiEiDi),i=1,2βi(t4(t32t12)t4(t3t1))=(FiDit12EiDit1),i=1,2.

Substitute the second row into the first row above to remove βi and t4,

t3+t1=FiDit12EiDit1,and thent3=FiEit1EiDit1,i=1,2.

With two equalities containing two variables, one quadratic equation in terms of t1 is obtained: (E1D2E2D1)t12+(D1F2D2F1)t1+(F1E2F2E1)=0. Notice that t3 is also one solution to this equation. Then by solving this equation we can get t1, t3. One of two values will be equal to t3 and the other is t1, then t4=E1D1t1A1L1t1.

For the 4th case, if R781=R782, R581=R582, R341=R342, we check the ratios R14i. If they are not equal, we can set t1, t2 as , t3=R781 and t4=R481. Otherwise, we may have special cases as discussed in the next subsection.

In the 5th case, we will see zero in the 8th components. Zeros in the 8th components can also appear in the special double cases discussed in next subsection. If the 8th components are zero, we check the 4th and 5th components. If they are not zero, we then check the ratios R34i. It is case 5 if they are equal and we set t1, t4 as . If the ratios R34i are both 0, then t3=0, t2=R151. Otherwise, t3=R341 and t2=G1F1t3C1B1t3.

BOX 1:

Procedures to determine double eigenvalue cases from the eigenvector components.

!DefineRjki=Vi,jVi,kIFVi,80,i=1,2THENIFR781=R782THENIFR78i=0,i=1,2THENIFVi,5=0,i=1,2THENIFVi,3=0,i=1,2THENIFVi,1=0,i=1,2THENcase6a,t1=t3=0ELSEcase4a,t3=t4=0ELSEcase3a,t3=t4=0,t1=R341(=R342)ELSEcase2a,t3=0,t2=R151(=R152),t4=R481(R482)ELSE!can be regular case2,3,4IFR581=R582THENIFVi,4=0,i=1,2THENcase 4b,t4=0,t3=R781(=R782)ELSEIFR341=R342THENIFR34i=0,i=1,2THENcase3b,t1=t4=0,t3=R781(=R782)ELSEIFR141=R142THENIFR141=R581THENcase6ELSE3c,t4=0,t1=R341(=R342),t3=R781(=R782)ELSEcase4ELSEcase3ELSEIFVi,1=0,i=1,2THENcase2b,t2=t4=0,t3=R781(=R782)ELSEcase2ELSEcase1ELSEIFVi,5=0,i=1,2THENIFR341=R342THENcase7,t1,t2,t4=,t3=R341(=R342)ELSEcase3d,t2,t4=ELSEIFVi,40,i=1,2THENIFR34i=0,i=1,2THENcase5a,t3=0,t2=R151(=R152)ELSEcase5,t3=R341(=R342)ELSEIFVi,10,i=1,2THENcase6b,t1=t3=ELSEcase6c,t1=t3=,t2=t4=0

D.2. Special double case.

Besides the regular double cases, we may face further complications. Based on the check in case 4 of the regular double case above, we need to do more testing on the components in the vectors. Now we have: R781=R782, R581=R582, R341=R342, R141=R142. We need to distinguish it from the regular case where t2= and t4=0 by checking the ratios. If R141R581, we have a regular case 3b where t2=, t4=0, t1=R341 and t3=R781. Otherwise it is a double-double case (case 6) and t1, t3 are identical while t1=t3=R781. t2, t4 cannot be obtained correctly because the eigenvalue problem is degenerate. Therefore, by substituting tR1, tA+1 into system (17) and multiplying the pseudoinverse of matrix B from SVD on both sides, we can obtain the system as follows:

b=(tAb1b1)=MAtA+MB. (31)

Taking advantage of the relationship among the components in the last 8 rows of (31), we have

[MA,14tA+MB,14][MA,16tA+MB,16]=MA,13tA+MB,13.

Two solutions of this quadratic equation correspond to t2, t4. One more special double-double case is needed to consider. If the 8th components are nonzero, the 7th, 5th, 3rd and 1st components are zero, then this is case 6a where the tR1 has double 0. However, we may not be able to resolve two subcases by checking the components in eigenvectors: 1. t2, t4 are finite; 2. t2=, t4 is finite. We need to substitute tA+1, tR1 back into the system obtaining (31) containing tA. If both t2, t4 are finite, the modification above can solve it. But if the last two components in vector MA are 0, then at least one of t2, t4 is infinity and we set both of them as infinity because the finite t4 in subcase 2 cannot be extracted, representing one limitation of our method.

Based on case 5 of the regular double case, if 4th and 8th components are zero and 5th component is nonzero, then we can identify that both t1, t3 will be infinity, and there may exist three subcases (case 6b) as discussed in the main text: 1. both of t2, t4 are finite; 2. one of t2, t4 is finite and the other is infinity; 3. both of t2, t4 are infinity. In this subcase 1, if t2, t4 are nonzero, it can be fixed by the modification above for double-double case. However, if t2, t4 are both zero (case 6c), then the first component Vi,1 would be zero leading to a defective case that may not be identified through the eigenvector. Substituting tA+1, tR1 back into system may resolve the problem without a guarantee, another limitation of the method. We can not distinguish subcases 2 and 3 because the last two components in MA are zero. Then t2, t4 will be set as infinity, indicating a third limitation of the method. On the other hand, if 5th and 8th components are zero, and 4th component is not zero, then we check the ratios R34i. The equality indicates that it is case 7 where t2, t4 are infinity and one of t1, t3 is infinity. We set t1 as infinity and t3=R341. If ratios R34i are not equal, then we expect t2, t4 are infinity and both of t1, t3 are finite values. This is case 3d and we use the treatment for case 3 in regular double to calculate t1, t3.

D.3. Regular triple case.

For the triple eigenvalue case, one more eigenvector will be given from the solver as V3=[G3,F3,E3,D3,C3,B3,A3,L3]T. Assume the third solution for tR1, tA is t5, t6 and t1t3t5. The expected third eigenvector is V^3=[t53t6,t52t6,t5t6,t6,t53,t52,t5,1]T. Suppose there exist nine real numbers αi, βi, γi, i=1, 2, 3 such that

αiV^1+βiV^2+γiV^3=Vi,i=1,2,3. (32)

We first pick out last four rows from each of the equations in (32):

αi(t13t12t11)+βi(t33t32t31)+γi(t53t52t51)=(CiBiAiLi),i=1,2,3.

By deleting the terms t1, t12, t13, we get

βi(t33t32t1t32t12t3t1)+γi(t53t52t1t52t12t5t1)=(CiBit1BiLit12AiLit1). (33)

Substitute the last equality βi(t3t1)=(AiLit1)γi(t5t1) into the second equality

[(AiLit1)γi(t5t1)](t3+t1)+γi(t5t1)(t5+t1)=BiLit12,γi(t5t1)=BiLit12(AiLit1)(t3+t1)t5t3.

Then substituting βi(t3t1), γi(t5t1) into the first equality in (33) and simplifying the expression, we have

t32Ait5L1t1t5Bi+Ait1t5t3+t52BiAit3+Lit1t3Ait1t5t3=CiBit1.

Finally, we simplify equality above as

Bi(t1+t3+t5)Ai(t1t3+t1t5+t3t5)+Lit1t3t5=Ci,i=1,2,3.

By treating the quantities t1+t3+t5, t1t3+t1t5+t3t5, t1t3t5 as three unknowns here, we solve the linear system of three equations and get

K1=t1+t3+t5,K2=t1t3+t1t5+t3t5,K3=t1t3t5. (34)

where K1, K2, K3 are constants involving Li, Ai, Bi, Ci, i=1, 2, 3. From system (34) it follows that t1, t3, t5 are the three roots of the cubic

t3K1t2+K2tK3=0.

Having obtained t1, t3, t5, we use them to calculate t2, t4, t6. Take out six rows containing t2, t4, t6 from the first equation in (32) as follows:

α1(t12t2t1t2t2t12t11)+β1(t32t4t3t4t4t32t31)+γ1(t52t6t5t6t6t52t51)=(F1E1D1B1A1L1).

Applying some basic algebraic computations, we have

β1(t32(t4t2)t3(t4t2)t4t2)+γ1(t52(t6t2)t5(t6t2)t6t2)=(F1B1t2E1A1t2D1L1t2).

By deleting β1, we have

γ1t52(t6t2)γ1t3t5(t6t2)=F1B1t2t3(E1A1t2),γ1t5(t6t2)γ1t3(t6t2)=E1A1t2t3(D1L1t2).

Taking the ratio of the first over the second equality, we obtain

t5=F1B1t2t3(E1A1t2)E1A1t2t3(D1t2)=F1E1t3(B1A1t3)t2E1D1t3(A1L1t3)t2,t2=t5(E1D1t3)(F1E1t3)(A1L1t3)t5(B1A1t3).

Repeating the procedure for t4, t6 we find

t4=t1(E1D1t5)(F1E1t5)(A1L1t5)t1(B1A1t5),t6=t3(E1D1t1)(F1E1t1)(A1L1t1)t3(B1A1t1). (35)

D.4. Special triple case.

For the triple eigenvalue case we assumed t1, t3, t5 are not identical, but two among these three roots can be equal, such as t1=t3, causing the method above to fail. For this case, following the previous formulation for the general triple case, we can get 3 roots from the cubic equation denoted as DT1. We then test if there exist equal roots among them. Using any pair of eigenvectors such as V1, V2 and applying the regular double case treatment, we can get two different solutions denoted as DT2. If the two solutions in DT2 are also in DT1, we conclude that two of t1, t3, t5 are equal, indicating a triple-double case; otherwise, the three roots are unequal and we have a regular triple case. For the equal roots, two in DT2 are the two roots and then we need to identify which root is double by substituting both of the two roots into (18). The root that makes the matrices degenerate is the double value. Once t1, t3, t5 are obtained, we substitute three roots into Eq.(35) above to get t2, t4, t6, but only one of them t6 would be correct because we assumed t1=t3. Then for the other two roots t2, t4 we need one more step to substitute tR1(=t1) and tA+1 into (17) to get two additional solutions similarly as in the special double case.

REFERENCES

  • [1].Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J, Du Croz J, Greenbaum A, Hammarling S, McKenney A and Sorensen D, LAPACK Users’ Guide, 3rd edition, Society for Industrial and Applied Mathematics, Philadelphia, PA, 1999. [Google Scholar]
  • [2].Angeles J, Fundamentals of Robotic Mechanical Systems: Theory, Methods, and Algorithms, Fourth edition. Mechanical Engineering Series. Springer, Cham, 2014. [Google Scholar]
  • [3].Angerer A and Hofbaur M, Industrial versatility of inverse kinematics algorithms for general 6R manipulators, 2013 16th International Conference on Advanced Robotics (ICAR), (2014), 1–7. [Google Scholar]
  • [4].Bricard R, Mémoire sur la théorie de l’octaèdre articulé, J. Math. Pures Appl, 3 (1897), 113–150. [Google Scholar]
  • [5].Coutsias EA, Lexa KW, Wester MJ, Pollock SN and Jacobson MP, Exhaustive conformational sampling of complex fused-ring macrocycles using inverse kinematics, Journal of Chemical Theory and Computation, 12 (2016), 4674–4687. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [6].Coutsias EA, Seok C, Jacobson MP and Dill KA, A kinematic view of loop closure, Journal of Computational Chemistry, 25 (2004), 510–528. [DOI] [PubMed] [Google Scholar]
  • [7].Coutsias EA, Seok C, Wester MJ and Dill KA, Resultants and loop closure, International Journal of Quantum Chemistry, 106 (2006), 176–189. [Google Scholar]
  • [8].Denavit J and Hartenberg R, A kinematic notation for lower pair mechanisms based on matrices, J. Appl. Mech, 22 (1955), 215–221. [Google Scholar]
  • [9].Go N and Scheraga H, Ring closure and local conformational deformations of chain molecules, Macromolecules, 3 (1970), 178–187. [Google Scholar]
  • [10].Husty ML, Pfurner M and Schröcker H-P, A new and efficient algorithm for the inverse kinematics of the general serial 6R manipulator, Mechanism and Machine Theory, 42 (2007), 66–81. [Google Scholar]
  • [11].Kim JS and Chirikjan GS, Inverse kinematic solutions of 6-D.O.F. biopolymer segments, Robotica, 34 (2016), 1734–1753. [Google Scholar]
  • [12].Kohli D and Osvatic M, Inverse kinematics of general 6R and 5R, P serial manipulators, ASME Journal of Mechanical Design, 115 (1993), 922–931. [Google Scholar]
  • [13].Lee H-Y and Liang C-G, Displacement analysis of the general spatial 7-link 7R mechanism, Mechanism and Machine Theory, 23 (1988), 219–226. [Google Scholar]
  • [14].Lee H-Y and Liang C-G, A new vector theory for the analysis of spatial mechanisms, Mechanism and Machine Theory, 23 (1988), 209–217. [Google Scholar]
  • [15].Liu S and Zhu S, An optimized real time algorithm for the inverse kinematics of general 6R robots, 2007 IEEE International Conference on Control and Automation, 2080–2084. [Google Scholar]
  • [16].Mandell DJ, Coutsias EA and Kortemme T, Sub-angstrom accuracy in protein loop reconstruction by robotics-inspired conformational sampling, Nature Methods, 6 (2009), 551–552. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [17].Manocha D, Solving systems of polynomial equations, IEEE Computer Graphics and Applications, 14 (1994), 46–55. [Google Scholar]
  • [18].Manocha D and Canny JF, Efficient inverse kinematics for general 6R manipulators, IEEE Transactions on Robotics and Automation, 10 (1994), 648–657. [Google Scholar]
  • [19].Manocha D and Zhu Y, Kinematic manipulation of molecular chains subject to rigid constraint, in ISMB, 1994, 285–293. [PubMed] [Google Scholar]
  • [20].Manocha D, Zhu Y and Wright W, Conformational analysis of molecular chains using nanokinematics, Bioinformatics, 11 (1995), 71–86. [DOI] [PubMed] [Google Scholar]
  • [21].Raghavan M and Roth B, Inverse kinematics of the general 6R manipulator and related linkages, ASME Journal of Mechanical Design, 115 (1993), 502–508. [Google Scholar]
  • [22].Renaud M, A simplified inverse kinematic model calculation method for all 6R type manipulators, in Current Advances in Mechanical Design and Production VII, 2000, 15–25. [Google Scholar]
  • [23].Song C-Y, Chen Y and Chen I-M, Kinematic study of the original and revised general line-symmetric Bricard 6R linkages, J. Mechanisms Robotics Aug, 6 (2014), 031002. [Google Scholar]
  • [24].Stewart GW and Sun J-G, Matrix Perturbation Theory, Computer Science and Scientific Computing. Academic Press, Inc., Boston, MA, 1990. [Google Scholar]
  • [25].Trefethen LN and Bau D, Numerical Linear Algebra, Society for Industrial and Applied Mathematics (SIAM), Philadelphia, PA, 1997. [Google Scholar]
  • [26].Tsai LW and Morgan AP, Solving the kinematics of the most general six- and five-degree-of-freedom manipulators by continuation methods, ASME Journal of Mechanisms, Transmissions, and Automation in Design, 107 (1985), 189–200. [Google Scholar]
  • [27].Wu MG and Deem MW, Analytical rebridging monte carlo: Application to cis/trans isomerization in proline-containing, cyclic peptides, Journal of Chemical Physics, 111 (1999), 6625–6632. [Google Scholar]

RESOURCES