Spot-welding path planning method for curved surface workpiece of body-in-white based on memetic algorithm

Aiming at the problem of complex path planning in the processing of curved surface workpieces of body-in-white, a hybrid path planning method based on memetic algorithm is proposed. The method is divided into two parts, welding sequence planning and welding path planning between welding joints. By establishing the kinematics model of spot welding robot based on pipper criterion and z-y-z Euler angle solution method, the motion constraints of path optimization are analyzed. Under the framework of the memetic algorithm, the improved A-star algorithm with redundant node deletion and post smoothing process is used to obtain the smooth collision-free optimal path set between welding joints, and construct the objective function of traveling all welding joints with the shortest path length and the highest smoothness, the multi-objective elitist simulated annealing genetic algorithm is used to achieve the welding sequence planning of all welding joints. The variable neighborhood search method improves the mutation operator, the elitist strategy is introduced to improve the probability of crossover and mutation operation, and a simulated annealing algorithm is used to jump out of local search to get the global optimal solution. According to the motion constraints, the joint space path is obtained by the optimal path in Cartesian space. Simulations analysis results demonstrate that the hybrid path planning method based on the memetic algorithm can effectively optimize the path of spot welding robot, lay the foundation of controlling and trajectory planning during welding processes.


Introduction
The curved surface shape of the body-in-white workpiece brings about difficulties to the spot-welding path planning.More and more researchers pay attention to the path planning technology of spot welding robots [1,2].The welding sequence planning and the welding path planning between welding joints are relatively independent while interdependent in the optimization process.However, most researchers only consider welding sequence planning, ignoring the impact of path planning between welding joints under the condition of curved surface workpiece.
Robot path planning is to find an optimal path from the initial state to the target state under certain optimization conditions (such as minimum energy consumption, minimum welding deformation, shortest time, shortest walking path, etc.) [3][4][5].In the process of welding path planning, the first question to consider is collision-free path planning.
Wang et al. [6] proposed a secondary optimization algorithm for local collision-free path planning and global path planning with the shortest path length as the optimization objective.Although the welding sequence and path planning between welding joints are studied in detail, the influence of smoothness on collision-free welding path is not considered.Most researchers only focus on the welding sequence in spot welding path planning.Yang et al. [7] grouped the welding joints according to the welding distortion.The welding joints group with less influence was optimized by the elastic network method.The other group used a genetic algorithm to find the welding sequence with the minimum distortion.Wang et al. have done a series of research in the field of robot welding sequence planning.The diversity of particles and global search ability were enhanced after another global solution from the genetic algorithm was considered [8].Taking the shortest path length and energy consumption of spot welding robot as optimization objectives, where improved particle clustering partitioning strategy, guidance particle selection strategy, and external archive save mechanism are used [9].A discrete elite particle swarm optimization algorithm based on discretization and elite strategy to optimize the shortest path length and minimum welding distortion [10].The welding sequence and the path planning of welded joints are interactive, it is difficult to evaluate the whole welding path only by welding sequence planning.
In the above literature, the path planning of spot welding robot is almost limited in 2D environment.However, curved surface workpiece machining can not be ignored in many applications [11][12][13].Since the flexibility and adaptability to different environments, the A-star algorithm has been widely used in path planning.Filippis et al. [14] extended the solution to the 3D environment, and used the θ-star algorithm to generate an optimal path, according to the limit of turning radius and climbing rate, dubins curve is used as post-smoother on the path.Liang et al. [15] proposed a geometrical path planning method, which used tree structure to describe obstacles.The method can find short paths in 2D or 3D complex environment rapidly.Senniappan Karuppusamy et al. [16] proposed a method for path optimization that exploits A-star and genetic algorithms to find the near-optimal safe path between each machining position.
Nevertheless, the improved A-star algorithm combined with redundant node deletion and post smoothing process is rarely studied.
Genetic algorithm is a representative solution to the problems of path planning [17][18][19].
Machmudah et al. [20] proposed a two-layer optimization strategy utilizing sixth degree polynomial as joint angle path.The genetic algorithm and particle swarm optimization is used in searching the feasible joint space path under the minimum total traveling time.Givehchi et al. [21] propose a hybrid methodology of rule-based assembly planning and the genetic algorithm applied in spot-welding sequence planning, genetic algorithm optimization engine was applied to process planning and simulation.Genetic algorithm has the defect of slow convergence speed and easy to fall into local optimal solution, redesigning the selection operator can improve the convergence speed and direction of the algorithm.Karami et al. [22] proposed an adaptive genetic algorithm for path planning in complex environments, designed adaptive selection operator by using the standard deviation of individual fitness value.Ahmed et al. [23] proposed four different path representation schemes for encoding, and proposed a multi-objective path planning method to optimize path length, path safety, and path smoothness using the elitist non-dominated sorting genetic algorithm.

