Welding Robot Collision-Free Path Optimization

Reasonable welding path has a significant impact on welding efficiency, and a collision-free path should be considered first in the process of welding robot path planning. The shortest path length is considered as an optimization objective, and obstacle avoidance is considered as the constraint condition in this paper. First, a grid method is used as a modeling method after the optimization objective is analyzed. For local collision-free path planning, an ant colony algorithm is selected as the search strategy. Then, to overcome the shortcomings of the ant colony algorithm, a secondary optimization is presented to improve the optimization performance. Finally, the particle swarm optimization algorithm is used to realize global path planning. Simulation results show that the desired welding path can be obtained based on the optimization strategy.


Introduction
With developments in welding technology, computer technology and robot technology, welding robots have been widely used in industrial production, especially in the automotive sector.To improve welding productivity when there are many weld joints, robot path planning needs to be studied.For welding robot path planning, some factors should be considered.Optimization objectives include a minimum path length [1], collision-free paths [2], and welding deformation [3].
Obstacle avoidance is a fundamental problem in welding robot path planning.However, most path planning with obstacle avoidance is obtained based on teaching mode programming.In this way, the planning process is time-consuming, and the optimum path is hard to achieve.Hence, robot collision-free path planning based on optimization algorithms needs to be studied to improve welding efficiency.Collision-free path planning includes two stages: environment modeling and path searching, which are explained in the following paragraphs.
Environment modeling refers to the mathematical description of the environment around the welding robot, which is essential for collision-free path planning.Allan [4] applied a grid method to solve path planning for real-time robots in dynamic environments.For the grid method, grids are applied to describe the free space and obstacle space in the robot's work space.A good path can be achieved if the precision is high, but the algorithm would be time-consuming at the same time.The environment would not be described clearly if the precision were otherwise low.Yu [5] presented a C-space layered search arithmetic for manipulators.Although the method could achieve obstacle avoidance for robot arms, the obstacle modeling was complex and inefficient.With increases in robot freedom, the computation becomes very complicated.In addition, there are other environmental modeling methods, such as the visibility graph method [6], the bounding box method [7], artificial neural networks [8], and approximate voronoi boundary networks [9].
After environment modeling, some path searching methods are essential to find an appropriate path.Li [10] presented an improved APF-based SIFORS method for autonomous mobile robot path planning in complex environments.The artificial potential field method is straightforward, but some problems may exist, such as the local optimum problem, falling into a deadlock, and moving unsteadily near the obstacle.Cao [11] proposed an improved ant colony algorithm for robot global path planning; the pheromone evaporation rate was adjusted dynamically to enhance the global search ability and convergence speed.In addition, the artificial bee colony algorithm [12] and the genetic algorithm [13] are also used to search the optimum path.
In this paper, obstacle avoidance and path length are considered to optimize path.Based on the above analysis, the model description is first described in Section 2.Then, in Section 3, the grid method is selected to realize environment modeling.Moreover, the ant colony algorithm (ACO) is applied for path searching in Section 4. In addition to this, a particle warm optimization (PSO) algorithm is used to realize global optimization in Section 5. Finally, conclusions are given in Section 6.

