A robot additive and subtractive operation implementation method based on digital twinning

CN121859512BActive Publication Date: 2026-08-21GUANGDONG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511712509.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-20
Publication Date
2026-08-21
Estimated Expiration
2045-11-20

AI Technical Summary

Technical Problem

[0003]针对上述缺陷,本发明提出了一种基于数字孪生的机器人增减材作业实现方法,目的在于解决传统通过反复调试实体机器人作业路径实现加工工件增减材的方式,不仅会造成加工材料的无效损耗、实验成本偏高,还会因多次试错导致加工周期延长的问题

Benefits of technology

本方案中通过先构建机器人三维模型和加工工件三维模型,并为两者构建BVH,分别递归遍历筛选出类型为叶子节点的BVH节点,即三角网格;随后采用GJK算法对两个三角网格进行碰撞检测并记录加工工件三维模型中已碰撞三角网格索引;再基于该索引计算增减材作用方向,结合偏移参考平面点确定偏移参考平面;最后根据预设增材减材模型计算加工工件的三角网格顶点偏移坐标,实现加工工件增减材效果的数字化模拟。相较于传统通过反复调试实体机器人作业路径实现加工工件增减材的方式,本方案以数字化模拟替代实体试错,不仅能够减少加工材料的无效损耗、降低实验成本,还可直接验证加工方案可行性,缩短加工周期,进而提升整体加工效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121859512B_ABST
    Figure CN121859512B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on digital twinning's robot additive-subtractive operation implementation method, comprising the following steps: constructing robot three-dimensional model and processing workpiece three-dimensional model, and constructs BVH for both, respectively recursive traversal filters out the BVH node of type leaf node, i.e. triangular mesh;Two triangular meshes are detected by collision using GJK algorithm and record the index of the triangular mesh that has collided in processing workpiece three-dimensional model;Based on the index, calculate the additive-subtractive action direction, determine the offset reference plane in combination with offset reference plane point;According to the preset additive-subtractive model, calculate the triangular mesh vertex offset coordinates of processing workpiece, realize the digital simulation of processing workpiece additive-subtractive effect.The application solves the problem that the traditional way of realizing processing workpiece additive-subtractive by repeatedly debugging entity robot operation path not only causes invalid loss of processing material, but also causes high experimental cost, and also causes the problem of processing cycle extension due to multiple trial and error.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of robotic additive and subtractive manufacturing technology, specifically a method for implementing robotic additive and subtractive manufacturing based on digital twins. Background Technology

[0002] In industrial production, robotic operations have become a core component driving industrial automation upgrades, with their high efficiency and precision being widely applied across various manufacturing scenarios. Additive or subtractive machining processes such as milling, welding, and drilling are key steps in industrial production, directly impacting product quality and production efficiency. However, in actual production, due to the complexity of processing scenarios, the diversity of workpiece structures, and the strong correlation between robot operation paths and additive / subtractive machining process parameters, ensuring product yield and reducing material waste often requires significant experimental costs. This involves repeatedly adjusting the robot's operation path to achieve the preset production requirements. This not only results in ineffective material waste and high experimental costs but also significantly extends the processing cycle due to repeated trial and error, thus affecting overall processing efficiency. Summary of the Invention

[0003] To address the aforementioned shortcomings, this invention proposes a method for robot-based addition and subtraction of materials operation based on digital twins. The aim is to solve the problems of traditional methods that involve repeatedly debugging the operation path of physical robots to add or subtract materials from workpieces, which not only cause ineffective waste of processed materials and high experimental costs, but also prolong the processing cycle due to multiple trial and error.

[0004] To achieve this objective, the present invention adopts the following technical solution: A method for implementing robotic additive and subtractive manufacturing operations based on digital twins includes the following steps: Step S1: Based on digital twin technology, construct a 3D model of the robot and a 3D model of the workpiece. Both the 3D model of the robot and the 3D model of the workpiece are composed of several triangular meshes. Step S2: Adaptively refine the triangular mesh of the 3D model of the workpiece to obtain an effective 3D model of the workpiece. Step S3: Construct the hierarchical bounding volume BVH of the robot's 3D model and the effective machining workpiece's 3D model, wherein the BVH includes several nodes; Step S4: Recursively traverse the BVH nodes of the robot 3D model and the effective workpiece 3D model, and select the BVH nodes of type leaf node, i.e. triangular mesh, from both. Step S5: Use the GJK algorithm to perform collision detection on the triangular mesh of the selected robot 3D model and the triangular mesh of the selected valid workpiece 3D model. If the two collide, record the index of the collided triangular mesh in the valid workpiece 3D model; if the two do not collide, do not perform the index recording operation. Step S6: Based on the index of the collided triangular mesh in the 3D model of the workpiece, calculate the average normal of all collided triangular mesh vertices and use it as the direction of additive and subtractive processing. Step S7: Calculate the offset reference plane point, and determine the offset reference plane based on the action direction of additive and subtractive manufacturing and the offset reference plane point; Step S8: Construct an additive and subtractive manufacturing model, and calculate the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset based on the additive and subtractive manufacturing model and the offset reference plane, so as to achieve the additive and subtractive manufacturing effect of the workpiece.

[0005] Preferably, in step S1, constructing the robot's three-dimensional model specifically includes the following sub-steps: Step S11: Constructing the three-dimensional models of each joint of the robot, and assembling the three-dimensional models of each joint of the robot according to the preset robot kinematic relationships to form a joint kinematic chain; Step S12: Correcting the joint kinematic chain according to the preset robot DH parameters, and constructing the robot's forward kinematics algorithm and inverse kinematics algorithm, wherein the robot's forward kinematics algorithm is an algorithm that uses the robot's joint pose as input to solve the robot's end-point pose matrix, and the robot's inverse kinematics algorithm is an algorithm that uses the robot's end-point pose matrix as input to solve the robot's joint pose.

