An Improved Weighted Gradient Projection Method for Inverse Kinematics of Redundant Surgical Manipulators

Different from traditional redundant manipulators, the redundant manipulators used in the surgical environment require the end effector (EE) to have high pose (position and orientation) accuracy to ensure the smooth progress of the operation. When analyzing the inverse kinematics (IK) of traditional redundant manipulators, gradient-projection method (GPM) and weighted least-norm (WLN) method are commonly used methods to avoid joint position limits. However, for the traditional GPM and WLN method, when joints are close to their limits, they stop moving, which greatly reduces the accuracy of the IK solution. When robotic manipulators enter a singular region, although traditional damped least-squares (DLS) algorithms are used to handle singularities effectively, motion errors of the EE will be introduced. Furthermore, selecting singular region through trial and error may cause some joint velocities exceed their corresponding limits. More importantly, traditional DLS algorithms cannot guide robotic manipulators away from singular regions. Inspired by the merits of GPM, WLN, and DLS methods, an improved weighted gradient projection method (IWGPM) is proposed to solve the IK problem of redundant manipulators used in the surgical environment with avoiding joint position limits and singularities. The weighted matrix of the WLN method and the damping factor of the DLS algorithm have been improved, and a joint limit repulsive potential field function and singular repulsive potential field function belong to the null space are introduced to completely keep joints away from the damping interval and redundant manipulators away from the unsafe region. To verify the validity of the proposed IWGPM, simulations on a 7 degree of freedom (DOF) redundant manipulator used in laparoscopic surgery indicate that the proposed method can not only achieve higher accuracy IK solution but also avoid joint position limits and singularities effectively by comparing them with the results of the traditional GPM and WLN method, respectively. Furthermore, based on the proposed IWGPM, simulation tests in two cases show that joint position limits have a great impact on the orientation accuracy, and singular potential energy function has a great impact on the position accuracy.


Introduction
Compared with six degree of freedom (DOF) robotic manipulators, 7-DOF robotic manipulators not only ensure motion accuracy of the end-effector (EE), but also optimize other objectives due to the existence of a redundant DOF, such as avoiding obstacles and adapting to human action [1][2][3][4][5][6]. Therefore, redundant manipulators have been widely used in the medical and aerospace fields, etc. However, 7-DOF manipulators not only improve the flexibility, but also increase the difficulty of solving the inverse kinematics (IK) solution [7]. Indeed, achieving the 6-DOF pose (position and orientation) given by the EE is equivalent to six equations and seven unknowns, and there are innumerable solutions in theory. However, only one set of the IK solution is needed in robot kinematics control. So far, many scholars have studied the IK solution of redundant manipulators. These methods include geometric method [8], gradient-projection method (GPM) [3,9], weighted least-norm (WLN) method [10], extended Jacobian matrix method [11], and analytical method [12], etc. Some artificial intelligence algorithms are also used in the IK solution of redundant manipulators, such as genetic algorithm [13], particle swarm optimization algorithm [14], neural network algorithm [15].
Geometric algorithms are not universal and their modeling and solving process is complex. The extended Jacobian matrix method can only obtain an approximate IK solution, which is not suitable for robotic manipulators with high accuracy. Analytical algorithm is only applicable to robotic manipulators with specific configurations, or robotic manipulators with some simplified processing [16,17]. It takes a long time for intelligent algorithms to solve IK, which is not conducive to real-time control.
The GPM and WLN methods are popular algorithms for solving IK of redundant manipulators, and have the effect of avoiding joint position limits. A weighted GPM [18] and a clamping WLN method [19] were proposed for IK of a 7-DOF manipulator. Due to the introduction of damping factors in the singular region, the position errors of the EE are as high as 96.3 mm and 25 mm, respectively, which are not suitable for robotic manipulators with high accuracy requirements. Hu [20] presented a gradient projection of a weighted Jacobian matrix method for IK of a planar 3-DOF manipulator. However, this method did not solve the problem of motion accuracy reduction caused by joint positions near their limits. Kelemen [21] introduced an IK algorithm to avoid joint position limits, singularities and obstacles. However, the position error of the EE is as high as 18 mm, and the orientation error is not analyzed. This is not conducive to the further operation of the EE. Jun [22] proposed an improved clamping WLN method for IK of a redundant manipulator. However, the constant value of the repulsive potential field would lead to the disadvantage of too large or too small repulsive force, which affected the motion accuracy of the EE.
When robotic manipulators move to a Jacobian singular configuration, the Jacobian inverse matrix becomes numerically unrealizable, which is not conducive to the motion control. In [23][24][25], a damped least-squares (DLS) algorithm was used to handle singularities. Although the introduction of damping factors can solve the shortcomings of singular configurations, the damping factors will lead to the decline of the motion accuracy of the EE.
The existing GPM and WLN methods do not completely keep redundant manipulators away from joint position limits and singular configurations, which can reduce the motion accuracy of the EE. Different from traditional redundant manipulator, the redundant manipulators used in the surgical environment require the EE to have high pose accuracy to ensure the smooth progress of the operation. Therefore, based on the advantages of GPM and WLN method, combined with the traditional DLS algorithm, an improved weighted GPM (IWGPM) which introduces a joint limit repulsive potential field function and singular repulsive potential field function as subtasks is proposed. A clamping weighted matrix can make joints stop at their limits, and the introduced joint limit repulsive potential field function generates virtual forces at the damping interval to make joints return to the flexible interval. In the unsafe region, virtual forces generated by the singular repulsive potential field function can make redundant manipulators move away from unsafe region and solve the singular problem thoroughly.
The remainder of this paper is organized as follows: The kinematics of redundant manipulators and the traditional GPM, WLN method, and DLS algorithm are briefly reviewed in Section 2. The IWGPM is proposed to solve the IK problem of redundant surgical manipulators with avoiding joint position limits and singularities in Section 3. In Section 4, to verify and evaluate the effectiveness of the proposed method, simulation results and discussion are performed. Finally, the conclusions are presented in Section 5.