Model Description of Welding Robot Path Planning with Obstacle Avoidance
Because spot welding robots are widely used for car body in white, it was selected as the welding object in this paper.All weld joints are given as spots, which are shown in Figure 1.To illustrate the problem more clearly, parts of the weld joints are chosen to conduct path planning, which are shown in Figure 2. The coordinates of 15 weld joints were obtained in "RobotStudio" software and are shown in Table 1.
Appl.Sci.2017, 7, 89 2 of 11 environmental modeling methods, such as the visibility graph method [6], the bounding box method [7], artificial neural networks [8], and approximate voronoi boundary networks [9].After environment modeling, some path searching methods are essential to find an appropriate path.Li [10] presented an improved APF-based SIFORS method for autonomous mobile robot path planning in complex environments.The artificial potential field method is straightforward, but some problems may exist, such as the local optimum problem, falling into a deadlock, and moving unsteadily near the obstacle.Cao [11] proposed an improved ant colony algorithm for robot global path planning; the pheromone evaporation rate was adjusted dynamically to enhance the global search ability and convergence speed.In addition, the artificial bee colony algorithm [12] and the genetic algorithm [13] are also used to search the optimum path.
In this paper, obstacle avoidance and path length are considered to optimize path.Based on the above analysis, the model description is first described in Section 2.Then, in Section 3, the grid method is selected to realize environment modeling.Moreover, the ant colony algorithm (ACO) is applied for path searching in Section 4. In addition to this, a particle warm optimization (PSO) algorithm is used to realize global optimization in Section 5. Finally, conclusions are given in Section 6.

Model Description of Welding Robot Path Planning with Obstacle Avoidance
Because spot welding robots are widely used for car body in white, it was selected as the welding object in this paper.All weld joints are given as spots, which are shown in Figure 1.To illustrate the problem more clearly, parts of the weld joints are chosen to conduct path planning, which are shown in Figure 2. The coordinates of 15 weld joints were obtained in "RobotStudio" software and are shown in Table 1.In order to achieve welding robot path planning with a collision-free path, a welding torch should move through all the weld joints first.At the same time, the shortest path length possible and the avoidance of all obstacles in the environment are desired.Suppose the number of the weld joints is , the welding sequence is [ (1), (2), … , ( )].Then, the problem can be treated as a TSP (Traveling Salesman Problem) with constraint conditions.TSP is described as follows.Suppose a salesman has to visit cities with the conditions that he must visit each city only once and finally return to the original departure city.The path planning problem can be described as  In order to achieve welding robot path planning with a collision-free path, a welding torch should move through all the weld joints first.At the same time, the shortest path length possible and the avoidance of all obstacles in the environment are desired.Suppose the number of the weld joints is n, the welding sequence is [π(1), π(2), . . . ,π(n)].Then, the problem can be treated as a TSP (Traveling Salesman Problem) with constraint conditions.TSP is described as follows.Suppose a salesman has to visit N cities with the conditions that he must visit each city only once and finally return to the original departure city.The path planning problem can be described as where path π(i)π(i + 1) is the path between Weld Joints π(i) and π(i + 1), which represents the local path.The welding sequence [π(1), π(2), . . . ,π(n)] represents the global path.
where dist( , ) indicates the Euclidean distance between point and .XY is a safe path, which represents that the robot's moves from point X to point without collision.

3D Environment Modeling
For collision-free path planning, the environment model of robot should be established.The grid method is relatively simple and intuitive when used for map creation and is beneficial for detecting the environment in the path searching process.Hence, the grid method is selected as the modeling method in this paper.Because the traditional grid method is used in 2D space, while the working environment for the welding robot is in 3D space, the improvement of the grid method is necessary.The procedure of the 3D environment modeling with the grid method is presented as follows.
(1) simplify the weld piece into some triangles, as shown in Figure 3.The red spots in Figure 3 denote weld joints.(2) Set up grid matrix.The whole space is divided into small cubes, and the centers of the cubes are set as the welding torch's footholds (Figure 4).Because the diameter of the welding electrode is 4.48 mm, each side length of the cubes is set to 5 mm.Then, all centers of the cubes are mapped on the triangles.If the projected point is located in the triangle and the vertical length is less than 5 mm, the triangle is the obstacle for the center; otherwise, the triangle is not the obstacle for the center.(3) If there are no obstacle triangles for a center, the center is a free point.Otherwise, the center is an obstacle point, which means that the welding torch cannot be located in the point.(4) Because the actual weld joints are located on the surface of the weldment, the weld joints cannot be located in the free points.However, in the process of path planning, the welding torch can For the path between two weld joints, the welding torch moves through intermediate points to avoid the obstacle and suppose that the path between weld joints and the intermediate points are straight lines.If the starting point is π(i), the terminal point is π(i + 1), and the intermediate points are [X 1 , X 2 , . . . ,X K ].Path π(i)π(i + 1) is made up of path π(i)X 1 , path X k X k+1 (k = 1, 2, . . ., K − 1), path X K π(i + 1), and the planning of path π(i)π(i + 1) can be described as follows: where dist(X, Y) indicates the Euclidean distance between point X and Y. XY is a safe path, which represents that the robot's moves from point X to point Y without collision.

