Trajectory Optimization of Spray Painting Robot for Complex Curved Surface Based on Exponential Mean Bézier Method

Automated tool trajectory planning for spray painting robots is still a challenging problem, especially for a large complex curved surface. This paper presents a new method of trajectory optimization for spray painting robot based on exponential mean Bézier method. The definition and the three theorems of exponential mean Bézier curves are discussed. Then a spatial painting path generation method based on exponential mean Bézier curves is developed. A new simple algorithm for trajectory optimization on complex curved surfaces is introduced. A golden section method is adopted to calculate the values. The experimental results illustrate that the exponential mean Bézier curves enhanced flexibility of the path planning, and the trajectory optimization algorithm achieved satisfactory performance. This method can also be extended to other applications.


Introduction
Spray painting robot is an important advanced paint production equipment, which is widely used in the paint production line of automotive.The complex shape of the workpiece in the actual industrial production is often encountered.The basic steps of the existing method in the trajectory optimization for spray painting on this kind of complex curved surface are as follows: (1) After obtaining the CAD (Computer Aided Design) data of the workpiece surface, triangulation is directly performed on the surface.And the surface is modeled by the corresponding method.
(2) After patching the complex curved surface according to the surface topology, each patch is approximated as a plane.Then the spray painting trajectory is optimized on each patch.
(3) The spray painting trajectory at the junction between patches is optimized.It needs to be optimized according to the geometric position relation of the painting path on every two patches: PA-PA (parallel-parallel), PA-PE (parallelperpendicular), and PE-PE (perpendicular-perpendicular) [1][2][3].
(4) Perform the tool trajectory optimal integration on each patch.Specifically, we can use ant colony algorithm or genetic algorithm.
In general, such trajectory optimization method for spray painting on a complex curved surface can basically meet the requirement of spray painting.However, this method has many steps to perform, and it needs to undergo three optimization operations such as the trajectory optimization on patch, optimization for spray painting trajectory at the junction of every two patches, and the tool trajectory optimal integration on each patch in actual process [4][5][6].The operation will be more troublesome, and a lot of system time will be consumed.In addition, when the area of complex curved surface is larger or with more patches, the following two problems will occur: (1) It is necessary to combine the optimized trajectories at the junction between the patches after the optimization for the painting path.The error will be larger, which will make the uniformity of the paint thickness at the junction of the patches worse.What is more, a lot of system execution time will be consumed in this process [7].
(2) When the number of patches is large, the population size (this is the concept of ant colony algorithm) will increase when performing the tool trajectory optimal integration on each patch.In this case, the convergence speed of genetic algorithm or ant colony algorithm is slow, and the algorithm is easy to fall into different local optimum fields, which leads to poor spray painting effect and lower spray painting efficiency [8][9][10].
Because of the existence of the problems above, the spray painting effect of the complex workpiece surface is still not very satisfactory in the current spray painting operations.Under this background, a new trajectory optimization method on curved surface based on Bézier surface is proposed in this paper.The specific idea for this method is after modeling the complex curved surface by using the Bézier triangular surface modeling technique, the discrete point array on the equidistant surface of the complex curved surface is found by the calculation method for discrete point array on equidistant surface of Bézier surface.Then the spatial painting path generation method based on the exponential mean Bézier curve is used to obtain the spatial painting path on the complex curved surface.According to the new trajectory optimization method on the complex curved surface, the spray painting trajectory is optimized along the specified spatial path, and the complete optimized trajectory for spray painting on the complex curved surface is obtained.The advantage of this method is that it does not need to split the complex curved surface but makes the full use of the flexible regulatory property of exponential mean Bézier curve to plan for the spatial painting path.This method not only increases the flexibility in the optimization process, but also greatly simplifies the steps of spray painting operations on complex curved surfaces.

