Inverse Kinematics of a 7R 6-DOF Robot with Nonspherical Wrist Based on Transformation into the 6R Robot

The 7R 6-DOF robots with hollow nonspherical wrist have been provenmore suitable for spray painting applications. However, the inverse kinematics of this kind of robot is still imperfect due to the coupling between position and orientation of the end-effector (EE). In this paper, a new and efficient algorithm for the inverse kinematics of a 7R 6-DOF robot is proposed.The proposed inverse kinematics algorithm is a two-stepmethod.The geometry of the 7R 6-DOF robot is analyzed. A comparison between the 7R 6-DOF robot and the well-known equivalent 6R robot is made. Based on this comparison, a rational transformation between these two kinds of robots is constructed. Then the general inverse kinematics algorithm of the equivalent 6R robot is applied to calculate the approximate solutions of the 7R 6-DOF robot, in the first step. The Damped Least-Squares (DLS) method is employed to derive the exact solutions, in the second step. The accuracy and efficiency of the algorithm are tested on a 7R 6-DOF painting robot. The results show that the proposed algorithm is more advantageous in the case without an approximate solution, such as the initial point of a continuous trajectory.


Introduction
In robotics, inverse kinematics is one of the most traditional research areas. It is necessary for robot design, trajectory planning, and dynamic analysis of robots. There are mainly two types of inverse kinematic techniques, namely, analytical methods and numerical methods. Analytical solutions exist only for some special geometric structure; that is, three adjacent axes intersect at one point or parallel to each other [1]. The robot with a spherical wrist is a good example. As the position and orientation of the end-effector (EE) are determined, respectively, by the first three joints and the last three joints, which is convenient to control and teaching, spherical wrists are widely used in industrial robots. In this paper, the serial 6R manipulator with a spherical wrist is called equivalent 6R robot. Many efficient inverse kinematics methods [2][3][4] have been presented for the equivalent 6R robot. However in some industrial applications such as spray painting, the 7R 6-DOF robot with hollow nonspherical wrist has been proved to be advantageous due to wider range of motion of the wrist. As shown in Figure 1, the wrist of 7R 6-DOF robot has 4 revolute joints, the second and third of which are coupled with the relation: 6 = − 5 . It means that an extra revolute joint is added to enlarge the range of motion of the wrist. And in order to avoid introduction of redundancy, a constraint is introduced on the second and third revolute joints of the wrist, resulting in a couple joint. Figure 2 is the configuration of the 7R 6-DOF robot.
Because of the nonspherical wrist, the analytical solution of the 7R 6-DOF robot is nonexistent. In order to get inverse kinematics of the robots with nonspherical wrist, Tsai and Morgan [5] proposed a higher dimensional approach with eight second-degree equations. As an improvement, Raghavan and Roth [6] used dialytic elimination to derive a 16 degree polynomial. Manocha and Canny [7] proposed symbolic preprocessing and matrix computations to convert the inverse kinematics to an eigenvalue problem. In recent years, [8][9][10][11][12] have studied the inverse kinematics of general 6R robots. However, the problem is that these methods can only be applied to 6R robots. In some references, the methods based on heuristic search techniques such as neural network solution [13,14], genetic algorithms [15,16], and simulated    annealing [17] are developed for the solution of inverse kinematics problem. These methods convert the kinematics problem into an equivalent minimization problem and generally suffer from time-consuming and low accuracy. For serial robots, the numerical iterative techniques, such as Newton-Raphson approach [18], the steepest descent approach [19], and the Damped Least-Squares (DLS) approach [20,21], are often applied. The drawbacks of a numerical iterative algorithm are slow iterations and sensitivity to the initial value and normally just one solution instead of all solutions can be derived. For the 7R 6-DOF robot, Wu et al. [22] proposed a twostep method: the approximate analytical solutions are firstly derived through solving the 7R robot with spherical wrist by introducing a virtual wrist center, and the Levenberg-Marquardt (LM) method is used to calculate the exact solutions. This is an interesting approach, but a complex polynomial system needs to be solved in the first step which is time-consuming. In this paper, a new and efficient twostep method is presented. As the major improvement, a rational transformation between the 7R 6-DOF robot and the well-known equivalent 6R robot is constructed. The general inverse kinematics algorithm of the equivalent 6R robot is used to calculate the approximate solutions of the 7R 6-DOF robot in the first step. Then a general iterative algorithm, that is, the DLS method, is employed to get the exact solutions. The approximate solutions derived from the first step can offer good initial value to the DLS method and make it computationally efficient. To verify the accuracy and efficiency of this method, three simulations are implemented. The paper is organized in the following manner. In Section 2, the inverse kinematics of the equivalent 6R robot is briefly reviewed. Section 3 describes the efficient transformation between the 7R 6-DOF robot and the equivalent 6R robot, where a rational assumption will be given. In Section 4, the DLS method is reviewed and the new inverse kinematics algorithm is presented. In Section 5, three simulations are implemented to illustrate the accuracy and efficiency of the proposed method. The results are presented and discussed. Section 6 is the conclusion.