3D Environment Modeling
For collision-free path planning, the environment model of robot should be established.The grid method is relatively simple and intuitive when used for map creation and is beneficial for detecting the environment in the path searching process.Hence, the grid method is selected as the modeling method in this paper.Because the traditional grid method is used in 2D space, while the working environment for the welding robot is in 3D space, the improvement of the grid method is necessary.The procedure of the 3D environment modeling with the grid method is presented as follows.
(1) simplify the weld piece into some triangles, as shown in Figure 3.The red spots in Figure 3 denote weld joints.(2) Set up grid matrix.The whole space is divided into small cubes, and the centers of the cubes are set as the welding torch's footholds (Figure 4).Because the diameter of the welding electrode is 4.48 mm, each side length of the cubes is set to 5 mm.Then, all centers of the cubes are mapped on the triangles.If the projected point is located in the triangle and the vertical length is less than 5 mm, the triangle is the obstacle for the center; otherwise, the triangle is not the obstacle for the center.(3) If there are no obstacle triangles for a center, the center is a free point.Otherwise, the center is an obstacle point, which means that the welding torch cannot be located in the point.( 4) Because the actual weld joints are located on the surface of the weldment, the weld joints cannot be located in the free points.However, in the process of path planning, the welding torch can only move among the free points.To solve this problem, a nearest free point is defined as a virtual weld joint for the weld joint.Because the distance between actual weld joints and virtual weld joints is invariable and is small in terms of the whole path length, the distance is ignored in the optimization process.The path planning mentioned below only considers the path between the virtual weld joints.
Appl.Sci.2017, 7, 89 4 of 11 only move among the free points.To solve this problem, a nearest free point is defined as a virtual weld joint for the weld joint.Because the distance between actual weld joints and virtual weld joints is invariable and is small in terms of the whole path length, the distance is ignored in the optimization process.The path planning mentioned below only considers the path between the virtual weld joints.

Ant Colony Optimization Algorithm (ACO)
ACO is a swarm intelligence optimization algorithm that stems from real ants.In 1991, Dorigo [14] firstly proposed the ACO and successfully applied it for solving different combination optimization problems.The foraging behavior of the ant colony can be regarded as a distributed collaborative optimization mechanism.It is difficult to find the shortest path from the nest to the food source for a single ant, while the ant colony can find the shortest path because the ants can communicate with each other by releasing pheromones on the route passed.The basic ACO mode is presented as follows [14]:  only move among the free points.To solve this problem, a nearest free point is defined as a virtual weld joint for the weld joint.Because the distance between actual weld joints and virtual weld joints is invariable and is small in terms of the whole path length, the distance is ignored in the optimization process.The path planning mentioned below only considers the path between the virtual weld joints.

Ant Colony Optimization Algorithm (ACO)
ACO is a swarm intelligence optimization algorithm that stems from real ants.In 1991, Dorigo [14] firstly proposed the ACO and successfully applied it for solving different combination optimization problems.The foraging behavior of the ant colony can be regarded as a distributed collaborative optimization mechanism.It is difficult to find the shortest path from the nest to the food source for a single ant, while the ant colony can find the shortest path because the ants can communicate with each other by releasing pheromones on the route passed.The basic ACO mode is presented as follows [14]:

