Cartesian space track planning for welding robot with inverse solution multi-objective optimization

Aiming at the problem that the traditional inverse solution optimization method is not comprehensive and does not consider the robot structure and actual working conditions, an inverse solution multi-objective optimization method is proposed. This method comprehensively considers the structural size and working state of the welding robot, establishes the stiffness performance evaluation index, optimizes the performance index of the subsequent connecting rod movement area caused by joint rotation, and selects the optimal inverse solution combined with the principle of “minimum joint displacement.” Compared with the traditional method, this method is more comprehensive. It makes the variation range of the rear three small joints of the welding robot larger than the front three large joints, which reduces the power consumption. In addition, it also improves the stiffness of the welding robot at the trajectory point, which ensures the reliability of the welding robot. On this basis, for linear and arc welds, the position interpolation of cartesian space line and arc trajectory based on the S-shaped acceleration and deceleration curve and the posture interpolation of spherical linear interpolation based on unit quaternion are realized. MATLAB simulation results show that the combination of the inverse optimization method and the interpolation method makes the end trajectory, velocity, acceleration, posture curve, and joint displacement curve of the welding robot continuous, smooth, and without mutation.


Introduction
With the rapid development of modern industrial technology, industrial production lines tend to be intelligent. Most welding production lines, such as automobile and ship manufacturing, have poor working conditions. In order to reduce production costs, improve production efficiency, and ensure welding accuracy, welding robots have become indispensable in welding operations. 1,2 Trajectory planning can make the robot move smoothly and reduce impact and vibration, which is of great significance to improving the stability, reliability, and work efficiency of the robot. 3,4 At present, scholars have conducted research on trajectory planning and have proposed some novel trajectory planning methods, such as the sine resistance networkbased planning approach. 5,6 But for the welding robot, its trajectory is determined, and the welds of weldments are generally straight lines and arcs. In order to ensure that the welding robot can accurately complete the welding task along the weld, it is necessary to carry out Cartesian space trajectory planning to ensure the stability of the end motion trajectory, so as to improve the welding accuracy and efficiency. 7,8 However, the optimal selection of the inverse solution is the basis of trajectory planning. 9,10 There are eight sets of inverse solutions for the 6-DOF welding robot. 11 Therefore, choosing appropriate joint variables is the premise of trajectory planning. Wang et al. 12,13 used the principle of ''shortest stroke'' to select a group of joint variables with the smallest variation of front and rear joint angle as the optimal solution. Zhao et al. 14 took the principle of ''moving more small joints and fewer large joints'' as the influencing factor of the current joint angle, so as to select the optimal solution of the inverse solution. Liu et al. 15 combined with the above principles and set the weighted inverse solution optimization criteria to optimize the inverse solution. However, the above method does not consider the structural characteristics of the robot, the motion state of the robot in actual work, or the minimum requirements of joint angular displacement. Therefore, the optimization principle of the inverse solution is not comprehensive. Duan et al. 16 set the optimization index and optimized the inverse solution by taking the stiffness performance index of the robot and the principle of ''moving more small joints and fewer large joints'' as the influencing factors, combined with the principle of ''shortest stroke.'' However, the expression of the principle of ''more small joints and fewer large joints'' is not combined with the D-H parameters of the robot, so the stroke optimization index is not comprehensive. Wang et al. 17 combined the two influencing factors of joint power consumption and the spatial range of subsequent connecting rod motion sweeping caused by joint rotation with the principle of ''shortest stroke,'' and proposed a weighted ''shortest stroke'' criterion to meet the actual work needs of the robot. For joint power consumption, the moving range of the connecting rod behind the joint is equivalent to the ratio of the power consumption of each joint to a certain extent, and the stiffness of the robot in actual work is not considered.
Based on the above literature, an inverse solution multi-objective optimization method is proposed. A group of trajectory points is selected, and the optimization method used in this paper is compared with the traditional inverse solution optimization method to verify the rationality of this method. Based on the inverse solution optimization of the welding robot, the position interpolation of Cartesian space line and arc trajectory based on the S-shaped acceleration and deceleration curve and the attitude interpolation of spherical linear interpolation based on unit quaternion are carried out for linear and arc welds. Finally, the feasibility of the inverse solution multi-objective optimization method and the interpolation method in Cartesian space trajectory planning is verified by MATLAB simulation.