Inverse Kinematics Algorithm of the Well-Known Equivalent 6R Robot
As stated previously, the equivalent 6R robot is a well-known typical structure of serial robots. The inverse kinematics methods have been proposed by [2][3][4]. Before deriving the inverse kinematics of the 7R 6-DOF robot, firstly we briefly describe that of the equivalent 6R robot. For the equivalent 6R robot, the configuration is shown in Figure 3. For serial robots, Denavit-Hartenberg (DH) parameters are widely used to describe the position and orientation of the EE. The transformation matrix relating the joint to joint − 1 could be given by where s = sin , c = cos , c = cos , and s = sin .
Mathematical Problems in Engineering 3 Then the forward kinematics of the manipulator could be formulated by where T end is the configuration of the EE with respect to the base frame. For the inverse kinematics, T end is known and described by (3), where n, o, and a are three unit orientation vectors, and p is the position vector of T end ] . ( As a result, the inverse kinematics problem is to calculate the joint angles through the matrix (2). To derive the solutions, (2) is firstly rearranged as From the last column of both sides of (4), we obtain From (6), two values of 1 are obtained as 1 = atan 2 ( , ) , Calculating the sum of the squares of (5), (6), and (7) on both sides, we obtain The joint angle 3 is obtained as where = ( + + − 4 − 2 )/2 2 4 . In order to derive 2 , rearrange (2) as Then 2 can be obtained by equating (1,4) and (2, 4) matrix elements of each sides in (11) where 1 = − z 4 − 2 3 and 2 = 1 + 1 .

Transformation between the 7R 6-DOF Robot and Equivalent 6R Robot
In order to apply above algorithm to the inverse kinematics of the 7R 6-DOF robot, firstly the geometry of the 7R 6-DOF robot is analyzed. The transformation between the 7R 6-DOF robot and the equivalent 6R robot is constructed based on a comparison. As shown in Figure 1, the 7R 6-DOF robot consists of 7 revolute joints. Configuration of the first three joints, that is, ⊥ // , is widely used in industrial robots. The last four joints construct the nonspherical wrist. From the comparison between the 7R 6-DOF robot and the equivalent 6R robot which is shown in Figure 3, configurations of the first three joints are the same and the wrists are different. In order to construct the transformation between the two kinds of robot, the first three joint angles are firstly set to be equal, described by (14). Then the transformation between the wrists can be derived separately. Geometrical models of the wrists are given in Figures 4 and 5, respectively. The center of joint 3 is taken as the origin of the base frame. For simplicity, the notation 4R wrist and equivalent 3R wrist are used in the following text. As for the 4R wrist, because the couple joint is the main difference, the kinematic analysis of the couple joint is firstly executed Figure 4 shows that the couple joint consists of two coupled revolute joints. As a result of rotating the couple joint over an angle 5 , axis 4 and axis 7 revolve around axis 5 and axis 6, respectively. And axis 4 and axis 7 intersect at a changing point . Ignoring the change of position, a virtual axis which is perpendicular to axis 4 and axis 7 could be constructed at the point . As a result, a virtual equivalent 3R wrist can be obtained, as shown in Figure 5. Taking the change of position into account, an additional relation is given by (15) Figure 4: Configuration of the 4R wrist. Based on DH parameters, configuration of the EE with respect to the base frame is given by The equivalent 3R wrist must generate the same configuration of EE as the 4R wrist, meaning the following equation: By equating the matrix elements of each side in (17), the transformation between the two wrists could be obtained. But it is not a simple relation. Given this situation, the orientation of the EE with respect to the base frame is considered solely, which is efficient for the 3-DOF wrist [23]. Then (17) is simplified as Because the couple joint is the main difference, we firstly keep joint 4 and joint 7 at the initial position, that is, Then 5eq is derived by substituting where = c 6 (c 4 c 5 − s 4 s 5 c 5 ) − s 6 (c 5 s 4 c 2 5 + c 4 s 5 c 5 + s 4 s 2 5 ). When s 5eq ̸ = 0, we can obtain the value of 4eq with (19) and (20) According to the property of the wrist, 6eq is equal to − 4eq ; that is, 6eq = − 4eq . Hence, taking the displacement of joint 4 and joint 7 into account, the value of 4eq and 6eq can be obtained  As for the inverse transformation, substitute c 5 = (1 − )/(1 + ) into (21). Where = (tan( 5 /2)) 2 , we can obtain From (26), two values of can be obtained. However, one of the values is negative, which results in 5 with imaginary part. Then note + as the nonnegative solution of (26); 5 is obtained as Take the effect of the couple joint into account; we can obtain 4 = 4eq − atan 2 ( , ) , Because of the changing point , the inverse kinematics algorithm in Section 2 cannot be used to the equivalent 6R robot obtained from the transformation. Given this situation, an assumption is made that the point is fixed. It means that the points , 1 , and 2 coincide all the time, as shown in Figure 4. With this assumption, the inverse kinematics algorithm in Section 2 can be used to calculate approximate solutions of the 7R 6-DOF robot.
In order to have a further understanding, the error of this transformation with an assumption is investigated as follows. As shown in Figure 6, the intersection of axis 4 and axis 7 is point . The position of point is changing while rotating the couple joint of the 4R wrist, which is the source of the error. So the variation of point , that is, the distance between point and 1 , is calculated in triangle O 4 O 5 and triangle O 4 as It is obvious that where max is the maximum distance between point and 1 , eq 5max is the maximum joint angle of the equivalent 6R robot, and eq 5max = 4 when ≤ 45 ∘ . For practical robots, 30 ∘ ≤ ≤ 35 ∘ . As shown in Figure 7, it is the tendency of variation on max versus with 5 = 90 mm. It is obvious that the smaller 5 and are, the smaller the distance between point and 1 will be. As a practical example, the wrist of ABB IRB 5400 painting robot uses = 35 ∘ and parameter 5 is small enough to ensure the assumption above. The effect of the transformation error on the inverse kinematics solution accuracy is discussed in Section 5.1 with a numerical simulation.

The DLS Method and the New Inverse Kinematics Algorithm
Because of the absence of the analytical solutions, a numerical iterative algorithm is necessary and helpful for the inverse kinematics of the 7R 6-DOF robot. As a stable numerical algorithm, the Damped Least-Squares (DLS) method is widely used for inverse kinematics of serial robots [20]. As the main advantage, the DLS method with a varying damping factor could deal with the kinematic singularities of the robot, providing user-defined accuracy capabilities. So in this paper, the DLS method is used and the main idea is described as follows.
where [ , , ] is the position error; [ , , ] is the orientation error of EE; p and p are the position vector of T and T , respectively; n , o , a and n , o , a are the orientation vector of T and T , respectively. According to the differential theory, we can obtain where e denotes the configuration error of EE, Δq denotes the increment of joint angle, and is the Jacobian matrix.
As for the general configuration where the Jacobian matrix is nonsingular, Δq could be calculated by (33) according to the least-squares principle When the Jacobian matrix is singular or at the neighborhood, the damping factor is introduced to make a trading off accuracy against feasibility of the joint angle required and Δq could be described as It is obvious that a suitable value for is essential. And a small value of gives accurate solution but low robustness to the kinematic singularities. Given this problem, a method to determine the value of is given based on the condition numbers of as follows: where is the condition numbers of ; is the critical value of ; 1 is the maximum value of and usually is set based on trial and error. Then the iterative formula of joint angle will be The exact inverse kinematics solution will be obtained with the rational termination condition err ≤ , where err = √ 2 + 2 + 2 and err = √ 2 + 2 + 2 are the position error and orientation error of EE, respectively. and are the critical value and usually are set based on trial and error.

New Inverse Kinematics Algorithm.
The new presented algorithm for the inverse kinematics of the 7R 6-DOF robot is shown in Algorithm 1. At line (1), DH parameters of the corresponding equivalent 6R robot are calculated with the transformation method shown in Section 3. At line (2), joint angle eq of equivalent 6R robot is derived with the inverse kinematics algorithm shown in Section 2. At line (3), the approximate solutions of the 7R 6-DOF robot are obtained with the inverse transformation method shown in Section 3. At lines (4)- (7), the exact inverse kinematic solutions of the 7R 6-DOF robot can be derived with the DLS method.
The new proposed algorithm is a two-step method, which incorporates the inverse kinematics algorithm of the equivalent 6R robot and the DLS method. The approximate solutions derived from the first step can offer good initial value to the DLS method. This is the main advantage of the proposed algorithm over the DLS method. Moreover, the DLS method can derive just a single solution, while the proposed algorithm can derive all 8 solutions. This is another advantage of the proposed algorithm over the DLS method. It is notable that [22] also presents a two-step method which is noted as Wu's method. There are several similarities between the new proposed algorithm and Wu's method: (1) the approximate solutions are derived by analytical method; (2) the exact solutions are derived by a numerical iterative technique with the approximate solutions as the initial values. And the main difference is the way to derive the approximate solutions in the first step. Because a complex polynomial system needs to be solved, the method used in the first step of Wu's method (i.e., directly deriving the approximate solutions by solving the 7R robot with spherical wrist) is time-consuming. Instead the inverse kinematics algorithm of the equivalent 6R robot (which has been well studied and is available in most commercial robot controllers) is utilized in the first step of the proposed algorithm. This improvement makes the proposed method more computationally efficient than Wu's method. Moreover, it is easier to find the correct approximate solution from all possible ones by prescribing configuration indicators [24] for the equivalent 6R robot. This is another advantage of the proposed method over Wu's method.
Additionally, the multiple solutions problem is discussed. It is well known that a general 6R 6-DOF robot can have at most 16 inverse kinematic solutions [7]. However with the proposed algorithm, only 8 real number solutions can be Mathematical Problems in Engineering    Figure 8. It is obvious that there is only one value of which is nonnegative when 5eq changes in its working space, that is, (−140 ∘ , 140 ∘ ). Therefore in some degree, we can draw the conclusion that there are at most 8 meaningful real number inverse kinematic solutions when the 7R 6-DOF robot works in its working space.

Simulation and Discussion
In order to illustrate the accuracy and efficiency of the algorithm proposed in this paper, three simulations are implemented on a practical 7R 6-DOF painting robot as shown in Figure 1. The DH parameters of the robot are shown in Table 1. The first simulation aims to validate the accuracy of the algorithm by calculating 8 solutions of the inverse kinematics with a given configuration of EE. In the second simulation, the proposed algorithm is compared with the DLS method and Wu's method. The accuracy of the  algorithm is also assessed in the whole usable workspace of the robot. The third simulation aims to illustrate the efficiency of the algorithm, when it is tested in an offline programming operation. ] . (38) According to the new proposed algorithm, the DH parameters of the corresponding equivalent 6R robot are derived with the method shown in Algorithm 1 line (1), as shown in Table 2. The 8 solutions of the equivalent 6R robot are calculated with equations in Algorithm 1 line (2). Then the approximate solutions of the 7R 6-DOF robot are obtained with the inverse transformation method in Algorithm 1 line (3), as listed in Table 3. At the end, Table 4 lists the final inverse kinematic solutions of the 7R 6-DOF robot. And the corresponding postures for the 8 inverse kinematic solutions are shown in Figure 9. The algorithm is performed on a desktop computer platform (Pentium i7 2.8 GHz, 8 GB RAM, MATLAB software program).
It is obvious that 8 solutions are obtained for a given configuration of EE. The first solution in Table 4 agrees with the given target joint angle, and the deviation is less than 0.0001 ∘ , which illustrate the accuracy of the proposed algorithm. It is worthwhile to make a comparison between the approximate solutions in Table 3 and the exact solutions in Table 4. As stated in Section 3, the deviations result from the error of the transformation, that is, the distance between points and 1 described by (34). From the comparison, the approximate solutions are very close to the exact ones with the deviation less than 5 ∘ . Therefore the approximate solutions as the initial values could guarantee the DLS method to convergent to the exact solutions rapidly. This is the advantage of the proposed algorithm over the general DLS method of which the initial value is randomly selected. Additionally, as shown in Figure 9, the corresponding postures of the robot are similar to that of the equivalent 6R robot [24], which makes it easy to select an optimal solution according to the joint working 8 Mathematical Problems in Engineering   range restrictions, which is a main advantage of the proposed algorithm over Wu's method.

Simulation 2.
In order to further illustrate the performance of the proposed algorithm, it is compared with the DLS method and Wu's method in this section. In the first comparison, the target joint angle in Simulation 1 is used. The proposed algorithm and DLS method are utilized to solve this inverse kinematics problem. Here, the termination conditions of the two methods are set to be the same (i.e., err ≤ 0.01 mm and err ≤ 0.01 ∘ ). The corresponding results are shown in Table 5. From Table 5, the proposed algorithm takes about 64 ms on an average. It is notable that three different initial values are chosen for the DLS method. When the initial value is chosen as in = [60 ∘ , −25 ∘ , 60 ∘ , −30 ∘ , 60 ∘ , −60 ∘ , 30 ∘ ], the computation time of DLS method is 60 ms which is slightly smaller than that of the proposed method. However, when the initial value is changed to in = [0 ∘ , 0 ∘ , 0 ∘ , 0 ∘ , 0 ∘ , 0 ∘ , 0 ∘ ], the computation time will greatly increase to 182 ms. The DLS method even fails to convergent to the correct solution, when the initial value is chosen as in = [−60 ∘ , −25 ∘ , 60 ∘ , −30 ∘ , 60 ∘ , −60 ∘ , 30 ∘ ]. It means that the DLS method is too sensitive to the initial value which is randomly selected in practical usage. So in some degree, we draw the conclusion that the proposed algorithm is more stable and efficient than the DLS method. Moreover, the DLS method can derive only one solution, while the proposed algorithm can derive all 8 solutions as shown in Simulation 1. This is another advantage of the proposed algorithm over the DLS method.
In the second comparison, the accuracy and efficiency of the algorithm are assessed in the whole usable workspace of the robot. For the 7R 6-DOF painting robot under studied,  the usable workspace is shown in Table 6. And 1000 groups of target joint angles are randomly selected in the usable workspace. For comparison, Wu's method [22] is also utilized to solve the inverse kinematics. Because the main difference between the proposed algorithm and Wu's method is the first step, that is, the method to derive the approximate solutions, the second step of Wu's method is changed from LM method to DLS method for simplicity. And the termination conditions of the two methods are set to be the same (i.e., err ≤ 0.01 mm and err ≤ 0.01 ∘ ). The corresponding solution errors and the computation times are depicted in Figures 10, 11, and 12, respectively. For simplicity, the average and maximum computation times of the two methods are also summarized in Table 7. From Figures 10 and 11, the inverse kinematic solutions for all 1000 configurations are successfully derived with the two methods, and the solution errors are rather small, that is, err ≤ 0.01 mm and err ≤ 0.0001 ∘ . However, the computation time of the proposed method is less than that of Wu's method, as shown in Figure 12 and Table 7. In other words, the proposed method is more efficient than Wu's method. This is because directly solving the 7R robot with spherical wrist in Wu's method is more time-consuming than solving the equivalent 6R robot in the new proposed method. Moreover, it is easier to find the correct approximate solution  from all possible ones by prescribing configuration indicators [24] for the equivalent 6R robot. Additionally, it is notable that the computation time of the algorithm is influenced by the termination conditions, that is, the prescribed solution error err and err . In other words, in order to improve the accuracy of the solution, the computation time will increase. From the perspective of application, the termination conditions used in this simulation are rational.

Simulation 3.
The new proposed inverse kinematics algorithm is implemented in an offline programming operation to spray painting. The graphic simulator of the 7R 6-DOF robot and the task is shown in Figure 13. The trajectory of EE is a classical raster trajectory in the plane --on the surface of the workpiece. The orientation of EE is constant, with theaxes parallel to that of the base frame and the -and -axes opposite to that of the base frame respectively. The duration of the motion is determined as 20 s. For trajectory tracking, firstly discrete points are sampled from the trajectory. The inverse kinematic solution for each sample point is derived. Later on, a further interpolation in joint space is implemented to make the trajectory smooth enough. And the calculated  Figure 13: Graphic simulator of the 7R 6-DOF robot and the trajectory. joint positions, velocities, and acceleration of the 7R 6-DOF robot are given in Figure 14.
It is obvious that the offline programming operation is completed with the new proposed algorithm. The algorithm takes 15 ms on an average on a desktop computer platform (Pentium i7 2.8 GHz, 8 GB RAM, MATLAB software program), which illustrates the efficiency. By comparing simulation 3 and simulation 2, the computing time in simulation 3 is less than 25 percent of that in simulation 2. The reason is that we use the solution of the last step as the initial value of the next step when the robot is following a continuous trajectory. In other words, the presented algorithm is only used for the initial point of the continuous trajectory. So, the presented algorithm may be not so great advantageous than general iterative method during a continuous trajectory. However, as for the initial point of the continuous trajectory, that is, the point without an approximate solution, the new proposed algorithm in this paper is significant, because, with an initial solution derived in the first step, the proposed algorithm is less time-consuming. Additionally, 8 solutions will be obtained for a given EE configuration. According to the joint working range restrictions and so on, the optimal solution could be selected.

Conclusion
A new and efficient two-step algorithm for the inverse kinematics of a 7R 6-DOF robot is proposed and studied in this paper. In the first step, a rational transformation between the 7R 6-DOF robot and the well-known equivalent 6R robot is constructed. Then 8 approximate solutions of the 7R 6-DOF robot are derived with the general inverse kinematics algorithm of the equivalent 6R robot. In the second step, the DLS method is employed to derive the exact solutions.
Compared with other methods, the proposed algorithm is systematic. The accuracy and efficiency has been evaluated with three simulations. In the first simulation, 8 solutions are obtained for a given EE configuration of the 7R 6-DOF robot. The error is less than 0.0001 degree, which illustrates the accuracy of this proposed algorithm. In order to further illustrate the performance of the proposed algorithm, it is compared with the DLS method and Wu's method in the second simulation. The accuracy of the algorithm is also assessed in the whole usable workspace of the robot. In the third simulation, the algorithm is implemented in an offline programming operation. The results show that the proposed algorithm is efficient for offline programming and it is more advantageous in the case without an approximate solution, such as the initial point of the continuous trajectory.