Ant Colony Optimization Algorithm (ACO)
ACO is a swarm intelligence optimization algorithm that stems from real ants.In 1991, Dorigo [14] firstly proposed the ACO and successfully applied it for solving different combination optimization problems.The foraging behavior of the ant colony can be regarded as a distributed collaborative optimization mechanism.It is difficult to find the shortest path from the nest to the food source for a Appl.Sci.2017, 7, 89 5 of 11 single ant, while the ant colony can find the shortest path because the ants can communicate with each other by releasing pheromones on the route passed.The basic ACO mode is presented as follows [14]: (3) , if ant k goes through the path (i, j) 0 otherwise (5) where P k ij is the transition probability of ant k from i to j, i is the location of the ant, and j is the location that the ant can arrive at.τ ij is the pheromone intensity from i to j, and η ij is heuristic information, where η ij = 1/d ij .α is the weight of the pheromone, β is the weight of heuristic information, Λ is the collection of the nodes that ants can reach, and ρ is the evaporation coefficient of pheromone on the route.∆τ k ij is the pheromone intensity ant k leaves on the route from i to j, and M is the amounts of ants.n is the number of iterations, d ij is the objective function, which is the Euclidean distance between two points, Q is the quality coefficient of the pheromone, and L k is path length of ant k goes from nest to food source.

Collision Free Path Optimization Based on ACO
When the ACO is applied for the welding robot path planning, the starting point of the welding torch is the nest of the ant colony and the destination is the food resource.Hence, the path planning based on the ACO is the food searching process for the ant colony.The communication between the ants is realized based on pheromones.The shortest path can be found through the mutual cooperation among the individuals.The chart of the welding robot local path planning is shown in Figure 5. where is the transition probability of ant from to , is the location of the ant, and is the location that the ant can arrive at.
is the pheromone intensity from to , and is heuristic information, where = 1/ . is the weight of the pheromone, is the weight of heuristic information, Λ is the collection of the nodes that ants can reach, and is the evaporation coefficient of pheromone on the route.Δ is the pheromone intensity ant leaves on the route from to , and is the amounts of ants. is the number of iterations, is the objective function, which is the Euclidean distance between two points, is the quality coefficient of the pheromone, and is path length of ant goes from nest to food source.