[0006] Preferably, step S2 specifically includes the following sub-steps: Step S21: Traverse the three vertices of the triangular facet corresponding to each triangular mesh in the 3D model of the workpiece; during the traversal, construct a hash mapping mechanism for identifying edges based on the vertex coordinates and vertex indices, and construct a half-edge data structure accordingly. Step S22: Based on the half-side data structure, identify the edges of all triangular facets; Step S23: Calculate the length of the edges of all triangular facets and compare them one by one with the preset thinning threshold. If the length of the edge of the current triangular facet is greater than the preset thinning threshold, then store the edge of the current triangular facet in the preset candidate segmentation edge sequence. Step S24: Sort the edges in the candidate splitting edge sequence in descending order of length to obtain the sorted candidate splitting edge sequence; Step S25: Traverse each edge according to the order of the edges in the sorted candidate segmentation edge sequence; during the traversal, first perform midpoint interpolation segmentation on the current edge, and determine whether the current edge is a shared edge to update its half-edge data structure. If the current edge is a shared edge, add one vertex, six edges and four faces, and remove the original two edges and two faces; if the current edge is a non-shared edge, add one vertex, three edges and two faces, and remove the original one edge and one face; then calculate the length of the newly added edge, and repeat steps S23-S25 until there are no available edges for segmentation in the candidate segmentation edge sequence, so as to obtain an effective 3D model of the workpiece.

[0007] Preferably, step S3 specifically includes the following sub-steps: Step S31: Obtain the triangular mesh set, the vertex set of the triangular mesh, and the vertex index set of the triangular mesh for the robot 3D model and the 3D model of the workpiece to be processed; Step S32: Recursively construct the BVH nodes of the robot 3D model and the effective machining workpiece 3D model, and traverse each BVH node. During the traversal, determine whether the current BVH node is divided into leaf node type. If yes, traverse the next BVH node. If not, execute steps S33-S36. Step S33: Calculate the covariance matrix of the triangular mesh of the current BVH node using principal component analysis. The specific formula for calculating the covariance matrix of the current triangular mesh is as follows: ; ; Where M represents the covariance matrix of the triangular mesh; N represents the number of triangular meshes; This represents the centroid coordinates of the ith vertex of the i-th triangular mesh. express The average value; This represents the coordinates of the first vertex of the i-th triangular mesh; This represents the coordinates of the second vertex of the i-th triangular mesh; This represents the coordinates of the third vertex of the i-th triangular mesh; Step S34: Perform eigenvalue decomposition on the covariance matrix of the triangular mesh of the current BVH node to obtain the local coordinate system of the OBB bounding box, project the vertices of the triangular mesh of the current BVH node onto the local coordinate system of the OBB bounding box, and find the maximum projection coordinates. with minimum projected coordinates and according to and The coordinates of the OBB bounding box center in the local coordinate system, `center`, and the length of half the side of the OBB bounding box, are calculated to construct the OBB bounding box. The specific formulas for calculating `center` and `length` are as follows: ; ; Step S35: Project the centroid of the triangular mesh of the current BVH node onto the principal axis of the local coordinate system of the OBB bounding box, sort the projected coordinates in descending order of centroid values, and extract the median value of the centroid values. Step S36: Determine whether the current BVH node contains a single triangular mesh. If yes, classify the current BVH node as a leaf node and record the index of the triangular mesh of the current BVH node; otherwise, calculate the projection coordinates of the centroid of the triangular mesh of the current BVH node onto the principal axis of the local coordinate system of the OBB bounding box. and judge If the value is greater than or equal to median_value, then the current BVH node is classified as a right leaf node and the index of the triangular mesh of the current BVH node is updated; otherwise, the current BVH node is classified as a left leaf node and the index of the triangular mesh of the current BVH node is updated.

[0008] Preferably, step S5 specifically includes the following steps: Step S51: For the triangular meshes of the selected robot 3D model and the selected effective workpiece 3D model, the simplex is obtained by calculating the Minkowski difference. The calculation formula is as follows: ; Where K represents the Minkowski difference; E represents the set of vertices of the triangular mesh of the robot's 3D model; F represents the set of vertices of the triangular mesh of the 3D model of the workpiece to be machined; e represents the vertex of the triangular mesh of the robot's 3D model; and f represents the vertex of the triangular mesh of the 3D model of the workpiece to be machined. Step S52: Take the difference between the key vectors of the triangular mesh of the selected robot 3D model and the triangular mesh of the selected effective workpiece 3D model as the initial search direction of the GJK algorithm, and use the support function to calculate the farthest point of the simplex in the initial search direction of the GJK algorithm. The specific mathematical expression of the support function is as follows: ; in, Indicates support function, Indicates the search direction of the GJK algorithm; Step S53: Add the farthest point of the simplex in the initial search direction of the GJK algorithm to the simplex set, and determine whether the origin of the world coordinate system is inside the simplex. If yes, it means that the triangular mesh of the selected robot 3D model collides with the triangular mesh of the selected effective workpiece 3D model. If no, find the nearest point from the origin to the simplex, and use the direction of this point as the search direction of the next GJK algorithm. Repeat steps S52-S53 until the preset tolerance error or number of iterations is reached.

[0009] Preferably, in step S6, the specific formula for calculating the average normal of all collided triangular mesh vertices is as follows: ; in, This represents the average normal to all vertices of the collided triangular mesh. G represents the original normal of the j-th collided triangular mesh vertex; G represents the total number of collided triangular mesh vertices.

[0010] Preferably, in step S7, the specific calculation formula for the offset reference plane point is as follows: ; in, Indicates the coordinates of the offset reference plane point; G represents the coordinates of the j-th collided triangular mesh vertex; G represents the total number of collided triangular mesh vertices. The specific formula for calculating the offset reference plane is as follows: ; in, This indicates an offset from the reference plane.

