Planning Method of Offset Spray Path for Patch considering Boundary Factors

To solve the problem of paint waste at the boundary of the patch when spraying, a planningmethod of offset spray path considering boundary of the patch is developed. By analyzing the causes of excessive paint waste at the boundary of the patch, a spray path planning method based on boundary curve of the patch is proposed, and the distance between the spray path and the boundary of the patch is optimized to reduce excessive paint waste. According to the allowable range of the spray height and the error range of the coating thickness, the variable range of the spacing distance is established; on this basis, the equal division method of plane intercept line is used to generate the discrete points of the spray path in the length direction of the patch, and a connection algorithm of the discrete points is used to generate the spray path of the patch.The simulation results show that the method can automatically generate a spray path based on the shape of the patch boundary; under the premise of meeting the uniformity requirements of the coating thickness, paint waste can be effectively reduced during spraying.


Introduction
As a kind of automation equipment, spray painting robot has been widely used in painting operations of automobile, ship, and aerospace.Aiming at the shortcomings of the artificial teaching programming method, the trajectory planning of spray painting robot around offline programming has been a hot topic for scholars at home and abroad [1][2][3].Spray path and related parameters on the surface of the workpiece are important factors to determine the coating thickness uniformity, the spray efficiency, and the paint utilization, which are of great significance to the production.
In the study of spray path planning, Zhou and Cai et al. developed a combined optimization method of spray path for the optimization of spray time; the genetic algorithm and the ant colony algorithm are used to solve the problem, respectively [4,5].Zhang developed a spray path connection algorithm based on commutator and exchange sequence; the algorithm can achieve global optimization of spray path quickly [6].But they have not yet studied the generation algorithm of spray path for the single patch.Cai developed an automatic spray path generation algorithm on the Robotstudio software platform [7].Mayur developed an incremental method for automatic generation of spray path [8].Kout developed an adaptive spray path generation method based on offset equidistant curve [9].However, they have not yet studied the spray path planning method considering boundary for the patch.Because the excess paint is easily wasted at the boundary of the patch when the robot is spraying, especially at the irregular boundary, the utilization of the paint is affected, and the research on the spray path planning method for the patch considering boundary factors that meets the requirements of coating thickness uniformity and less waste of paint has obvious engineering application value.
In view of the above problems and combined with a single approximate plane patch after complex surface partitioned [10], in this paper, the influences of patch boundary on the coating thickness and paint waste are considered comprehensively, and a offset spray path planning method considering the boundary factor for the patch is studied.The influence of the distance between the patch boundary and the spray path on the coating thickness and paint waste is studied.Based on the optimization of the distance between the spray path and the patch boundary, and the established variable range of the spacing distance between two adjacent spray paths, the equal division method of plane intercept line is used to study the offset spray path generation algorithm based on the patch boundary curve.Finally, the vehicle hood and fender were taken as the experimental object to verify the effectiveness and feasibility of the proposed method.

Influence of Distance between Spray Path and Boundary on Coating
Thickness and Paint Waste.In the usual case, to ensure the coating thickness at the boundary of the workpiece meets the quality requirements, the spray path is kept closer to the boundary of the workpiece, but in this case, the paint sprayed out of the spray gun will spread to the outside of the workpiece, resulting in excessive paint waste.Therefore, it is necessary to optimize the distance ℎ between the spray path and the boundary to minimize the excess paint waste, as shown in Figure 2.
Assuming that the ideal coating thickness is   , the allowable thickness error is Δ.Assuming that the shape of the spray paint is conical, the coating growth rate model of the spray gun static spray is (),  ≤ , as shown in Figure 3, in which  is the spray radius,  is the spray height,  is the spray opening angle, and  =  tan(/2).The models of coating thickness after spraying at certain velocity V along the two adjacent paths are, respectively, expressed as In order to achieve the best uniformity of coating thickness after spraying, in the range  of the spacing distance between two adjacent spray paths, the objective function is established by minimizing the variance between the coating thickness at any point and the ideal coating thickness; the expression is as follows: The above formula can be used to calculate V and the  by golden section method.
After optimizing the coating thickness uniformity, the coating thickness at the boundary of the patch is reduced outwards.Take the spray path 1 in Figure 2 as an example, to ensure that the coating thickness at the boundary of the patch meets the quality requirements, it is required that  1 (−ℎ, V) ≥   − △.With the decrease of ℎ, the closer the spray path is to the boundary of the patch, the more waste of paint is produced by spraying.Under the premise of ensuring the quality of coating thickness, in order to achieve the least waste of paint, here command  1 (−ℎ, V) =   − △, the value of the ℎ can be solved.In the variable range of the spray height , the spray height is directly proportional to the spray radius [11], so the value of ℎ is directly proportional to the spray height.