Collision Free Path Optimization Based on ACO
When the ACO is applied for the welding robot path planning, the starting point of the welding torch is the nest of the ant colony and the destination is the food resource.Hence, the path planning based on the ACO is the food searching process for the ant colony.The communication between the ants is realized based on pheromones.The shortest path can be found through the mutual cooperation among the individuals.The chart of the welding robot local path planning is shown in Figure 5. Steps of the local welding path planning with collision-free based on ACO are given as follows: Step 1. Realize the environment modeling based on the grid method.
Step 2. Initialize the parameters of the ACO.Based on the empirical value, the weight of the pheromone is set as 1, the weight of heuristic pheromone is set as 11, the evaporation coefficient of pheromone is set as 0.9, and the pheromone quality coefficient Q is set as 5.The Steps of the local welding path planning with collision-free based on ACO are given as follows: Step 1. Realize the environment modeling based on the grid method.
Step 2. Initialize the parameters of the ACO.Based on the empirical value, the weight of the pheromone α is set as 1, the weight of heuristic pheromone β is set as 11, the evaporation coefficient of pheromone ρ is set as 0.9, and the pheromone quality coefficient Q is set as 5.The iteration number N is set as 50, and the population quantity M is set as 50.Initialize the coordinates of the starting point and the terminal point.Initialize the pheromone matrix, and the pheromones for all points are set as 0.5.The above parameter settings are shown in Table 2.
Step 4. Set the number of ant k as 1.
Step 5. Clear tabu list tabu k for the ant k, add the starting point to tabu k , and clear foraging path rout k for ant k.
Step 6. Calculate the probability of each node according to Equation (3).In this paper, the ants' step length is set as 5 mm and the number of nodes that can be chosen as the next node is no larger than 6.The positive and negative directions of the 3D coordinate system are set as the directions of the ants' movement in this paper.Hence, the number of directions of the ants' movement is 6.When there are neighboring nodes that are obstacle points, the number of next nodes that the ant can choose is lower than 6.Select the next node according to the roulette wheel and add the node to the tabu list tabu k and foraging path rout k .
Step 7. If the ant reaches the destination or reaches a dead end, jump to Step 8. Otherwise, return to Step 6.A dead end means that, for the current node, there are not any nodes that can be found as the next node.
Step 8.If the ant reaches the destination, calculate the path length L according to Equation ( 2).If the ant reaches a dead end, the path length L is set to infinity.Calculate the left pheromone according to Equations ( 4) and ( 5).
Step 9.If k is less than M, k = k + 1, and return to Step 5. Otherwise, jump to Step 10.
Step 11.If n < N, n = n + 1, and return to Step 4. Otherwise, jump to Step 12.
Step 12. Select the shortest foraging path (rout), which is the result of collision-free welding path planning.
Set Weld Joint 3 and Weld Joint 7 as the starting point and terminal point, respectively.The result of the path planning is shown in Figure 6, and the path length is 330 mm.The iterative process of the ant colony algorithm is shown in Figure 7.
Step 4. Set the number of ant as 1.
Step 5. Clear tabu list for the ant , add the starting point to , and clear foraging path for ant .Step 6. Calculate the probability of each node according to Equation (3).In this paper, the ants' step length is set as 5 mm and the number of nodes that can be chosen as the next node is no larger than 6.The positive and negative directions of the 3D coordinate system are set as the directions of the ants' movement in this paper.Hence, the number of directions of the ants' movement is 6.When there are neighboring nodes that are obstacle points, the number of next nodes that the ant can choose is lower than 6.Select the next node according to the roulette wheel and add the node to the list and foraging path .Step 7. If the ant reaches the destination or reaches a dead end, jump to Step 8. Otherwise, return to Step 6.A dead end means that, for the current node, there are not any nodes that can be found as the next node.
Step 8.If the ant reaches the destination, calculate the path length according to Equation ( 2).If the ant reaches a dead end, the path length is set to infinity.Calculate the left pheromone according to Equations ( 4) and ( 5).
Step ), which is the result of collision-free welding path planning.
Set Weld Joint 3 and Weld Joint 7 as the starting point and terminal point, respectively.The result of the path planning is shown in Figure 6, and the path length is 330 mm.The iterative process of the ant colony algorithm is shown in Figure 7.

The Secondary Optimization of ACO (SO-ACO)
The path solved based on the ACO is not the shortest path because of its discontinuous step length and direction.Hence, a secondary optimization (SO) is proposed to obtain better optimization results.Here, represents the optimized path based on ACO, and represents improved path based on SO-ACO.The optimization process is presented as follows: Step 1. Initialize as void.Step 9.If the length of each segment in rout is greater than 5 mm, the segment is split into points, and the new points are added to rout.Then, reverse the order of the rout and return to Step 1.
Step 10.Set as the optimized result.According to the above steps, when the Weld Joints 3 and 7 are selected as the starting joint and the terminal joint, respectively, the parameters of the ACO are the same as Section 4.2.The path planning result based on the SO-ACO is shown in Figure 9