[0011] Preferably, in step S8, the additive and subtractive manufacturing models include models based on the normal direction, models based on the normal direction toward the plane, and models based on the normal direction and constrained to the plane. When the additive and subtractive manufacturing model is based on a model along the normal direction, the specific calculation formula for the vertex coordinates of the triangular mesh of the offset effective 3D model of the workpiece is as follows: ; When the additive and subtractive manufacturing model is based on a model along the normal direction toward the plane, the specific calculation formula for the vertex coordinates of the triangular mesh of the offset effective workpiece 3D model is as follows: ; When the additive and subtractive manufacturing model is based on a model constrained to a plane and aligned with the normal, the specific calculation formula for the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset is as follows: ; in, This represents the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset, when the additive and subtractive manufacturing model is based on a model along the normal direction. This represents the triangular mesh vertices of the effective 3D model of the workpiece after offset when the additive and subtractive manufacturing model is based on a model along the normal direction toward the plane. This represents the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset, when the additive and subtractive model is based on a model constrained to a plane and aligned with the normal; p represents the vertex coordinates of the triangular mesh of the original effective 3D model of the workpiece; s represents the sign, positive for additive operation and negative for subtractive operation; l represents the distance from p to the center point of the area of ​​the workpiece 3D model hit by the brush; r represents the minimum circumscribed circle radius of the area of ​​the workpiece 3D model hit by the brush; h represents the base strength of the brush; dist represents the distance from p to the offset reference plane, calculated using the following formula: .

[0012] Preferably, the method further includes the following step: calculating the vertices of the triangular mesh of the three-dimensional model of the workpiece after the addition / subtraction operation. Directed distance to the target reference plane To evaluate the magnitude and uniformity of changes in the workpiece after material addition or subtraction operations, among which, The specific calculation formula is as follows: ; in, Indicates the direction of the normal to the target reference plane; Indicates the coordinates of the target reference plane point.

[0013] The technical solution provided by this invention may include the following beneficial effects: This solution first constructs a 3D model of the robot and a 3D model of the workpiece, and then constructs BVH (Browser-Valued Hash) for both. It recursively traverses and filters out BVH nodes of type leaf node, i.e., triangular meshes. Next, the GJK algorithm is used to perform collision detection on the two triangular meshes, and the indices of the collided triangular meshes in the workpiece's 3D model are recorded. Based on these indices, the direction of material addition and subtraction is calculated, and the offset reference plane is determined by combining this with the offset reference plane point. Finally, the offset coordinates of the triangular mesh vertices of the workpiece are calculated according to the preset material addition and subtraction model, thus achieving a digital simulation of the material addition and subtraction effect on the workpiece. Compared to the traditional method of repeatedly debugging the physical robot's working path to achieve material addition and subtraction for workpieces, this solution replaces physical trial and error with digital simulation. This not only reduces the ineffective waste of processing materials and lowers experimental costs, but also directly verifies the feasibility of the processing scheme, shortens the processing cycle, and thus improves overall processing efficiency. Attached Figure Description

[0014] Figure 1 This is a flowchart illustrating the steps of a method for implementing robotic additive and subtractive manufacturing operations based on digital twins. Detailed Implementation

[0015] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0016] A method for implementing robotic additive and subtractive manufacturing operations based on digital twins includes the following steps: Step S1: Based on digital twin technology, construct a 3D model of the robot and a 3D model of the workpiece. Both the 3D model of the robot and the 3D model of the workpiece are composed of several triangular meshes. Step S2: Adaptively refine the triangular mesh of the 3D model of the workpiece to obtain an effective 3D model of the workpiece. Step S3: Construct the hierarchical bounding volume BVH of the robot's 3D model and the effective machining workpiece's 3D model, wherein the BVH includes several nodes; Step S4: Recursively traverse the BVH nodes of the robot 3D model and the effective workpiece 3D model, and select the BVH nodes of type leaf node, i.e. triangular mesh, from both. Step S5: Use the GJK algorithm to perform collision detection on the triangular mesh of the selected robot 3D model and the triangular mesh of the selected valid workpiece 3D model. If the two collide, record the index of the collided triangular mesh in the valid workpiece 3D model; if the two do not collide, do not perform the index recording operation. Step S6: Based on the index of the collided triangular mesh in the 3D model of the workpiece, calculate the average normal of all collided triangular mesh vertices and use it as the direction of additive and subtractive processing. Step S7: Calculate the offset reference plane point, and determine the offset reference plane based on the action direction of additive and subtractive manufacturing and the offset reference plane point; Step S8: Construct an additive and subtractive manufacturing model, and calculate the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset based on the additive and subtractive manufacturing model and the offset reference plane, so as to achieve the additive and subtractive manufacturing effect of the workpiece.