Spot welding robot kinematics model
The spot-welding path planning on a curved surface workpiece is actually the path planning of robot operation space.The advantage is to predict the path of operation space and reduce the collision possibility.There are position and posture constraints between the welding tongs and the workpiece, so it is necessary to solve the forward and inverse kinematics with motion constraints.Then, the joint space path is deduced to reflect the motion performance of the robot intuitively.The purpose of robot kinematics research is to describe the geometric relationship of robot multilink cooperative motion.Fig. 1 shows a commercial industrial robot and symbols together with variables.
Fig. 1 The model of industrial robot and its link coordinate frames.
The D-H method is used to establish the coordinate system of the spot welding robot.The D-H parameters of the spot welding robot are shown in Table 1.i a is the link length, i  is the torsion angle of the link, i d is the offset of the link, and i  is the joint angle.

Forward and inverse kinematics analysis of spot welding robot
The transformation matrix of the robot link can easily be found in the following manner: Since Where i  is the joint variable, ,, and   noa are the position vector and posture matrix of the end reference point relative to the base coordinate system.
Since the three joints of most commercial spot welding robots intersect at the same point, the inverse kinematics of the robot can be calculated by the Pieper criterion.Firstly, according to the position of the wrist coordinate system, the joint variable of the first three joints is calculated by robot inverse kinematics, and the next three joint variables   4,5, 6 i i   are calculated according to the wrist pose coordinates.
Since the wrist joint coordinate system {4}, {5} and {6} have the same origin, the position of the point in the base coordinate system can be obtained by a transformation matrix.
Where, 0 4 p is expressed as  By using the homogeneous transformation matrix, the known 0 4 p transform into the following relation equation. Where,

( )
Substituting the D-H parameters into Eqs.3~6, Where, m a a a d     .The posture transformation matrix of the next three joints Where, 0 3 R is the posture matrix of the first three joints, 0 6 R is the posture matrix   noa of the robot end reference point relative to the base coordinate system.
denotes the homogeneous transformation matrix element of 3  6 R , and the negative sign in front of the formula indicates that the Y-axis of coordinate system {4} is opposite to 5  .

Motion constraints of spot welding robot
In the process of welding, there is interference between the welding tongs and the complex curved surface workpiece.Therefore, it is essential to analyze the position and constraint relationship between welding tongs and workpieces.
The workpiece is a curved surface, and its general formula can be expressed by the space surface equation.( , , ) ( , , ) ( , , ) The set of workpiece edge points is {} j m , and the vector between workpiece edge points ( , , ) and welding joint ( , , ) to the unit normal vector of the welding joint ( , , ) p x y z on a curved surface is expressed as follows: The vector corresponding to the shortest to the norm of welding joint ( , , ) coordinate can be formulated as follows: The unit vector from the workpiece edge point ( , , ) to the welding joint ( , , ) is taken as the X-axis unit vector of the welding joint coordinate system{} The unit vector of the Y-axis of the welding joint coordinate system {} i p is expressed as: Homogeneous transformation matrix of base coordinate and welding joint coordinate system   i p is expressed as: Here, the homogeneous transformation matrix 6 t T is applied to represent the transformation matrix of the robot end flange and welding tong.
In which, The position of the end coordinate of C-type servo welding tong in the base coordinate system is ( , , ) x y z .The axis of the C-type servo welding tong should be perpendicular to the cutting plane of the workpiece at the welding point coordinate, so as to ensure the dense and compact weld nugget, which is denoted by The complete closed chain of motion constraints is expressed as 6 0 6 0 The forward and inverse kinematics with motion constraints is a bridge between cartesian space and joint space of robot, which lays a foundation for path planning of robot end-effector and joint angle.