The Secondary Optimization of ACO (SO-ACO)
The path solved based on the ACO is not the shortest path because of its discontinuous step length and direction.Hence, a secondary optimization (SO) is proposed to obtain better optimization results.Here, rout represents the optimized path based on ACO, and routi represents improved path based on SO-ACO.The optimization process is presented as follows: Step 1. Initialize routi as void.
Step 2. Add the first point of rout to routi.
Step 3. Suppose the last point of routi is p, and the last point in rout is q.
Step 4. If q is the next point to p, the location of p in routi and q in rout are shown in Figure 8, jump to Step 6.Otherwise, jump to Step 5.
Step 5. Connect p and q to form a line.If the line encounters the obstacles, set the point in front of q in rout as q, and return to Step 4. Otherwise, jump to Step 6.
Step 7. If q is the last point in rout, jump to Step 8; otherwise, return to Step 3.
Step 8. Compare the length of rout and routi.If the length is the same, jump to Step 10.Otherwise, replace the sequence in rout with that in routi and jump to Step 9.
Step 9.If the length of each segment in rout is greater than 5 mm, the segment is split into points, and the new points are added to rout.Then, reverse the order of the rout and return to Step 1.
Step 10.Set routi as the optimized result.

The Secondary Optimization of ACO (SO-ACO)
The path solved based on the ACO is not the shortest path because of its discontinuous step length and direction.Hence, a secondary optimization (SO) is proposed to obtain better optimization results.Here, represents the optimized path based on ACO, and represents improved path based on SO-ACO.The optimization process is presented as follows: Step 1. Initialize as void.Step 9.If the length of each segment in rout is greater than 5 mm, the segment is split into points, and the new points are added to rout.Then, reverse the order of the rout and return to Step 1.
Step 10.Set as the optimized result.According to the above steps, when the Weld Joints 3 and 7 are selected as the starting joint and the terminal joint, respectively, the parameters of the ACO are the same as Section 4.2.The path planning result based on the SO-ACO is shown in Figure 9 (a and b are a different view of the same result).The path length optimized based on ACO is 330 mm, while the path length optimized based on the SO-ACO is 203.290mm.According to the above steps, when the Weld Joints 3 and 7 are selected as the starting joint and the terminal joint, respectively, the parameters of the ACO are the same as Section 4.2.The path planning result based on the SO-ACO is shown in Figure 9 (a and b are a different view of the same result).The path length optimized based on ACO is 330 mm, while the path length optimized based on the SO-ACO is 203.290mm.Different iterations and population sizes are selected to prove the effectiveness of the SO-ACO, which are shown in Table 3.Other parameters refer to Section 4.2.The algorithm is conducted 20 times for every condition, and the minimum, maximum, average, variance of path length, and time for every conditions are shown in Table 3. From Table 3, it can be seen that the SO-ACO is obviously superior to the basic ACO; satisfactory results were obtained when the iterations and population sizes were 10.For ACO, with the increase in the iteration , population size , and searching time, the path length of the ACO decreases, but it is still larger than the optimization results based on SO-ACO.Hence, it can be concluded that the SO-ACO can improve the optimization effect of the algorithm, and it can be applied for actual optimization processes to achieve a satisfactory result with a small iteration and population size .

Global Welding Robot Path Planning
Based on the collision free path optimization, the global welding path planning can be treated as a TSP.Due to the effective application of the PSO, this algorithm will be used to realize global optimization for welding robot path.Different iterations N and population sizes M are selected to prove the effectiveness of the SO-ACO, which are shown in Table 3.Other parameters refer to Section 4.2.The algorithm is conducted 20 times for every condition, and the minimum, maximum, average, variance of path length, and time for every conditions are shown in Table 3. From Table 3, it can be seen that the SO-ACO is obviously superior to the basic ACO; satisfactory results were obtained when the iterations N and population sizes M were 10.For ACO, with the increase in the iteration N, population size M, and searching time, the path length of the ACO decreases, but it is still larger than the optimization results based on SO-ACO.Hence, it can be concluded that Appl.Sci.2017, 7, 89 9 of 11 the SO-ACO can improve the optimization effect of the algorithm, and it can be applied for actual optimization processes to achieve a satisfactory result with a small iteration N and population size M.

Global Welding Robot Path Planning
Based on the collision free path optimization, the global welding path planning can be treated as a TSP.Due to the effective application of the PSO, this algorithm will be used to realize global optimization for welding robot path.