Path Planning
Trajectory optimization of the spray painting robot consists of two parts, one is the path planning and the other is the spray speed optimization.The effect of spray painting on the complex curved surface workpiece is still not very satisfactory in the current spray painting operation.In the spray painting operation, the curvature of the workpiece surface is likely to be large due to the complexity of curved surface and the shape of the workpiece surface, which makes it more difficult to optimize the spray painting trajectory.In the first part of the description, the existing method is curved triangulation.In this method, Cubic Cardinal spline curves are used to connect the discrete point arrays on the equidistant surface of the Bézier surface, and each adjacent Cardinal spline curve is connected by Hermite spline curve [11][12][13].Since both Cardinal and Hermite curves are parametric cubic polynomials, the local control properties for the curves are particularly poor and it is difficult to make a direct and geometric intuitionistic estimate of the geometry of the curve under normal circumstances.
In the current surface modeling technology of CAGD (Computer Aided Geometric Design) for free-form curved surface, Bézier theory and method have been widely used in the CAM/CAD system as a set of mature algorithm theories, which shows a strong vitality and practical value.The main reason is that Bézier method is easy to operate and it has good geometric properties.The traditional Bézier curve is defined as a convex combination of spatial position vector with the Bernstein basis function as weight, which is also a kind of average value.But the traditional Bézier curve has great limitations on describing the geometry of the entity, and its rational and polynomial form also have many shortcomings.Therefore, it is of vital importance to find the new basis functions of Bézier curves.In this section, Bézier curves are evenly combined with exponential mean, and the definition of exponential mean Bézier curves with parameter is put forward [14,15].The three basic properties of this kind of curves are given, such as the elevation, de Casteljau algorithm, and segmentation theorem which are applied to the method for generating the painting path in complicated surface.Finally, better results can be obtained.
Make the exponential mean of control vertices  0 ,  1 , . . .,   on this basis; we can get the definition of exponential mean Bézier curve.
Obviously, -time first-order exponential mean Bézier curve is the Bézier curve in traditional sense.After introducing the displacement operator , difference operator Δ, and unit operator  motioned above, then we have so,    () has the following operator representation: The derivative formula of    () is given as follows: obviously, Note the exponential mean Bézier curves determined by the control vertices  0 ,  1 , . . .,   as    ( 0 ,  1 , . . .,   ; ).Then, it satisfies the interpolation properties at the endpoints, which is and when  ∈  * + , from  , () =  −, (1 − ), we can obtain and when  = 1, similarly we can obtain It can be seen that the exponential mean Bézier curve defined by the same control polygon is unique.The parametric cubic Hermite interpolation does not have the symmetry represented by the formula above.
In the Bézier curve design, the flexibility of curve designing can be improved by increasing the number of control vertices while keeping the curve shape unchanged, which is called elevation.The exponential mean Bézier curve is also a parametric polynomial curve segment with global properties.In the discrete point arrays on the equidistant surface of a complex curved surface, it is possible that the control vertices cannot reach the ideal curve (path) shape no matter how we adjust them.That is, the "rigidity" of the curve (path) is adequate while the "flexibility" is insufficient.
In the process of selecting the control vertices according to the discrete point arrays on the equidistant surface of the complex curved surface, the geometric properties of the complex curved surfaces themselves determine that the geometrical properties of the Bézier curves obtained from these control vertices are also complex.The process of each intermediate vertex generated by the de Casteljau algorithm is linear interpolation.This algorithm can resolve a complex geometric computation problem into a series of linear operations.The algorithm is easy to program and the speed is quite fast.Also, it facilitates the rapid generation of spatial painting path on complex curved surface.
Theorem 3 (de Casteljau algorithm theorem).   () is the time -order exponential mean Bézier curve.Suppose that the control vertex {  }  =0 and parameter  ∈ [0, 1] are given.Then  []   is defined as follows: and this satisfies    () =  []  0 ,  ∈  + . Proof. while Let  = 0 and  = ; then we have When  ∈  * + , while and thereby thus Let  = 0 and  = ; then we have de Casteljau's algorithm theorem improves the rapidity of generating the spatial paths on complex curved surfaces.However, since the curvature of the complex curved surface itself changes greatly, in the actual spray painting operations, sometimes the entire painting path needs to be processed by segment.That is, the entire path curve needs to be divided into two subpath curve segments.The de Casteljau algorithm can not only determine a point on the path curve, but also introduce the path curve segmentation problem.There are two vertices sets  0 ,  [1]  0 , . . .,  []  0 and  []  0 ,  [−1] 1 , . . .,   in the de Casteljau algorithm.We can get the two subcurve segments divided from the entire exponential mean Bézier curve by using the exponential mean Bézier curve determined by these two vertices sets as the control vertex.

