Workpiece surface complete spraying path generation method based on design model
Through the design model-based method, the sub-spraying surface of the workpiece surface is segmented and optimized to generate a complete spray path, which solves the problem of dependence on point cloud data in the prior art, and achieves more efficient and accurate workpiece surface spray path planning.
Patent Information
- Application Number
- CN202510076417.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-05-30
AI Technical Summary
The prior art relies on point cloud data in the planning of surface spraying paths of large three-dimensional workpieces, and there are problems such as accuracy error, noise interference, difficulty in generating smoothing models, and high computing resources.
The complete spray path generation method of the workpiece surface based on the design model is adopted. By obtaining the three-dimensional model of the workpiece, segmenting it into sub-spray surfaces, an undirected graph structure model is constructed, the connection sequence is optimized using the maximum matching algorithm, and the key spray points are obtained through grid segmentation to generate a complete spray path.
Without image acquisition and point cloud processing, the data is more complete and accurate, improving the accuracy and efficiency of the spray path, automatically identifying the sub-spraying surface and optimizing the connection sequence, which is suitable for spraying on complex workpiece surfaces.
Smart Images

Figure CN120070810A_ABST
Abstract
Description
Technical Field
[0001] The present invention discloses a method for generating a complete spraying path on the surface of a workpiece based on a design model, belonging to the technology of automatic spraying processing of workpieces. Background Art
[0002] At present, automatic spraying has been realized for the surface spraying of large workpieces, such as the surface spraying of workpieces such as vehicle surfaces, train car body skins, and aircraft skins. In the automatic spraying operation on the surface of three-dimensional workpieces, planning a reasonable spraying path on the workpiece surface is an important prerequisite for improving spraying efficiency and ensuring spraying quality.
[0003] Currently, the path planning technology for the surface spraying operation of large three-dimensional workpieces is mostly based on a point cloud model. The point cloud information of the workpiece image is obtained through image acquisition. For example, a robot spraying path planning method based on the point cloud data of an aircraft skin disclosed in a Chinese patent with the application number CN202311841162.3 collects the actual point cloud data of the skin to be sprayed for preprocessing, and converts it into the robot base coordinate system through a transformation matrix; uses the longitude and latitude traversal method to cut the point cloud one by one on the plane of the maximum projection coordinate system of the point cloud to obtain the outermost contour points of the point cloud, divides the edge point clouds according to the existing mathematical model to generate independent point cloud data respectively; performs spatial high-order curve fitting on each edge point cloud to obtain the intersection points of each pair of edges, sets the intervals in each direction, and equally takes points according to the fitting curve to obtain evenly spaced optimized edge point clouds, performs three-dimensional optimization and compensation calculations on each path point to find the normal vector corresponding to each path point; plans and optimizes the spraying path to obtain a spraying path that meets the requirements of the scene application.
[0004] In the actual production scenario, the point cloud acquisition of large workpieces requires cost, and the collected point cloud data also needs to be processed and repaired by other means according to the differences in image acquisition technology. There are the following technical deficiencies: (1) The accuracy of the point cloud itself has errors, and its model sampling requires special equipment; (2) The collected point cloud data often contains noise points and irregularities, which will interfere with the accuracy of trajectory planning. Additional preprocessing steps are required to remove noise and fill holes. (3) It may be difficult to generate a smooth surface model from the point cloud, especially when the point cloud density is uneven or there are missing parts, which will affect the continuity and uniformity of the spraying trajectory; (4) Extracting geometric features (such as curvature, boundaries, etc.) from the point cloud and performing path planning based on these features usually requires complex algorithms and high computing resources. Summary of the Invention
[0005] The technical problem solved by the present invention is: aiming at the defect of the existing method that requires collecting the point cloud data of the workpiece for the spraying path planning on the workpiece surface, a method for generating a complete spraying path on the workpiece surface based on a design model is provided.
[0006] The present invention is implemented by the following technical solutions:
[0007] A method for generating a complete spraying path on the surface of a workpiece based on a design model, specifically including the following steps:
[0008] S1. Obtain all triangular patches that make up the surface of the three-dimensional model through the three-dimensional model of the workpiece to be sprayed;
[0009] S2. Traverse all triangular patches on the surface of the three-dimensional model, perform clustering according to the included angle of the normal vectors between the triangular patches, and divide the surface of the three-dimensional model according to the clustering results to obtain several sub-spraying surfaces;
[0010] S3. All sub-spraying surfaces are used to construct a bipartite graph through a first undirected graph structure model, the maximum matching algorithm is used to obtain the maximum matching in all bipartite graphs, a path is constructed with the edges in the maximum matching, and the final connection order of all vertices in the bipartite graph is obtained by merging the constructed paths, and the connection order between the sub-spraying surfaces is extracted;
[0011] S4. Perform grid segmentation on each sub-spraying surface, construct path segments according to the intersection of the cutting plane of the grid segmentation and the triangular patches in the sub-spraying surface, and obtain key spraying points covering the entire sub-spraying surface by segmenting the path segments;
[0012] S5. Connect the key spraying points of all sub-spraying surfaces according to the connection order between the sub-spraying surfaces to create a complete spraying path on the surface of the three-dimensional model of the workpiece to be sprayed.
[0013] In the method for generating a complete spraying path on the surface of a workpiece based on a design model of the present invention, further, in the step S1, obtain triangular patch parameters including vertices, normal vectors, areas, and patch adjacency relationships, and represent this information using a list or dictionary data structure.
[0014] In the method for generating a complete spraying path on the surface of a workpiece based on a design model of the present invention, further, the step S2 includes the following sub-steps:
[0015] S21. Initialize, create an empty list to store the index list of triangular patches in each sub-spraying surface segmented, and create an empty set to record the triangular patch indices that have been added to the above list;
[0016] S22. Sort the triangular patches on the surface of the three-dimensional model in descending order according to the triangular patch areas, convert the areas of all triangular patches into a one-dimensional array, and sort the indices of the triangular patches in descending order of area;
[0017] S23. Traverse the triangle meshes arranged in descending order, compare the included angles of the normal vectors between the triangle meshes, cluster the triangle meshes according to the comparison results of the included angles of the normal vectors, obtain the segmented sub-spraying surfaces, and update the index list in step S21;
[0018] S24. Repeat step S23 until all triangle meshes are visited;
[0019] S25. Return the triangle index list containing all the segmented sub-spraying surfaces.
[0020] In the method for generating a complete spraying path on the surface of a workpiece based on a design model of the present invention, further, in step S23, according to the order of arranging the triangle meshes in descending order of area, obtain the first triangle mesh that has not been added to any sub-spraying surface, and use it as the seed triangle mesh of a new sub-spraying surface. Then traverse the triangle meshes adjacent to the current seed triangle mesh and not in the current sub-spraying surface, and compare the included angles of the normal vectors between the triangle meshes through the following requirements:
[0021] A. The included angle between the visited triangle mesh and the normal vector of the current sub-spraying surface is less than the first threshold angle, and the normal vector of the sub-spraying surface is the average value of the normal vectors of all current triangle meshes in the sub-spraying surface;
[0022] B. The included angles between the visited triangle mesh and the normal vectors of all current triangle meshes in the current sub-spraying surface are less than the second threshold angle;
[0023] If the visited triangle mesh satisfies both requirements A and B, it is added to the current sub-spraying surface, the normal vector of the current sub-spraying surface is updated, and the newly added triangle mesh is used as the new seed triangle mesh of the current sub-spraying surface;
[0024] Repeat the above traversal process until no new triangle meshes are added to the current sub-spraying surface, and add all the triangle meshes of the current sub-spraying surface to the index list in step S21.
[0025] In the method for generating a complete spraying path on the surface of a workpiece based on a design model of the present invention, further, step S3 includes the following sub-steps:
[0026] S31. Construct a first undirected graph structure model of the sub-spraying surface, use each segmented sub-spraying surface as a vertex of the undirected graph, obtain the adjacency relationship of the sub-spraying surface through the adjacency relationship of all triangle meshes in the sub-spraying surface, and use the adjacency relationship between the sub-spraying surfaces as the edges in the undirected graph structure model;
[0027] S32. Construct a bipartite graph based on the first undirected graph structure model, and use the Hopcroft Karp algorithm to find the maximum matching in the bipartite graph. The maximum matching is the largest set of edges in the bipartite graph that do not share the same vertices.
[0028] S33. Start constructing paths from each unvisited left vertex in the bipartite graph, sequentially visit the matched vertices along the edges in the maximum matching, and add the constructed paths to the path list.
[0029] S34. Repeat step S33 to process all unvisited left vertices in the bipartite graph, and merge the paths in the path list by connecting the same vertices at the head and tail to obtain the final path order of all vertices in the bipartite graph.
[0030] S35. Connect according to the final path order obtained from the bipartite graph to generate the connection order between each sub-spraying surface, that is, the spraying path between all sub-spraying surfaces on the surface of the workpiece three-dimensional model to be sprayed.
[0031] In the method for generating a complete spraying path on the surface of a workpiece based on a design model of the present invention, further, the step S4 includes the following sub-steps:
[0032] S41. Traverse the vertex coordinates of all triangular patches within the sub-spraying surface to obtain the position range and normal vector of the cutting plane for meshing the sub-spraying surface.
[0033] S42. Find all the indexes of the triangular patches within the sub-spraying surface that intersect with the cutting plane.
[0034] S43. Construct a second undirected graph structure model with all the triangular patches within the sub-spraying surface that intersect with the cutting plane for topological sorting.
[0035] S44. Find all the connected components in the second undirected graph structure model, and for each connected component, construct the path segments between the triangular patches intersecting with the cutting plane through intersection point calculation to obtain the continuous path segments between all the cutting planes within the sub-spraying surface. The cutting path points along the path segments are used as the key spraying points within the sub-spraying surface, and the normal vectors of the triangular patches corresponding to the key spraying points are returned.
[0036] In the method for generating a complete spraying path on the surface of a workpiece based on a design model according to the present invention, further, in step S41, by traversing the vertex coordinates of all triangular patches within the sub-spraying surface, the minimum and maximum coordinate values of the cutting plane boundary coordinates are updated. The range of the cutting plane boundary in each coordinate axis direction is determined by the updated minimum and maximum coordinate values of the cutting plane boundary coordinates. The direction of the second-largest coordinate value within this range is selected as the normal vector direction of the cutting plane cluster. Based on the selected normal vector direction, the cutting plane normal vector is set. According to the selected cutting plane normal vector direction, the minimum and maximum coordinate values are calculated, and the position range of the cutting plane is determined based on the path_gap parameter.
[0037] In the method for generating a complete spraying path on the surface of a workpiece based on a design model according to the present invention, further, in step S43, the second undirected graph uses the index values of all triangular patches within the sub-spraying surface that intersect with the cutting plane as vertices. By traversing the adjacency relationship list of all triangular patches, if two triangular patches are both in the set of triangular patches that intersect with the selected cutting plane and are not the same triangular patch, an edge connecting these two vertices is added in the second undirected graph.
[0038] In the method for generating a complete spraying path on the surface of a workpiece based on a design model according to the present invention, further, in step S44, the triangular patch indices within the connected component are traversed, and the edges within the triangular patches that intersect with the cutting plane are recorded. A continuous path segment is constructed using the intersection points of the cutting plane and the edges within the triangular patches and the index of the triangular patch, and the obtained path segment and the corresponding triangular patch normal vector are stored.
[0039] Collect the path segments within all cutting planes within the sub-spraying surface and evenly divide them to obtain cutting path points. The cutting path points are used as the key spraying points within the sub-spraying surface, and the triangular patch normal vectors corresponding to the key spraying points are obtained.
[0040] In the method for generating a complete spraying path on the surface of a workpiece based on a design model according to the present invention, further, in step S5, the order of the key spraying points in the current sub-spraying surface path is adjusted according to the last key spraying point in the path segment of the key spraying points in the previous sub-spraying surface; if the distance between the starting key spraying point on the path segment of the current sub-spraying surface and the ending key spraying point on the path segment of the previous sub-spraying surface is greater than the distance between the ending key spraying point on the path segment of the current sub-spraying surface and the ending key spraying point on the path segment of the previous sub-spraying surface, the connection order of the key spraying points on the path segment of the current sub-spraying surface is reversed.
[0041] The complete spraying trajectory generation technology provided by the present invention is based on the sub-spraying surface segmentation information of the three-dimensional model of the workpiece. It automatically identifies and segments the sub-spraying surfaces through the normal vectors of the triangular patches that make up the surface of the three-dimensional model of the workpiece, processes the obtained information of each sub-spraying surface, obtains the key spraying points and paths of the sub-spraying surfaces, and combines the connection order between the sub-spraying surfaces to generate a complete spraying path on the surface of the workpiece.
[0042] The present invention has the following beneficial effects:
[0043] (1) The present invention directly generates the surface spraying path through the three-dimensional model of the workpiece design, without the need to collect and process the point cloud data of the workpiece through image acquisition. The design model data of the workpiece is more complete and accurate than the collected point cloud data, without the error generated in the image acquisition process, and fits more precisely with the actual data of the workpiece surface, ensuring the accuracy of spraying. Since the present invention generates the spraying path based on the drawing information rather than the point cloud information, it has a good effect on spraying workpieces with complex surfaces.
[0044] (2) Automatically identify sub-spraying surfaces. When spraying the entire surface of the workpiece, due to considering the movement range of the spraying robot arm, it cannot remain completely stationary during the process of starting to spray to finishing spraying the workpiece. And because there are convex or concave features on the workpiece surface, they need to be considered separately from the plane. The present invention uses the normal vectors of the triangular patches that make up the surface of the three-dimensional model, and divides the sub-spraying surfaces by the method of normal vector clustering, clusters the areas with relatively small changes in the undulation angle of the workpiece surface, and automatically identifies and segments the sub-spraying surfaces on the three-dimensional workpiece. According to the workpiece drawing, the vector information can be easily obtained and accurately clustered, which is more convenient, fast and accurate.
[0045] (3) Optimize the connection order of sub-spraying surfaces. The present invention optimizes the connection order between each sub-spraying surface through the maximum matching algorithm of the bipartite graph. By constructing an undirected graph with each sub-spraying surface as a vertex, the spraying order problem between each sub-spraying surface is solved through the minimum path covering problem of the undirected graph. By the maximum matching of the bipartite graph, the empty travel and re-spraying areas in the planned spraying line are reduced, thereby improving the automatic spraying efficiency of the workpiece surface.
[0046] (4) Inside the identified sub-spraying surface, the sub-spraying surface is segmented by the cutting plane of grid segmentation, combined with the undirected graph structure model to connect and sort the path line segments. By segmenting the path line segments, the key spraying points that can fully cover the sub-spraying surface are obtained, and combined with the connection order between the sub-spraying surfaces, a complete continuous spraying route corresponding to the workpiece surface is automatically planned.
[0047] In summary, the method for generating a complete spraying path for the surface of a workpiece based on a design model provided by the present invention takes the three-dimensional model designed for the workpiece as the planning basis, and the data acquisition and processing are more efficient and accurate. It can automatically plan a complete spraying path for the complex surface of the workpiece, providing an efficient and standard spraying route decision for the automated spraying production of the workpiece.
[0048] The following further describes the present invention in conjunction with the accompanying drawings and specific embodiments. Brief Description of the Drawings
[0049] Figure 1 It is a flowchart of the steps of the method for generating a complete spraying path for the surface of a workpiece based on a design model of the present invention.
[0050] Figure 2 It is a flowchart of the steps for the present invention to obtain sub-spraying surfaces on the workpiece surface.
[0051] Figure 3 It is a flowchart of the steps for the present invention to obtain the connection sequence between sub-spraying surfaces.
[0052] Figure 4 It is a flowchart of the steps for the present invention to obtain key spraying points within a sub-spraying surface. Detailed Description of the Invention
[0053] Embodiment
[0054] The present invention is a method for generating a complete spraying path for spraying the surface of a workpiece based on the design model of the workpiece, which specifically includes the following steps:
[0055] Based on the above three-dimensional model of the workpiece, the specific process of the method for planning the spraying path on the workpiece surface in the present invention is as follows:
[0056] S1. Through the three-dimensional model of the workpiece to be sprayed, obtain all triangular facets that make up the surface of the three-dimensional model. Analyze and preprocess the three-dimensional model of the workpiece to be sprayed, obtain the vertices, normal vectors, areas, and facet adjacency relationships of the triangular facets on the surface of the three-dimensional model of the workpiece to be sprayed, and represent this information using a list or dictionary data structure.
[0057] The three-dimensional model of the workpiece to be sprayed is derived from the three-dimensional model file designed for the workpiece, and a common file format for 3D printing and CAD / CAM application programs is adopted. The three-dimensional model consists of a series of triangular facets, each triangular facet is composed of three vertices and its normal vector, and each triangular facet must share two vertices with its adjacent triangles.
[0058] After reading the 3D model file of the workpiece to be sprayed, information such as vertices, patches, normal vectors, areas, and adjacency relationships is obtained based on the vertex coordinate information and normal vector information of the triangular patches that make up the 3D model, and these information are represented using data structures such as lists or dictionaries for subsequent operations.
[0059] By traversing each triangular patch of the 3D model, the triangular patch index of the vertex and the vertex index of the triangular patch are constructed. The vertices contained in each triangular patch and the relationship information of the triangular patches where each vertex exists are obtained.
[0060] Calculate the vertex normal vector of the triangular patch. For each vertex, first obtain the list of triangular patches containing the current vertex, and then calculate the weighted average normal vector value according to the area of each triangular patch as the weight size. This normal vector value is the normal vector of the current vertex. The normal vector of the path points in each sub-spraying surface is obtained through the normal vector of the triangular patch vertices, and the spraying direction of the spraying tool on the robotic arm is indicated by the normal vector.
[0061] Calculate the adjacency relationship of the triangular patches. By traversing each triangular patch, determine the triangular patches sharing vertices, and add the indexes of these triangular patches to the adjacency list of the current triangular patch to represent the adjacency relationship between the two triangular patches. At the same time, ensure that the adjacency list does not contain the current triangular patch itself.
[0062] S2. Segment the sub-spraying surfaces on the surface of the 3D model based on the normal vectors between the triangular patches. Traverse all the triangular patches on the surface of the 3D model, perform clustering according to the included angle of the normal vectors between the triangular patches, and segment the surface of the 3D model according to the clustering results to obtain several sub-spraying surfaces. See Figure 2 Specifically, it includes the following sub-steps:
[0063] S21. Initialization.
[0064] Create an empty list to store the list of triangular patch indexes of each segmented sub-spraying surface, and create an empty set to record the triangular patch indexes that have been added to the above list.
[0065] S22. Sort the triangular patches on the surface of the 3D model in descending order by area.
[0066] Convert the areas of all the triangular patches on the surface of the 3D model into a one-dimensional array, and sort the indexes of the triangular patches in descending order by area.
[0067] S23. Traverse all triangular patches on the surface of the 3D model and segment the sub-spraying surfaces. During the traversal, compare the included angles between the normal vectors of the triangular patches, cluster the triangular patches according to the comparison results of the included angles between the normal vectors, obtain the segmented sub-spraying surfaces, and update the index list in step S21.
[0068] According to the order sorted in the previous step, obtain the first triangular patch that has not been added to any sub-spraying surface. In descending order, this triangular patch is the triangular patch with the largest area among all triangular patches. Take it as the seed triangular patch of a new sub-spraying surface and start the subsequent segmentation operation. By traversing the triangular patches that are within the current sub-spraying surface and are the seed triangular patch, and are not within the current sub-spraying surface, check whether the triangular patch meets the following conditions:
[0069] Condition A: The included angle between the accessed triangular patch and the normal vector of the current sub-spraying surface is less than the set first threshold angle. The normal vector of the current sub-spraying surface is the average value of the normal vectors of all triangular patches within the sub-spraying surface.
[0070] Condition B: The included angle between the current triangular patch and the normal vectors of all triangular patches within the current sub-spraying surface is less than the set second threshold angle.
[0071] The settings of the first threshold angle and the second threshold angle are related to the performance of the spraying robotic arm. If the movement range of the spraying robotic arm is large, these parameters can be set larger, and the requirements for the sub-spraying surface can be less flat. The smaller the threshold angle is set, the flatter the clustered sub-spraying surface will be. The first threshold angle and the second threshold angle are generally selected as 20°.
[0072] If the currently accessed triangular patch meets the above conditions, add the current triangular patch to the current sub-spraying surface, update the average normal vector of the current sub-spraying surface at the same time, and use the newly added triangular patch as the seed triangular patch for subsequent clustering and segmentation of the sub-spraying surface. If it does not meet the above conditions, do not add the triangular patch to any sub-spraying surface and wait to be used as the seed triangular patch of a new sub-spraying surface after subsequent steps are accessed.
[0073] Repeat the above steps until no new triangular patches are added to the current sub-spraying surface, and add the current sub-spraying surface to the triangular patch index list of the sub-spraying surfaces created in step S21.
[0074] S24. Repeat step S23, traverse in descending order according to step S22 from the remaining triangular patches that have not been added to any sub-spraying surface until all triangular patches on the surface of the 3D model have been accessed.
[0075] S25. Return the triangle index list containing all the segmented sub-spraying surfaces. After the above steps, the segmented regions of the three-dimensional model of the workpiece are obtained, and each segmented region is a sub-spraying surface of the workpiece to be sprayed.
[0076] S3. Obtain a bipartite graph by constructing an undirected graph structure model for all the sub-spraying surfaces on the surface of the three-dimensional model. Use the maximum matching algorithm to obtain the maximum matching in all the bipartite graphs. Construct paths with the edges in the maximum matching, and merge the constructed paths to obtain the final connection order of all the vertices in the bipartite graph. Extract the connection order between the sub-spraying surfaces as the spraying path between all the sub-spraying surfaces on the surface of the three-dimensional model of the workpiece to be sprayed. For details, see Figure 3 , which specifically includes the following sub-steps:
[0077] After obtaining each sub-spraying surface, in order to facilitate spraying or further processing and ensure the continuity and efficiency of the spraying or processing process, the connection order of each sub-spraying surface is obtained through this step. This step abstracts each sub-spraying surface into an undirected graph structure. The vertices in the undirected graph are the segmented sub-spraying surfaces, and the edges represent the connection between two sub-spraying surfaces. Each sub-spraying surface only needs to be sprayed once during the spraying process. This problem is converted into the minimum path covering problem of the undirected graph, that is, finding as few paths as possible to visit each node, and each node is only visited once. This problem can be solved through the maximum matching of the undirected graph. The specific process includes the following sub-steps.
[0078] S31. Construct the undirected graph structure model of the sub-spraying surfaces. Use the tool library networkx to create an undirected graph model structure. Add each segmented sub-spraying surface as a vertex of the undirected graph to the undirected graph model. For each sub-spraying surface, find all the adjacent triangular patches of the triangular patches within the sub-spraying surface. After excluding its own triangular patch, obtain the adjacent triangular patches of the sub-spraying surface. Find the sub-spraying surfaces where each adjacent triangular patch is located, that is, obtain the adjacency relationship of the sub-spraying surface. Add the adjacency relationship as an edge to the undirected graph structure model of the sub-spraying surface to obtain the undirected graph structure model of the sub-spraying surface.
[0079] S32. Construct a bipartite graph based on the undirected graph structure model. For each vertex v in the original undirected graph, create two vertices L v and R v . For each edge (u, v) in the original undirected graph, add two edges (L v , R u ) and (L u , R v ) to the bipartite graph. Use the maximum matching algorithm to find the maximum matching in the bipartite graph. The maximum matching is the largest set of edges in the bipartite graph that do not share the same vertex;
[0080] Use the Hopcroft Karp algorithm to find the maximum matching in a bipartite graph. The specific process is as follows:
[0081] Initialization: Mark all vertices in the constructed bipartite graph as unmatched. Initialize an empty matching set M and an infinite distance array dist to support the search for augmenting paths.
[0082] Construct augmenting paths: Select an unmatched left vertex u and use breadth - first search to find a path from this left vertex u to an unmatched right vertex. This path is called an augmenting path. During the breadth - first search, mark the predecessor edges of the left vertices. Update the found augmenting paths to the matching set M. Repeat this process to find all augmenting paths for this left vertex.
[0083] Repeat constructing augmenting paths: Repeat the above process for all unmatched vertices in the left part until all vertices have been checked.
[0084] Termination condition: When all left vertices have been checked and no new augmenting paths are found, the algorithm terminates.
[0085] S33: Start constructing paths from each unvisited left vertex in the bipartite graph. Follow the edges in the maximum matching to visit the matching vertices in sequence until there are no more matches or visited nodes. Add the constructed paths to the path list and continue processing other unvisited left vertices.
[0086] S34: Repeat step S33 to process all unvisited left vertices in the bipartite graph. Merge the paths in the path list by connecting the same points at the head and tail to obtain the final path order of all vertices in the bipartite graph.
[0087] S35: According to the final path order found in the above process, connect the starting point and the ending point to generate the connection order between each sub - spraying surface, that is, the spraying path between all sub - spraying surfaces on the surface of the three - dimensional model of the workpiece to be sprayed. Adjust the connection order according to the spraying process or the actual situation at the spraying site to ensure the rationality and feasibility of the connection order.
[0088] S4: Perform mesh segmentation on each sub - spraying surface and construct path segments based on the intersection of the cutting planes of the mesh segmentation with the triangular patches within the sub - spraying surface. Obtain the key spraying points that cover the entire sub - spraying surface by dividing the path segments. As Figure 4 shown, it specifically includes the following sub - steps:
[0089] S41. Obtain all sub-spraying surfaces according to the previous steps, and obtain the three-dimensional information including the vertex coordinates of the triangular patches within the sub-spraying surfaces. Traverse the vertex coordinates of all triangular patches within the sub-spraying surfaces to obtain the position range and normal vector of the cutting plane for grid division of the sub-spraying surface. The cutting plane is approximately perpendicular to the spraying surface, and the plane itself extends infinitely. The position range of the cutting plane is determined by determining the left and right ranges of the plane. Since the three vertex coordinates of the triangular patch are known, by traversing and comparing the vertex coordinates of all triangular patches within the sub-spraying surface, the maximum and minimum values of the corresponding coordinates are the boundary coordinate values of the cutting plane.
[0090] The specific process is as follows:
[0091] a. Initialize the boundary coordinates of the cutting plane. Traverse the vertex coordinates of all triangular patches within the sub-spraying surface. The vertex coordinates contain three parameters: x, y, and z. Obtain the interval range through traversal, and initialize x_min, x_max, y_min, y_max, z_min, and z_max to extremely large or extremely small values.
[0092] b. Calculate the boundary values of the cutting plane. Traverse the vertex coordinates of all triangular patches within the sub-spraying surface and update the minimum and maximum coordinate values of the cutting plane boundary coordinates.
[0093] c. Calculate the coordinate range of the cutting plane. Calculate the range of the boundary of the cutting plane in each coordinate axis direction based on the updated minimum and maximum coordinate values of the cutting plane boundary coordinates.
[0094] d. Set the normal vector of the cutting plane. Select the direction of the second-largest coordinate value in the range of the boundary of the cutting plane in each coordinate axis direction as the normal vector direction of the cutting plane cluster, and set the normal vector of the cutting plane based on the selected normal vector direction.
[0095] e. Determine the cutting range. Calculate the minimum and maximum coordinate values according to the selected direction, and determine the position range of the cutting plane based on the path_gap parameter. This parameter is related to the spraying material and spraying tool. If the performance of the spraying tool is strong and the spraying area is wide, this parameter will be large, reducing the key spraying points within the sub-spraying surface. Calculate how many cutting planes are needed in the middle based on the maximum and minimum coordinate values of the cutting plane boundary coordinates and the path_gap parameter.
[0096] S42. Find all the triangular patch indices within the sub-spraying surface that intersect with the cutting plane. The specific process is as follows:
[0097] a. Initialize the result dictionary. Create a result dictionary to store the cutting plane indices of each sub-spraying surface and the triangular patch indices that intersect with the cutting plane.
[0098] b. Traverse the triangular patches. Traverse all the triangular patch indices in the sub-spraying surface divided by the cutting plane.
[0099] c. Obtain the vertex coordinates of the triangular patches. Obtain the vertex coordinates of each triangular patch divided by the cutting plane and store them in a NumPy array.
[0100] d. Determine the range of the triangular patches along the normal vector direction of the cutting plane. Find the maximum and minimum values of the coordinate components of the triangular patches along the normal vector direction of the cutting plane.
[0101] e. Filter the intersecting cutting planes: Check which cutting planes are within the coordinate range of the triangular patches along the normal vector direction. By judging the position relationship between the three vertices of a triangular patch and the cutting plane, taking the three-dimensional coordinate system as an example, if the triangular patch is on the xOy plane, the normal vector of this triangular patch can be the z-axis, and the normal vector of the cutting plane is the x-axis. Then calculate the size relationship between the x values of the three vertex coordinates of the triangular patch and the x value of the cutting plane. If the x value of the cutting plane is between the maximum and minimum values of the x values of the three vertex coordinates, it means they intersect; otherwise, they don't. Store the indices of these cutting planes.
[0102] f. Update the result dictionary: Add the triangular patch indices that intersect with the filtered cutting planes to the result dictionary.
[0103] S43. Construct a second undirected graph structure model with all the triangular patches in the sub-spraying surface that intersect with the cutting plane and perform topological sorting. The specific process is as follows:
[0104] a. Create a second undirected graph structure model. Create a second undirected graph structure model representing the connection relationship of the triangular patches, and add all the triangular patch index values in the result dictionary to the second undirected graph structure model as vertices.
[0105] b. Add the triangular patch index values as nodes. Add all the triangular index values to the undirected graph G as vertices.
[0106] c. Establish edge connections according to the adjacency relationship. Traverse the adjacency relationship list of all the triangular patches. If two triangular patches are both in the set of triangular patches that intersect with the filtered cutting plane and are not the same triangular patch, add an edge representing the vertex connection of the two triangular patches in the second undirected graph.
[0107] S44. Find all connected components in the second undirected graph structure model, and calculate the intersection points for each connected component to construct the path segments between the triangular patches where the cutting planes intersect, obtaining the continuous path segments between all the cutting planes within the sub-spraying surface. The cutting path points on the path segments are used as the key spraying points within the sub-spraying surface, and return the normal vectors of the triangular patches corresponding to the key spraying points. The specific process is as follows:
[0108] a) Obtain the index list of the triangular patches of the current connected component;
[0109] b) Obtain the vertex indices of the edges where the cutting plane intersects each triangular patch through the following process:
[0110] i. Traverse the triangular patch indices in the connected component and check whether each side of the triangular patch intersects the cutting plane.
[0111] ii. If it intersects, record the vertex indices of this side.
[0112] c) Construct a continuous path. Use the intersection points of the sides where the cutting plane intersects the triangular patch and the index of the triangular patch to construct a continuous path segment, and store the calculated path segment and the corresponding triangular patch normal vector.
[0113] d. Collect the results of each cutting plane. Collect the path segments of each cutting plane within the sub-spraying surface, evenly divide the path segments at equal intervals to obtain the cutting path points distributed along the path segments, use the cutting path points as the key spraying points, and determine the spacing of the path segment cutting according to the point spraying range of the spraying robot arm to ensure that the spraying robot arm can fully cover all sub-spraying surfaces when spraying along the path segments of the key spraying points. At the same time, output the normal vectors of the triangular patches corresponding to the key spraying points, and adjust the spraying angle of the spraying robot arm moving to the key spraying point to be perpendicular to the triangular patch through the corresponding triangular patch normal vector.
[0114] e. Collect the results of each sub-spraying surface. Collect the path segments and normal vectors of all the cutting planes within each sub-spraying surface on the workpiece surface through the above steps, and return the cutting path points of all sub-spraying surfaces as the key spraying points.
[0115] S5. Connect the key spraying points of all sub-spraying surfaces in the connection order between the sub-spraying surfaces to create a complete spraying path on the surface of the three-dimensional model of the workpiece to be sprayed.
[0116] When connecting the connection sequence of two sub-spraying surfaces, if it is not the first sub-spraying surface to be processed, then the order of the points on the path of the current sub-spraying surface is adjusted according to the last key spraying point in the path segment of the key spraying points in the previous sub-spraying surface. If the distance between the starting point on the path segment of the current sub-spraying surface and the ending point on the path segment of the previous sub-spraying surface is greater than the distance between the ending point on the path segment of the current sub-spraying surface and the ending point on the path segment of the previous sub-spraying surface, then reverse the connection order of the key spraying points on the path segment of the current sub-spraying surface.
[0117] Create and connect paths, create line segments connecting adjacent points, and store these line segments to obtain a complete continuous spraying path for finally spraying the surface of the three-dimensional model workpiece.
[0118] In this article, the orientation or positional relationship indicated by the terms "upper", "lower", "front", "rear", "left", "right", "top", "bottom", "inner", "outer", "vertical", "horizontal", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the sake of clarity of expressing the technical solution and convenience of description. Therefore, it cannot be understood as a limitation to the present invention.
[0119] In this article, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion. In addition to the listed elements, it may also include other elements not specifically listed.
[0120] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A method for generating a complete spraying path on a workpiece surface based on a design model, characterized in that: The specific steps include: S1, obtaining all triangular facets constituting the surface of the three-dimensional model through the three-dimensional model of the workpiece to be sprayed; S2, traversing all triangular facets on the surface of the three-dimensional model, clustering them according to the normal vector angles between the triangular facets, and segmenting the surface of the three-dimensional model according to the clustering results to obtain a number of sub-spraying surfaces; S3. All the sub-spraying surfaces are obtained by constructing a first undirected graph structure model to obtain a bipartite graph, using a maximum matching algorithm to obtain the maximum matching in all the bipartite graphs, constructing a path with the edges in the maximum matching, merging the constructed paths to obtain the final connection order of all vertices in the bipartite graph, and extracting the connection order between the sub-spraying surfaces; S4, meshing each sub-spraying surface, and constructing path segments based on the intersection of the cutting plane of the mesh segmentation and the triangular facets in the sub-spraying surface, and obtaining key spraying points covering the entire sub-spraying surface by segmenting the path segments; S5. Connect the key spraying points of all sub-spraying surfaces according to the connection sequence between the sub-spraying surfaces, and create a complete spraying path for the three-dimensional model surface of the workpiece to be sprayed.
2. The method for generating a complete spraying path on a workpiece surface based on a design model according to claim 1, characterized in that: In the step S1, triangle patch parameters including vertices, normal vectors, areas and patch adjacency relationships are obtained, and this information is represented using a list or dictionary data structure.
3. The method for generating a complete spraying path on a workpiece surface based on a design model according to claim 1, characterized in that: The step S2 includes the following sub-steps: S21, initialization, creating an empty list to store the index list of the triangular facets in each segmented sub-spraying surface, and creating an empty set to record the index of the triangular facets added to the above list; S22, arranging the triangular patches on the surface of the three-dimensional model in descending order according to the area of the triangular patches, converting the areas of all the triangular patches into a one-dimensional array, and arranging the indexes of the triangular patches in descending order according to the area; S23, traversing the triangular face patches arranged in descending order, comparing the normal vector angles between the triangular face patches, clustering the triangular face patches according to the comparison results of the normal vector angles, obtaining the segmented sub-spraying surfaces, and updating the index list in step S21; S24, repeat step S23 until all triangular facets are visited; S25. Return a triangle index list containing all segmented sub-spraying surfaces.
4. The method for generating a complete spraying path on a workpiece surface based on a design model according to claim 3, characterized in that: In step S23, according to the order in which the areas of the triangle patches are arranged in descending order, the first triangle patch that is not added to any sub-spraying surface is obtained, and it is used as a seed triangle patch of a new sub-spraying surface, and then the triangle patches adjacent to the current seed triangle patch and not in the current sub-spraying surface are traversed, and the normal vector angles between the triangle patches are compared according to the following requirements: A. The normal vector of the accessed triangular face and the current sub-spraying surface is less than the first threshold angle, and the normal vector of the sub-spraying surface is the average normal vector of all the triangular facets in the sub-spraying surface; B. The angle between the normal vectors of the accessed triangular face and all the current triangular face in the current sub-spraying surface is less than the second threshold angle; If the accessed triangle patch meets both requirements A and B, it is added to the current sub-spraying surface, and the normal vector of the current sub-spraying surface is updated, and the newly added triangle patch is used as the new seed triangle patch of the current sub-spraying surface; The above traversal process is repeated until no new triangular facets are added to the current sub-spraying surface, and all triangular facets of the current sub-spraying surface are added to the index list in step S21.
5. The method for generating a complete spraying path on a workpiece surface based on a design model according to claim 1, characterized in that: The step S3 includes the following sub-steps: S31, constructing a first undirected graph structure model of the sub-spraying surface, taking each sub-spraying surface obtained by segmentation as a vertex of the undirected graph, obtaining the adjacency relationship of the sub-spraying surface through the adjacency relationship of all triangular facets in the sub-spraying surface, and taking the adjacency relationship between the sub-spraying surfaces as an edge in the undirected graph structure model; S32, constructing a bipartite graph according to the first undirected graph structure model, and using the Hopcroft Karp algorithm to find a maximum matching in the bipartite graph, wherein the maximum matching is a maximum edge set in the bipartite graph that does not share the same vertex; S33, building a path from each unvisited left vertex in the bipartite graph, visiting the matching vertices in sequence along the edges in the maximum matching, and adding the built path to the path list; S34, repeat step S33 to process all unvisited left vertices in the bipartite graph, merge the paths in the path list according to the same vertices, and obtain the final path order of all vertices in the bipartite graph; S35, generating a connection sequence between the sub-spraying surfaces by connecting the final path sequence obtained by the bipartite graph, that is, the spraying path between all the sub-spraying surfaces on the surface of the three-dimensional model of the workpiece to be sprayed.
6. The method for generating a complete spraying path on a workpiece surface based on a design model according to claim 1, characterized in that: The step S4 includes the following sub-steps: S41, traversing the vertex coordinates of all triangular facets in the sub-spraying surface, and obtaining the cutting plane position range and normal vector for meshing the sub-spraying surface; S42, finding out all the triangle patch indexes that intersect with the cutting plane in the sub-spraying surface; S43, constructing a second undirected graph structure model with all triangular facets intersecting with the cutting plane in the sub-spraying surface for topological sorting; S44. Find all connected components in the second undirected graph structure model, and construct path segments between triangular facets intersecting with the cutting planes for each connected component through intersection calculation, and obtain continuous path segments between all cutting planes in the sub-spraying surface. The cutting path points along the path segments are used as key spraying points in the sub-spraying surface, and the normal vectors of the triangular facets corresponding to the key spraying points are returned.
7. The method for generating a complete spraying path on a workpiece surface based on a design model according to claim 6, characterized in that: In the step S41, the minimum and maximum coordinate values of the cutting plane boundary coordinates are updated by traversing the vertex coordinates of all triangular facets in the sub-spraying surface, and the range of the cutting plane boundary in the direction of each coordinate axis is determined by the updated minimum and maximum coordinate values of the cutting plane boundary coordinates. The direction of the second largest coordinate value selected within the range is used as the normal vector direction of the cutting plane cluster, and the cutting plane normal vector is set based on the selected normal vector direction. According to the selected cutting plane normal vector direction, the minimum and maximum coordinate values are calculated, and the position range of the cutting plane is determined based on the path_gap parameter.
8. The method for generating a complete spraying path on a workpiece surface based on a design model according to claim 6, characterized in that: In step S43, the second undirected graph uses the index values of all triangular facets in the sub-spraying surface that intersect with the cutting plane as vertices, traverses the adjacency relationship list of all triangular facets, and if two triangular facets are in the set of triangular facets that intersect with the filtered cutting plane and are not the same triangular facets, then an edge connecting the two vertices is added in the second undirected graph.
9. The method for generating a complete spraying path on a workpiece surface based on a design model according to claim 6, characterized in that: In the step S44, the triangle patch indexes in the connected components are traversed, the edges in the triangle patch that intersect with the cutting plane are recorded, a continuous path segment is constructed using the intersection point of the edge where the cutting plane intersects with the triangle patch and the triangle patch index, and the obtained path segment and the corresponding triangle patch normal vector are stored; Collect the path segments in all cutting planes within the sub-spraying surface and evenly divide them to obtain cutting path points. Use the cutting path points as the key spraying points within the sub-spraying surface to obtain the triangle patch normal vectors corresponding to the key spraying points.
10. The method for generating a complete spraying path on a workpiece surface based on a design model according to claim 1, characterized in that: In the step S5, the order of the key spraying points in the path of the current sub-spraying surface is adjusted according to the last key spraying point in the path segment of the key spraying point in the previous sub-spraying surface; if the distance between the starting key spraying point on the path segment of the current sub-spraying surface and the ending key spraying point on the path segment of the previous sub-spraying surface is greater than the distance between the ending key spraying point on the path segment of the current sub-spraying surface and the ending key spraying point on the path segment of the previous sub-spraying surface, the connection order of the key spraying points of the path segment of the current sub-spraying surface is reversed.
Citation Information
Patent Citations
Robot spraying path planning method based on aircraft skin point cloud data
CN117718965A
Cited By
Automobile part paint spraying path optimization method and system based on data processing
CN120671407A