Spot-welding path planning based on memetic algorithm
In the path planning method based on the memetic algorithm, the path planning method is divided into two parts, welding sequence planning and welding path planning between welding joints.The

Path planning between welding joints based on improved A-star algorithm
The A-star algorithm is a graph search algorithm, which analyzes the current node by the cost of the initial node and nearby node and heuristic function from the current node to the target node.The cost function of the A-star algorithm is defined as follows: Where n represents the current node and () fn is the cost function of the initial node, current node and target node.
() gn is the real cost between the initial node and the current node in the state environment.() hn is the estimated cost of the process from the current node to the target node.
The heuristic function ()  hn plays a key role in the cost function, which determines the efficiency of the A-star algorithm.It is necessary to design a heuristic function suitable for the purpose of specific path planning.In order to improve the success rate and accuracy of the A-star algorithm, the Euclidean distance is selected as the cost function of ()  hn .
Where, ( , , )   n n n x y z represents the center coordinates of the current node and ( , , ) represents the center coordinates of the target node.
In order to ensure that the welding tong and the workpiece do not affect each other, the safe distance between the welding tong and the workpiece should be determined.
( , ) Where R and W represent the end effector and the workpiece respectively, indicating that there is no collision between the robot and the workpiece and ,, Where, 01 curve is a segment definition.Given 1 mn  nodes, then the parameter curve of n degree in 1 m  segment can be defined.

, () kn
Ft is an n degree B-spline basis function, and its expression is Where, 01 t , 0,1, 2, , kn  L , the whole curve composed of all curve segments is called n degree B-spline curve.The process of robot path planning is equivalent to TSP problem.However, the robot welds each point only once, it is not necessary to return to the first welding joint.Suppose that the set of n welding joints., ij C is the cost between i v and j v .In order to minimize the total cost, the formula can be expressed as follows: , the optimal path planning of robot can be described as follows: is the sum of the path segment between every two welding joints of the path.
The objective function of robot path planning is traveling all welding joints with the shortest path and the highest smoothness.
The objective function is the sum of the path segment length traversing all welding joints.
Where, ij l is the shortest path segment between welding joints obtained by the improved A-star algorithm, and n is the number of path segments between welding joints.
The objective function of path smoothness traversing all welding joint is as follows: m and n are the number of turnning and the number of path segments between welding joints. is the angle between the front and rear nodes, t  is the coefficient related to the angle.M is the path length matrix, the elements in the matrix represent the path length between two welding joints, where n is the number of welding joints, and the values of jk L and kj L between the two welding joints are not necessarily equal.The roulette method is overwhelmingly dependent on the probability transfer mechanism.The probability of being selected is positively proportional to its fitness.The selection probability of an individual i x is defined as follows: Calculate the selection probability of each individual by Eqs.38, and then the cumulative probability i q of individual i x is expressed as: The basic idea of roulette selection method is to generate a random number  .Specific mechanism of the mentioned strategy is shown as Fig. 3. Improved selection operator speeds up the convergence of the genetic algorithm.
In this paper, by using four neighborhood structures of "point insertion", "exchange", "2-opt" and "block insertion", the variable neighborhood search is carried out to expand the search scope and obtain the local optimal solution.
(1) Neighborhood structure 1: "inserting" is defined as transferring continuous nodes from the current path segment to another path segment.
(2) Neighborhood structure 2: "block switching" is defined as selecting continuous nodes from two different path segments to exchange positions.
(3) Neighborhood structure 3: "2-opt" is defined as selecting any two points that are not adjacent in a certain path and reversing all points (including the two points) between the two points.
(4) Neighborhood structure 4: "point exchange" is defined as the position exchange between two genes.

