A robot spraying control method and system based on digital twin
Through digital twin technology, the three-dimensional model is constructed and refined, and virtual spraying simulation is carried out, which solves the problem of difficulty and low efficiency of debugging robot spraying parameters, and achieves a more efficient and accurate spraying process.
Patent Information
- Application Number
- CN202411386160.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-09-30
AI Technical Summary
In the prior art, the debugging of robot spraying parameters is difficult and the debugging speed is slow, resulting in low production efficiency, waste of materials and high labor costs.
Using a robot spray control method based on digital twins, virtual simulation and visualization of spray coating is realized by building a three-dimensional model of workpieces and robots, refining the triangular grid, storing BVH data structures, setting the spray gun parameters and thickness color tables, and performing ray collision detection and dyeing thickness calculations.
It simplifies the adjustment of robot posture and parameters, improves debugging efficiency, reduces material waste and labor costs, and achieves a more accurate spraying effect.
Smart Images

Figure CN119304863B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of twin machines, and in particular to a robot spraying control method and system based on digital twins. Background Art
[0002] In the industrial production process, most of the later stages of production require the production parts to be painted and sprayed, and the quality of the coating directly affects the service life of the workpiece. At the same time, due to the different process parameters of various workpieces, the corresponding spraying parameters (spraying flow rate, spraying distance, etc.) are also different. In order to obtain a better coating effect, at this stage, determining the spraying parameters requires a large number of actual production tests to determine the process parameters corresponding to the workpiece.
[0003] In this process, workpieces, coatings and other materials will be wasted, and great labor and time costs are required to inspect the workpieces after spraying, resulting in production delays and other problems. The present invention proposes a method for constructing a virtual simulation of robot spraying using digital twin technology. By constructing a digital twin, simulating the actual spraying situation, and analyzing the coating quality of the workpiece, on the one hand, it can reduce material waste, and on the other hand, obtain accurate spraying parameters through virtual testing, saving time and labor costs.
[0004] The existing technology of robot spraying mainly has the following disadvantages:
[0005] (1) The setting of key parameters of the spraying robot, such as the spraying path point, speed, acceleration, etc., is highly dependent on the shape, material, surface condition and desired coating effect of the workpiece. This highly customized requirement makes the debugging and teaching process extremely complicated and time-consuming. Engineers not only need to have deep professional knowledge, but also need to go through repeated trials and adjustments. In addition, with the frequent updates and upgrades of product designs, the resetting and debugging of spraying parameters has exacerbated this problem, resulting in longer debugging cycles, higher costs, and difficulty in quickly responding to market changes.
[0006] (2) In the actual production process, due to the influence of various factors such as production environment, material characteristics, equipment wear, etc., spraying parameters often need to be dynamically adjusted and optimized. At this time, it is necessary to continuously monitor the actual equipment on site, modify parameters and debug to ensure the stability of coating quality. This process not only consumes a lot of human resources, but also increases downtime and reduces overall production efficiency.
[0007] (3) Since it is difficult to determine the quality of spraying during spraying, and the existing robots cannot provide feedback on the images during spraying, the corresponding results can only be obtained after the spraying is completed. Therefore, each time the robot data is adjusted, it is necessary to wait until the spraying is completed before making adjustments, which reduces the overall production efficiency. Summary of the invention
[0008] In view of the above-mentioned defects, the purpose of the present invention is to propose a robot spraying control method and system based on digital twins to solve the problems of difficulty and slow debugging of spraying parameters in the prior art.
[0009] To achieve this purpose, the present invention adopts the following technical solution: a robot spraying control method based on digital twin, comprising the following steps:
[0010] Step S1: constructing a three-dimensional model of the workpiece to be sprayed and the robot, wherein the three-dimensional model of the workpiece is composed of a triangular mesh;
[0011] Step S2: Refining the triangular mesh of the three-dimensional model of the workpiece to obtain a refined first model;
[0012] Step S3: constructing a BVH data structure, and storing the triangular mesh parameters in the first model through the BVH data structure;
[0013] Step S4: setting spray gun parameters and a thickness color table of the workpiece, wherein the spray gun parameters are spray flow rate and spray cone angle;
[0014] Step S5: Obtain the center position of the nozzle spraying: Use the BVH data structure to perform ray collision detection of the spray gun;
[0015] After the workpiece collides with the nozzle ray, the distance D between the starting point of the ray and the collision point is used to calculate the dyeing thickness of each triangular mesh in the spraying, and the three-dimensional model of the workpiece is given color through the dyeing thickness and thickness color table.
[0016] Preferably, the three-dimensional model construction method of the robot is as follows:
[0017] Model each joint of the robot independently;
[0018] The positive kinematics and negative kinematics of the robot are constructed according to the DH parameters of the robot, and the joints of the robot are assembled according to the relationship between the positive kinematics and the negative kinematics to obtain a complete joint motion chain.
[0019] Preferably, the specific steps of refining the three-dimensional model of the workpiece are as follows:
[0020] Step S21: constructing a half-edge data structure of the Mesh of the workpiece three-dimensional model;
[0021] Step S22: Obtain the length of each edge in the half-edge data structure, and determine whether the edge length is greater than a length threshold. If so, store the edges in a to-be-processed collection in descending order of length.
[0022] Step S23: Obtain the midpoint of the edge in the collection to be processed, and update the half-edge data structure of the edge through the midpoint and the diagonal of the edge; repeat steps S22 to S23 until the collection to be processed is an empty set.
[0023] Preferably, the step S23 further includes the following steps:
[0024] Step S231: constructing a hash value through vertex coordinates and vertex indices of the triangle mesh;
[0025] Step S232: determine whether there is a common edge in the triangular mesh through the hash value. If there is a common edge, obtain the midpoint of the common edge, and update the half-edge data structure of the edge through the midpoint and the two diagonals of the edge.
[0026] Preferably, in step S3, the child nodes of the BVH data structure are used to store the bounding box data of the node, and the leaf nodes store the vertex and index information data of the triangle mesh.
[0027] Preferably, the formula for obtaining the dyeing thickness in step S5 is as follows:
[0028]
[0029] Where D is the distance between the starting point of the ray and the workpiece, R is the radius of the spray, Q is the flow rate, and θ is the spray cone angle.
[0030] A robot spraying control system based on digital twin, using the robot spraying control method based on digital twin, including a modeling module, a refinement module, a storage module, an initialization module and a simulation spraying module;
[0031] The modeling module is used to construct a three-dimensional model of the workpiece to be sprayed and the robot, wherein the three-dimensional model of the workpiece is composed of a triangular mesh;
[0032] The refinement module is used to refine the three-dimensional model of the workpiece to obtain a refined first model;
[0033] The storage module is used to construct a BVH data structure, and store the triangular mesh parameters in the first model through the BVH data structure;
[0034] The initialization module is used to set the spray gun parameters and the thickness color table of the workpiece, wherein the spray gun parameters are the spray flow rate and the spray cone angle;
[0035] The simulation spraying module is used to obtain the center position of the nozzle spraying: using the BVH data structure to perform ray collision detection of the spray gun;
[0036] After the workpiece collides with the nozzle ray, the distance D between the starting point of the ray and the collision point is used to calculate the dyeing thickness of each triangular mesh in the spraying, and the workpiece is given color through the dyeing thickness and thickness color table.
[0037] Preferably, the modeling module includes a joint submodule and a combination submodule;
[0038] The joint submodule is used to independently model each joint of the robot;
[0039] The combination submodule is used to construct the positive kinematics and negative kinematics of the robot according to the DH parameters of the robot, and assemble the joints of the robot according to the relationship between the positive kinematics and the negative kinematics to obtain a complete joint motion chain.
[0040] Preferably, the refinement module includes a side length acquisition submodule, a judgment submodule and a circulation submodule;
[0041] The edge length acquisition submodule is used to construct a half-edge data structure of the Mesh of the workpiece three-dimensional model;
[0042] The judgment submodule is used to obtain the length of each edge in the half-edge data structure, and judge whether the edge length is greater than the length threshold. If so, the edges are stored in the to-be-processed collection in descending order of length.
[0043] The loop submodule is used to obtain the midpoint of the edge in the collection to be processed, and update the half-edge data structure of the edge through the midpoint and the diagonal of the edge; repeatedly call the judgment submodule and the loop submodule; until the collection to be processed is an empty set.
[0044] Preferably, the circulation submodule further includes a common edge processing subunit;
[0045] The common edge processing subunit is used to construct a hash value through the vertex coordinates and vertex indexes of the triangular mesh;
[0046] It is determined by the hash value whether there is a common edge in the triangular mesh. If there is a common edge, the midpoint of the common edge is obtained, and the half-edge data structure of the edge is updated through the midpoint and the two diagonals of the edge.
[0047] One of the above technical solutions has the following advantages or beneficial effects: 1. By constructing a three-dimensional model of the workpiece and the robot, encapsulating the robot parameters, and having precise point coordinates, the robot posture and parameters can be adjusted better and more conveniently. The problem of difficulty in debugging the spray robot is solved.
[0048] 2. Accurately color the 3D model of the workpiece to achieve visualization of spraying. Users can judge whether the spraying meets their own requirements based on the colored 3D model. If it does not meet the requirements, they can continuously adjust the spray gun parameters to make the spraying results meet their own needs, thereby improving the efficiency of debugging. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a flow chart of an embodiment of the method of the present invention;
[0050] Figure 2 is a schematic diagram of a cube mesh refinement according to an embodiment of the present invention;
[0051] Figure 3 is a schematic diagram of a half-edge data structure of an embodiment of the present invention;
[0052] Figure 4 It is a schematic diagram of the specific construction division of an embodiment of the present invention;
[0053] Figure 5 is a schematic diagram of a spray gun model according to an embodiment of the present invention;
[0054] Figure 6 It is a schematic diagram of the structure of an embodiment of the system of the present invention; DETAILED DESCRIPTION
[0055] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0056] In the description of the embodiments of the present invention, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0057] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, the meaning of "plurality" is two or more. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0058] like Figures 1 to 6 As shown, a robot spraying control method based on digital twin includes the following steps:
[0059] Step S1: constructing a three-dimensional model of the workpiece to be sprayed and the robot, wherein the three-dimensional model of the workpiece is composed of a triangular mesh;
[0060] Step S2: Refining the triangular mesh of the three-dimensional model of the workpiece to obtain a refined first model;
[0061] Step S3: constructing a BVH data structure, and storing the triangular mesh parameters in the first model through the BVH data structure;
[0062] Step S4: setting spray gun parameters and a thickness color table of the workpiece, wherein the spray gun parameters are spray flow rate and spray cone angle;
[0063] Step S5: Obtain the center position of the nozzle spraying: Use the BVH data structure to perform ray collision detection of the spray gun;
[0064] After the workpiece collides with the nozzle ray, the distance D between the starting point of the ray and the collision point is used to calculate the dyeing thickness of each triangular mesh in the spraying, and the three-dimensional model of the workpiece is given color through the dyeing thickness and thickness color table.
[0065] In the present invention, by constructing a three-dimensional model of the workpiece and the robot, encapsulating the robot parameters, and having accurate point coordinates, the robot posture and parameters can be adjusted better and more conveniently, solving the problem of difficulty in debugging the spray robot.
[0066] In addition, the existing model of the workpiece is constructed by a curved surface or an existing single part. Since the three-dimensional model of the workpiece is a single side, it is difficult to refine it when coloring, which causes the place where there should be no color to be colored. In order to solve this problem, the three-dimensional model of the workpiece is constructed by a triangular mesh in the present invention. After the three-dimensional model is constructed, if the triangular mesh is too large, it is not conducive to the presentation of the coloring effect, and it is also far from the actual situation, so it is necessary to refine the model triangular mesh. The purpose of mesh refinement is to make the object present color by setting the vertex color attribute of the triangular mesh in computer graphics. The color presentation effect of the spraying needs to be presented by setting the color attribute of the vertex, but if the mesh is not refined, it will cause the spraying area to be very small. When the spraying area is smaller than the area of a triangular mesh, the entire mesh will present the set color after the vertex coloring of the mesh where the spraying area is located, which cannot achieve the color presentation only in the spraying area, so it is necessary to refine the mesh, so that no matter how small our spraying area is, as long as the mesh is refined small enough, the coloring area can be equal to the spraying area. Therefore, when coloring the three-dimensional model of the workpiece in step S5, the three-dimensional model of the workpiece can be colored accurately to realize the visualization of spraying. The user can judge whether the spraying meets his own requirements based on the colored three-dimensional model. If it does not meet the requirements, the spray gun parameters can be continuously adjusted to make the spraying results meet his own requirements, thereby improving the debugging efficiency.
[0067] It is worth noting that a thickness color table is provided in the present invention, and the thickness color table is used to mark the colors corresponding to different dyeing thicknesses. After calculating the dyeing thickness of each triangular mesh in the spraying by the distance D between the starting point of the ray and the collision point, the color can be assigned according to the dyeing thickness of the triangular mesh. The user determines whether the requirements are met by observing the color of the three-dimensional model of the workpiece. This method can also accurately assign colors.
[0068] Preferably, the three-dimensional model construction method of the robot is as follows:
[0069] Model each joint of the robot independently;
[0070] The positive kinematics and negative kinematics of the robot are constructed according to the DH parameters of the robot, and the joints of the robot are assembled according to the relationship between the positive kinematics and the negative kinematics to obtain a complete joint motion chain.
[0071] The three-dimensional model of the robot should maintain the kinematic relationship corresponding to the real object, that is, each joint needs to be modeled independently and assembled according to the kinematic relationship of the robot, so as to form a complete joint motion chain, so that the model can reproduce the action of the real robot through joint motion. Then correct the motion chain according to the standard size parameters or DH parameters in the robot technical manual, so that the relative position between each joint fully meets the requirements, and reduce the size and assembly errors between the virtual robot and the real robot. Among them, the forward kinematics algorithm is an algorithm that uses the pose of each joint of the robot as input to solve the pose matrix of the end point of the robot, and the inverse kinematics algorithm is an algorithm that uses the pose matrix of the end point of the robot as input to solve the pose of each joint of the robot. The inverse kinematics algorithm of the robot includes but is not limited to analytical methods (algebraic methods, geometric methods) and numerical methods, but the analytical method should be used first to obtain a faster solution speed.
[0072] Preferably, the specific steps of refining the three-dimensional model of the workpiece are as follows:
[0073] Step S21: constructing a half-edge data structure of the Mesh of the workpiece three-dimensional model;
[0074] Step S22: Obtain the length of each edge in the half-edge data structure, and determine whether the edge length is greater than a length threshold. If so, store the edges in a to-be-processed collection in descending order of length.
[0075] Step S23: Obtain the midpoint of the edge in the collection to be processed, and update the half-edge data structure of the edge through the midpoint and the diagonal of the edge; repeat steps S22 to S23 until the collection to be processed is an empty set.
[0076] In the present invention, the edges stored in the collection to be processed are sorted from large to small according to the length of the edge, so as to ensure the segmentation based on the longest edge. The midpoint segmentation of the edges in the collection to be processed is: connect the diagonal lines from the midpoint, at this time, two sides, one point and one face will be added. If it is a shared edge, four sides, one point and two faces will be added. After updating the connection relationship of the face, edge and point, it will be judged whether the newly added edge is still greater than the set longest edge threshold. If it is greater, it will be added to the collection of edges to be processed until the collection of edges to be processed is empty, indicating that the model grid has been refined. Figure 2 This is the result of thinning a cube with a side length of 2m and setting the longest side to 0.05m.
[0077] Preferably, the step S23 further includes the following steps:
[0078] Step S231: constructing a hash value through vertex coordinates and vertex indices of the triangle mesh;
[0079] Step S232: determine whether there is a common edge in the triangular mesh through the hash value. If there is a common edge, obtain the midpoint of the common edge, and update the half-edge data structure of the edge through the midpoint and the two diagonals of the edge.
[0080] A half-edge data structure is established for this non-topological feature data of the triangular mesh data (established by vertices and indices), so that the points, edges and faces of the triangular mesh are connected, so that when the edges are subsequently divided and refined, the corresponding connection points, connection edges and face data can be quickly found and reconstructed. The half-edge data structure is established to speed up the division speed of the algorithm. Secondly, each time the triangular mesh is divided, the longest side of the mesh will be selected for division, so as to achieve the regularity of the divided triangular mesh.
[0081] In computer graphics, if the edges are co-edges, the vertex coordinates and vertex indices used are the same. Then, as long as these two attributes are used as hash values, the hash values can be used to determine whether the edges of this triangle mesh also exist in other triangle meshes.
[0082] This step is also to build the grid half edge data structure, such as Figure 3 A topological relationship is established between the two edges edge3 and edge4. In the half-edge data structure, if they are co-edges, such as edge3 in triangle 1 (from vertex v0->v2), its reverse edge edge edge4 in triangle 2 (from vertex v2->v0) needs to be stored. The advantage of this setting is that the two triangles in which they are located can be refined together when the co-edges are refined later.
[0083] Preferably, in step S3, the child nodes of the BVH data structure are used to store the bounding box data of the node, and the leaf nodes store the vertex and index information data of the triangle mesh.
[0084] For the three-dimensional model of the workpiece refined in step S2, a BVH binary tree data structure is established. The child nodes of the BVH data structure mainly store the bounding box data of the node, and the leaf nodes store the vertex and index information data of the triangular mesh. The purpose of establishing the BVH data structure is to speed up the traversal of the triangular mesh of the model. For example, if the BVH data structure is not established, when the ray detects collision, it is necessary to traverse each triangular mesh of the model for intersection detection to determine whether a collision occurs. After the BVH data structure is established, only the intersection detection of the bounding box needs to be performed, and because it is a binary tree data structure, the number of times the ray performs intersection detection can be greatly reduced to speed up the process.
[0085] Specifically, when storing, each triangular mesh is traversed first to obtain the bounding box data of the three-dimensional model of the workpiece and the bounding box data of each triangular mesh, and then the longest axial direction is obtained for the x, y, and z directions for center segmentation. After midpoint segmentation of the entire model bounding box, the sub-bounding boxes are segmented separately until the segmentation is recursively completed to the leaf node.
[0086] The following is described using an embodiment:
[0087] The following is for a two-dimensional square (with 8 triangle meshes), such as Figure 4 As shown, first traverse 8 triangular meshes, establish a square bounding box and a bounding box for each triangular mesh, and obtain nodes node1 and node2 from the midpoint segmentation. The nodes only contain the bounding box data, the index coordinates of the triangular mesh, and the segmentation axis. After the segmentation, the nodes are segmented again, and finally the leaf nodes are obtained. The leaf nodes store the bounding box data, the index coordinates of the triangular mesh, the number of triangular meshes, and the vertex data of the triangular meshes. A binary tree data structure is established, which can greatly reduce the number of detections during collision detection and improve the algorithm speed.
[0088] Preferably, when the three-dimensional model of the workpiece collides with the nozzle ray in step S5, it is known that the distance between the starting point of the ray and the collision point is D, and the spraying radius is determined by the distance between the nozzle and the workpiece and the size of the fog cone angle. The schematic diagram of the spray gun is as follows: Figure 5 As shown, after calculating the spraying radius, it is necessary to collect the triangular meshes of the workpiece model in the area with the collision point as the center and R as the radius for vertex coloring. The present invention sets a bounding box with R as the radius and the center of the sphere at the collision point, performs collision detection with the workpiece BVH data structure, traverses the BVH binary tree in pre-order, obtains the triangular mesh within the sphere, and then screens out the triangular mesh with a normal vector angle between 0-90° through the normal vector between the triangular mesh and the triangular mesh where the collision point is located.
[0089] Then the acquired vertices are colored. Since the spraying process will cause paint loss due to the spraying distance, and the paint obtained at the center of the circle is the thickest and decreases along the radius, the mathematical model established by the present invention is as follows:
[0090]
[0091] Where D is the distance between the starting point of the ray and the workpiece, R is the radius of the spray, Q is the flow rate, and θ is the spray cone angle.
[0092] A robot spraying control system based on digital twin, using the robot spraying control method based on digital twin, including a modeling module, a refinement module, a storage module, an initialization module and a simulation spraying module;
[0093] The modeling module is used to construct a three-dimensional model of the workpiece to be sprayed and the robot, wherein the three-dimensional model of the workpiece is composed of a triangular mesh;
[0094] The refinement module is used to refine the three-dimensional model of the workpiece to obtain a refined first model;
[0095] The storage module is used to construct a BVH data structure, and store the triangular mesh parameters in the first model through the BVH data structure;
[0096] The initialization module is used to set the spray gun parameters and the thickness color table of the workpiece, wherein the spray gun parameters are the spray flow rate and the spray cone angle;
[0097] The simulation spraying module is used to obtain the center position of the nozzle spraying: using the BVH data structure to perform ray collision detection of the spray gun;
[0098] After the workpiece collides with the nozzle ray, the distance D between the starting point of the ray and the collision point is used to calculate the dyeing thickness of each triangular mesh in the spraying, and the workpiece is given color through the dyeing thickness and thickness color table.
[0099] Preferably, the modeling module includes a joint submodule and a combination submodule;
[0100] The joint submodule is used to independently model each joint of the robot;
[0101] The combination submodule is used to construct the positive kinematics and negative kinematics of the robot according to the DH parameters of the robot, and assemble the joints of the robot according to the relationship between the positive kinematics and the negative kinematics to obtain a complete joint motion chain.
[0102] Preferably, the refinement module includes a side length acquisition submodule, a judgment submodule and a circulation submodule;
[0103] The side length acquisition submodule is used to construct a half-side data structure of the Mesh of the workpiece three-dimensional model;
[0104] The judgment submodule is used to obtain the length of each edge in the half-edge data structure, and judge whether the edge length is greater than the length threshold. If so, the edges are stored in the to-be-processed collection in descending order of length.
[0105] The loop submodule is used to obtain the midpoint of the edge in the collection to be processed, and update the half-edge data structure of the edge through the midpoint and the diagonal of the edge; repeatedly call the judgment submodule and the loop submodule; until the collection to be processed is an empty set.
[0106] Preferably, the circulation submodule further includes a common edge processing subunit;
[0107] The common edge processing subunit is used to construct a hash value through the vertex coordinates and vertex indexes of the triangular mesh;
[0108] It is determined by the hash value whether there is a common edge in the triangular mesh. If there is a common edge, the midpoint of the common edge is obtained, and the half-edge data structure of the edge is updated through the midpoint and the two diagonals of the edge.
[0109] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0110] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A robot spraying control method based on digital twin, characterized in that: The steps include: Step S1: constructing a three-dimensional model of the workpiece to be sprayed and the robot, wherein the three-dimensional model of the workpiece is composed of a triangular mesh; Step S2: Refining the triangular mesh of the three-dimensional model of the workpiece to obtain a refined first model; Step S3: constructing a BVH data structure, and storing the triangular mesh parameters in the first model through the BVH data structure; Step S4: setting spray gun parameters and a thickness color table of the workpiece, wherein the spray gun parameters are spray flow rate and spray cone angle; Step S5: Obtain the center position of the nozzle spraying: Use the BVH data structure to perform ray collision detection of the spray gun; After the workpiece collides with the nozzle ray, the distance D between the starting point of the ray and the collision point is used to calculate the dyeing thickness of each triangular mesh in the spraying, and the three-dimensional model of the workpiece is given color through the dyeing thickness and thickness color table.
2. According to a digital twin-based robot spraying control method according to claim 1, it is characterized in that: The three-dimensional model construction method of the robot is as follows: Model each joint of the robot independently; The positive kinematics and negative kinematics of the robot are constructed according to the DH parameters of the robot, and the joints of the robot are assembled according to the relationship between the positive kinematics and the negative kinematics to obtain a complete joint motion chain.
3. According to a digital twin-based robot spraying control method according to claim 1, it is characterized in that: The specific steps for refining the three-dimensional model of the workpiece are as follows: Step S21: constructing a half-edge data structure of the Mesh of the workpiece three-dimensional model; Step S22: Obtain the length of each edge in the half-edge data structure, and determine whether the edge length is greater than a length threshold. If so, store the edges in a to-be-processed collection in descending order of length. Step S23: Obtain the midpoint of the edge in the collection to be processed, and update the half-edge data structure of the edge through the midpoint and the diagonal of the edge; repeat steps S22 to S23 until the collection to be processed is an empty set.
4. According to a digital twin-based robot spraying control method according to claim 3, it is characterized in that: The step S23 further comprises the following steps: Step S231: constructing a hash value through vertex coordinates and vertex indices of the triangle mesh; Step S232: determine whether there is a common edge in the triangular mesh through the hash value. If there is a common edge, obtain the midpoint of the common edge, and update the half-edge data structure of the edge through the midpoint and the two diagonals of the edge.
5. The robot spraying control method based on digital twin according to claim 3 is characterized in that: In step S3, the child nodes of the BVH data structure are used to store the bounding box data of the node, and the leaf nodes store the vertex and index information data of the triangle mesh.
6. The robot spraying control method based on digital twin according to claim 3 is characterized in that: The formula for obtaining the dyeing thickness in step S5 is as follows: Where D is the distance between the starting point of the ray and the workpiece, R is the radius of the spray, Q is the flow rate, and θ is the spray cone angle.
7. A robot spraying control system based on digital twin, using a robot spraying control method based on digital twin according to any one of claims 1 to 6, characterized in that: It includes modeling module, refinement module, storage module, initialization module and simulation spraying module; The modeling module is used to construct a three-dimensional model of the workpiece to be sprayed and the robot, wherein the three-dimensional model of the workpiece is composed of a triangular mesh; The refinement module is used to refine the three-dimensional model of the workpiece to obtain a refined first model; The storage module is used to construct a BVH data structure, and store the triangular mesh parameters in the first model through the BVH data structure; The initialization module is used to set the spray gun parameters and the thickness color table of the workpiece, wherein the spray gun parameters are the spray flow rate and the spray cone angle; The simulation spraying module is used to obtain the center position of the nozzle spraying: using the BVH data structure to perform ray collision detection of the spray gun; After the workpiece collides with the nozzle ray, the distance D between the starting point of the ray and the collision point is used to calculate the dyeing thickness of each triangular mesh in the spraying, and the workpiece is given color through the dyeing thickness and thickness color table.
8. The robot spraying control system based on digital twin according to claim 7 is characterized in that: The modeling module includes a joint submodule and a combination submodule; The joint submodule is used to independently model each joint of the robot; The combination submodule is used to construct the positive kinematics and negative kinematics of the robot according to the DH parameters of the robot, and assemble the joints of the robot according to the relationship between the positive kinematics and the negative kinematics to obtain a complete joint motion chain.
9. The robot spraying control system based on digital twin according to claim 7, characterized in that: The refinement module includes a side length acquisition submodule, a judgment submodule and a circulation submodule; The edge length acquisition submodule is used to construct a half-edge data structure of the Mesh of the workpiece three-dimensional model; The judgment submodule is used to obtain the length of each edge in the half-edge data structure, and judge whether the edge length is greater than the length threshold. If so, the edges are stored in the to-be-processed collection in descending order of length. The loop submodule is used to obtain the midpoint of the edge in the collection to be processed, and update the half-edge data structure of the edge through the midpoint and the diagonal of the edge; repeatedly call the judgment submodule and the loop submodule; until the collection to be processed is an empty set.
10. The robot spraying control system based on digital twin according to claim 7, characterized in that: The circulation submodule also includes a common edge processing subunit; The common edge processing subunit is used to construct a hash value through the vertex coordinates and vertex indexes of the triangular mesh; It is determined by the hash value whether there is a common edge in the triangular mesh. If there is a common edge, the midpoint of the common edge is obtained, and the half-edge data structure of the edge is updated through the midpoint and the two diagonals of the edge.
Citation Information
Patent Citations
Spraying process optimization system based on digital twinning and spraying optimization method thereof
CN114011608A
Collision detection and trajectory planning method of three-dimensional vision robot
CN117798909A