[0017] This solution includes a method for implementing robotic additive and subtractive manufacturing operations based on digital twins, such as... Figure 1As shown, the first step is to construct a 3D model of the robot and a 3D model of the workpiece based on digital twin technology. Both the robot and workpiece 3D models are composed of several triangular meshes. In this embodiment, by constructing the robot and workpiece 3D models based on digital twin technology, the geometric features of the physical objects can be accurately mapped in the virtual environment, providing a digital foundation for the subsequent simulation of the robot's additive and subtractive processing of the workpiece. Furthermore, both the robot and workpiece 3D models can be constructed using 3D modeling software such as SolidWorks, Unigraphics NX, and 3D Studio Max. The second step is to adaptively refine the triangular mesh of the workpiece 3D model to obtain an effective workpiece 3D model. In this embodiment, adaptively refining the triangular mesh of the workpiece 3D model helps to increase the density of the triangular mesh, avoiding inaccurate processing range due to sparse meshes. The third step is to construct a hierarchical bounding volume (BVH) for the robot and the effective workpiece 3D model. The BVH includes several nodes. In this embodiment, the hierarchical bounding volume is a hierarchical data structure used to accelerate ray tracing and other geometric queries in a 3D scene. By constructing the BVH (Browser-Valued Hash) of the 3D model, complex 3D models can be simplified hierarchically, reducing the computational load during subsequent collision detection. The fourth step involves recursively traversing the BVH nodes of both the robot's 3D model and the effective workpiece's 3D model, and selecting leaf nodes (triangular meshes) from both. In this embodiment, recursively traversing the BVH nodes and selecting leaf nodes efficiently locates the smallest geometric unit participating in subsequent collision detection, avoiding redundant calculations in unnecessary areas and thus improving the efficiency of subsequent collision detection. The fifth step uses the GJK algorithm to perform collision detection between the selected triangular meshes of the robot's 3D model and the selected triangular meshes of the effective workpiece's 3D model. If a collision occurs, the index of the collided triangular mesh in the effective workpiece's 3D model is recorded; if no collision occurs, the index recording operation is not performed. In this embodiment, the GJK algorithm is an existing algorithm in the field of collision detection. By using the GJK algorithm to perform collision detection between the selected triangular meshes of the robot's 3D model and the selected triangular meshes of the effective workpiece's 3D model, the contact state between the robot and the workpiece can be quickly determined. By recording the indices of the collided triangular meshes in the 3D model of the workpiece, the processing areas that need to be added or subtracted from the workpiece can be accurately located, providing an accurate target area for the subsequent calculation of the direction of material addition or subtraction.The sixth step is to calculate the average normal of all collided triangular mesh vertices in the effective 3D model of the workpiece based on the index of the collided triangular meshes, and use this as the direction of additive and subtractive processing. In this embodiment, by calculating the average normal of the collided triangular mesh vertices in the effective 3D model of the workpiece, it is ensured that the brush direction is consistent with the local surface of the workpiece, avoiding abrupt offsets and improving the realism of the processing simulation. The seventh step is to calculate the offset reference plane point and determine the offset reference plane based on the direction of additive and subtractive processing and the offset reference plane point. In this embodiment, determining the offset reference plane based on the direction of additive and subtractive processing and the offset reference plane point provides a clear benchmark for the geometric offset after subsequent additive and subtractive processing operations. The eighth step is to construct the additive and subtractive processing model and calculate the coordinates of the triangular mesh vertices of the effective 3D model of the workpiece after offset based on the additive and subtractive processing model and the offset reference plane, so as to realize the additive and subtractive processing effect of the workpiece. In this embodiment, by calculating the offset coordinates of the triangular mesh vertices of the effective 3D model of the workpiece based on the additive and subtractive processing model and the offset reference plane, the shape of the processed workpiece after processing can be intuitively presented in the virtual environment, realizing the digital simulation of the additive and subtractive processing effect of the workpiece.

[0018] This scheme first constructs a 3D model of the robot and a 3D model of the workpiece, and creates BVH nodes for both. It then recursively traverses and filters out BVH nodes of type leaf node, i.e., triangular meshes. Next, the GJK algorithm is used to perform collision detection on the two triangular meshes, and the indices of the collided triangular meshes in the workpiece's 3D model are recorded. Based on these indices, the direction of material addition and subtraction is calculated, and the offset reference plane is determined by combining this with the offset reference plane point. Finally, the offset coordinates of the triangular mesh vertices of the workpiece are calculated according to the preset material addition and subtraction model, thus achieving a digital simulation of the material addition and subtraction effect on the workpiece. Compared to the traditional method of repeatedly debugging the physical robot's working path to achieve material addition and subtraction, this scheme replaces physical trial and error with digital simulation. This not only reduces the ineffective waste of processing materials and lowers experimental costs, but also directly verifies the feasibility of the processing scheme, shortens the processing cycle, and thus improves overall processing efficiency.

[0019] Preferably, in step S1, constructing the robot's three-dimensional model specifically includes the following sub-steps: Step S11: Constructing the three-dimensional models of each joint of the robot, and assembling the three-dimensional models of each joint of the robot according to the preset robot kinematic relationships to form a joint kinematic chain; Step S12: Correcting the joint kinematic chain according to the preset robot DH parameters, and constructing the robot's forward kinematics algorithm and inverse kinematics algorithm, wherein the robot's forward kinematics algorithm is an algorithm that uses the robot's joint pose as input to solve the robot's end-effector pose matrix, and the robot's inverse kinematics algorithm is an algorithm that uses the robot's end-effector pose matrix as input to solve the robot's joint pose.

[0020] In this embodiment, in step S21, the 3D models of each joint of the robot are assembled according to a preset robot kinematic relationship, enabling the 3D model to reproduce the movements of the real robot through joint motion. In step S22, the joint kinematic chains are corrected to ensure that the relative positions between the robot joints meet the requirements, reducing dimensional and assembly errors between the virtual and real robots. By constructing a forward kinematics algorithm for the robot, accurate prediction of the spatial pose of the robot's end effector is achieved. By constructing an inverse kinematics algorithm for the robot, core computational support is provided for the robot to move along the target trajectory.

[0021] Preferably, step S2 specifically includes the following sub-steps: Step S21: Traverse the three vertices of the triangular facet corresponding to each triangular mesh in the 3D model of the workpiece; during the traversal, construct a hash mapping mechanism for identifying edges based on the vertex coordinates and vertex indices, and construct a half-edge data structure accordingly. Step S22: Based on the half-side data structure, identify the edges of all triangular facets; Step S23: Calculate the length of the edges of all triangular facets and compare them one by one with the preset thinning threshold. If the length of the edge of the current triangular facet is greater than the preset thinning threshold, then store the edge of the current triangular facet in the preset candidate segmentation edge sequence. Step S24: Sort the edges in the candidate splitting edge sequence in descending order of length to obtain the sorted candidate splitting edge sequence; Step S25: Traverse each edge according to the order of the edges in the sorted candidate segmentation edge sequence; during the traversal, first perform midpoint interpolation segmentation on the current edge, and determine whether the current edge is a shared edge to update its half-edge data structure. If the current edge is a shared edge, add one vertex, six edges and four faces, and remove the original two edges and two faces; if the current edge is a non-shared edge, add one vertex, three edges and two faces, and remove the original one edge and one face; then calculate the length of the newly added edge, and repeat steps S23-S25 until there are no available edges for segmentation in the candidate segmentation edge sequence, so as to obtain an effective 3D model of the workpiece.