Comparison of traditional A-star algorithm and improved A-star algorithm in path planning
For welding robot path optimization between every two welding joints, the safe height distance is set as  The traditional genetic algorithm takes all individuals in the population as the object and only uses the basic genetic operators, that is, selection operator, crossover operator and mutation operator.Fig. 7 The path planning method based on traditional multi-objective genetic algorithm Fig. 7 is the welding joint path optimized by a traditional multi-objective genetic algorithm.There are many intersections and obvious unreasonable path segments, that is, traveling through the convex or concave area of curved workpiece,which not only increases the welding path length of the welding tongs, but also increases the collision risk between the welding tongs and the workpiece.
For adaptive genetic algorithm, in the early stages of population evolution, because of the low fitness of the individuals,      Fig. 12 and Fig. 13 show the evolution curve of population fitness variance and the evolutionary curve of mean value of population fitness respectively.It can be seen that in the early stage of the evolution curve, multi-objective elitist simulated annealing genetic algorithm has better individual diversity and stronger global searchability.However, the traditional multi-objective genetic algorithm and the multi-objective elitist adaptive genetic algorithm fail to reach the global optimal solution.The fitness variance value of the multi-objective elitist adaptive genetic algorithm is larger and has a stronger global searchability.The results show that the optimized path of multi-objective elitist simulated annealing genetic algorithm is 48.3% shorter than that of the traditional multi-objective genetic algorithm, and 41.6% shorter than that of multi-objective elitist adaptive genetic algorithm.
According to the complete motion constraint closed chain of the base coordinate system, the robot end coordinate system, the welding joint coordinate system and the welding tong coordinate system, the desired position and posture of the robot end coordinate relative to the base coordinate system can be obtained, and then the joint variables to reach the desired position and posture can be solved by inverse kinematics.The robot welding workstation is modeled by PLM offline planning software as shown in Fig. 15a.In the MATLAB simulation software, the planning path of curved surface welding joints based on a memetic algorithm is imported into the automobile automatic production line software Process Designer & Process Simulate.The welding path of the rear seat cross beam assembly station is simulated in the virtual environment.The interference detection function in the software is used for collision detection, the safe threshold distance of robot movement is set as 2.5mm, and the setting interface is shown in Fig. 15b.According to the simulation results, there is no collision phenomenon in the whole welding process.With the computer-assisted planning function of off-line programming, the corresponding robot program can be generated from the above path.

Conclusion
The spot welding path planning method based on a memetic algorithm is divided into two parts: welding sequence planning and path planning between welding joints, which has reference value in practical industrial application.It can not only greatly shorten the time of engineer's early planning and debugging, but also improve the efficiency of the robot.The actual workpiece is used in this paper, and the welding path optimization is similar to the actual welding situation.It can be seen from the simulation results that the planned path can provide an effective reference for the welding path planning of rear seat cross beam assembly station.However, there is the phenomenon of mutation position and motion discontinuity in the joint path of the spot welding robot, the singularity of robot kinematics should be considered in future work. T

i i 1 
of link transformation is only related to joint variable i  .A homogeneous transformation matrix is usually adopted to represent the position and orientation of the robot end-effector,

3 6 R
can be expressed as a relation in the form of

R 4  , 5  and 6 
 is the z-y-z euler angular rotation matrix equivalent to the robot wrist joints.is the posture matrix of coordinate system {4} in the coordinate system {3} with 4 0   .Using the solving method of z-y-z Euler angle, can be written as: z , which is the Z-axis unit vector of the welding joint coordinate system{} i p .