Kinematics Formulations
The forward kinematics is a nonlinear function that describes the relation between the pose of the EE x ∈ R m and joint position q ∈ R n as follows: The first-order derivation of the function: describes the velocities from the joint to the EE, where .
x ∈ R m represents the velocity vector of the EE, . q ∈ R n is the velocity vector of joints, and J ∈ R m×n is a Jacobian matrix. To obtain a unique solution . q, the Jacobian inverse J −1 or pseudo inverse J + for non-redundant or redundant manipulators, respectively, is used, as follows [26]: for non-redundant manipulators (m = n) and: .
It is not difficult to conclude that Equations (3) and (4) hold when J −1 and J + exists, and Equation (4) provides a least-norm solution. When robotic manipulators approach a singular configuration, J −1 or J + of the manipulators becomes numerically ill conditioned. Furthermore, the vicinity of singular configurations may also cause joint velocities to exceed the corresponding limits. To overcome this drawback, a DLS algorithm [23,25] is a widely used approach that sacrifices accuracy of the IK solution to generate an improved Jacobian matrix in the singular region. The DLS algorithm is expressed as: where I m ∈ R n is an identity matrix, and λ is a damping factor. For redundant manipulators, the self-motion can be realized with some subtasks, with not affecting the main task, which can be expressed by GPM [3]: where I n − J + J is the projection operator onto the null space of the matrix J, and z is a gradient vector of performance criterion as a subtask. The (I n − J + J)z is the homogeneous solution for self-motion. Avoidance for joint position limits as a subtask were presented as: where q imin and q imax are the lower and upper limits of the i-th joint position, and q i is the i-th joint position. As a result, replace z with ∇H(q), Equation (6) can be derived further as follows: where k is a positive scalar coefficient to make the gradient rate of H(q) to be minimized, and ∇H(q) is the gradient vector of H(q), which is described as: The WLN method [10] is also used to avoid joint position limits through weighted factors, and the transformations are introduced as follows: .
where J w and . q w are a weighted Jacobian matrix and a weighted joint velocity, respectively. The W ∈ R n×n is a diagonal and positive weighted matrix, and the i-th diagonal element is expressed as: , and H * (q) is defined as follows: where q imin and q imax are the lower and upper limits of the i-th joint position, and q i is the i-th joint position. Figure 1 shows the distributions of w i (q) with q i . When q i is close to q imin and q imax , (12), q i tends to zero, the corresponding joint stops at its limit position, but it is not far away from its limit.
. From Equation (12), i q tends to zero, the corresponding joint stops at its limit position, but it is not far away from its limit. Both GPM and WLN method can deal with singular problems, therefore, combining Equations (5) and (8) can be redefined by: Both GPM and WLN method can deal with singular problems, therefore, combining Equations (5) and (8) can be redefined by: Equation (12) can be rewritten as:

Improved Weighted Gradient Projection Method
The WLN method is much more efficient than the GPM one in avoiding joint position limits [20]. Due to the weighted matrix W, some joints stop at their limits, but this does not keep them away from their limits. Furthermore, on solving singular problems, DLS algorithms can prevent the problem of joint velocities exceeding the corresponding limits, but motion errors will be introduced. More importantly, DLS algorithms cannot guide redundant manipulators away from singular region. These conditions occur suddenly during the operation, which is very unfavorable to patients. Therefore, based on GPM, a joint limit repulsive potential field function and a singular repulsive potential field function are introduced in the null space to solve the shortages of GPM, WLN, and DLS methods.

Clamping Weighted Matrix and Joint Limit Repulsive Potential Field Function
From Figure 1, it is easy to find that the starting and ending positions of W are difficult to determine, which sometimes affects the validity of the weighted matrix. Therefore, a buffer is added before the joint position limits, and the whole joint motion interval is divided into damping interval and flexible interval, as shown in Figure 2. That is a progressive clamping weighted matrix designed as follows: where f (·) is a smooth function varying from 0 to 1. The q itmin and q itmax are the lower and upper damping thresholds before q imin and q imax , respectively: where ξ is a positive constant scalar to determine the width of damping interval. Then, Equation (17) can be rewritten as: When q i run in the flexible interval, w c (q i ) = 1. While q i runs in the damping interval, the weighting matrix w c (q i ) prevents q i from approaching its limit. When w c (q i ) → 0 , the corresponding joints stop moving forever, which will affect motion control and reduce pose accuracy of the EE.
where  is a positive constant scalar to determine the width of damping interval. Then, Equation (17) can be rewritten as: A joint limit repulsive potential field function (I n − W c )R i (q) is introduced to solve the drawback of Equation (23), and I n − W c is also a smooth weighted matrix, when q i runs in the flexible interval, the joint limit repulsive potential field function is invalid. On the contrary, when q i starts to enter the damping interval, the joint limit repulsive potential field function R i (q) = diag(r(q i )) comes into play to force the corresponding joints back the flexible interval as far as possible. The r(q i ) is defined as: where r max is the maximum potential field force, the closer the limit is, the bigger the potential field force. When q i goes towards q imin , r(q i ) is negative, and r(q i ) is positive when q i goes towards q imax .
Considering the joint limit repulsive potential field function and combining with GPM, Equation (23) becomes: where the second part on the right-hand side is a homogeneous solution, which does not affect the main task.