[0022] In this embodiment, in step S21, a hash mapping mechanism for edge identification is constructed based on vertex coordinates and vertex indices, enabling rapid determination of edge uniqueness and sharing. By constructing a half-edge data structure, the association between edges and adjacent faces and vertices is clearly recorded, laying the foundation for subsequent adaptive triangular mesh refinement. In step S22, the edges of all triangular faces are identified based on the half-edge data structure, eliminating the need to repeatedly traverse vertices to reconstruct edges, thus reducing the computational cost of edge extraction. In step S23, by comparing the length of the edges of the triangular faces with a preset refinement threshold and storing the selected edges in a preset candidate segmentation edge sequence, triangular mesh refinement is performed only on edges whose length exceeds the threshold, avoiding invalid processing of edges that meet the accuracy requirements. In step S24, by sorting the edges in the candidate segmentation edge sequence in descending order of length, it is ensured that the longest edges are refined first. In step S25, midpoint interpolation is performed on the edges. Specifically, the midpoint of the edge is used for segmentation. While preserving the original triangular mesh geometric features, details are accurately added to ensure that the refined triangular mesh closely matches the actual shape of the workpiece. By dynamically updating the half-edge data structure based on edge sharing, the correctness of the mesh topology can be ensured in real time, preventing topological errors such as overhanging edges and isolated faces. By calculating the length of the newly added edges and repeating steps S23-S25, the refinement process can adaptively focus on the long-side regions of the 3D model of the workpiece, gradually achieving convergence of the overall edge length.

[0023] Preferably, step S3 specifically includes the following sub-steps: Step S31: Obtain the triangular mesh set, the vertex set of the triangular mesh, and the vertex index set of the triangular mesh for the robot 3D model and the 3D model of the workpiece to be processed; Step S32: Recursively construct the BVH nodes of the robot 3D model and the effective machining workpiece 3D model, and traverse each BVH node. During the traversal, determine whether the current BVH node is divided into leaf node type. If yes, traverse the next BVH node. If not, execute steps S33-S36. Step S33: Calculate the covariance matrix of the triangular mesh of the current BVH node using principal component analysis. The specific formula for calculating the covariance matrix of the current triangular mesh is as follows: ; ; Where M represents the covariance matrix of the triangular mesh; N represents the number of triangular meshes; This represents the centroid coordinates of the ith vertex of the i-th triangular mesh. express The average value; This represents the coordinates of the first vertex of the i-th triangular mesh; This represents the coordinates of the second vertex of the i-th triangular mesh; This represents the coordinates of the third vertex of the i-th triangular mesh; Step S34: Perform eigenvalue decomposition on the covariance matrix of the triangular mesh of the current BVH node to obtain the local coordinate system of the OBB bounding box, project the vertices of the triangular mesh of the current BVH node onto the local coordinate system of the OBB bounding box, and find the maximum projection coordinates. with minimum projected coordinates and according to and The coordinates of the OBB bounding box center in the local coordinate system, `center`, and the length of half the side of the OBB bounding box, are calculated to construct the OBB bounding box. The specific formulas for calculating `center` and `length` are as follows: ; ; Step S35: Project the centroid of the triangular mesh of the current BVH node onto the principal axis of the local coordinate system of the OBB bounding box, sort the projected coordinates in descending order of centroid values, and extract the median value of the centroid values. Step S36: Determine whether the current BVH node contains a single triangular mesh. If yes, classify the current BVH node as a leaf node and record the index of the triangular mesh of the current BVH node; otherwise, calculate the projection coordinates of the centroid of the triangular mesh of the current BVH node onto the principal axis of the local coordinate system of the OBB bounding box. and judge If the value is greater than or equal to median_value, then the current BVH node is classified as a right leaf node and the index of the triangular mesh of the current BVH node is updated; otherwise, the current BVH node is classified as a left leaf node and the index of the triangular mesh of the current BVH node is updated.

[0024] In this embodiment, in step S31, by acquiring the triangular mesh set, vertex set, and vertex index set of the robot 3D model and the effective workpiece 3D model, a data foundation is provided for the subsequent construction of the BVH of the robot 3D model and the effective workpiece 3D model. In step S32, by recursively constructing BVH nodes and traversing to determine the node type, it is beneficial to distinguish between leaf nodes and non-leaf nodes, realizing the hierarchical partitioning of the 3D model. In step S33, by using principal component analysis to calculate the covariance matrix of the triangular mesh of the current BVH node, it is beneficial to accurately describe the distribution characteristics of the triangular mesh within the current BVH node. In step S34, by eigenvalue decomposition of the covariance matrix to obtain the local coordinate system of the OBB bounding box, and by projecting the vertices of the triangular mesh to calculate the center and half-side length of the OBB bounding box, the OBB bounding box is constructed. Compared with the AABB bounding box, the OBB bounding box can more tightly wrap the triangular mesh, significantly reducing the blank space within the bounding box, effectively reducing the overlap of bounding boxes in the BVH hierarchy, and thus improving the efficiency of subsequent collision detection. In step S35, the centroid of the triangular mesh of the current BVH node is projected onto the principal axis of the OBB local coordinate system and sorted by median value, providing an efficient segmentation basis for subsequent node partitioning. In step S36, the leaf node determination ensures that the "leaf layer" of BVH accurately corresponds to the smallest geometric unit, guaranteeing the accuracy of the underlying query.