Spray Path Planning Based on Boundary Curve of Patch
Before the spray path is generated, the length direction of the patch must be determined first, and then the spray path on the patch is generated by the patch boundary curve as the seed curve in the length direction of the patch.In order to simplify the problem, the projection method is used to obtain the projection patch of the approximate plane patch in the average normal direction  of the patch; the planned spray path on the projection patch can be equated to the spray path on the original patch [12], as shown in Figure 4.The determination of the length direction of the patch can be obtained by the algorithm of solving the smallest circumscribed rectangle of the projection patch [13], and the long edge of the circumscribed rectangle can be expressed as the length direction of the patch, its length is , and the length direction of the rectangle is the planning direction of the spray path for the patch.When the spray path is generated, the discrete points of spray path are first generated by the equal division method of plane intercept line, and then the discrete points are connected in order with the smooth curve through the connection algorithm, thus forming the spray path on the patch.In order to generate the required spray path, it is necessary to establish the spacing distance range between the two adjacent spray paths that determines the equal fraction of each cutting line, and to establish the connection algorithm for the discrete points that eventually generate the spray path.

Permitted Spacing Distance Range between Two Adjacent
Spray Paths.The spray path generation based on the patch boundary curve is based on the premise that the spacing distance between the two adjacent spray paths is variable; the spacing distance range is determined by the range of the spray height and the error range of the permitted coating thickness.It is assumed that the spray height of spray gun is [ min ,  max ], the spray height is directly proportional to the spacing distance between two adjacent spray paths, and it can be seen from this that when the spray height is the minimum and the maximum, the corresponding spacing distance value can be solved separately through formulas (1)-( 3), assuming they are  1 and  2 , respectively; at this time, under the premise of ensuring the best uniformity of coating thickness, the variable range of the spacing distance is [ 1 ,  2 ].If the permitted coating thickness error range [  − △,   + △] is considered, on the basis of obtaining  1 and  2 , the coating thickness is just up to the upper and lower limits of the error range by reducing  1 and magnifying  2 , and the variable range of the spacing distance can be expanded, as shown in Figure 5.
According to formulas (1)-( 2), order where  min and  max are the minimum and the maximum value of the spacing distance, respectively, V 1 and V 2 are the optimal spray velocities when the spacing distance is  1 and  2 , respectively, and  1 and  2 are the spray radiuses when the spacing distance is  1 and  2 , respectively.The values of  min and  max can be obtained by solving the above equations; the specific algorithm is as follows: (1) Determine the step values of  and , determine the threshold , order  = 0.