Particle Swarm Optimization Algorithm
In 1995, Kennedy and Eberhart [15] presented the particle swarm optimization (PSO) algorithm based on the regularity of hunting birds.In the PSO algorithm, every bird is named as a particle with no quality and volume.Multiple particles coexist and search for the best position with cooperation.Every particle moves to a better position with its experience and others' in the swarm.The best position of a particle is called pBest, and the best position of the whole swarm is called gBest.The state of the particle is described by the D-dimensional velocity v i = (v i1 , v i2 , . . . ,v iD ) and the position X i = (x i1 , x i2 , , . . . ,x iD ).Thus, every particle updates its state according to Equations ( 6) and ( 7), and the next generation is generated.
where k represents the current iterations.c 1 , c 2 , which are the learning factor, are usually positive and adjust the traction force of the personal optimal position and the global optimal position.r 1 , r 2 are random numbers between 0 and 1.
The PSO algorithm has shown its superior performance in optimization of continuous problems.However, the original PSO is not appropriate for solving discrete problems such as TSP.Clerc [16] proposed a TSP-PSO algorithm based on the operation of particle positions and velocity vector to solve TSP.This algorithm is used to realize global path planning in Section 5.2.

Global Path Planning Based on PSO
Because of the advantages of PSO, it is chosen as the optimization algorithm for global path planning.The steps of the globe welding path planning based on PSO are presented as follows [16]: Step 1. Initialization: the iterations N of the PSO is set as 100, the population size is set as 50, and the learning rates C 1 , C 2 are set as 1.0.The weight is set as 0.4.The positions and velocities of the particles are initialized randomly.The local route can be obtained according to the local path planning algorithm.Each particle's fitness is evaluated in the light of Equations ( 6) and (7).Then, the personal best positions and the global best position of the particles are updated.The above parameter settings are shown in Table 4.
Step 2. Update the positions and velocities of the particles according to the equation of the PSO.Update the fitness, personal best positions, and the global best position.
Step 3. If the number of iterations is not larger than 100, then return to Step 2; otherwise, jump to Step 4.
Step 4. The global best position is the result of the global welding path planning.Based on the above steps, the shortest collision-free welding path can be achieved as follows: 15→13→14→7→8→9→10→11→12→3→6→2→5→1→4.The global path length is 599.720mm, the final global welding collision-free robot path planning is shown in Figure 10, and the iterative process of PSO is shown in Figure 11.planning algorithm.Each particle's fitness is evaluated in the light of Equations ( 6) and (7).Then, the personal best positions and the global best position of the particles are updated.The above parameter settings are shown in Table 4.
Step 2. Update the positions and velocities of the particles according to the equation of the PSO.Update the fitness, personal best positions, and the global best position.
Step 3. If the number of iterations is not larger than 100, then return to Step 2; otherwise, jump to Step 4.
Step 4. The global best position is the result of the global welding path planning.Based on the above steps, the shortest collision-free welding path can be achieved as follows: 15→13→14→7→8→9→10→11→12→3→6→2→5→1→4.The global path length is 599.720mm, the final global welding collision-free robot path planning is shown in Figure 10, and the iterative process of PSO is shown in Figure 11.

Conclusions
Welding robot collision-free path optimization was studied in this paper.The optimization objective is the shortest path length and the constraint is obstacle avoidance.Environment modeling was realized using the grid method.The ACO was used for path searching.In order to improve the performance of the ACO, a secondary optimization algorithm was presented, which markedly improves the result of the algorithm.Finally, particle swarm optimization was applied to optimize the global welding collision-free path planning.The shortest collision-free path was obtained based on the proposed strategies in this paper, which shows the effectiveness of the algorithm.
The welding path optimization studied in this article is similar to practical welding situations.Hence, manual teaching and offline programming (OLP) is beneficial.Based on the optimization strategy, the obtained welding path can help welding engineering by shortening the teaching time.At the same time, the path can make the OLP software intelligent and more effective after the optimization strategy is integrated with OLP software.