Kinematics analysis
The welding robot is a series robot with only six rotating joints, and the rear three axes intersect at one point. As shown in Figure 1, the coordinate system of the welding robot is established according to the modified D-H parameter method. 18 According to the definition of the D-H connecting rod parameters, the D-H parameters of the welding robot are presented in Table 1. For example, joint angle u i , twist angle of adjacent joints a iÀ1 , connecting rod length a iÀ1 , and offset of adjacent connecting rods d i .
Based on the above parameters, the forward kinematics model can be established and the inverse kinematics solution can be obtained by the method described in Wang and Lam. 11 Optimal selection of the inverse solution The solution process of the inverse solution of the welding robot shows that there are almost eight groups of analytical solutions for any attitude in its workspace. However, motion planning only needs to select a set of joint variables as the input of the joint. For the traditional optimal solution selection principle, only the motion of small joints is considered, but the relationship with the current joint variables is not considered, or only the principle of minimum joint displacement is considered, while the structure and working conditions (1) Eight sets of joint variables should be within the angle limit of each joint. (2) Combining with the structure size and working condition of the robot, the inverse solution multi-objective optimization is carried out.
When implementing the welding task for the welding robot, the following connecting rod movement space caused by joint rotation and the stiffness problem of the manipulator in actual work are mainly considered. 19 Therefore, taking them as the influencing factors, the stiffness performance index 20 is shown in equation (1): Where C tt is the translation submatrix of the cartesian flexibility matrix C, and C can be expressed by equation (2).
Where J q ð Þ is the Jacobian matrix of the welding robot, which can be determined by the improved D-H parameters, and the change of the manipulator attitude will also affect the change of its value. K u is the joint stiffness matrix in the form of a diagonal matrix. The greater the stiffness index, the better the stiffness performance.
For the principle of ''more moving small joints and fewer moving large joints,'' 14 power minimization is considered without considering the mechanism parameters of the welding robot, as shown in equation (3): Where l i is the connecting rod length of the front three joints.
The performance index of the subsequent link motion space caused by joint rotation includes the structural parameters of the robot, so it is more comprehensive than the conventional expression. According to the literature, 17 the optimization index based on standard D-H parameters can be expressed by equation (4).
Since the rear three axes of the welding robot intersect at a point, based on the modified D-H parameters, combined with equation (3) and equation (4), the performance indexes of the front three joints can be expressed by equation (5), and The expression of the rear three joints is the same as equation (3).
Combining the performance index S g j with the principle of ''minimum joint displacement,'' the joint stroke optimization model g s can be expressed by the following formula.
Unify the order of magnitude, set the stiffness index to k sg = k s Á 10 Àm , and combine the stiffness index with the joint stroke optimization model to form a multi objective optimization index v, as shown in equation (7): The weights are shown in Table 2.
The code idea of optimal selection of the inverse solution is as follows: Step1: Enter the current joint angle variable u j ,j = 1;6; Step2: Using the expression of the inverse solution, the joint variables of the next pose are obtained, and the joint variables u i, j that meet the joint limit are selected; Step3: The multi-objective optimization index v i corresponding to each group of joint variables is obtained; Step4: The joint variables corresponding to the minimum v i are selected as the optimal solution; Step5: Taking the selected optimal solution as u j , the next round of optimal solution selection is carried out.
Trajectory planning based on based on S-shaped acceleration and deceleration curve The welding robot has strict requirements for the end trajectory, which require that the robot end run according to the specified trajectory and the trajectory be smooth. Therefore, it is necessary to plan the straightline and arc trajectory of the welding robot in Cartesian space. 4,21 In the welding task, the maximum speed and maximum acceleration need to be constrained to make the end trajectory smooth, the speed and acceleration continuous, and reduce the impact on the joint and the loss of the motor. Therefore, on the basis of the inverse solution multi-objective optimization, straight line and circular arc interpolation based on the S-shaped acceleration and deceleration curve are adopted. [22][23][24] S-shaped acceleration and deceleration curve As shown in Figure 2. Set T k = t k À t kÀ1 k = 1, Á Á Á , 7 ð Þ to represent the time of each stage. In addition, the variable t is introduced, t k = t À t kÀ1 is set as the relative time with the starting time of each time period as the zero point, and J is set as the acceleration jerk; Set the maximum acceleration as a max , maximum speed as v max , initial speed v 0 and initial speed v 1 ; At the same time, T 1 = T 3 = T 5 = T 7 , T 2 = T 6 : Through the analysis of each process, the acceleration function, velocity function, and displacement function of each cycle can be expressed by equations (8)-(10).
In order to determine the running time of each stage, it is necessary to set the displacement, start and stop speed, maximum speed, maximum acceleration, and acceleration jerk of the S-curve. The operation time of each stage is shown in equations (11)- (13).
The normalized time operator l t ð Þ plays a role in adjusting the step size in interpolation motion. According to An and Yang, 25 the normalized time operator l t ð Þ is expressed by equation (14).
Where S t ð Þ is the time-varying displacement of the Sshaped acceleration and deceleration curve, and L is the distance from the starting point to the end point.