Connection Algorithm of Discrete Points for Spray Path.
A rectangular coordinate system is established on the projection patch, the X-axis coincides with the long side of the circumscribed rectangle of the projection patch, and the Y-axis coincides with the short side of the circumscribed rectangle of the projection patch.Then, a series of cutting lines are obtained by using  planes to cut the projection patch perpendicular to the length direction of the patch, and the density of the cutting line is set to ,  = ⌈( − )/⌉.The intersection point between the cutting line and the projection patch boundary is the boundary point, and the distance between two adjacent boundary points on any cutting line is   ( = 1, 2, . . ., ).When the spray height is  min , the distance from the optimized spray path to the patch boundary is ℎ min .The spacing distance between two adjacent spray paths in the direction of the cutting line is set to   , and its value varies within [ min ,  max ] range.In order to ensure that the coating thickness at the boundary of the patch can meet the quality requirements at different spray heights, order  ≤ ℎ min <  min , the related parameters are shown in Figure 6.The connection algorithm of discrete points for generating spray path is as follows: (1) Based on the boundary points at ends of each cutting line, a distance ℎ min is offset from the boundary point to the interior of the patch to obtain the discrete points on the spray path at the boundary of the patch; if   − 2ℎ  < 0, then the cutting line and its discrete points are ignored.The number of remaining cutting lines is ,  cutting lines are defined as  1 ,  2 , . . .,   , respectively, in the positive direction along the X-axis.
( points at the ends of the  cutting line are called the discrete points of the  cutting line, and the number   =   + 1; finally the total number of discrete points on the patch  = ∑  =1   .(3) Order  = 1, the distances between the  point and  discrete points are calculated, respectively, the discrete point that is the shortest distance from the  point is taken as the starting point of the spray path, and it is numbered   ; the cutting line of the starting point is   .
(5)   is used as the search center point to calculate the distances between the point   and the points of the   cutting line, the discrete point is the shortest distance between the point   and the point in the   cutting line, and that which has not been numbered is taken out and numbered  +1 ,  =  + 1, if  = , next, otherwise, go to step (4).
(6) The discrete points after the numbered  1 ,  2 , . . .,   are connected in order with a smooth curve.
(8)   is used as the search center point to calculate the distances between the point   and the points of the   cutting line, the discrete point is the shortest distance between the point   and the point in the   cutting line, and that which has not been numbered is taken out and numbered  +1 ,  =  + 1, if  = , then go to step (6); otherwise, go to step (7).was obtained through the vertical static spraying experiment on the plane: () = 0.1(50 2 −  2 ).After optimization of formula (3), the spray velocities and the spacing distances were obtained at the minimum and the maximum spray height, respectively, as shown in Table 1.

Simulation and Analysis
According to Table 1, the values of  1 and  2 are 45.7mm and 76.1mm, respectively; on this basis, the variable range [ min ,  max ] of the spacing distance can be further obtained as [41.1mm, 85.0mm].Order  = 14.6mm, according to the spray path generation method proposed in this paper, secondary development is carried out by C++ in Robotstudio software, the spray paths are generated on the hood and fender of a brand car, respectively, and the results are shown in Figure 7.
Figure 8 shows the spray path generated by previous method [1]; compared with the method in this paper, in order to ensure the coating thickness quality at the boundary of the workpiece, the previous method is used to plan the spray path to the outside of the workpiece, caused the gun to stay too long time outside the boundary of the patch and overspray, resulting in a large amount of unnecessary paint waste, especially at the irregular boundary of the workpiece.

Analysis.
In order to verify the effectiveness and feasibility of the proposed spray path planning method, the spray trajectory parameters are optimized on the surface of the hood and the fender, and the coating thickness distribution is obtained after the optimization of the parameters.In this paper, the optimization method of spray trajectory parameters proposed by [2] is used to divide the path into several segments, and set the spray velocity and the spray height on each segment to be constant.Optimize the spray velocity and the spray height for each segment in MATLAB 7.0, and Thickness (um) Points   finally obtain the optimized coating thickness value on the workpiece.100 discrete points are randomly selected on the surface of the hood and the fender, respectively, and the coating thickness of these discrete points is used to represent the overall coating thickness distribution on the surface, as shown by the black line in Figure 9.
As shown in Figure 9(a), the maximum and minimum coating thicknesses on the hood are 54.86m and 43.93m, respectively.The maximum and minimum coating thicknesses on the fender are 56.05m and 43.72m, respectively, as shown in Figure 9(b).The red line in Figure 9 shows the distribution of coating thickness after optimization of the trajectory parameters based on the previous spray path.By comparison, the coating thickness error obtained by the method is larger than that of the previous method; however, the error value can also be controlled within the range of 10m, which basically meets the requirements for conventional coating thickness uniformity.
The optimized spray velocities of the two spray paths are imported into the Robotstudio software for spray simulation, and the corresponding spray times are obtained, respectively; the results are shown in Table 2.
As shown in Table 2, the spray time on the hood is reduced by 15% and on the fender is reduced by 33.7% compared with the previous methods.The reduction in spray time means a reduction in paint waste, provided that the flow rate of the spray gun is constant.By comparing the reduction of the spray time on the hood and the fender, it can be seen that, for the workpiece with more complicated boundary shapes, the advantage of using the method proposed in this paper to plan the spray path in saving the spray time will be more obvious.

Conclusions
In this paper, in order to solve the problem of paint waste at the boundary of irregular patch, a planning method of spray path considering the boundary factors is established.By analyzing the influence of patch boundary on spray effect, an optimization method for the distance between the spray path and the boundary is established.The variable range of the spacing distance is established according to the variable range of the spray height and the error range of the allowable coating thickness.In the length direction of the patch, an offset spray path generation algorithm is established based on the boundary curve of the patch as the seed curve.The simulation results show the following: (1) The proposed spray path planning algorithm can adapt to multiple types of irregular patches and can automatically generate a spray path based on the patch boundary according to the patch shape.
(2) After optimization of the spray trajectory parameters, the method of this paper can effectively reduce the spray time and the paint waste under the premise of meeting the uniformity of coating thickness, and the more complicated the boundary shape of the workpiece, the more obvious the effect.

Figure 1 :
Figure 1: Comparison of two spray path planning methods.

2. 1 .
Paint Waste at the Irregular Boundary of the Patch.For a single patch, in order to minimize the number of corners that affect the spray time in the path, the spray path is generally planned along the length direction of the patch.However, in the past, the linear spray path planning method without considering the boundary of the patch can easily produce unnecessary paint waste at the irregular boundary of the patch, as shown in Figure1(a).If spraying along the irregular boundary of the patch based on the spray path is planned in the direction of the length of the patch, it can reduce the paint waste to a certain extent, as shown in Figure 1(b).

Figure 2 :Figure 3 :
Figure 2: Influence of distance between spray path and workpiece boundary on spraying effect.

Figure 4 :
Figure 4: Projection of the patch and its spray path.

Figure 5 :
Figure 5: Coating thickness distribution under the minimum and the maximum spacing distance.

Figure 6 :
Figure 6: Generation principle of the offset spray path.

Figure 7 :
Figure 7: Simulation results of path planning method proposed in this paper.

Figure 8 :
Figure 8: Simulation results of path planning by previous method.
(b) Coating thickness distribution on the fender

Figure 9 :
Figure 9: Comparison of coating thickness distribution in two spray path planning methods.

Table 1 :
Parameters after optimization at the minimum, maximum, and optimum spray height, respectively.

Table 2 :
Comparison of spray time obtained by the proposed method and previous method.