A Novel DLS Method and Singular Repulsive Potential Field Function
In the traditional DLS algorithm, the damping factor function [27] is: The ε ∈ [0 , σ b ] is the singular region, and the selection of σ b through trial and error may result in joint velocities exceeding the corresponding limits, so a novel damping function which includes a micro-buffer region ε ∈ (σ b , σ b is presented to avoid the Sensors 2021, 21, 7362 7 of 20 joint maximum velocities being exceeded owing to the small selection of σ b . The novel damping function is defined as: where γ is a positive constant scalar to determine the width of micro-buffer region. In this paper, the single region and micro-buffer region are called unsafe region. The distributions of λ 2 and damped inverse σ σ 2 +λ 2 with singular value is depicted in Figure 3a,b, respectively. Through Figure 3b, it can be seen that in the case of no damping, infinite damping inverse will occur at a singular configuration which will result in very high joint velocities. Figure 3a,b show that the fixed damping value has the same effect in the unsafe region, which is unfair to the micro-buffer region, while the traditional damping function has an effect only in the singular region. However, except for the singular region, the new damping function still has a micro-damping factor in the micro-buffer to prevent the disadvantage that the joint speed exceeds the limit due to the small selection of σ b . Furthermore, the damping continuity in the singular and micro-buffer regions ensures the continuity of joint velocities.
where  is a positive constant scalar to determine the width of micro-buffer region. In this paper, the single region and micro-buffer region are called unsafe region.
The distributions of 2  and damped inverse 2 2    + with singular value is depicted in Figure 3 (a) and (b), respectively. Through Figure 3b, it can be seen that in the case of no damping, infinite damping inverse will occur at a singular configuration which will result in very high joint velocities. Figure 3a,b show that the fixed damping value has the same effect in the unsafe region, which is unfair to the micro-buffer region, while the traditional damping function has an effect only in the singular region. However, except for the singular region, the new damping function still has a micro-damping factor in the micro-buffer to prevent the disadvantage that the joint speed exceeds the limit due to the small selection of b  . Furthermore, the damping continuity in the singular and microbuffer regions ensures the continuity of joint velocities.
When solving singular problems, traditional DLS algorithms generate motion errors due to the introduction of damping factor in unsafe region, and it cannot guide robotic manipulators away from unsafe region. It is suitable for the manipulator with low accuracy requirements. However, this paper studies a surgical manipulator, which has very high requirements for pose. Therefore, a singular repulsive potential field function ( ) F q [28] is introduced to address the two deficiencies: When solving singular problems, traditional DLS algorithms generate motion errors due to the introduction of damping factor in unsafe region, and it cannot guide robotic manipulators away from unsafe region. It is suitable for the manipulator with low accuracy requirements. However, this paper studies a surgical manipulator, which has very high requirements for pose. Therefore, a singular repulsive potential field function F(q) [28] is introduced to address the two deficiencies: where K is a diagonal matrix that contains the maximum torque or force that we allow to be applied to the operator in each spatial dimension. The matrix ∇d(q) is used to direct the wrench away from unsafe region. The f (d(σ)|σ b , σ b ) is given as [29], and d(σ) is the distance to σ min = 0, the δ = 12/(σ b − σ b ) is recommended. It can be observed from Figure 4 that the change of f (d(σ)) in [ 0, σ b ] is smooth and continuous.
where K is a diagonal matrix that contains the maximum torque or force that we allow to be applied to the operator in each spatial dimension. The matrix ( ) d q is used to direct the wrench away from unsafe region. The is given as [29], and is recommended. It can be observed from Figure 4 that the change of ( ( )) is smooth and continuous.
In Equation (31), when = c n W I , Equation (25) becomes Equation (23). On the contrary, when i q is in the damping interval, ( ) c i w q decreases gradually from 1 to 0, and

Resolution IWGPM
Considering 3.1 and 3.2, and combining with GPM, a novel method called IWGPM is defined as: We define J + c = W c J T JW c J T + λ 2 noval I m −1 , the Equation (30) is represented as: In Equation (31), when W c = I n , Equation (25) becomes Equation (23). On the contrary, when q i is in the damping interval, w c (q i ) decreases gradually from 1 to 0, and the corresponding joint velocity also gradually decreases to 0. Meanwhile, r(q i ) increases gradually from 0 to make q i return to flexible interval. In the safe region, all elements in F(q) are zero, indicating that the singular repulsive potential field function does not work. When redundant manipulators are gradually entering the micro-buffer region from the safe region, some elements that cause singularities in F(q) increase gradually from 0 to F max . In the singular region, the function F(q) is always F max . The function F(q) has pushed redundant manipulators away from the unsafe region. From Equation (32), it is found that (I n − J + c J)(I n − W c )R i (q) and (I n − J + c J)F(q) pick from the null space of J c do not generate any motion at the EE.

Simulation Results and Discussion
In this section, simulations in the paper are implemented with the aid of the MATLAB R2015a tool, and a computer equipped with an Intel Core™ i5-2450M CPU @ 2.50 GHz and 2 GB RAM as the control platform.
A path starts from an initial pose of the EE, x initial , to a desired pose, x desired . The path is divided into M smaller line segments for numerical integration. At any integration step, the joint rates required to move the EE are calculated. Joint velocities are integrated sequentially until the EE reaches the desired pose. Equations (8), (23), (25) and (32) can be realized by an iterative algorithm and further applied to IK solution of redundant manipulators. The iterative algorithm steps are as follows: Step (1): Assume an initial pose expressed as Euler angles of the EE, x initial ∈ R 6×1 .
Step (2): Plan a trajectory from x initial to x M+1 = x desired ∈ R 6×1 with M intervals, and assume the running time of the motion, T.
Step (3): Calculate a planned velocity at the interval k that moves the EE toward where β > 1 is a deceleration factor.
Step (7): Letting q(k) =q(k +1) Step (8): where ρ is the accuracy of the actual pose and desired pose of the EE specified by the user.
where Λ is positive feedback gain, The E e ∈ R 6×1 is tracking error between the desired pose and the actual pose of the EE, which is defined as follows: where The (p xdesired , p ydesired , p zdesired ) and (p xactual , p yactual , p zactual ) are desired position and actual position, respectively. The (φ desired , θ desired , ψ desired ) and (φ actual , θ actual , ψ actual ) are desired orientation and actual orientation expressed as Euler angles of the EE, respectively.

Case Study 1
Simulations are provided to demonstrate the validity and practicability of the proposed IWGPM method for IK solutions of the redundant manipulators. The self-developed 7-DOF surgical manipulator with a diameter of 10 mm is taken as the research object. Its structure diagram and coordinate system are shown in Figure 5a,b.

Case Study 1
Simulations are provided to demonstrate the validity and practicability of th posed IWGPM method for IK solutions of the redundant manipulators. The selfoped 7-DOF surgical manipulator with a diameter of 10 mm is taken as the research Its structure diagram and coordinate system are shown in Figure 5a,b. The DH parameters of manipulator with joint position limit range are shown in 1. Table 1. Modified DH parameters and joint position limits of the 7-DOF manipulator.
q -π 2 , π 2 The DH parameters of manipulator with joint position limit range are shown in Table 1.
To illustrate the effect of the joint limit repulsive potential field function and singular repulsive potential field function, a straight-line path is selected as the trajectory. Moreover, the manipulator will enter a singular region, and some joints will be near their limit positions. The initial joint position q initial = [44, π 3 , π 6 , π 10 , −1.4349, π 4 , π 3 T and final joint position q desired = [50, π 5 , π 3 , π 6 , π 4 , π 3 , π For comparison, simulations with traditional GPM and WLN method are also presented. To reflect the coincidence degree of IK solution x and x desired , the pose accuracy is defined as follows: where the E * x , E * y , and E * z are the position errors in the x, y, and z directions between the final position and the desired position, respectively. The E * φ , E * θ , and E * ψ is orientation error in φ, θ, and ψ directions between the final orientation and the desired orientation, respectively. The average deviation E p between the final position and the desired position, and the average deviation E o between the final orientation and the desired orientation are defined as follows: To make simulations more convincing, in IWGPM, GPM, and WLN methods, we set In the two methods, 7 q exceeded its limit at 2.1s  t and 1.8s  t , respectively. It can also be clearly seen from Figure 8d that 7 q is in the damping interval from 1s  t to 1.8s  t and exceeds 7max q from 1.8s  t to the end of operation. When a joint exceeds its position limit, the corresponding joint will stop moving. Furthermore, there is no virtual force to push the joint away from its limit position, so when 7 q exceeds its limit, it remains unchanged, as shown in Figures 7a and 8a. It is known that the orientation of the manipulator is mainly controlled by the rear three joints. Therefore, the stop motion of 7 q seriously affects the orientation accuracy of the EE, as shown in Figures 7c and 8c. Figures  7b and 8b describe the deviation between the actual position and the desired position of the EE. In the initial stage, the actual position is far from the desired position. With the operation of time, it is more and more close to the desired position. According to Equations (41) and (42), for GPM, the average position deviation p E is 1.0452mm and the average orientation deviation o E is 0.6058 rad. For WLN method, the average position deviation p E is 1.46 mm and the average orientation deviation o E is 0.6144 rad. It also shows that the position accuracy of the EE is acceptable, but the orientation accuracy is very low. Figures 7d and 8e show that the manipulator runs in the unsafe region from 0.5s  t to 10s  t , and the damping value is generated during this time period to ensure that joint velocities operate within their limit, as shown in Figure 7e,f and Figure 8f,g, respectively.
In addition, Figures 7d and 8e show that the manipulator is always in the unsafe region because of no singular potential energy function, while Figure 6f shows that the existence of singular potential energy function urges the manipulator to stay away from the unsafe region. i.e., the singular potential energy function introduced in this paper is very effective in solving singular problems. During the operation of the EE of the manipulator from the initial pose to the desired pose, Figure 6a shows the change curve of joint position. It is indicated that all joints operate within their position limits, and the position change curve of each joint shows continuity and small fluctuation. Figure 6b,c describe the deviation between the actual pose and the desired pose of the EE. In the initial stage, the actual pose is far from the desired pose. With the operation of time, it is more and more close to the desired pose. Figure 6d shows that q 7 is in the damping interval when t = 1 s and t = 1.8 s. Figure 6e indicates that the limit repulsive potential energy function of q 7 produces virtual forces r(q 7 ) = 4.7111 and r(q 7 ) = 7.9569 at the same time point, which makes q 7 enter the flexible interval. The joint q 3 is also in the damping interval when t = 8.7 s. Figure 6e also indicates that the limit repulsive potential energy function of q 3 produces virtual forces r(q 3 ) = −6.066 at the same time point, which makes q 3 enter the flexible interval. Figure 6f shows that the manipulator runs in the unsafe region from t = 0.3 s to t = 8.6 s, and the damping factor is generated during this time period to ensure that joint velocities operate within their limit, as shown in Figure 6g,i. Meanwhile, the singular potential energy repulsion function generates a virtual force F(q 2 ) =F(q 3 ) = F(q 4 ) = F(q 5 ) = F(q 6 ) =0.08 to make the manipulator enter the safe region at t = 8.7 s, as shown in Figure 6h In the two methods, q 7 exceeded its limit at t = 2.1 s and t = 1.8 s, respectively. It can also be clearly seen from Figure 8d that q 7 is in the damping interval from t = 1s to t = 1.8 s and exceeds q 7max from t = 1.8 s to the end of operation. When a joint exceeds its position limit, the corresponding joint will stop moving. Furthermore, there is no virtual force to push the joint away from its limit position, so when q 7 exceeds its limit, it remains unchanged, as shown in Figures 7a and 8a. It is known that the orientation of the manipulator is mainly controlled by the rear three joints. Therefore, the stop motion of q 7 seriously affects the orientation accuracy of the EE, as shown in Figures 7c and 8c. Figures 7b and 8b describe the deviation between the actual position and the desired position of the EE. In the initial stage, the actual position is far from the desired position. With the operation of time, it is more and more close to the desired position. According to Equations (41) and (42), for GPM, the average position deviation E p is 1.0452 mm and the average orientation deviation E o is 0.6058 rad. For WLN method, the average position deviation E p is 1.46 mm and the average orientation deviation E o is 0.6144 rad. It also shows that the position accuracy of the EE is acceptable, but the orientation accuracy is very low. Figures 7d and 8e show that the manipulator runs in the unsafe region from t = 0.5 s to t = 10 s, and the damping value is generated during this time period to ensure that joint velocities operate within their limit, as shown in Figure 7e,f and Figure 8f,g, respectively.  In addition, Figures 7d and 8e show that the manipulator is always in the unsafe region because of no singular potential energy function, while Figure 6f shows that the existence of singular potential energy function urges the manipulator to stay away from the unsafe region. i.e., the singular potential energy function introduced in this paper is very effective in solving singular problems. Table 2 shows that the IK solution obtained by the proposed IWGPM. Compared with the proposed IWGPM, the position accuracy of the traditional GPM in x, y and z directions is reduced by 95.5%, 98.4%, and 82.9%, respectively. The orientation accuracy in φ, θ and ψ directions decreased by 94.3%, 97.7%, and 92.3%, respectively. The position accuracy of the traditional WLN in x, y and z directions is reduced by 96.0%, 98.8%, and 89.1%, respectively. The orientation accuracy in φ, θ and ψ directions decreased by 93.7%, 98.0%, and 92.6%, respectively. It can be seen that the proposed IWGPM can obtain very high pose accuracy, which fully meets the requirements of surgical accuracy.

Case Study 2
To observe the influence of joint position limits and singular potential energy function on the motion of the redundant manipulators. In this section, only the pose accuracy of the EE is considered for the simulation test in the following two cases. In case 1, based on the proposed IWGPM, joint position limit is removed and singular repulsive potential energy function is retained, Equation (38) is expressed as: In case 2, based on the proposed IWGPM, singular repulsive potential energy function is removed and joint position limit is retained, Equation (38) is presented as: The initial pose, desired pose of the EE and other parameter settings are the same as those in the previous section. The simulations are shown in Figures 9 and 10. In the first case, the average position deviation of the EE is 0.6553 mm and the average orientation deviation is 0.3353 rad. Compared with the proposed IWGPM, the average position deviation is reduced by 82.8% and the average orientation deviation is reduced by 88.4%. In the second case, the average position deviation of the EE is 2.5319mm and the average orientation deviation is 0.2547 rad. Compared with the proposed IWGPM, the average position deviation is reduced by 95.5% and the average orientation deviation is reduced by 84.8%. It is not difficult to find that the position and orientation of the EE are affected differently in the two cases. The first case has a great impact on the orientation accuracy, and the second case has a great impact on the position accuracy.
In addition, Figure 9a shows that q 7 exceeds q 7max from t = 1.1 s to t = 10 s. However, Figure 10d shows that q 7 is in the damping interval at t = 1.3 s, 1.6 s, 2.85 s. Meanwhile, the virtual force generated by the joint position potential energy function urges q 7 to enter the flexible interval, as shown in Figure 10a, which shows that the joint position potential energy function is very effective. Figure 10e,f show that the manipulator is always in the unsafe region from t = 0.7 s to t = 10 s. However, Figure 9d,e show that the manipulator after t = 3 s is in the safe region, which shows that the singular potential energy function is very effective. From another point of view, this section verifies that the proposed IWGPM is very effective in solving joint position limits and singularity problems. proposed IWGPM is very effective in solving joint position limits and singularity problems.

Conclusions
In this paper, the proposed IWGPM for the IK solution of redundant surgical manipulators is proposed to avoid joint position limits and singularities. The IWGPM introdues a clamping weighted matrix and joint limit repulsive potential field function. The clamping weighting matrix prevents approaching joint position limits, and the joint limit repulsive potential field function belong to the null space of weighted matrix only generates virtual force in the damping interval to make joints return to the flexible interval. Furthermore, a singular repulsive potential field function of belong to the null space of weighted matrix is introduced. When robotic manipulators enter an unsafe region, the singular repulsive potential field function produces an elastic force to drive

Conclusions
In this paper, the proposed IWGPM for the IK solution of redundant surgical manipulators is proposed to avoid joint position limits and singularities. The IWGPM introdues a clamping weighted matrix and joint limit repulsive potential field function. The clamping weighting matrix prevents approaching joint position limits, and the joint limit repulsive potential field function belong to the null space of weighted matrix only generates virtual force in the damping interval to make joints return to the flexible interval. Furthermore, a singular repulsive potential field function of belong to the null space of weighted matrix is introduced. When robotic manipulators enter an unsafe region, the singular repulsive potential field function produces an elastic force to drive manipulators back to the safe region. The proposed IWGPM is applied to the 7-DOF redundant surgical manipulator and compared with the traditional GPM and WLN methods. Simulations show that the proposed IWGPM is effective in avoiding joint position limits and singularities, and the pose accuracy is higher than achievable with the traditional GPM and WLN methods.
Furthermore, based on the proposed IWGPM, simulation tests in two cases are carried out. The results show that joint position limits have a great impact on the orientation accuracy, and singular potential energy function has a great impact on the position accuracy. Future work will focus on obstacle avoidance and optimal path planning of redundant surgical manipulators.