Position interpolation
The coordinates of the track start point p 0 (x 0 , y 0 , z 0 ) and the end point p n (x n , y n , z n ) are determined according to the basic coordinate system. Taking the normalized time operator based on the S-shaped acceleration and deceleration curve as the variable, the coordinates p i (x i , y i , z i ) of the interpolation point can be expressed by equation (15): In the base coordinate system, set the coordinates of the arc start point, midpoint and end point as p 1 (x 1 , y 1 , z 1 ), p 2 (x 2 , y 2 , z 2 ), and p 3 (x 3 , y 3 , z 3 ). The three points are in the same 3D space, but not on the same line.
(1) As shown in Figure 3. According to the method in Corradini and Cristofaro, 26 the center coordinate p c and arc radius r are obtained, and the coordinate system C f g is established with the center C as the origin, and the coordinate axis is set as X c Y c Z c .
(2) Calculate the conversion matrix B C T between coordinate system C f g and coordinate system B f g.

Attitude interpolation
Compared with other representations of attitude, unit quaternion has the advantages of simple operation, no universal joint locking, and easy interpolation. Therefore, the spherical linear interpolation (SLERP) method based on unit four elements is used for attitude interpolation. 27 Set the quaternion to q,q = ½s, a, b, c. According to the rotation matrix R, two complementary quaternions can be obtained by equation (20). Set the attitude matrices of the starting point and the ending point as R 1 , R 2 respectively. The quaternion q 1 and q 2 corresponding to the posture matrix can be obtained through equation (20) (considering the minimum time, select a group of quaternions according to the principle of minimizing the angle with the previous attitude from the two complementary quaternions obtained from each attitude matrix), and the angle u between the two quaternions can be obtained according to the point multiplication principle of the unit quaternion.
The pose between two points can be obtained by the SLERP method. 28 Where t is the normalized time operator l (t) based on the S-shaped acceleration and deceleration curve. If the value of the quaternion dot product is negative, it will be interpolated to the farthest path on the 4D sphere. In order to deal with this drawback, the value of the dot product is calculated first. When it is negative, any one of the two quaternions is taken as the inverse (it will not change its direction). Through the above processing, interpolation can be done on the shortest path.

Simulation results and discussion
The position where the joint angle is 0 is taken as the starting position, and a series of trajectory points are obtained by quintic polynomial interpolation. The optimization index formed by the combination of the performance index S j and the principle of ''minimum displacement'' is set as b s . 17 When the joint stroke is mainly considered, the multi-objective optimization index is set as v 0:4, 0:6 . When the stiffness of the robot in actual work is mainly considered, the multi-objective optimization index is set as v 0:6, 0:4 . A simulation analysis is carried out in order to verify the performance of the optimization index v.