[0025] Preferably, step S5 specifically includes the following steps: Step S51: For the triangular meshes of the selected robot 3D model and the selected effective workpiece 3D model, the simplex is obtained by calculating the Minkowski difference. The calculation formula is as follows: ; Where K represents the Minkowski difference; E represents the set of vertices of the triangular mesh of the robot's 3D model; F represents the set of vertices of the triangular mesh of the 3D model of the workpiece to be machined; e represents the vertex of the triangular mesh of the robot's 3D model; and f represents the vertex of the triangular mesh of the 3D model of the workpiece to be machined. Step S52: Take the difference between the key vectors of the triangular mesh of the selected robot 3D model and the triangular mesh of the selected effective workpiece 3D model as the initial search direction of the GJK algorithm, and use the support function to calculate the farthest point of the simplex in the initial search direction of the GJK algorithm. The specific mathematical expression of the support function is as follows: ; in, Indicates support function, Indicates the search direction of the GJK algorithm; Step S53: Add the farthest point of the simplex in the initial search direction of the GJK algorithm to the simplex set, and determine whether the origin of the world coordinate system is inside the simplex. If yes, it means that the triangular mesh of the selected robot 3D model collides with the triangular mesh of the selected effective workpiece 3D model. If no, find the nearest point from the origin to the simplex, and use the direction of this point as the search direction of the next GJK algorithm. Repeat steps S52-S53 until the preset tolerance error or number of iterations is reached.

[0026] In this embodiment, in step S51, by calculating the Minkowski difference between the vertex sets of the triangular meshes of the robot's 3D model and the effective workpiece's 3D model, the collision detection problem between the robot and the workpiece can be transformed into a geometric determination problem of "whether the simplex contains the origin". In step S52, by taking the difference in the vertex vectors of the triangular meshes of the robot's 3D model and the effective workpiece's 3D model as the initial search direction of the GJK algorithm, the geometric features of the model itself are used to guide the GJK algorithm to converge quickly, reducing the number of iterations and improving the real-time performance of collision detection. By using support functions to calculate the farthest point of the simplex in the GJK algorithm's search direction, a reliable calculation basis is provided for subsequent determination of whether the origin is inside the simplex. In step S53, the collision state between the robot and the workpiece can be directly quantified through the judgment logic of "whether the origin is inside the simplex". Further, in this embodiment, the simplex used is a triangle, and its judgment logic is "whether the origin is outside the triangle". In other embodiments, if the simplex used is a line segment, the judgment logic is "whether the origin is on the negative half of the line segment's extension direction"; if the simplex used is a tetrahedron, the judgment logic is "whether the origin is on the same side of all faces". This further ensures the applicability and accuracy of collision detection in multiple scenarios.

[0027] Preferably, in step S6, the specific formula for calculating the average normal of all collided triangular mesh vertices is as follows: ; in, This represents the average normal to all vertices of the collided triangular mesh. G represents the original normal of the j-th collided triangular mesh vertex; G represents the total number of collided triangular mesh vertices.

[0028] In this embodiment, by weighted averaging the original normals of the collided triangular mesh vertices, the normal information of all collided triangular mesh vertices can be integrated to accurately reflect the overall geometric orientation characteristics of the collision area of ​​the workpiece.

[0029] Preferably, in step S7, the specific calculation formula for the offset reference plane point is as follows: ; in, Indicates the coordinates of the offset reference plane point; G represents the coordinates of the j-th collided triangular mesh vertex; G represents the total number of collided triangular mesh vertices. The specific formula for calculating the offset reference plane is as follows: ; in, This indicates an offset from the reference plane.

[0030] In this embodiment, the offset reference plane point is calculated, and based on this and Determine the offset reference plane to provide a data baseline for the vertices of the triangular mesh used in subsequent offset calculations.

[0031] Preferably, in step S8, the additive and subtractive manufacturing models include models based on the normal direction, models based on the normal direction toward the plane, and models based on the normal direction and constrained to the plane. When the additive and subtractive manufacturing model is based on a model along the normal direction, the specific calculation formula for the vertex coordinates of the triangular mesh of the offset effective 3D model of the workpiece is as follows: ; When the additive and subtractive manufacturing model is based on a model along the normal direction toward the plane, the specific calculation formula for the vertex coordinates of the triangular mesh of the offset effective workpiece 3D model is as follows: ; When the additive and subtractive manufacturing model is based on a model constrained to a plane and aligned with the normal, the specific calculation formula for the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset is as follows: ; in, This represents the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset, when the additive and subtractive manufacturing model is based on a model along the normal direction. This represents the triangular mesh vertices of the effective 3D model of the workpiece after offset when the additive and subtractive manufacturing model is based on a model along the normal direction toward the plane. This represents the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset, when the additive and subtractive model is based on a model constrained to a plane and aligned with the normal; p represents the vertex coordinates of the triangular mesh of the original effective 3D model of the workpiece; s represents the sign, positive for additive operation and negative for subtractive operation; l represents the distance from p to the center point of the area of ​​the workpiece 3D model hit by the brush; r represents the minimum circumscribed circle radius of the area of ​​the workpiece 3D model hit by the brush; h represents the base strength of the brush; dist represents the distance from p to the offset reference plane, calculated using the following formula: .

[0032] In this embodiment, if uniform additive or subtractive processing is required along the surface normal direction, a "model based on the normal direction" can be selected; if composite processing of the normal direction and the planar direction is required, a "model based on the normal direction towards the planar direction" can be used; if precise processing of planar regions is required under normal constraints, a "model based on the normal constraint towards the plane" can be used. By calculating the corresponding vertex offset coordinates for different additive and subtractive processing models, precise adaptation to diverse additive and subtractive processing scenarios can be achieved.