Spatial Path Generation of Exponential Mean Bézier
Curves.Due to the large curvature changes of the complex curved surface studied in this paper, the Cardinal splines and the parametric polynomial expressions of the Hermite splines themselves determine that the local control is relatively poor.Therefore, the exponential mean Bézier curves with parameter are used in order to overcome these shortcomings.The discrete point arrays (-direction or -direction) are regarded as the experimental data point arrays, and an exponential mean Bézier curve is used to fit the data points.Then the control vertices of the curves are inverted to generate the spatial painting path, where the -direction spatial path of the surface is shown in Figure 1 and the direction spatial path of the surface is shown in Figure 2.
In the following, we will make the following first-order ( = 1) exponential mean Bézier curve as an example.Take the -direction as an example; the discrete point array is represented as a set of data points: Obtain an exponential menial Bézier curve these data points are fitted, and the control vertex   is to be determined.The curve is obtained by using the least-squares approximation method.First,   ( = 0, 1, . . ., ) is parameterized.The parameter sequence is determined by using the specification accumulation chord length parameterization: 0 =  0 <  1 < ⋅ ⋅ ⋅ <   = 1, so we have The problem is transformed into solving the least-squares solution of the equation set.The problem can be solved by solving the following regularization equation: where In practical problems, we often hope that  0 =  0 ,   =   .That is, the two ends of the curve coincide with the first and last points of the data point.Then (32) becomes the following equation: = 1, 2, . . .,  − 1; (34) then its least-squares solution   ( = 1, 2, . . .,  − 1) together with the two endpoints  0 ,   forms the control vertices of the curve.
In the following, the smooth stitching condition of two adjacent curves is obtained by using Beta constraint formula.Suppose that the control vertex of the curve on the left of  − () is { −  }  =0 , the control vertex of the curve on the right of  + () is { +  }  =0 .In order to obtain a common unit tangent vector and a common curvature vector at the connection point of the two curved segments, we need to meet the following requirements: By solving the derivative of (), the above condition can be transformed into Then At this point, the curve obtained by the smooth stitching of two adjacent curves is the specified spatial painting path.The application of the three basic properties of exponential mean Bézier curves and their own parameters improves the flexibility of the painting path on complex curved surfaces.And the potential flexibility of shape controlling on the painting path is also enhanced.At the same time, it makes the algorithm very simple, stable, and reliable.The algorithm is easy to program and the speed is quite fast.Also, it facilitates the rapid generation of spatial painting path on complex curved surface.