14 )
The vector from the workpiece edge points( , , ) improved A-star algorithm is used to obtain the path set between welding joints.According to the path set, The multi-objective elitist simulated annealing genetic algorithm is used to obtain the welding sequence of all welding joints.The objective function of the algorithm is to travel all welding joints with the shortest path and the highest smoothness.Using elite strategy to improve selection operator, which can prevent outstanding individuals from accidentally being eliminated.The mutation operation is improved by the variable neighborhood search method, and a simulated annealing algorithm is used to improve the genetic algorithm in order to jump out of the local optimal solution.
Fig.2 Redundant node discriminant process After removing redundant nodes, 1 mn 

3. 2
Welding sequence planning based on the multi-objective elitist simulated annealing genetic algorithm Multi-objective elitist simulated annealing genetic algorithm is a combination of population-based global search and individual-based local heuristic search under the framework of the memetic algorithm.The combination mechanism makes the search efficiency of the memetic algorithm faster than that of the traditional evolutionary algorithm in path planning areas.

1 (
requires traveling all welding joints, which is a NP-hard problem. the welding sequence is   

M
is the path smoothness matrix, and the elements in the matrix represent the path smoothness degree between two welding joints, and the values of kj S and jk S are not necessarily equal.Transform the multi-objective problem into a single objective optimization problem.The objective function is as follows: is to measure the degree of excellence that an individual can reach the optimal solution.Individuals with higher fitness are more likely to be inherited to the next generation.The fitness function of individuals in the population is ( k and d k influence the individual selection probability, The larger the values of c k and d k , the higher the selection probability of individual i x .

Fig. 3
Fig.3 Action mechanism of genetic operator with elite population strategy integrated.

Fig. 4
Neighborhood structure of " insert " Neighborhood structure of "block switching" Variable neighborhood structure search After the crossover operation and mutation operation, if the offspring's individual objective function value will result in the traditional genetic algorithm falling into the local optimization.The importance sampling method based on the Metropolis criterion was adopted.At temperature t , if the objective function value is new old LL , the population is updated, and the new individual replaces the parent individual; if the objective function value is Boltzmann constant, the system will tend to the equilibrium state with lower energy after many repetitions.The above process is organized into pseudo-code, the procedures of the spot-welding path planning method based on the memetic algorithm is presented in Algorithm 1.

Algorithm 1 :
The spot-welding path planning method based on memetic algorithm Input:Population size, Number of elitist, Initial temperature, Number of iterations

19 end 4 4 . 1 Fig. 5
Fig.5 KUKA KR240 R2900 robot testbed and projected welding points of a rear floor.carbon steel.Compared with other body-in-white parts, the shape of the rear floor is more complex and the welding requirement is higher.The problem under study involves the optimization of the operation sequence and welding path planning between welding joints for assembling the rear floor of 5 sheet-metal parts connecting by 36 welding points.3D CAD model of the assembly and

Fig. 6
Fig.6, the path planning of the traditional A-star algorithm and the improved A-star algorithm on the curved surface workpiece are analyzed by MATLAB simulation software.

4. 3 .
Performance of the multi-objective elite simulated annealing genetic algorithm The traditional genetic algorithm, elitist adaptive genetic algorithm and elitist simulated annealing genetic algorithm are used to optimize the path on the curved surface.The population size is set as 40 pop  , and the number of iterations is 1000.The initial crossover probability of traditional genetic algorithm and elite adaptive genetic algorithm The initialization parameters of the multi-objective elitist simulated annealing genetic algorithm are set as follows, the initial temperature is set as 0 50 T  , and the attenuation factor is 0.96   .

cp
is increased and m p is reduced to enhance the ability of global search.In the later stages, the genetic algorithm has no use for the large-scale changes of the individuals, several individuals mutate to approximate the optimal solution in local search mode and does not affect the general trend of convergence.

Fig. 8
Fig.8 The path planning method based on multi-objective elitist adaptive genetic algorithm Fig.8 shows the welding joint path diagram optimized by multi-objective elitist adaptive genetic algorithm.Compared with the traditional multi-objective genetic algorithm, the overall path planning quality has been significantly improved.The optimized path length of 6931.53mm, which is smaller than that of 8497.88mmoptimized by a traditional multi-objective genetic algorithm.However, there are still many intersections and unreasonable paths.The elitist adaptive genetic algorithm is still not applicable.The memetic algorithm is a novel intelligent algorithm that combines evolutionary algorithm and local heuristic search strategy.Under the framework of the memetic algorithm, the multi-objective elitist simulated annealing genetic algorithm combines the advantages of elitist strategy, simulated annealing algorithm and variable neighborhood search algorithm.The elitist strategy adopted in this paper not only preserves the elite individuals in the population, but also provides more crossover operation opportunities for the elitis individuals, which increases the number of elitis genes in the population.The simulated annealing algorithm has the ability to jump out of the local optimal solution, which can accept part of the deteriorating solutions within a limited range.Variable neighborhood search is to change the neighborhood structure on the basis of the local optimal solution, and then expand the search scope.

Fig. 9
Fig.9 The path planning method based on Multi-objective elitist simulated annealing genetic algorithm Fig.9 shows the welding joint path diagram optimized by multi-objective elitist simulated annealing genetic algorithm.Compared with traditional multi-objective genetic algorithm and multi-objective elitist adaptive genetic algorithm, the quality of overall planning path has been significantly improved.The optimized path length of 4207.99mm is smaller than that of 8497.88mmoptimized by traditional multi-objective genetic algorithm and 6931.53mm by multi-objective elitist adaptive genetic annealing algorithm.The smoothing degree of the planning path is 0.63613, which is less than the traditional multi-objective genetic algorithm planning path smoothing degree of 1.5725 and the multi-objective elite adaptive genetic algorithm planning path smoothing degree of 1.4472.There are no intersections and unreasonable paths.It can be concluded that the multi-objective elitist simulated annealing genetic algorithm can meet the welding requirements.

Fig. 11
Fig.11 Objective function evolution curve Fig.10 and Fig.11 show the comparison of objective function value evolution curve and fitness evolution curve of traditional multi-objective genetic algorithm, multi-objective elite adaptive genetic algorithm and multi-objective elite simulated annealing genetic algorithm respectively.The traditional multi-objective genetic algorithm and the multi-objective elite adaptive genetic algorithm finally fall into the local optimum.The traditional multi-objective genetic algorithm uses the basic crossover and mutation operator to optimize the path.The multi-objective elite adaptive genetic algorithm uses the adaptive crossover and mutation operator to optimize the path， both of them lack the ability to jump out of the local optimal solution.The multi-objective elitist simulated annealing genetic algorithm based on the framework of memetic algorithm adopts the variable neighborhood search algorithm for individual local search, and uses the simulated annealing algorithm to improve the ability to jump out of the local optimal solution.Therefore, the convergence speed is better than the traditional multi-objective genetic algorithm and the multi-objective elite adaptive algorithm.When the number of iterations is about 150 generations, the global optimal solution is obtained.The comparison results show that the objective function value of the multi-objective elite simulated annealing genetic algorithm is better than that of the traditional multi-objective genetic algorithm and multi-objective elite adaptive genetic algorithm, the objective function value is reduced by 47.8% than that of traditional genetic algorithm, and reduced by 39.3% than that of adaptive genetic algorithm.

Fig. 14
Fig.14 Joint value of spot welding robot A collision-free path usually consists of a series of points in space for TCP, with the target orientation and position.Fig.14 shows the relationship between the joint angle and discrete points of the path as the robot moves along the welding joint path.All welding joints are included in the planning path and meet the kinematic constraints in equation 22.
(a)3D model of the robotic welding station (b)Collision detection GUI of spot welding robot

Fig. 15
Fig.15 The virtual model of the robotic welding cell in Process Simulate software

Table 1 D
-H parameters of spot welding robot Joint