[0033] Preferably, the method further includes the following step: calculating the vertices of the triangular mesh of the 3D model of the workpiece to be effectively machined after the addition and subtraction operations. Directed distance to the target reference plane To evaluate the magnitude and uniformity of changes in the workpiece after material addition or subtraction operations, among which, The specific calculation formula is as follows: ; in, Indicates the direction of the normal to the target reference plane; Indicates the coordinates of the target reference plane point.

[0034] In this embodiment, the vertices of the triangular mesh of the 3D model of the workpiece effectively machined after the addition and subtraction operations are calculated. Directed distance to the target reference plane This allows for a direct and quantitative assessment of the deformation effect of the workpiece after additive or subtractive material operations. In other embodiments, the surface shape of the workpiece before and after the additive or subtractive material operations can be compared and analyzed by calculating the Hausdorff distance or root mean square error (RMS), further quantitatively assessing the accuracy, flatness, and consistency of the additive or subtractive material effects on the workpiece.

[0035] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0036] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for implementing robotic additive and subtractive manufacturing operations based on digital twins, characterized in that: Includes the following steps: Step S1: Based on digital twin technology, construct a 3D model of the robot and a 3D model of the workpiece. Both the 3D model of the robot and the 3D model of the workpiece are composed of several triangular meshes. Step S2: Adaptively refine the triangular mesh of the 3D model of the workpiece to obtain an effective 3D model of the workpiece. Step S3: Construct the hierarchical bounding volume BVH of the robot's 3D model and the effective machining workpiece's 3D model, wherein the BVH includes several nodes; Step S4: Recursively traverse the BVH nodes of the robot 3D model and the effective workpiece 3D model, and select the BVH nodes of type leaf node, i.e. triangular mesh, from both. Step S5: Use the GJK algorithm to perform collision detection on the triangular mesh of the selected robot 3D model and the triangular mesh of the selected valid workpiece 3D model. If the two collide, record the index of the collided triangular mesh in the valid workpiece 3D model; if the two do not collide, do not perform the index recording operation. Step S6: Based on the index of the collided triangular meshes in the 3D model of the workpiece, calculate the average normal of all collided triangular mesh vertices and use it as the direction of additive and subtractive processing. Step S7: Calculate the offset reference plane point, and determine the offset reference plane based on the action direction of additive and subtractive manufacturing and the offset reference plane point; Step S8: Construct an additive and subtractive manufacturing model, and calculate the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset based on the additive and subtractive manufacturing model and the offset reference plane, so as to achieve the additive and subtractive manufacturing effect of the workpiece. In step S8, the additive and subtractive manufacturing models include models based on the normal direction, models based on the normal direction toward the plane, and models based on the normal direction and constrained to the plane. When the additive and subtractive manufacturing model is based on a model along the normal direction, the specific calculation formula for the vertex coordinates of the triangular mesh of the offset effective 3D model of the workpiece is as follows: ; When the additive and subtractive manufacturing model is based on a model along the normal direction toward the plane, the specific calculation formula for the vertex coordinates of the triangular mesh of the offset effective workpiece 3D model is as follows: ; When the additive and subtractive manufacturing model is based on a model constrained to a plane and aligned with the normal, the specific calculation formula for the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset is as follows: ; in, This represents the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset, when the additive and subtractive manufacturing model is based on a model along the normal direction. This represents the triangular mesh vertices of the effective 3D model of the workpiece after offset when the additive and subtractive manufacturing model is based on a model along the normal direction toward the plane. This represents the vertex coordinates of the triangular mesh of the effective 3D model of the workpiece after offset, when the additive and subtractive model is based on a model constrained to a plane and aligned with the normal; p represents the vertex coordinates of the triangular mesh of the original effective 3D model of the workpiece; s represents the sign, positive for additive operation and negative for subtractive operation; l represents the distance from p to the center point of the area of ​​the workpiece 3D model hit by the brush; r represents the minimum circumscribed circle radius of the area of ​​the workpiece 3D model hit by the brush; h represents the base strength of the brush; dist represents the distance from p to the offset reference plane, calculated using the following formula: ; This represents the average normal to all vertices of the collided triangular mesh. This indicates the coordinates of the offset reference plane point.

2. The method for implementing robot additive and subtractive manufacturing operations based on digital twins according to claim 1, characterized in that: In step S1, the robot's 3D model is constructed, which specifically includes the following sub-steps: Step S11: Construct a three-dimensional model of each joint of the robot, and assemble the three-dimensional models of each joint of the robot according to the preset robot kinematic relationship to form a joint kinematic chain. Step S12: Based on the preset robot DH parameters, the joint kinematic chains are corrected, and the robot's forward kinematics algorithm and inverse kinematics algorithm are constructed. The robot's forward kinematics algorithm is an algorithm that uses the robot's joint pose as input to solve the robot's end-effector pose matrix, and the robot's inverse kinematics algorithm is an algorithm that uses the robot's end-effector pose matrix as input to solve the robot's joint pose.

3. The method for implementing robot additive and subtractive manufacturing operations based on digital twins according to claim 1, characterized in that: Step S2 specifically includes the following sub-steps: Step S21: Traverse the three vertices of the triangular facet corresponding to each triangular mesh in the 3D model of the workpiece; during the traversal, construct a hash mapping mechanism for identifying edges based on the vertex coordinates and vertex indices, and construct a half-edge data structure accordingly. Step S22: Based on the half-side data structure, identify the edges of all triangular facets; Step S23: Calculate the length of the edges of all triangular facets and compare them one by one with the preset thinning threshold. If the length of the edge of the current triangular facet is greater than the preset thinning threshold, then store the edge of the current triangular facet in the preset candidate segmentation edge sequence. Step S24: Sort the edges in the candidate splitting edge sequence in descending order of length to obtain the sorted candidate splitting edge sequence; Step S25: Traverse each edge according to the order of the edges in the sorted candidate segmentation edge sequence; during the traversal, first perform midpoint interpolation segmentation on the current edge, and determine whether the current edge is a shared edge to update its half-edge data structure. If the current edge is a shared edge, add one vertex, six edges and four faces, and remove the original two edges and two faces; if the current edge is a non-shared edge, add one vertex, three edges and two faces, and remove the original one edge and one face; then calculate the length of the newly added edge, and repeat steps S23-S25 until there are no available edges for segmentation in the candidate segmentation edge sequence, so as to obtain an effective 3D model of the workpiece.