Trajectory Algorithm
After generating the exponential mean Bézier curves according to the method described in Section 2, a new simple algorithm for trajectory optimization on complex curved surfaces is introduced in this section.The method is simple in expression and fast in operation speed, which can meet the requirement of spray painting quality on complex curved surface.
When the end effector is in a specific position, the trajectory and position vector p() at a point (, , ℎ(, )) on the surface can be expressed as   (p(), , )(), where   (p(), , ) is the spray painting trajectory and () is the paint flow which () changes with the movement of the end effector.The spray painting trajectory   (p(), , ) is determined by the distance of the end effector and the surface and its spatial position.The spray painting model of the system is shown in Figure 3. Here, an experimental method is used to establish the paint deposition rate model.In the experiment, after a period of time, the paint deposition rate of the end effector is measured at a fixed position, and the paint deposition rate model is determined by the reverse flow distribution method.When the position of the end effector is p(), the expression of spray painting trajectory is where r denotes the vector of the end effector to point (, ),  imp denotes the angle between r and the normal vector n  of point (, ), and Θ(, ) represents the droplet distribution of the conical paint stream.The droplet distribution depends on the normal vector of the end effector (it is determined by the position of the end effector), the angle  between r and the perpendicular bisector of the end effector, and the inner halfangle  of the conical paint flow, which can be represented as a regularized Dirac function: Through a large number of spray painting experiments, it can be found that  = 0.32 rad under normal circumstances.In some spray painting experiments (especially on metal surfaces), a significant portion of the paint is wasted due to splashing and sticking efficiency ( imp ).The expression of sticking efficiency ( imp ) is where (0) represents the paint efficiency,  represents the fitting parameters in usual case (0) = 0.67, and  = 0.04.In fact, it has been assumed in the model of Figure 1 that there is no paint deposition outside the paint cone angle .In the actual spray painting operation, there will be a small amount of splash paint falling outside the paint cone angle, but this situation can be ignored.
Assuming that the paint thickness distribution on the curved surface is (, ), one of the objectives of the spray painting operation is to achieve the desired paint thickness distribution (, ).In practice, the paint thickness distribution (, ) varies on the curved surface.However, in the experiment, it is common to predefine an expected value in the system.That is, the paint thickness distribution is a constant.Therefore, for determining the vector p() of the locus and position of the nozzle as well as the flow rate (), the minimum difference between the actual paint distribution and the actual paint thickness distribution can be selected as the optimization objective function.That is, Here, the golden section method in mathematical programming can be used to solve the discrete points on the spray painting trajectory, from which we can get the optimized trajectory on the complex curved surface.

Experimental Verification
4.1.Spray Painting Simulation.Taking the automotive body of a brand as the paint objective, we have simulated the feasibility of exponential mean Bézier method.Since the left and right sides are completely symmetrical, only one side is listed.In addition, the car body spraying path is shown in Figure 4.
According to the actual spray painting requirements in the production process of the car, the ideal paint thickness   = 50 um, the error of the maximum paint thickness   = 10 um, painting radius  = 60 mm, painting distance ℎ = 80 mm, and painting speed  = 389 mm/s (the optimization speed on the plane).We have collected 200 discrete points at the top, side, and rear of the body.The paint thickness curve of each sampling point on the automobile body is shown in Figure 5.The graph shows that the coating thickness meets the requirements, and the simulation results verify the effectiveness of the trajectory optimization method.