Performance superiority analysis of optimization index v
The complexity of the algorithm is divided into time complexity and space complexity. The welding robot is a real-time system, and the system response requirements are high. So the algorithm v mainly considers time complexity. According to the running idea of the algorithm v, the algorithm is programed, and the time complexity is calculated by formula (23).
Only the stiffness of the welding robot is considered 0.5 \ p 1 \ 1 The stiffness of welding robot is mainly considered, and the joint stroke is secondary considered 0.5 \ p 2 \ 1 Joint stroke is mainly considered Only joint stroke is considered T(n) represents the execution time of the code; n represents the size of the data size; f(n) represents the total number of executions per line; O represents the trend of code execution time with the increase of data scale, also known as progressive time complexity. The time complexity of the algorithm v is O(n), which is the same as the traditional algorithm Trad 12,13 and the algorithm v. Theoretically, when it tends to infinity, the execution efficiency of the three algorithms is the same.
The execution time of the three algorithms is shown in Figure 5.
As shown in Figure 5 the execution time of the three algorithms has little difference, and the order of magnitude of the execution time of the algorithm v meets the requirements of the welding robot system.
As shown in Figures 6 and 7 in order to further analyze the superiority of the optimization index v, it is compared with the traditional optimization index Trad and the optimization index b s .
In ADAMS software, the welding robot model is constructed, and the variation of the above joints is taken as the input to measure the power consumption of the welding robot under different optimization indexes. The results are shown in Figure 8. Figures 6 and 7 show that, firstly, in the initial position, according to the weight setting of the optimization index v, the welding robot adjusts the attitude to meet the stiffness requirements under the premise of ensuring the position is unchanged, and uses this as the initial attitude to select the optimal inverse solution at the trajectory point. When the weight is selected differently, the variation range of the three small joints after the optimization index v 0:4, 0:6 is greater than that of the optimization index v 0:6, 0:4 , and the variation range of the three large joints is smaller than that of the optimization index v 0:6, 0:4 . In addition, the variation range of the rear three small joints of the two optimization indexes is greater than that of the front three large joints, and the stiffness of the optimization index v 0:6, 0:4 is greater than that of the optimization index v 0:4, 0:6 . Figure 8 shows that the power consumption of the optimization index v 0:4, 0:6 is less than that of the   optimization index v 0:6, 0:4 . This data verifies that the optimization index v is consistent with the design principles of this article. Secondly, the variation range of the front three large joints of the index b s is consistent with that of the traditional optimization index Trad, and the variation range of the rear three small joints is greater than that of the traditional optimization index Trad. However, the smoothness of the rear three small joint variables of the optimization index b s at a certain point is low. In terms of stiffness and power consumption, the optimization index b s is the same as the traditional optimization index Trad. Compared with the two optimization indexes mentioned above, the optimization index v improves the smoothness of the variation amplitude of the rear three small joint variables. In addition, the variation range of the front three large joints of the optimization index v is smaller than that  of the traditional optimization index Trad, and the variation range of the rear three small joints is larger than that of the traditional optimization index Trad. This will make the welding robot move more small joints and fewer large joints, thereby reducing the power consumption of the welding robot. Figure 8 shows that the power consumption of the optimization index v is less than that of the other two methods, which verifies the accuracy of the above conclusion. In addition, the stiffness of the optimization index v is greater than the traditional optimization index Trad, which improves the reliability of the welding robot.

Trajectory simulation
MATLAB is used to complete the motion trajectory interpolation simulation of the welding robot. [29][30][31] The simulation idea is shown in Figure 9.
(1) Linear interpolation simulation The pose matrix of the start point p 1 and the end point p 2 is set as follows: The corresponding quaternions Q 1 = 0, 1, 0, 0 ½ , Q 2 = ½0, 0:9063, À 0:4226, 0. The simulation results of spatial linear interpolation based on S-shaped   The attitude quaternion is converted into XYZ Euler angle. The end attitude change curve is shown in Figure 14.
The attitude quaternion is converted into XYZ Euler angle. The end attitude change curve is shown in Figure 19. Figures 11 and 16 show that the trajectory planning method can make the welding robot complete the specified straight and circular trajectory. Figures  10 and 15 show that the end of the welding robot can complete the welding task according to the set velocity constraint curve, and the displacement, velocity, and acceleration of the end are flat without mutation, which verifies the feasibility of the spatial trajectory    interpolation based on the S-shaped acceleration and deceleration curve and improves the working performance of the welding robot. Figures 14 and 19 show that the spherical linear interpolation (SLERR) based on unit quaternion ensures the stability of the end attitude of the welding robot and avoids the singularity of the attitude. Figures 13 and 18 show that each joint variable of the welding robot is gentle and has no mutation, and the variation range of the rear three small joint variables is greater than that of the front three large joint variables, which verifies the feasibility of the combination of the inverse solution multiobjective optimization method and the trajectory planning method.

Conclusion
In this paper, the performance evaluation index of the connecting rod stiffness is established, and the performance index of the subsequent motion area of the connecting rod caused by joint rotation is improved. Based on the principle of minimum joint displacement,     an inverse multi-objective optimization method is proposed. Compared with traditional methods, it is more comprehensive. To a certain extent, this method makes the post-triaxial variables continuously non-mutation, and the angle variation of the rear three small joints is greater than that of the front three large joints, which reduces the power consumption of the welding robot. In addition, the multi-objective optimization index v improves the stiffness of the robot during operation to a certain extent, which ensures the reliability of the welding robot. On this basis, the S-shaped acceleration and deceleration curve is combined with the Cartesian space linear interpolation motion and arc interpolation motion of the welding robot to interpolate the position of the welding robot. The end attitude adopts spherical linear interpolation of unit quaternion based on the Sshaped acceleration and deceleration curve. Through simulation, the welding robot can complete space linear and arc motion, and the trajectory, attitude, and displacement curves of each joint end are continuous and smooth without mutation. The feasibility of the inverse multi-objective optimization method and interpolation method in trajectory planning is verified, which lays the foundation for the welding robot to realize welding tasks and maintain welding stability in the future.
Prospect: In the future, the inverse multi-objective optimization problem will be further studied to achieve the optimal solution from the inverse operation itself and, on this basis, deepen the trajectory planning.

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