Spraying robot spray gun attitude optimization method based on genetic algorithm
The combination of genetic algorithm and PPO reinforcement learning algorithm optimizes the spray gun posture of the spray robot, which solves the problems of posture sudden change and uneven coating during the spraying process, and improves the spray quality and path accuracy, which is suitable for spraying tasks of complex curved surface structures.
Patent Information
- Application Number
- CN202510505263.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-08-12
AI Technical Summary
It is difficult for existing spray robot systems to achieve global optimization of spray gun posture during spraying, resulting in sudden posture changes, spray offsets and uneven coating thicknesses, and lack of adaptive adjustments to the surface morphology of different workpieces.
The combined method based on genetic algorithm and PPO reinforcement learning algorithm is adopted to optimize the spray gun attitude of the spray robot globally and locally real-time optimization. By designing a multi-objective function, the direction consistency, smoothness and coating thickness uniformity of the spray gun attitude are comprehensively considered to generate an optimized spray gun attitude sequence.
It realizes comprehensive optimization of multi-objective performance during the spraying process, ensures spraying quality and path accuracy, has dynamic adaptability, is suitable for spraying tasks of complex curved surface structures, and improves the automation and efficiency of spraying operations.
Smart Images

Figure CN120460171A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent spraying technology, and in particular to a method for optimizing the spray gun posture of a spray robot based on a genetic algorithm. Background Art
[0002] With the continuous improvement of industrial automation, spraying robots have been widely used in various industries, including automotive, shipbuilding, aerospace, and home appliance manufacturing. Spraying robot systems control spray guns through preset paths and posture commands to complete coating operations on complex workpiece surfaces. The quality of the spraying directly affects the appearance consistency and protective performance of the product.
[0003] Traditional spray path planning methods mostly focus on path coverage design, while the planning of spray gun posture often adopts a fixed strategy or simple normal matching. It is difficult to fully take into account the posture continuity and spray uniformity, and it is easy to cause problems such as posture mutation, spray offset, and uneven coating thickness.
[0004] In recent years, intelligent optimization algorithms have been gradually introduced to spray trajectory and posture optimization, but many challenges remain. For one thing, existing methods often lack a systematic multi-objective posture optimization model and lack a comprehensive trade-off between factors such as spray direction continuity and coating thickness feedback. Furthermore, some algorithms have limited search capabilities in complex, high-dimensional spaces, making them prone to local optimality and making it difficult to obtain a globally optimal posture sequence for the spray path. Furthermore, existing spray strategies lack adaptive adjustment mechanisms for varying workpiece surface topography and spray area characteristics. Summary of the Invention
[0005] Purpose of the invention: The purpose of the present invention is to provide a spray robot gun posture optimization method based on genetic algorithm with real-time optimization spraying capability.
[0006] Technical solution: A method for optimizing the spray gun posture of a spray robot based on a genetic algorithm, comprising the following steps:
[0007] S1, reconstruct the point cloud of the workpiece surface to be sprayed and extract the spraying area;
[0008] S2. Path planning is performed on the spraying area to obtain a spraying path, and the spraying path is discretized to obtain a number of spraying path points, each of which contains three-dimensional coordinate information and corresponding surface normal vector information. The spray gun posture of each spraying path point is represented as a quaternion to obtain an original spray gun posture sequence;
[0009] S3, using the PPO algorithm to optimize the initial spray gun posture sequence and output the optimized spray gun posture sequence;
[0010] S4, using a genetic algorithm to perform a global optimization search on the optimized spray gun posture sequence to minimize the objective function and obtain a global optimized spray gun posture sequence;
[0011] S5. Use the PPO algorithm to optimize the global optimal spray gun posture sequence in real time to obtain the optimal spray gun posture sequence. The spray robot executes the optimal spray gun posture sequence to perform spraying operations on the surface of the workpiece to be sprayed.
[0012] Specifically, step S1 includes:
[0013] S11, obtaining a point cloud set of the surface of the workpiece to be sprayed, obtaining a mesh model of the surface of the workpiece to be sprayed using a Poisson surface reconstruction algorithm, and performing point cloud simplification and smoothing processing;
[0014] S12, calculating the surface normal vector at each point on the mesh model, and unifying the direction of the surface normal vector;
[0015] S13. Mark the facets to be sprayed in the grid model, and construct a set of facets to be sprayed as a spraying area.
[0016] Specifically, step S2 includes:
[0017] S21. Generate a spray path corresponding to the spray area using a scan line algorithm, construct a set of equally spaced scan planes in the normal direction, intersect the scan planes with the spray area to obtain corresponding tangent segments, and use uniform discrete points on the tangent segments as spray path points to obtain a spray path point sequence;
[0018] S22, using quaternions to represent the spray gun posture corresponding to the spray path point, the spray gun posture including the three-dimensional coordinate information of the spray path point and the corresponding spray gun direction, and aligning the corresponding spray gun direction with the surface normal vector;
[0019] S23. Using a spline interpolation method, the quaternion corresponding to the spraying path point sequence is processed continuously to obtain an original spray gun posture sequence.
[0020] Specifically, step S3 includes:
[0021] The spraying area and the original spray gun posture sequence are used for simulation spray modeling, and spray testing is performed through simulation spray modeling. The coating thickness and spray gun stability data of real-time spraying feedback are collected, and the PPO algorithm is used to dynamically adjust the spray gun posture at each spray path point to output the optimized spray gun posture sequence.
[0022] Specifically, the objective function is obtained by weighting the consistency function between the spray gun posture and the surface normal vector, the smoothness function of the change between adjacent spray gun postures, and the coating thickness distribution uniformity function;
[0023] The consistency function formula between the spray gun posture and the surface normal vector is:
[0024]
[0025] Where: f1 is the consistency function between the spray gun posture and the surface normal vector, n is the number of spray path points, θ i is the deviation angle corresponding to the i-th spraying path point, is the surface normal vector corresponding to the i-th spraying path point, is the actual spraying direction vector of the spray gun at the i-th spraying path point;
[0026] The smoothness function formula of the change between adjacent spray gun postures is:
[0027]
[0028] Where: f2 is the smoothness function of the change between adjacent spray gun postures, q i is the quaternion corresponding to the i-th spraying path point;
[0029] The coating thickness distribution uniformity function formula is:
[0030]
[0031] Where: f3 is the coating thickness distribution uniformity function, m is the number of discrete bins in the spraying area, t j is the coating thickness of the jth element, is the average coating thickness.
[0032] Specifically, the calculation formula for coating thickness is as follows:
[0033]
[0034] Where: t j is the coating thickness of the jth element, α ij For airbrush in pose When the opposite element f j Spray intensity contribution, θ ij is the direction of the spray gun and the surface element f j The angle between the two directions is the normal direction, and β is the modulation coating angle sensitivity constant.
[0035] Specifically, step S4 includes:
[0036] S41, using a quaternion sequence as a coding structure to construct an individual chromosome of a genetic algorithm;
[0037] S42. Based on the optimized spray gun posture sequence, a small random perturbation is added to generate diversified solutions and generate an initial population;
[0038] S43, bringing the spray gun posture and surface normal vector, quaternion sequence, and coating thickness data corresponding to each individual into the objective function to perform fitness calculation;
[0039] S44, using a tournament selection strategy to select, each tournament randomly selects a number of individuals from the initial population, and selects the one with the lowest fitness to enter the next generation;
[0040] S45, performing a crossover operation using simulated binary crossover;
[0041] S46, using Gaussian perturbation mutation to perform mutation operation, adding perturbation to each component of the quaternion and then normalizing it; at the same time, introducing an adaptive mutation rate strategy to dynamically adjust the mutation intensity according to the current population diversity;
[0042] S47. After each generation of iteration, a set proportion of individuals with the best fitness are retained. When the maximum number of iterations is reached or the fitness of the best individual fluctuates below the set threshold within a set number of consecutive generations or the Pareto front converges in the multi-objective optimization, the genetic algorithm is terminated and the global optimized spray gun posture sequence is output.
[0043] Specifically, in step S46, the adaptive mutation rate strategy includes:
[0044] Define the spray gun attitude variance index of the population:
[0045]
[0046] Where: D t is the gun posture variance, N p is the population size;
[0047] The mutation rate formula is:
[0048] μ t =μ min +(μ max -μ min )·exp(-λD t )
[0049] Where: μ t is the mutation rate, μ min is the minimum mutation rate threshold, μ max is the maximum mutation rate threshold, and λ is the adjustment coefficient.
[0050] Specifically, in step S5, the spraying robot executes the optimal spray gun posture sequence including:
[0051] The optimal spray gun posture sequence is used to construct the posture instruction sequence of the spray gun at each spraying path point:
[0052]
[0053] Where: T i is a homogeneous transformation matrix used to generate control instructions for the spraying robot. is the quaternion q i The corresponding rotation matrix, P i is the coordinate vector of the i-th spraying path point.
[0054] Preferably, the above method further comprises the following steps:
[0055] S6. Evaluate the uniformity of the coating thickness on the surface of the workpiece to be sprayed, and use the coefficient of variation of the coating thickness as the evaluation index. The formula is as follows:
[0056]
[0057] Where: CV t is the coefficient of variation, m is the number of discrete surface elements in the spraying area, t j is the coating thickness of the jth element, is the average coating thickness; the smaller the coefficient of variation, the more uniform the coating distribution.
[0058] Beneficial effects: Compared with the prior art, the significant effects of the present invention are: the present invention utilizes a genetic algorithm to globally optimize the spray gun posture of the spray robot to avoid falling into a local optimum, and designs an objective function by simultaneously considering the directional consistency, smoothness and spraying uniformity of the spray gun posture, thereby achieving comprehensive optimization of multi-objective performance in the spraying process, ensuring the balance between various objectives, and maximizing the spraying quality and path accuracy. The present invention introduces the PPO reinforcement learning algorithm to achieve local real-time optimization of the spray gun posture, ensuring continuous adjustment of the optimization strategy in a dynamic environment, thereby obtaining a more stable and reliable optimization result. The optimized spray gun posture trajectory can be directly converted into an industrial robot control instruction, which is convenient for rapid deployment in an actual production environment, and improves the automation and efficiency of the spraying operation. The present invention supports the optimization of the spray gun posture on any complex curved surface structure, and at the same time has dynamic adaptive adjustment capabilities, good general adaptability, and can cope with spraying tasks of different types of workpieces. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 It is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0060] A preferred embodiment of the present invention is further described below with reference to the accompanying drawings.
[0061] Example 1
[0062] See also Figure 1 As shown, this embodiment provides a method for optimizing the spray gun posture of a spray robot based on a genetic algorithm, comprising the following steps:
[0063] S1. In the present invention, firstly, it is necessary to obtain the 3D model data of the workpiece to be sprayed and accurately extract the spraying area from it. Assume that the 3D model is composed of a point cloud set. Represents that each point p i =(x i ,y i ,z i ) represents a spatial position on the surface of the workpiece. If the 3D model comes from a 3D scanning device, the original point cloud data is obtained; if the model is generated by CAD design, the triangular face mesh is output in STL format and can be directly converted into vertex point cloud representation.
[0064] In order to improve the surface continuity and smoothness of the point cloud data, the Poisson surface reconstruction algorithm is used to obtain the mesh model of the surface of the workpiece to be sprayed. Considered as a gradient field Construct the implicit function χ(x) so that it satisfies the following Poisson equation:
[0065]
[0066] By solving the above equations and extracting the isosurface where χ(x) = 0, a closed and smooth mesh model can be obtained.
[0067] After point cloud reconstruction is completed, point cloud simplification and smoothing are further performed using moving least squares fitting or Laplace smoothing to reduce redundant points and noise interference.
[0068] Then calculate the surface normal vector at each point on the mesh model and unify the direction of the surface normal vector. Specifically, in the neighborhood N of each point k (p i ) to construct the covariance matrix C i :
[0069]
[0070] Where: is the neighborhood center point, for C i Perform eigenvalue decomposition and take the eigenvector corresponding to the minimum eigenvalue as point p i Normal estimation And unify its direction outward or upward. k represents the neighborhood size used in the calculation process, that is, each point p i The selected neighborhood N k (p i ) contains the number of points.
[0071] Mark the faces to be sprayed in the mesh model as "paint" and construct a set of faces to be sprayed S as the spraying area:
[0072] S={f j ∈F|label(f j )="paint"}
[0073] Where: F is the set of all triangular faces in the model, S is the set of faces to be sprayed, that is, the spraying area.
[0074] S2. Path planning is performed on the spraying area to obtain a spraying path, and the spraying path is discretized to obtain a number of spraying path points. Each spraying path point contains three-dimensional coordinate information and corresponding surface normal vector information. The spray gun posture of each spraying path point is represented as a quaternion to obtain an original spray gun posture sequence.
[0075] The present invention uses a scanning line algorithm to generate a spray path corresponding to the spray area, and constructs a set of equally spaced scanning planes {∏ k}, the scanning plane intersects with the spraying area to obtain the corresponding tangent segment, and the uniform discrete points on the tangent segment are used as spraying path points to obtain the spraying path point sequence:
[0076]
[0077] Each waypoint Q i The corresponding spray gun posture needs to make its nozzle point to the unit normal vector on the surface where the point is located The present invention adopts quaternion q i =[ω i ,x i ,y i ,z i ] represents the spray gun posture corresponding to the spray path point, and the spray gun posture includes the three-dimensional coordinate information of the spray path point and the corresponding spray gun direction.
[0078] To orient the gun Align to Surface Normal In this step, the quaternion q is constructed i satisfy:
[0079]
[0080] Where: is the default direction of the nozzle, R(q i ) represents the quaternion q i Represents the rotation matrix.
[0081] To simplify the calculation, the Rodriguez formula of vector rotation or the quaternion interpolation method is used to obtain the minimum rotation quaternion, so that Rotate to
[0082] The specific calculation is as follows:
[0083] (1) Rotation axis
[0084] (2) Rotation angle
[0085] (3) The initial attitude quaternion is:
[0086]
[0087] in Need to be unitized.
[0088] In order to avoid sudden changes or jitters between postures, the present invention further smoothes the initial posture sequence. The spline interpolation method is used to continuously process the quaternions corresponding to the spray path point sequence to obtain the original spray gun posture sequence:
[0089] Assume the original quaternion sequence is {q i}, through the interpolation function Ω(t i ), generating continuous and smooth pose curves on a parameterized path:
[0090]
[0091] Where: represents the smoothed spray gun posture sequence obtained after interpolation, Ω(t i ) is the interpolation function used to calculate the continuity and smoothness between path points, t i It is a variable in the path parameterization, which represents the position parameter of the i-th point in the path. It is the discretized coordinate of the path and is usually normalized in the interval [0,1].
[0092] S3. Although step S2 has obtained the original spray gun posture sequence that is basically aligned with the normal direction, the smoothness of the posture change and the spray simulation feedback are not fully considered. Therefore, the present invention introduces the PPO (Proximal Policy Optimization) proximal policy optimization algorithm to optimize the original spray gun posture sequence in real time. Specifically, the present invention first uses the spraying area and the original spray gun posture sequence to simulate spray modeling, and performs spraying testing through simulated spray modeling, collects the coating thickness and spray gun stability data of real-time spray feedback, and uses the PPO algorithm to dynamically adjust the spray gun posture at each spray path point to maximize the spray quality and reduce the sudden change of posture change, outputs the optimized spray gun posture sequence, and forms the initial solution set X0 with the spray path point:
[0093]
[0094] The initial solution set χ0 serves as the input benchmark for the subsequent genetic algorithm.
[0095] S4. The present invention further models the spray gun posture optimization problem as a multi-objective optimization problem. The goal is to further smooth the changes in the posture sequence while keeping the spray gun posture basically consistent with the normal direction of the spray surface, and at the same time optimize the coverage quality of the spraying to obtain a highly consistent and uniform spraying effect.
[0096] To this end, the present invention designs three objective functions, namely, the consistency function of the spray gun posture and the surface normal vector, the smoothness function of the change between adjacent spray gun postures, and the coating thickness distribution uniformity function.
[0097] The goal of the consistency function between the spray gun posture and the surface normal vector is to make the orientation of the spray gun fit the normal vector of the spray surface at each spray path point as closely as possible. The formula is:
[0098]
[0099] Where: f1 is the consistency function between the spray gun posture and the surface normal vector, n is the number of spray path points, θ i is the deviation angle corresponding to the i-th spraying path point, is the surface normal vector corresponding to the i-th spraying path point, is the actual spraying direction vector of the spray gun at the i-th spraying path point; the smaller f1 is, the more stably the spray gun is aligned with the normal of the workpiece surface.
[0100] The smoothness function of the change between adjacent spray gun postures is used to constrain the continuity of posture changes during the spraying process. In order to avoid posture jumps during the execution of the robot arm, the Euclidean difference metric between the quaternions of adjacent spray gun postures is defined as follows:
[0101]
[0102] Where: f2 is the smoothness function of the change between adjacent spray gun postures, q i is the quaternion corresponding to the i-th spraying path point; minimizing this objective function can promote the smooth evolution of the quaternion sequence on the spraying path, which is beneficial to subsequent trajectory tracking.
[0103] Finally, the spray uniformity objective function is based on the coating thickness simulation. The spray area S is simulated and meshed to obtain m elements, and each element j receives the cumulative coating thickness t j The present invention measures coating consistency by the standard deviation of thickness, and the coating thickness distribution uniformity function formula is:
[0104]
[0105] Where: f3 is the coating thickness distribution uniformity function, m is the number of discrete bins in the spraying area, t j is the coating thickness of the jth element, The goal is to make the thickness close to the average coating thickness, thereby improving the spraying quality.
[0106] The coating thickness is calculated as follows:
[0107]
[0108] Where: t j is the coating thickness of the jth element, α ij For airbrush in pose When the opposite element f j Spray intensity contribution, θ ij is the direction of the spray gun and the surface element f j The angle between the two directions is the normal direction, and β is the modulation coating angle sensitivity constant.
[0109] In order to achieve multi-objective unified optimization, the present invention adopts a weighted addition model to construct the final objective function:
[0110] F=ω1f1+ω2f2+ω3f3
[0111] Where: ω1, ω2, ω3 are weights, ω1, ω2, ω3∈[0,1], and ω1+ω2+ω3=1. They can be manually set according to the focus of the task or adaptively adjusted through the fuzzy logic reasoning system. Alternatively, a Pareto optimization algorithm such as NSGA-II can be used to directly optimize the multi-objective vector (f1, f2, f3) to obtain a Pareto frontier set consisting of multiple non-dominated solutions.
[0112] In order to make the optimization problem solvable in a genetic algorithm, the present invention uses a quaternion sequence as the encoding structure to construct individual chromosomes. Each individual is represented by a posture sequence with a path length of n:
[0113] X=[q1,q2,...,q n ],q i =[ω i ,x i ,y i ,z i ]
[0114] The initial population can be generated by adding Gaussian perturbations to the initial quaternion sequence and normalizing it to meet the quaternion unit constraint, that is:
[0115]
[0116] The present invention uses an improved genetic algorithm to perform global optimization search on the spray gun posture sequence. The algorithm searches for the optimal posture sequence in the solution space through iterative evolution to achieve the purpose of minimizing the multi-objective loss function.
[0117] First, let the total population size be Np , the individual dimension is the number of path points n. Each individual chromosome is encoded as a sequence of spray gun postures:
[0118]
[0119] Where l is the number of individuals, and the initial population is generated using the "perturbation initialization strategy", that is, based on the aforementioned initial solution set χ0, a small random perturbation ε is added to generate diversified solutions. The details are as follows:
[0120]
[0121] Where: σ is the standard deviation of the perturbation, M represents the quaternion normalization to satisfy the unit modulus constraint, and I is the identity matrix, indicating that the perturbation is added to each attitude component independently.
[0122] For each individual X l The corresponding spray gun posture and surface normal vector, quaternion sequence, and coating thickness data are brought into the above objective function to perform fitness calculation:
[0123]
[0124] The present invention adopts a tournament selection strategy to retain individuals with good fitness and maintain diversity. Each tournament randomly selects 1 individual from the initial population and selects the one with the lowest fitness to enter the next generation:
[0125]
[0126] Where: b is the initial population, L is the minimum fitness value.
[0127] The present invention adopts simulated binary crossover, which is applicable to continuous numerical variables. Let the quaternions corresponding to the i-th path point in the two parent chromosomes be and The offspring code for:
[0128]
[0129] The crossover control parameter β is generated by the following formula:
[0130]
[0131] Where: n c is the cross-distribution index (usually ranging from 5 to 20).
[0132] The mutation operation is used to introduce new solutions and enhance global search capabilities. The present invention uses Gaussian perturbation mutation, that is, each component of the quaternion is perturbed and then normalized:
[0133]
[0134] In order to avoid the search capability degradation problem caused by a fixed mutation rate, the present invention introduces an adaptive mutation rate strategy, dynamically adjusts the mutation intensity according to the current population diversity, and defines the attitude variance index D of the tth generation of the population t :
[0135]
[0136] The mutation rate formula is:
[0137] μ t =μ min +(μ max -μ min )·exp(-λD t )
[0138] Where: μ t is the mutation rate, μ min is the minimum mutation rate threshold, μ max is the maximum mutation rate threshold, and λ is the adjustment coefficient, which ensures that the mutation probability is increased when the population diversity is high in the early stage, and gradually decreases when it tends to converge in the later stage.
[0139] After each generation of iteration, some individuals with the best fitness are retained to ensure that the excellent solution is not destroyed by genetic operations. The termination condition of the algorithm can be set according to any of the following criteria: reaching the maximum number of iterations T max The optimal individual fitness fluctuates below a threshold ε for t consecutive generations. The Pareto front converges in multi-objective optimization. Upon algorithm termination, a globally optimized sequence of spray gun postures is output.
[0140] S5. Use the PPO algorithm to optimize the global optimal spray gun posture sequence in real time to obtain the optimal spray gun posture sequence. The spray robot executes the optimal spray gun posture sequence to perform spraying operations on the surface of the workpiece to be sprayed.
[0141] After completing the iterative optimization of the genetic algorithm, the present invention outputs a set of optimal spray gun posture sequences. It is used to guide the spray robot to complete high-quality spraying operations. This posture sequence can be directly used in the spray simulation system to verify the spraying effect, and can also be converted into an executable program through the industrial robot control interface for physical operation deployment.
[0142] Optimal solution individual Corresponding to the optimal posture of each spraying path point on the spraying path, is the gun posture represented by the unit quaternion. To facilitate docking with the robot controller, the quaternion sequence can be further converted into Euler angle representation or direction cosine matrix to construct the posture instruction sequence of the gun end at each path point:
[0143]
[0144] Where: T i is a homogeneous transformation matrix used to generate control instructions for the spraying robot. is the quaternion q i The corresponding rotation matrix, P i is the coordinate vector of the i-th spraying path point.
[0145] The final posture sequence is further optimized in real time using the PPO algorithm. The role of the PPO algorithm at this stage is to make subtle adjustments to the output spray gun posture based on real-time spray feedback, thereby improving the accuracy of the spray effect.
[0146] S6. To verify the effectiveness of posture optimization in a simulation environment, this paper introduces a spray simulation module based on physical modeling. This module simulates the spraying, adhesion, and coverage of coating particles based on the spray gun's motion trajectory and posture sequence. To visualize the spraying effect, the simulation results can be displayed using a heat map to display the coating thickness distribution. The thickness value of each bin is mapped to a color value, facilitating the intuitive identification of overspray and underspray in the coverage area.
[0147] The uniformity of the coating thickness on the surface of the sprayed workpiece is evaluated, and the coefficient of variation of the coating thickness is used as the evaluation index. The formula is as follows:
[0148]
[0149] Where: CV t is the coefficient of variation, m is the number of discrete surface elements in the spraying area, t j is the coating thickness of the jth element, is the average coating thickness; the smaller the coefficient of variation, the more uniform the coating distribution and the better the spraying quality.
[0150] The final optimized posture sequence can be converted into specific robot control instructions after being adjusted through real-time feedback of PPO reinforcement learning, such as ABB robots using RAPID language and UR robots using URScript control instructions for actual deployment.
Claims
1. A method for optimizing the spray gun posture of a spray robot based on genetic algorithm, characterized in that: The following steps are involved: S1, reconstruct the point cloud of the workpiece surface to be sprayed and extract the spraying area; S2. Path planning is performed on the spraying area to obtain a spraying path, and the spraying path is discretized to obtain a number of spraying path points, each of which contains three-dimensional coordinate information and corresponding surface normal vector information. The spray gun posture of each spraying path point is represented as a quaternion to obtain an original spray gun posture sequence; S3, using the PPO algorithm to optimize the initial spray gun posture sequence and output the optimized spray gun posture sequence; S4, using a genetic algorithm to perform a global optimization search on the optimized spray gun posture sequence to minimize the objective function and obtain a global optimized spray gun posture sequence; S5. Use the PPO algorithm to optimize the global optimal spray gun posture sequence in real time to obtain the optimal spray gun posture sequence. The spray robot executes the optimal spray gun posture sequence to perform spraying operations on the surface of the workpiece to be sprayed.
2. The method for optimizing the spray gun posture of a spraying robot according to claim 1, characterized in that: The step S1 comprises: S11, obtaining a point cloud set of the surface of the workpiece to be sprayed, obtaining a mesh model of the surface of the workpiece to be sprayed using a Poisson surface reconstruction algorithm, and performing point cloud simplification and smoothing processing; S12, calculating the surface normal vector at each point on the mesh model, and unifying the direction of the surface normal vector; S13. Mark the facets to be sprayed in the grid model, and construct a set of facets to be sprayed as a spraying area.
3. The method for optimizing the spray gun posture of a spray robot according to claim 1, wherein: The step S2 comprises: S21. Generate a spray path corresponding to the spray area using a scan line algorithm, construct a set of equally spaced scan planes in the normal direction, intersect the scan planes with the spray area to obtain corresponding tangent segments, and use uniform discrete points on the tangent segments as spray path points to obtain a spray path point sequence; S22, using quaternions to represent the spray gun posture corresponding to the spray path point, the spray gun posture including the three-dimensional coordinate information of the spray path point and the corresponding spray gun direction, and aligning the corresponding spray gun direction with the surface normal vector; S23. Using a spline interpolation method, the quaternion corresponding to the spraying path point sequence is processed continuously to obtain an original spray gun posture sequence.
4. The method for optimizing the spray gun posture of a spray robot according to claim 1, wherein: The step S3 comprises: The spraying area and the original spray gun posture sequence are used for simulation spray modeling, and spray testing is performed through simulation spray modeling. The coating thickness and spray gun stability data of real-time spraying feedback are collected, and the PPO algorithm is used to dynamically adjust the spray gun posture at each spray path point to output the optimized spray gun posture sequence.
5. The method for optimizing the spray gun posture of a spray robot according to claim 1, wherein: The objective function is obtained by weighting the consistency function between the spray gun posture and the surface normal vector, the smoothness function of the change between adjacent spray gun postures, and the coating thickness distribution uniformity function; The consistency function formula of the spray gun posture and surface normal vector is: Where: f1 is the consistency function between the spray gun posture and the surface normal vector, n is the number of spray path points, θ i is the deviation angle corresponding to the i-th spraying path point, is the surface normal vector corresponding to the i-th spraying path point, is the actual spraying direction vector of the spray gun at the i-th spraying path point; The smoothness function formula of the change between adjacent spray gun postures is: Where: f2 is the smoothness function of the change between adjacent spray gun postures, q i is the quaternion corresponding to the i-th spraying path point; The coating thickness distribution uniformity function formula is: Where: f3 is the coating thickness distribution uniformity function, m is the number of discrete bins in the spraying area, t j is the coating thickness of the jth element, is the average coating thickness.
6. The method for optimizing the spray gun posture of a spray robot according to claim 5, characterized in that: The coating thickness is calculated as follows: Where: t j is the coating thickness of the jth element, α ij For airbrush in pose When the opposite element f j Spray intensity contribution, θ ij is the direction of the spray gun and the surface element f j The angle between the two directions is the normal direction, and β is the modulation coating angle sensitivity constant.
7. The method for optimizing the spray gun posture of a spraying robot according to claim 5, characterized in that: The step S4 comprises: S41, using a quaternion sequence as a coding structure to construct an individual chromosome of a genetic algorithm; S42. Based on the optimized spray gun posture sequence, a small random perturbation is added to generate diversified solutions and generate an initial population; S43, bringing the spray gun posture and surface normal vector, quaternion sequence, and coating thickness data corresponding to each individual into the objective function to perform fitness calculation; S44, using a tournament selection strategy to select, each tournament randomly selects a number of individuals from the initial population, and selects the one with the lowest fitness to enter the next generation; S45, performing a crossover operation using simulated binary crossover; S46, using Gaussian perturbation mutation to perform mutation operation, adding perturbation to each component of the quaternion and then normalizing it; at the same time, introducing an adaptive mutation rate strategy to dynamically adjust the mutation intensity according to the current population diversity; S47. After each generation of iteration, a set proportion of individuals with the best fitness are retained. When the maximum number of iterations is reached or the fitness of the best individual fluctuates below the set threshold within a set number of consecutive generations or the Pareto front converges in the multi-objective optimization, the genetic algorithm is terminated and the global optimized spray gun posture sequence is output.
8. The method for optimizing the spray gun posture of a spraying robot according to claim 7, characterized in that: In step S46, the adaptive mutation rate strategy includes: Define the spray gun attitude variance index of the population: Where: D t is the gun posture variance, N p is the population size; The mutation rate formula is: m t =μ min +(m max -m min )·exp(-λD t ) Where: μ t is the mutation rate, μ min is the minimum mutation rate threshold, v max is the maximum mutation rate threshold, and λ is the adjustment coefficient.
9. The method for optimizing the spray gun posture of a spray robot according to claim 1, wherein: In step S5, the spraying robot executes the optimal spray gun posture sequence including: The optimal spray gun posture sequence is used to construct the posture instruction sequence of the spray gun at each spraying path point: Where: T i is a homogeneous transformation matrix used to generate control instructions for the spraying robot. is the quaternion q i The corresponding rotation matrix, P i is the coordinate vector of the i-th spraying path point.
10. The method for optimizing the spray gun posture of a spraying robot according to claim 1, characterized in that: The following steps are also included: S6. Evaluate the uniformity of the coating thickness on the surface of the workpiece to be sprayed, and use the coefficient of variation of the coating thickness as the evaluation index. The formula is as follows: Where: CV t is the coefficient of variation, m is the number of discrete surface elements in the spraying area, t j is the coating thickness of the jth element, is the average coating thickness; The smaller the coefficient of variation, the more uniform the coating distribution.
Citation Information
Cited By
Spraying track planning method for intelligent self-adaptive helmet
CN120724857A
Intelligent throwing and spraying control method and system for large complex casting
CN120941291A