Spraying trajectory planning method and electronic equipment
By cutting the workpiece point cloud through multiple cutting planes and selecting the slice path using optimization algorithms, the problem of easy local solutions for the trajectory planning of the spray robot is solved, and the spray quality and speed are improved, which is suitable for large-size free surfaces.
Patent Information
- Application Number
- CN202411835281.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-13
AI Technical Summary
The trajectory planning technology of existing spray robots is prone to falling into local solutions, resulting in poor spraying effects, especially when dealing with large-size free surfaces.
Cut the point cloud of the workpiece to be sprayed through multiple cutting planes, multiple slice paths are generated, and whether the slice path is selected as the optimization variable, the optimal individual is obtained through the optimization algorithm, thereby building a high-quality spray trajectory.
It reduces the risk of falling into local solutions, improves spray quality and trajectory optimization speed, and is suitable for spraying applications with large-size free surfaces.
Smart Images

Figure CN119335953B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of path planning, and in particular to a spraying trajectory planning method and electronic equipment. Background Art
[0002] At present, robotics technology has been widely used in many manufacturing fields, such as automated production of automobiles, furniture, plastics and electronic products. As a key component in coating equipment, spray robots can improve the production efficiency and product quality of workpieces in complex production environments through precise coating spraying. With the improvement of consumption levels, consumers' requirements for the appearance of consumer goods continue to rise, and the thickness uniformity and color appearance of surface coatings have become the focus of attention. The trajectory planning of spray robots plays a vital role in the uniformity of the coating thickness on the workpiece surface.
[0003] At present, the trajectory planning technology of the spraying robot mainly relies on the algorithm based on point cloud slicing. It is mainly through slicing and sampling the point cloud model of the spraying workpiece, then uniformly sampling on the cutting line, and estimating the normal vector of each sampling point. Subsequently, the spraying position is determined according to the spraying height and normal vector, and these data points are connected through the interpolation algorithm to generate the final spraying trajectory.
[0004] In order to adapt to the spraying of free-form surfaces, the existing scheme uses optimization algorithms to optimize the slice interval. In this method, the optimization variable is the distance of the slice relative to the previous slice. When there are many slice data, this method will greatly increase the possibility of falling into a local solution due to the mutual coupling between the variables, thereby affecting the final spraying effect. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a spraying trajectory planning method and electronic device to reduce the risk of falling into a local solution and improve the spraying quality.
[0006] In a first aspect, the present invention provides a spraying trajectory planning method, the method comprising:
[0007] Obtaining a workpiece point cloud of a workpiece to be sprayed;
[0008] Using multiple cutting planes to cut the workpiece point cloud to obtain multiple slicing paths;
[0009] Generating a plurality of individuals to be optimized based on the plurality of slice paths, wherein each of the individuals to be optimized includes the same number of elements as the slice paths, and each of the elements is an identifier indicating whether the corresponding slice path is selected;
[0010] Optimizing the multiple individuals to be optimized to obtain the optimal individual;
[0011] A target slicing path is selected from the plurality of slicing paths based on the optimal individual, and a spraying trajectory is formed based on the target slicing path.
[0012] In an optional implementation, the step of optimizing the multiple individuals to be optimized to obtain the optimal individual includes:
[0013] constructing an objective function based on the number of selected slicing paths and the spraying thickness error of the three-dimensional points in the workpiece point cloud;
[0014] According to the constructed objective function, the multiple individuals to be optimized are optimized to obtain the optimal individual, wherein the objective function is minimized under the optimal individual.
[0015] In an optional embodiment, the step of constructing an objective function based on the number of selected slicing paths and the spraying thickness error of the three-dimensional points in the workpiece point cloud includes:
[0016] Count the number of selected slice paths;
[0017] Calculating the spraying thickness error between the spraying thickness estimate value and the spraying thickness target value of each three-dimensional point in the workpiece point cloud, and correcting the spraying thickness error using a huber kernel function;
[0018] The objective function is constructed based on the counted quantity and the corrected spray thickness error.
[0019] In an optional embodiment, the spraying thickness estimate is obtained by:
[0020] For each of the slicing paths, obtaining a spraying posture of the spraying robot when operating along the slicing path;
[0021] Based on the spraying posture and the set spraying parameters, an estimated value of the spraying thickness generated by the spraying robot for each three-dimensional point in the workpiece point cloud when the spraying robot operates along the slicing path is obtained.
[0022] In an optional embodiment, the step of obtaining the spraying posture of the spraying robot when operating along the slicing path includes:
[0023] Sampling is performed on the slice path according to a set sampling interval to obtain a plurality of sampling points;
[0024] Obtaining a normal vector of each sampling point, and extending each sampling point along the direction of its normal vector by a preset distance to locate an extension point;
[0025] Based on the position information of each of the extension points, the normal vector of the extension point and the forward direction of the spraying robot, the spraying posture of the spraying robot when operating along the slicing path is determined.
[0026] In an optional implementation, the step of optimizing the multiple individuals to be optimized according to the constructed objective function to obtain the optimal individual includes:
[0027] For each individual to be optimized, detecting whether the individual to be optimized satisfies a set constraint condition, wherein the constraint condition is formed based on a spray coverage estimation value and a spray coverage target value;
[0028] If the individual to be optimized does not satisfy the constraint condition, a penalty term is added to the objective function corresponding to the individual to be optimized;
[0029] In each round of iteration, the individuals to enter the next round of iteration are selected based on the objective functions corresponding to the individuals to be optimized, until the iteration stop condition is met to obtain the optimal individual.
[0030] In an optional embodiment, after the step of selecting the individuals to enter the next round of iteration based on the objective function corresponding to each of the individuals to be optimized, the method further includes at least one of the following:
[0031] For the selected individuals, transforming the elements included in the individuals to generate new individuals;
[0032] For any two selected individuals, cross-transformation is performed on the elements in the two individuals to generate a new individual.
[0033] In an optional embodiment, the step of cutting the workpiece point cloud using multiple cutting planes to obtain multiple slicing paths includes:
[0034] Constructing a covariance matrix based on the three-dimensional points in the workpiece point cloud, performing singular value decomposition on the covariance matrix, and obtaining eigenvalues and eigenvectors corresponding to the eigenvalues;
[0035] A plurality of cutting planes whose normal vectors are parallel to the feature vectors are constructed, and cutting lines between each of the cutting planes and the workpiece point cloud are obtained as slicing paths.
[0036] In an optional embodiment, the characteristic value is multiple;
[0037] The step of constructing a plurality of cutting planes whose normal vectors are parallel to the feature vectors comprises:
[0038] Determine the largest eigenvalue among the multiple eigenvalues, and determine the eigenvector corresponding to the largest eigenvalue as the dominant eigenvector;
[0039] A plurality of cutting planes whose normal vectors are parallel to the dominant eigenvector are constructed.
[0040] In a second aspect, the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the method described in any one of the aforementioned implementation modes are implemented.
[0041] The present invention provides a spraying trajectory planning method and electronic device, which utilize multiple cutting planes to cut a workpiece point cloud of a workpiece to be sprayed to obtain multiple slice paths. Based on the multiple slice paths, multiple individuals to be optimized are generated, and each individual to be optimized includes the same number of elements as the slice paths, and each element is an identifier that characterizes whether the corresponding slice path is selected. The multiple individuals to be optimized are optimized to obtain the optimal individual, and a target slice path is selected from the multiple slice paths based on the optimal individual, and a spraying trajectory is constructed based on the target slice path. In this solution, whether the slice path is selected is used as an optimization variable, which realizes variable decoupling, reduces the complexity of mutual influence between variables, and reduces the possibility of falling into a local solution, thereby improving the spraying quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments of the present invention are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0043] Figure 1 A flow chart of a spraying trajectory planning method provided by an embodiment of the present invention;
[0044] Figure 2 for Figure 1 Flow chart of the sub-steps included in step S12;
[0045] Figure 3 for Figure 2 Flow chart of sub-steps included in step S122;
[0046] Figure 4 A flow chart of a spraying thickness estimation method involved in a spraying trajectory planning method provided in an embodiment of the present invention;
[0047] Figure 5 for Figure 4 Flow chart of sub-steps included in step S21;
[0048] Figure 6 for Figure 1 Flow chart of the sub-steps included in step S14;
[0049] Figure 7 for Figure 6 Flow chart of sub-steps included in step S141;
[0050] Figure 8 for Figure 6 Flow chart of sub-steps included in step S142;
[0051] Fig. 9 A functional module block diagram of a spray trajectory planning device provided by an embodiment of the present invention;
[0052] Fig.10 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0054] See also Figure 1 , which is a flow chart of a spraying trajectory planning method provided by an embodiment of the present invention, the spraying trajectory planning method can be executed by a spraying trajectory planning device, the spraying trajectory planning device can be implemented by software and / or hardware, and can be configured in an electronic device, the electronic device can be a computer device, a server, a programmable logic controller, a controller in a robot, etc. The detailed steps of the spraying trajectory planning method are described as follows.
[0055] S11, obtaining a workpiece point cloud of the workpiece to be sprayed.
[0056] S12, cutting the workpiece point cloud using multiple cutting planes to obtain multiple slicing paths.
[0057] S13, generating a plurality of individuals to be optimized based on the plurality of slicing paths, wherein each of the individuals to be optimized includes the same number of elements as the slicing paths, and each of the elements is an identifier indicating whether the corresponding slicing path is selected.
[0058] S14, optimizing the multiple individuals to be optimized to obtain the best individual.
[0059] S15, selecting a target slicing path from the multiple slicing paths based on the optimal individual, and forming a spraying trajectory based on the target slicing path.
[0060] In this embodiment, the workpiece to be sprayed can be any workpiece that needs to be sprayed. The way to obtain the workpiece point cloud of the workpiece to be sprayed can be to use a shooting device to shoot the workpiece to be sprayed to obtain a workpiece image, and obtain the workpiece point cloud based on the workpiece image.
[0061] On this basis, multiple cutting planes are used to cut the workpiece point cloud. The multiple cutting planes can be parallel to each other and have a certain spacing. There is a cutting line between each cutting plane and the workpiece point cloud, that is, the intersection line between the cutting plane and the workpiece point cloud. In this embodiment, the cutting line between each cutting plane and the workpiece point cloud is used as a slicing path. Subsequently, the spraying robot can be controlled to move along each slicing path and perform the spraying operation during the moving process.
[0062] In actual scenarios, the number of slice paths obtained is large, that is, the intervals between the slice paths are very dense. In actual operation, it is not necessary to control the spraying robot to walk on each slice path. The spraying trajectory planning method provided in this embodiment is intended to determine which slice paths to select and which slice paths not to select from these slice paths. The slice path finally selected will constitute the spraying trajectory of the spraying robot, and the spraying robot can achieve good spraying quality by traveling and spraying along the spraying trajectory.
[0063] Based on this, in this embodiment, on the basis of obtaining multiple slice paths, multiple individuals to be optimized are generated based on the multiple slice paths. The individuals to be optimized can be understood as an array, which includes multiple elements, and the number of elements included in each array is consistent with the number of slice paths. In addition, each element is an identifier that indicates whether the corresponding slice path is selected.
[0064] For example, if the number of slice paths is n, the number of elements in each individual to be optimized is n, and the value of each element in the n elements is 0 or 1. When the element is 0, it indicates that the corresponding slice path is not selected, and when the element is 1, it indicates that the corresponding slice path is selected.
[0065] The values of the elements in each individual to be optimized are determined randomly, that is, it is necessary to find the optimal individual among the multiple randomly generated individuals to be optimized. It can be understood that the slicing path is selected based on the values of the elements in the optimal individual, and the spraying trajectory formed by these slicing paths is optimal.
[0066] Therefore, multiple individuals to be optimized can be optimized to obtain the optimal individual. The optimization method can be genetic algorithm, particle swarm algorithm, ant colony algorithm, etc.
[0067] The process of optimizing multiple individuals to be optimized is equivalent to selecting individuals that meet the requirements from the individuals to be optimized one by one to enter subsequent iterations, and so on. When an individual that meets the iteration stop requirements is selected, or the number of iterations reaches a preset number, or the iteration duration reaches a preset duration, the optimization process can be stopped and the optimal individual at this time can be determined.
[0068] After determining the optimal individual, each element in the optimal individual can be obtained, and based on the value of each element, it can be determined whether the corresponding slicing path is selected. In this way, the selected slicing path can be screened out, and the selected slicing path constitutes the final spraying trajectory. Subsequently, the spraying robot can be controlled to move along the spraying trajectory and perform the spraying operation during the movement to spray the surface of the workpiece to be sprayed.
[0069] The spraying trajectory planning method provided in this embodiment takes whether the slicing path is selected as an optimization variable, realizes variable decoupling, reduces the complexity of mutual influence between variables, reduces the possibility of falling into a local solution, and thus improves the spraying quality.
[0070] See also Figure 2 In this embodiment, the above step of cutting the workpiece point cloud using multiple cutting planes to obtain multiple slicing paths can be achieved by the following method:
[0071] S121, constructing a covariance matrix based on the three-dimensional points in the workpiece point cloud, performing singular value decomposition on the covariance matrix, and obtaining eigenvalues and eigenvectors corresponding to the eigenvalues.
[0072] S122, constructing a plurality of cutting planes whose normal vectors are parallel to the feature vectors, and obtaining cutting lines between each of the cutting planes and the workpiece point cloud as slicing paths.
[0073] In this embodiment, based on the workpiece point cloud obtained in the early stage, it is also necessary to obtain the set spraying parameters, the expected spraying thickness (spraying thickness target value) and the minimum expected spraying ratio (that is, when the ratio of the spraying thickness to the spraying thickness target value reaches the minimum expected spraying ratio, it can be determined that the overall spraying coverage requirements are met), etc.
[0074] Among them, the spraying parameters include the size of the spraying robot, the spraying thickness per unit time, the spraying height and other parameters.
[0075] In this embodiment, the workpiece point cloud may be preprocessed first, including removing abnormal points and noise points in the workpiece point cloud, translating the center of the workpiece point cloud to the origin of the coordinate system, and performing rotation alignment processing on the workpiece point cloud.
[0076] On this basis, a covariance matrix is constructed based on the three-dimensional points in the workpiece point cloud. The covariance matrix can be constructed in a commonly used manner, which will not be described in detail here. The constructed covariance matrix is subjected to singular value decomposition to obtain eigenvalues and eigenvectors corresponding to the eigenvalues.
[0077] The eigenvector has a certain direction, so multiple cutting planes can be constructed, and the normal vector of each cutting plane is parallel to the eigenvector, that is, the cutting plane is perpendicular to the eigenvector. The number of cutting planes and the spacing between two adjacent cutting planes can be set based on demand.
[0078] Each cutting plane has an intersection line with the workpiece point cloud, and the intersection line is the cutting line, which can be used as an alternative slicing path.
[0079] See also Figure 3 In this embodiment, when performing singular value decomposition, multiple eigenvalues are obtained. When constructing multiple cutting planes whose normal vectors are parallel to the eigenvectors, this can be achieved in the following manner:
[0080] S1221, determining the largest eigenvalue among the multiple eigenvalues, and determining an eigenvector corresponding to the largest eigenvalue as the dominant eigenvector.
[0081] S1222, construct multiple cutting planes whose normal vectors are parallel to the dominant eigenvector.
[0082] In this embodiment, the multiple eigenvalues obtained by singular value decomposition have different sizes, and the multiple eigenvalues can be sorted in order from large to small. Among them, the eigenvector corresponding to the eigenvalue with the largest value is the dominant eigenvector, and the eigenvector corresponding to the eigenvalue with the middle value is the slicing direction of the workpiece point cloud, that is, the tangent direction of the spray robot.
[0083] The normal vectors of the constructed multiple cutting planes are parallel to the dominant eigenvector.
[0084] On this basis, in this embodiment, an estimated spray thickness value can be calculated, which is an estimated value of the thickness of the coating generated at the position of each three-dimensional point in the workpiece point cloud when the spray robot is controlled to move and spray along the slicing path.
[0085] See also Figure 4 In this embodiment, the estimated value of the spraying thickness can be obtained by:
[0086] S21, for each of the slicing paths, obtaining a spraying posture of the spraying robot when operating along the slicing path.
[0087] S22, based on the spraying posture and the set spraying parameters, obtaining an estimated spraying thickness generated by the spraying robot for each three-dimensional point in the workpiece point cloud when the spraying robot operates along the slicing path.
[0088] When the spraying robot moves along each slicing path and sprays, the spray gun on the spraying robot is not attached to the surface of the workpiece, but should be at a certain distance from the surface of the workpiece. In addition, the spraying robot operates in a certain posture during the operation. Therefore, it is necessary to determine the spraying posture of the spraying robot when it operates along the slicing path.
[0089] On this basis, combined with the set spraying parameters, such as the size of the spraying robot, the spraying thickness per unit time, the spraying height, etc., the estimated spraying thickness generated by the spraying robot for each three-dimensional point in the workpiece point cloud when the spraying robot operates along the slicing path is obtained.
[0090] It can be understood that when the spraying robot operates along a certain slicing path, the 3D points within its spraying range will be covered by the paint, while the 3D points not within its spraying range will not be covered by the paint. The estimated spray thickness of these 3D points not within its spraying range is 0.
[0091] In addition, since there are multiple slicing paths and they are arranged side by side, if a three-dimensional point is located near two or more slicing paths, when the spray robot operates on the two or more slicing paths, the three-dimensional point may be located in the spraying range of the two or more slicing paths respectively. Then, its spraying thickness estimated value should be the cumulative value of the spraying thickness estimated value generated for the three-dimensional point when the spray robot operates on the two or more slicing paths respectively.
[0092] See also Figure 5 In this embodiment, the step of obtaining the spraying posture of the spraying robot when operating along the slicing path can be achieved in the following way:
[0093] S211, sampling is performed on the slice path according to a set sampling interval to obtain a plurality of sampling points.
[0094] S212, obtaining a normal vector of each sampling point, and extending each sampling point along the direction of its normal vector by a preset distance to locate an extension point.
[0095] S213, determining the spraying posture of the spraying robot when operating along the slicing path based on the position information of each of the extension points, the normal vector of the extension point and the forward direction of the spraying robot.
[0096] In this embodiment, the sampling interval can be set as required, and multiple sampling points can be obtained by sampling at the sampling interval on each slicing path. The normal vector of each sampling point is obtained, and the normal vector of the sampling point is a vector passing through the sampling point and perpendicular to the surface of the workpiece at the location of the sampling point. The sampling point is extended along the direction of its normal vector by a preset distance to locate the extension point. The preset distance length can be set based on the spray gun related information on the spray robot.
[0097] The located extension point can be understood as the sampling point diverging outward along the workpiece surface. The extended position information can be understood as the position information of the subsequent spraying robot, and the posture information of the spraying robot can be obtained based on the normal vector of the extension point, the forward direction of the spraying robot, and the cross product between the two.
[0098] In this way, the position information and posture information of the spraying robot, that is, the posture information, is determined, and the spraying robot can be controlled to operate on the slicing path according to the posture information. Thus, a corresponding spray thickness estimate is generated for each three-dimensional point in the workpiece point cloud. In this embodiment, the spray deposition model can be called, and the spray thickness estimate of each three-dimensional point can be calculated based on the spray posture, spray parameters, etc. Among them, the spray deposition model adopts the currently commonly used model, which will not be described here.
[0099] In this embodiment, based on the above, an initialized individual to be optimized is constructed, and each individual to be optimized can be characterized as follows:
[0100]
[0101] in, n Characterizes the number of slice paths, that is, the number of elements in the individual to be optimized, where x i When it is 1, it means that the slice path corresponding to the element is selected. x i When it is 0, it means that the slice path corresponding to the element is not selected. The values of each element in the initialized individual to be optimized are randomly generated. Then, the optimal individual is determined based on multiple individuals to be optimized.
[0102] See also Figure 6 In this embodiment, the step of optimizing multiple individuals to be optimized and obtaining the optimal individual can be achieved by the following method:
[0103] S141, constructing an objective function based on the number of selected slicing paths and the spraying thickness errors of the three-dimensional points in the workpiece point cloud.
[0104] S142, optimizing the multiple individuals to be optimized according to the constructed objective function to obtain the optimal individual, wherein the objective function is minimized under the optimal individual.
[0105] In this embodiment, the constructed objective function is used as a guide to achieve individual optimization. On the one hand, the optimization goal is to make the spraying thickness error of the three-dimensional points in the workpiece point cloud as small as possible to ensure the spraying quality. On the other hand, the number of slice paths that need to be finally selected is as small as possible. The fewer the number of slice paths, the shorter the total time of the spraying operation, so that the spraying speed can be improved.
[0106] Based on this, in this embodiment, the objective function is constructed based on the number of selected slice paths and the spraying thickness error of the three-dimensional points in the workpiece point cloud. Then, the optimization is carried out according to the objective function as a guide, and the objective function should be minimized under the optimal individual finally determined. That is, the optimization direction is to optimize in the direction of minimizing the objective function.
[0107] Considering that if the spraying uniformity is evaluated simply by the spraying thickness error of each three-dimensional point, the effect is better when it comes to relatively perfect free-form surfaces. However, when there are some protruding structures on the surface corresponding to the workpiece surface, this method may cause areas with large local errors (such as areas that are blocked and cannot be sprayed or repeated spraying due to complex structures) to be given too high a weight, thereby reducing the overall spraying quality.
[0108] Based on this consideration, in this embodiment, the Huber kernel function is added to the objective function. The Huber kernel function can better handle outliers in the data and reduce the impact caused by the outliers.
[0109] Based on this, see Figure 7 In this embodiment, the step of constructing the objective function based on the number of selected slicing paths and the spraying thickness error of the three-dimensional points in the workpiece point cloud can be implemented in the following way:
[0110] S1411, counting the number of selected slice paths.
[0111] S1412, calculating the spraying thickness error between the spraying thickness estimate value and the spraying thickness target value of each three-dimensional point in the workpiece point cloud, and correcting the spraying thickness error using a huber kernel function.
[0112] S1413, constructing an objective function based on the counted quantity and the corrected spraying thickness error.
[0113] In this embodiment, the number of selected slice paths is counted, that is, by determining the elements representing the corresponding slice paths selected in the individuals to be optimized, the number of determined elements is counted, for example, the number of elements with a value of 1.
[0114] Then, the spraying thickness error between the spraying thickness estimate value and the spraying thickness target value of each 3D point in the workpiece point cloud is calculated. The calculation method of the spraying thickness estimate value of the 3D point can refer to the above content of this embodiment, which will not be repeated here.
[0115] Among them, the larger the spray thickness error, the greater the problem of spray unevenness at the corresponding three-dimensional point. For example, it may be a position on the workpiece surface that is not sprayed due to being blocked, or a position on the workpiece surface that is repeatedly sprayed due to a complex structure. Due to the existence of large spray thickness errors caused by these positions, the optimization process will be affected by these spray thickness errors. However, in the actual process, the blocked positions or positions with complex structures on the workpiece surface are difficult to achieve good spray uniformity. Therefore, there is no need to pay too much attention to them, otherwise it will affect the overall spray quality.
[0116] Based on this consideration, in this embodiment, after calculating the spraying thickness error of each three-dimensional point, the huber kernel function is used for correction. The huber kernel function can well avoid the influence of outliers on the overall optimization.
[0117] In this embodiment, the final objective function is as follows:
[0118]
[0119] in, is a weight factor used to balance the slice data and the uniformity of the spraying thickness. m Represents the number of 3D points in the workpiece point cloud, t j Indicates j Estimated spray thickness of 3D points, T desired Indicates the target value of spraying thickness. K is the huber kernel function, which indicates the correction of spraying thickness error.
[0120] Specifically, under the correction of the Huber kernel function, when the spraying thickness error is greater than a preset threshold (indicating that the spraying thickness estimate is abnormal), the Huber kernel function correction process is similar to the absolute error loss. In this way, the contribution of outliers in the objective function can be reduced, thereby reducing the impact of outliers on the optimization process and preventing the problem of overfitting.
[0121] In addition, in this embodiment, the initialized individuals to be optimized and the selected individuals must basically meet the set constraints, where the constraints can be set based on the spray coverage ratio, that is, while ensuring that the spray coverage ratio meets the requirements, find the spray trajectory with the best spray uniformity and the shortest spray trajectory.
[0122] Based on this, see Figure 8 In this embodiment, the step of optimizing multiple individuals to be optimized according to the constructed objective function to obtain the optimal individual can be achieved in the following way:
[0123] S1421, for each individual to be optimized, detecting whether the individual to be optimized satisfies a set constraint condition, wherein the constraint condition is composed of a spray coverage estimation value and a spray coverage target value.
[0124] S1422: If the individual to be optimized does not satisfy the constraint condition, a penalty term is added to the objective function corresponding to the individual to be optimized.
[0125] S1423, in each round of iteration, the individuals to enter the next round of iteration are selected based on the objective function corresponding to each individual to be optimized, until the iteration stop condition is met, and the optimal individual is obtained.
[0126] In this embodiment, the constraint condition is based on the spray coverage estimation value and the spray coverage target value, and can be specifically as follows:
[0127]
[0128] in, h i ( x i ) represents the estimated value of spray coverage finally achieved under the comprehensive operation of multiple slicing paths in an individual, H desired Represents the target value of spray coverage. That is, the constraint condition restricts the estimated value of spray coverage to be greater than or equal to the target value of spray coverage. For each 3D point in the workpiece point cloud, if the position of the 3D point is finally sprayed, it means that it is covered by spraying. In this way, the number of all 3D points covered by spraying can be counted, and the estimated value of spray coverage is obtained by dividing the number of 3D points covered by spraying by the total number of 3D points.
[0129] Check whether each individual to be optimized meets the constraints. If it does not meet the constraints, it means that its quality is poor and it is highly likely that it will not be selected to enter the next round of iteration. Therefore, in order to ensure that it is not selected to enter the next round of iteration, a penalty term can be added to its objective function. The fitness function obtained after adding the penalty term is as follows:
[0130]
[0131] in, is the penalty factor, Penalty(X k) represents the penalty term for not meeting the constraints, which is usually a significant value to ensure that unqualified solutions are unlikely to be selected.
[0132] From the above, we can see that in the process of individual optimization based on the constructed objective function as a guide, the optimization is carried out in the direction of minimizing the objective function. When selecting individuals to enter the next round of iteration, roulette or bidding selection methods can be used for selection, but the overall idea is that individuals with smaller objective functions will be selected to enter the next round of iterations, while individuals with larger objective functions may be eliminated. Therefore, if a penalty term is added to the objective function, the function value of the objective function will be increased accordingly, that is, the fitness value will be increased, which means that the probability of the corresponding individual not being selected will increase. In this way, it can be ensured that some individuals that do not meet the constraints are not selected to enter the next round of iterations.
[0133] In this embodiment, the optimization method can adopt a genetic algorithm. In order to avoid falling into a local optimal solution during individual optimization and making it difficult to find a global optimal solution, after selecting the individuals to enter the next round of iteration based on the objective function corresponding to the individuals to be optimized, crossover operations and / or mutation operations can also be performed on the individuals to expand the diversity of individuals.
[0134] Specifically, for the selected individuals, transformation operations are performed on the elements included in the individuals to generate new individuals.
[0135] The transformation operation may be to randomly transform element 0 in an individual into 1, and transform element 1 into 0, without any specific limitation.
[0136] In addition, for any two selected individuals, the elements in the two individuals are cross-transformed to generate new individuals.
[0137] That is, the elements at corresponding positions of two individuals can be exchanged, so as to generate a new individual based on the two individuals.
[0138] By generating new individuals, we can avoid falling into the local optimal solution, so as to ensure that the optimal solution in the global scope is finally found, thereby improving the final spraying quality.
[0139] It should be noted that the new individuals generated by the above method must also ensure that the constraints are met. For individuals that do not meet the constraints, repair operations can be applied to adjust them. For example, the necessary slice paths can be added through a greedy strategy or the selection of existing slice paths can be adjusted to make them meet the constraints.
[0140] In the optimization process, the above selection, crossover operation, mutation operation, etc. are repeated to perform multiple rounds of iterations, and finally the optimal individual with the smallest objective function is found, so as to determine the spraying path based on the optimal individual.
[0141] In the spray trajectory planning of large-scale free-form surfaces, as the number of slices increases, the increase in the number of variables and numerical range in the existing optimization algorithm significantly expands the search space of the optimization algorithm, resulting in a significant increase in computational complexity and time cost.
[0142] In this embodiment, multiple cutting planes are generated to cut the workpiece point cloud to generate multiple slice paths, so as to convert large-scale continuous variables into limited discrete options, and whether the slice path is selected is used as an optimization variable to achieve variable decoupling, avoid the defects of strong coupling and mutual influence between optimization variables, reduce the possibility of falling into local solutions, optimize the spraying quality, and improve the trajectory optimization speed. The set covering method is adopted to replace a large number of continuous variables with limited discrete options without affecting the optimization quality, and then optimize them through combination, thereby improving the optimization speed. At the same time, the number of calls to the spray deposition model is reduced, and the planning speed is further improved.
[0143] In the existing spraying effect evaluation, the uniformity of the paint film thickness is evaluated by calculating the sum of squares of the deviations between the actual coating thickness and the expected thickness at all points in the spraying area. When there are local features of complex structures on the free-form surface, this evaluation method causes the algorithm to overfit these areas, resulting in a worse spraying effect. Therefore, this evaluation method is not suitable for most workpieces. In this embodiment, the huber kernel function is introduced to correct outliers with large errors, thereby solving the problem of uneven spraying caused by local complex structures on large-size free-form surfaces, avoiding common local optimization traps, and enhancing the uniformity and stability of the spraying thickness.
[0144] The optimization variable of the existing slice interval optimization method is the distance of the slice relative to the previous slice. When the number of slices is large, this method will greatly increase the possibility of falling into a local solution due to the mutual coupling between variables. In this embodiment, whether to select a new slice path is used as the optimization variable, and the selection of the previous slice path will not affect the selection of the subsequent slice path, thereby decoupling the variables, reducing the possibility of falling into a local solution, and thus improving the spraying quality.
[0145] Overall, the solution provided in this embodiment can solve the optimization difficulty problem caused by the increase in the number of slices of large-sized workpieces. The slice interval is optimized by the collective covering technology, showing excellent planning efficiency while maintaining the uniformity of the spraying effect. It is particularly suitable for large-sized free-form surface applications that require fast planning of spraying trajectories.
[0146] Based on the same inventive concept, please refer to Fig. 9, an embodiment of the present invention further provides a functional module schematic diagram of a spray trajectory planning device. This embodiment can divide the functional modules of the spray trajectory planning device according to the above method embodiment. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present invention is schematic, which is only a logical function division, and there may be other division methods in actual implementation.
[0147] For example, when each functional module is divided into corresponding functional modules, Fig. 9 The spray trajectory planning device shown is only a schematic diagram of the device. The spray trajectory planning device may include an acquisition module, a cutting module, a generation module, an optimization module and a selection module. The functions of each functional module of the spray trajectory planning device are described in detail below.
[0148] An acquisition module, used for acquiring a workpiece point cloud of a workpiece to be sprayed;
[0149] A cutting module, used for cutting the workpiece point cloud using multiple cutting planes to obtain multiple slicing paths;
[0150] A generating module, used for generating a plurality of individuals to be optimized based on the plurality of slicing paths, wherein each of the individuals to be optimized includes the same number of elements as the slicing paths, and each of the elements is an identifier indicating whether the corresponding slicing path is selected;
[0151] An optimization module, used to optimize the multiple individuals to be optimized to obtain the best individual;
[0152] A selection module is used to select a target slicing path from the multiple slicing paths based on the optimal individual, and to form a spraying trajectory based on the target slicing path.
[0153] It can be understood that the above-mentioned acquisition module, cutting module, generation module, optimization module and selection module can be used to execute the above-mentioned S11 to S15. For the detailed implementation method of the acquisition module, cutting module, generation module, optimization module and selection module, please refer to the relevant contents of the above-mentioned S11 to S15.
[0154] In a possible implementation, the above optimization module may be used to:
[0155] constructing an objective function based on the number of selected slicing paths and the spraying thickness error of the three-dimensional points in the workpiece point cloud;
[0156] According to the constructed objective function, the multiple individuals to be optimized are optimized to obtain the optimal individual, wherein the objective function is minimized under the optimal individual.
[0157] In a possible implementation, the above optimization module may be specifically used for:
[0158] Count the number of selected slice paths;
[0159] Calculating the spraying thickness error between the spraying thickness estimate value and the spraying thickness target value of each three-dimensional point in the workpiece point cloud, and correcting the spraying thickness error using a huber kernel function;
[0160] The objective function is constructed based on the counted quantity and the corrected spray thickness error.
[0161] In a possible implementation, the cutting module can be used to obtain an estimated spray thickness in the following manner:
[0162] For each of the slicing paths, obtaining a spraying posture of the spraying robot when operating along the slicing path;
[0163] Based on the spraying posture and the set spraying parameters, an estimated value of the spraying thickness generated by the spraying robot for each three-dimensional point in the workpiece point cloud when the spraying robot operates along the slicing path is obtained.
[0164] In a possible implementation, the cutting module may be specifically used for:
[0165] Sampling is performed on the slice path according to a set sampling interval to obtain a plurality of sampling points;
[0166] Obtaining a normal vector of each sampling point, and extending each sampling point along the direction of its normal vector by a preset distance to locate an extension point;
[0167] Based on the position information of each of the extension points, the normal vector of the extension point and the forward direction of the spraying robot, the spraying posture of the spraying robot when operating along the slicing path is determined.
[0168] In a possible implementation, the above optimization module may be used to:
[0169] For each individual to be optimized, detecting whether the individual to be optimized satisfies a set constraint condition, wherein the constraint condition is formed based on a spray coverage estimation value and a spray coverage target value;
[0170] If the individual to be optimized does not satisfy the constraint condition, a penalty term is added to the objective function corresponding to the individual to be optimized;
[0171] In each round of iteration, the individuals to enter the next round of iteration are selected based on the objective functions corresponding to the individuals to be optimized, until the iteration stop condition is met to obtain the optimal individual.
[0172] In a possible implementation, the above optimization module can also be used for:
[0173] For the selected individuals, transforming the elements included in the individuals to generate new individuals;
[0174] For any two selected individuals, cross-transformation is performed on the elements in the two individuals to generate a new individual.
[0175] In a possible implementation, the cutting module may be used to:
[0176] Constructing a covariance matrix based on the three-dimensional points in the workpiece point cloud, performing singular value decomposition on the covariance matrix, and obtaining eigenvalues and eigenvectors corresponding to the eigenvalues;
[0177] A plurality of cutting planes whose normal vectors are parallel to the feature vectors are constructed, and cutting lines between each of the cutting planes and the workpiece point cloud are obtained as slicing paths.
[0178] In a possible implementation, there are multiple characteristic values, and the cutting module can be specifically used for:
[0179] Determine the largest eigenvalue among the multiple eigenvalues, and determine the eigenvector corresponding to the largest eigenvalue as the dominant eigenvector;
[0180] A plurality of cutting planes whose normal vectors are parallel to the dominant eigenvector are constructed.
[0181] See also Fig.10 , is a block diagram of an electronic device provided in an embodiment of the present invention, the electronic device may be a computer device, etc., and the electronic device includes a memory, a processor, and a communication module. The memory, the processor, and the communication module are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines.
[0182] The memory is used to store computer programs or data. The memory can be, but is not limited to, random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0183] The processor is used to read / write data or programs stored in the memory and execute the spraying trajectory planning method provided by any embodiment of the present invention.
[0184] The communication module is used to establish a communication connection between the electronic device and other communication terminals through the network, and is used to send and receive data through the network.
[0185] It should be understood that Fig.10 The structure shown is only a schematic diagram of the structure of the electronic device. The electronic device may also include Fig.10 More or fewer components as shown, or with Fig.10 Different configurations are shown.
[0186] Furthermore, an embodiment of the present invention also provides a computer-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are executed, the spray trajectory planning method provided in the above embodiment is implemented.
[0187] Specifically, the computer-readable storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the computer-readable storage medium is executed, the above-mentioned spray trajectory planning method can be executed. Regarding the process involved when the computer-readable storage medium and its executable instructions are executed, reference can be made to the relevant description in the above-mentioned method embodiment, which will not be described in detail here.
[0188] In summary, the spray trajectory planning method and electronic device provided in the embodiments of the present invention utilize multiple cutting planes to cut the workpiece point cloud of the workpiece to be sprayed to obtain multiple slice paths. Based on the multiple slice paths, multiple individuals to be optimized are generated, and each individual to be optimized includes the same number of elements as the slice paths, and each element is an identifier that characterizes whether the corresponding slice path is selected. The multiple individuals to be optimized are optimized to obtain the optimal individual, and the target slice path is selected from the multiple slice paths based on the optimal individual, and the spray trajectory is constructed based on the target slice path. In this solution, whether the slice path is selected is used as an optimization variable, which realizes variable decoupling, reduces the complexity of the mutual influence between variables, and reduces the possibility of falling into a local solution, thereby improving the spraying quality.
[0189] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0190] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0191] Furthermore, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0192] It should be noted that if the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0193] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0194] The above description is only an embodiment of the present invention and is not intended to limit the protection scope of the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A spraying trajectory planning method, characterized in that: The method comprises: Obtaining a workpiece point cloud of a workpiece to be sprayed; Using multiple cutting planes to cut the workpiece point cloud to obtain multiple slicing paths; Generating a plurality of individuals to be optimized based on the plurality of slice paths, wherein each of the individuals to be optimized includes the same number of elements as the slice paths, and each of the elements is an identifier indicating whether the corresponding slice path is selected; Optimizing the multiple individuals to be optimized to obtain the optimal individual; A target slicing path is selected from the plurality of slicing paths based on the optimal individual, and a spraying trajectory is formed based on the target slicing path.
2. The spraying trajectory planning method according to claim 1, characterized in that: The step of optimizing the multiple individuals to be optimized to obtain the optimal individual includes: Constructing an objective function based on the number of selected slicing paths and the spraying thickness error of the three-dimensional points in the workpiece point cloud, wherein the spraying thickness error is obtained by correcting the difference between the spraying thickness estimate value and the spraying thickness target value of each three-dimensional point in the workpiece point cloud using a huber kernel function; According to the constructed objective function, the plurality of individuals to be optimized are optimized to obtain an optimal individual, wherein the objective function is minimized under the optimal individual; The spray thickness estimate is obtained by: For each of the slicing paths, the spraying posture of the spray robot when operating along the slicing path is obtained; based on the spraying posture and the set spraying parameters, the estimated spraying thickness generated by the spray robot for each three-dimensional point in the workpiece point cloud when operating along the slicing path is obtained.
3. The spraying trajectory planning method according to claim 2, characterized in that: The step of constructing an objective function based on the number of selected slicing paths and the spraying thickness error of the three-dimensional points in the workpiece point cloud comprises: Count the number of selected slice paths; Calculating the spraying thickness error between the spraying thickness estimate value and the spraying thickness target value of each three-dimensional point in the workpiece point cloud, and correcting the spraying thickness error using a huber kernel function; The objective function is constructed based on the counted quantity and the corrected spray thickness error.
4. The spraying trajectory planning method according to claim 2, characterized in that: The step of obtaining the spraying posture of the spraying robot when operating along the slicing path includes: Sampling is performed on the slice path according to a set sampling interval to obtain a plurality of sampling points; Obtaining a normal vector of each sampling point, and extending each sampling point along the direction of its normal vector by a preset distance to locate an extension point; Based on the position information of each of the extension points, the normal vector of the extension point and the forward direction of the spraying robot, the spraying posture of the spraying robot when operating along the slicing path is determined.
5. The spraying trajectory planning method according to claim 2, characterized in that: The step of optimizing the multiple individuals to be optimized according to the constructed objective function to obtain the optimal individual includes: For each individual to be optimized, detecting whether the individual to be optimized satisfies a set constraint condition, wherein the constraint condition is formed based on a spray coverage estimation value and a spray coverage target value; If the individual to be optimized does not satisfy the constraint condition, a penalty term is added to the objective function corresponding to the individual to be optimized; In each round of iteration, the individuals to enter the next round of iteration are selected based on the objective functions corresponding to the individuals to be optimized, until the iteration stop condition is met to obtain the optimal individual.
6. The spraying trajectory planning method according to claim 5, characterized in that: After the step of selecting the individuals to enter the next round of iteration based on the objective functions corresponding to the individuals to be optimized, the method further includes at least one of the following: For the selected individuals, transforming the elements included in the individuals to generate new individuals; For any two selected individuals, cross-transformation is performed on the elements in the two individuals to generate a new individual.
7. The spraying trajectory planning method according to claim 1, characterized in that: The step of cutting the workpiece point cloud using multiple cutting planes to obtain multiple slicing paths includes: Constructing a covariance matrix based on the three-dimensional points in the workpiece point cloud, performing singular value decomposition on the covariance matrix, and obtaining eigenvalues and eigenvectors corresponding to the eigenvalues; A plurality of cutting planes whose normal vectors are parallel to the feature vectors are constructed, and cutting lines between each of the cutting planes and the workpiece point cloud are obtained as slicing paths.
8. The spraying trajectory planning method according to claim 7, characterized in that: The characteristic value is multiple; The step of constructing a plurality of cutting planes whose normal vectors are parallel to the feature vectors comprises: Determine the largest eigenvalue among the multiple eigenvalues, and determine the eigenvector corresponding to the largest eigenvalue as the dominant eigenvector; A plurality of cutting planes whose normal vectors are parallel to the dominant eigenvector are constructed.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Intelligent automobile paint spraying method based on cloud computing
CN106853433A
Spraying robot trajectory planning method based on improved point cloud slicing algorithm
CN112632718A