4. The method for implementing robot additive and subtractive manufacturing operations based on digital twins according to claim 1, characterized in that: Step S3 specifically includes the following sub-steps: Step S31: Obtain the triangular mesh set, the vertex set of the triangular mesh, and the vertex index set of the triangular mesh for the robot 3D model and the 3D model of the workpiece to be processed; Step S32: Recursively construct the BVH nodes of the robot 3D model and the effective machining workpiece 3D model, and traverse each BVH node. During the traversal, determine whether the current BVH node is divided into leaf node type. If yes, traverse the next BVH node. If not, execute steps S33-S36. Step S33: Calculate the covariance matrix of the triangular mesh of the current BVH node using principal component analysis. The specific formula for calculating the covariance matrix of the current triangular mesh is as follows: ; ; Where M represents the covariance matrix of the triangular mesh; N represents the number of triangular meshes; This represents the centroid coordinates of the vertices of the i-th triangular mesh. express The average value; This represents the coordinates of the first vertex of the i-th triangular mesh; This represents the coordinates of the second vertex of the i-th triangular mesh; This represents the coordinates of the third vertex of the i-th triangular mesh; Step S34: Perform eigenvalue decomposition on the covariance matrix of the triangular mesh of the current BVH node to obtain the local coordinate system of the OBB bounding box, project the vertices of the triangular mesh of the current BVH node onto the local coordinate system of the OBB bounding box, and find the maximum projection coordinates. with minimum projected coordinates and according to and The coordinates of the OBB bounding box center in the local coordinate system, `center`, and the length of half the side of the OBB bounding box, are calculated to construct the OBB bounding box. The specific formulas for calculating `center` and `length` are as follows: ; ; Step S35: Project the centroid of the triangular mesh of the current BVH node onto the principal axis of the local coordinate system of the OBB bounding box, sort the projected coordinates in descending order of centroid values, and extract the median value of the centroid values. Step S36: Determine whether the current BVH node contains a single triangular mesh. If yes, classify the current BVH node as a leaf node and record the index of the triangular mesh of the current BVH node; otherwise, calculate the projection coordinates of the centroid of the triangular mesh of the current BVH node onto the principal axis of the local coordinate system of the OBB bounding box. and judge If the value is greater than or equal to median_value, then the current BVH node is classified as a right leaf node and the index of the triangular mesh of the current BVH node is updated; otherwise, the current BVH node is classified as a left leaf node and the index of the triangular mesh of the current BVH node is updated.

5. The method for implementing robot additive and subtractive manufacturing operations based on digital twins according to claim 1, characterized in that: Step S5 specifically includes the following steps: Step S51: For the triangular meshes of the selected robot 3D model and the selected effective workpiece 3D model, the simplex is obtained by calculating the Minkowski difference. The calculation formula is as follows: ; Where K represents the Minkowski difference; E represents the set of vertices of the triangular mesh of the robot's 3D model; F represents the set of vertices of the triangular mesh of the 3D model of the workpiece to be machined; e represents the vertex of the triangular mesh of the robot's 3D model; and f represents the vertex of the triangular mesh of the 3D model of the workpiece to be machined. Step S52: Take the difference between the key vectors of the triangular mesh of the selected robot 3D model and the triangular mesh of the selected effective workpiece 3D model as the initial search direction of the GJK algorithm, and use the support function to calculate the farthest point of the simplex in the initial search direction of the GJK algorithm. The specific mathematical expression of the support function is as follows: ; in, Indicates support function, Indicates the search direction of the GJK algorithm; Step S53: Add the farthest point of the simplex in the initial search direction of the GJK algorithm to the simplex set, and determine whether the origin of the world coordinate system is inside the simplex. If yes, it means that the triangular mesh of the selected robot 3D model collides with the triangular mesh of the selected effective workpiece 3D model. If no, find the nearest point from the origin to the simplex, and use the direction of this point as the search direction of the next GJK algorithm. Repeat steps S52-S53 until the preset tolerance error or number of iterations is reached.

6. The method for implementing robot additive and subtractive manufacturing operations based on digital twins according to claim 1, characterized in that: In step S6, the specific formula for calculating the average normal of all collided triangular mesh vertices is as follows: ; in, This represents the average normal to all vertices of the collided triangular mesh. G represents the original normal of the j-th collided triangular mesh vertex; G represents the total number of collided triangular mesh vertices.

7. The method for implementing robot additive and subtractive manufacturing operations based on digital twins according to claim 6, characterized in that: In step S7, the specific calculation formula for the offset reference plane point is as follows: ; in, Indicates the coordinates of the offset reference plane point; G represents the coordinates of the j-th collided triangular mesh vertex; G represents the total number of collided triangular mesh vertices. The specific formula for calculating the offset reference plane is as follows: ; in, This indicates an offset from the reference plane.

8. The method for implementing robot additive and subtractive manufacturing operations based on digital twins according to claim 1, characterized in that: It also includes the following steps: Calculate the vertices of the triangular mesh of the 3D model of the workpiece after additive and subtractive material operations. Directed distance to the target reference plane To evaluate the magnitude and uniformity of changes in the workpiece after material addition or subtraction operations, among which, The specific calculation formula is as follows: ; in, Indicates the direction of the normal to the target reference plane; Indicates the coordinates of the target reference plane point.

Citation Information

Patent Citations

  • Collision detection method and device in digital twin mode

    CN117518880A

  • Mixed additive and subtractive process planning method and system for remanufacturing

    CN118823281A