Spray Painting Experiment.
We use FANUC industrial robots in the experiment.According to the characteristics of FANUC industrial robot off-line programming and spraying space trajectory, the method of spraying space trajectory converting to the robot motion trajectory is proposed.
By analyzing the relationship between the workpiece coordinate system and the robot coordinate system, the robot tool coordinate system is calibrated, and then the space trajectory in the workpiece coordinate system is transformed into the robot coordinate system.In the inverse solution of the robot, the optimal model of the shortest joint motion is established, and the inverse solution of the robot is derived [16].
Finally, the best inverse combination is obtained to realize the transformation of the spraying space trajectory to the robot motion trajectory.
The spatial paths obtained from different directions are shown in Figures 6, 7, and 8.
The spray painting experiment will be carried out along the specified painting path.Before the experiment, the following two points need to be explained: (1) In the literature [12], the experimental results show that the spray painting effect is better with the path planning scheme along the -direction path, and it is not easy to further improve the effect with the prior technology.As the spray painting effect along the -direction path is not ideal, we just generate the -direction path here in order to form a contrast between the two.
(2) The spatial painting path generation method based on the exponential mean Bézier curve is used in the experiment of this paper.As this method is more accurate but the calculation process is more complex, more discrete points of the equidistant surface need to be generated in the calculation.Then the spatial path density in -direction generated by this method is also large (i.e., the distance between adjacent two paths is small).Therefore, in the spray painting experiment, we no longer need to optimize the spray painting speed.We can only perform uniform spray painting operation along the generated path in the experiment.Figure 9 shows the robotic spray painting experiment of -direction path planning for FANUC robot.Because the shape of the workpiece is symmetrical, half of the workpiece is sprayed in the experiment.
In the spray experiment, the ideal paint thickness is   = 50 um, maximum allowable error   = 10 um, painting radius  = 50 mm, painting distance ℎ = 100 mm, and painting speed  = 256 mm/s (the optimization speed on the plane) when performing uniform spray painting.We take 400 discrete points evenly on the workpiece surface after spray painting operation.The paint thickness curve is shown in Figure 10 after using a paint thickness gauge to measure the paint thickness at the discrete points.The results of the experimental data obtained by using the surface spray painting method are shown in Table 1.
It can be seen from the comparison of the experimental results that the spray painting effect is better when using the   method proposed in this paper, but the spray painting time is obviously increased.There are two main reasons accounting for this: (1) The painting path obtained by the spatial painting path generation method based on the exponential mean Bézier curve is longer, which leads to the longer spray painting time.(2) Since the method is carried out with uniform spray painting, the spray painting speed is not optimized.That is, the robot does not have the acceleration and deceleration process during the spray painting operation.So the spray painting time is longer.
However, it should be noted that although the method in literature [12] can optimize the spray painting speed, it is based on the situation that the workpiece is divided into a number of triangular facets.When the sprayed workpiece is relatively large, the number of triangles will also be very large.In the multiobjective optimization problem with constraints, the two optimization objectives: paint thickness uniformity and spray painting time are coupled and competing with each other, which makes it difficult to solve the exact solution of this multiobjective optimization problem.In this case, for workpiece with large curved surface, the solution will inevitably lead to slower system operation and system realtime deterioration, and the calculation error will become larger.At this point, the spray painting effect should be better when using the method proposed in this chapter for uniform spray painting.

Conclusion
In this paper, a new trajectory optimization method based on the Bézier method on complex curved surface is proposed.By using the Bézier triangular surface modeling technique, the complex surface is modeled and the discrete points array on the equidistant surface of the toric surface is found by using the discrete point array calculation method of Bézier surface equidistant surface.Then the spatial painting path generation method based on the exponential mean Bézier curve is used to obtain the spatial painting path on the complex curved surface.And then, according to a new paint thickness algorithm in the spray painting model on complex curved surface, the spray painting trajectory is optimized along the specified spatial path and a complete spray painting trajectory on the complex curved surface is obtained.The biggest advantage of this method is that it does not need to patch the complex curved surface but makes full use of the flexible feature of exponential mean Bézier curves to plan the spatial painting path first.This method enhances the potential flexibility of the shape control on painting path.The experimental results show that it is better to use the method proposed in this paper to make the uniform spraying effect when spraying the large surface workpiece.

Figure 1 :
Figure 1: The -direction spatial path of the surface.

Figure 2 :
Figure 2: The -direction spatial path of the surface.

Figure 3 :
Figure 3: Spray painting model of the system.
(, ) − ∫  0   (p () , , )  ()           2  , (41) where  represents a paint curved surface and  indicates the completion time of the spray painting operation.Since the objective function is not a convex function, the optimization problem is difficult to solve.Suppose that ℎ(, ) is a constant, the distance of the end effector and the curved surface remains constant and is always perpendicular to the curved surface.Then the expression of spray painting trajectory is   (p () , , ) =  ( −   () ,  −   ()) , (42) where ( −   (),  −   ()) represents the constant painting path.If the moving speed of end effector remains unchanged while the paint flow can be adjusted in the process of spray painting operation, then the above optimization problem can be transformed into min   ,  ,() ∬            (, ) − ∫  0  ( −   () ,  −   ())  ()           2  .

Figure 4 :Figure 5 :
Figure 4: The spraying path for part of car body.

Figure 9 :Figure 10 :
Figure 9: Spray painting experiment of -direction path planning for FANUC robot.

Table 1 :
Comparison of spray painting experiment.