Figure 1 .
Figure 1.Body in white weld piece.

Figure 1 .
Figure 1.Body in white weld piece.

Figure 2 .
Figure 2. Part of the body in white weld piece.

Figure 2 .
Figure 2. Part of the body in white weld piece.

Figure 3 .
Figure 3. Simplified triangles for white body weld piece, red spots: weld joints.

Figure 4 .
Figure 4.The environment model using the grid method, red spots: weld joints, blue area: grid matrix.

Figure 3 .
Figure 3. Simplified triangles for white body weld piece, red spots: weld joints.

Figure 3 .
Figure 3. Simplified triangles for white body weld piece, red spots: weld joints.

Figure 4 .
Figure 4.The environment model using the grid method, red spots: weld joints, blue area: grid matrix.

Figure 4 .
Figure 4.The environment model using the grid method, red spots: weld joints, blue area: grid matrix.

Figure 5 .
Figure 5. Chart of welding robot collision free path optimization.

Figure 5 .
Figure 5. Chart of welding robot collision free path optimization.

Figure 6 .
Figure 6.Welding robot path planning between two weld joints.(a) View A; (b) View B.Figure 6. Welding robot path planning between two weld joints.(a) View A; (b) View B.

Figure 6 .
Figure 6.Welding robot path planning between two weld joints.(a) View A; (b) View B.Figure 6. Welding robot path planning between two weld joints.(a) View A; (b) View B.

Figure 7 .
Figure 7.The iterative process of the ant colony algorithm .

Step 2 .
Add the first point of to .Step 3. Suppose the last point of is , and the last point in is .Step 4. If is the next point to , the location of in and in are shown in Figure 8, jump to Step 6.Otherwise, jump to Step 5. Step 5. Connect and to form a line.If the line encounters the obstacles, set the point in front of in as , and return to Step 4. Otherwise, jump to Step 6. Step 6. Add to .Step 7. If is the last point in , jump to Step 8; otherwise, return to Step 3. Step 8. Compare the length of and .If the length is the same, jump to Step 10.Otherwise, replace the sequence in rout with that in routi and jump to Step 9.

Figure 8 .
Figure 8.The location of and .
(a and b are a different view of the same result).The path length optimized based on ACO is 330 mm, while the path length optimized based on the SO-ACO is 203.290mm.

Figure 7 .
Figure 7.The iterative process of the ant colony algorithm.

Figure 7 .
Figure 7.The iterative process of the ant colony algorithm .

Step 2 .
Add the first point of to .Step 3. Suppose the last point of is , and the last point in is .Step 4. If is the next point to , the location of in and in are shown in Figure 8, jump to Step 6.Otherwise, jump to Step 5. Step 5. Connect and to form a line.If the line encounters the obstacles, set the point in front of in as , and return to Step 4. Otherwise, jump to Step 6. Step 6. Add to .Step 7. If is the last point in , jump to Step 8; otherwise, return to Step 3. Step 8. Compare the length of and .If the length is the same, jump to Step 10.Otherwise, replace the sequence in rout with that in routi and jump to Step 9.

Figure 8 .
Figure 8.The location of and .

Figure 8 .
Figure 8.The location of p and q.

Figure 9 .
Figure 9. Welding robot path planning based on the Secondary Optimization of ACO (SO-ACO).(a) View A; (b) View B.

Figure 9 .
Figure 9. Welding robot path planning based on the Secondary Optimization of ACO (SO-ACO).(a) View A; (b) View B.

Figure 10 .
Figure 10.Global path planning with obstacle avoidance.(a)View A; (b) View B.

Table 3 .
Comparison of the results optimized based on two algorithms.

Table 3 .
Comparison of the results optimized based on two algorithms.