A method for guiding casting grinding that links defect detection with grinding area

CN122500751APending Publication Date: 2026-08-04DALIAN YUYANG IND INTELLIGENT
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DALIAN YUYANG IND INTELLIGENT
Filing Date
2026-07-08
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

[0003]现有技术仍存在以下问题:人工示教打磨依赖操作人员经验,轨迹生成效率低,且对铸件个体差异和毛刺、飞边形态变化适应性不足

Benefits of technology

1、本发明将机器人位姿、手眼标定结果和多视角点云融合过程统一为后续CAD比对、深度学习识别和机器人路径规划提供一致的三维空间基础,避免了单视角采集造成的遮挡和局部缺失问题;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122500751A_ABST
    Figure CN122500751A_ABST
Patent Text Reader

Abstract

This invention discloses a casting grinding guidance method that links defect detection with grinding area, relating to the fields of intelligent manufacturing and industrial robot automated processing technology. The method includes: acquiring point clouds from the casting surface; converting these points to the robot base coordinate system via hand-eye calibration and robot pose matrix transformation; obtaining a preprocessed point cloud after ICP fine registration and preprocessing; registering this point cloud with a CAD triangular mesh model to obtain an aligned point cloud and calculating signed distance and full geometric comparison data; using PointNet++ to perform semantic segmentation on the point cloud to obtain an initial semantic probability map; fusing the signed distance to calculate a joint defect score; selecting points to be ground to obtain effective grinding areas and their defect feature descriptors; generating a grinding trajectory and process parameters; executing grinding; replanning the path through closed-loop correction and grinding again. This invention can automatically determine the process parameters during grinding based on the grinding allowance, improving the stability of grinding quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent manufacturing and industrial robot automated processing technology, and in particular to a casting grinding guidance method that links defect detection and grinding area. Background Technology

[0002] Currently, the main methods for detecting surface defects and guiding grinding of castings include the following: The first is manual teaching grinding, where operators manually teach the robot trajectory based on experience, and this trajectory is repeated in subsequent batch production. The second is two-dimensional vision-based defect detection, which involves acquiring images of the casting surface using industrial cameras and identifying abnormal areas using grayscale, edge, texture, or deep learning image segmentation methods. The third is geometric deviation detection based on comparing 3D point clouds with CAD triangular mesh models, which involves first scanning the casting surface point cloud, then registering the point cloud with the CAD triangular mesh model, and extracting the deviation areas by calculating the distance from the point cloud to the theoretical CAD surface. The fourth is semantic segmentation based on point cloud deep learning, which uses PointNet, PointNet++, or other point cloud networks to classify the casting surface point cloud point by point, identifying abnormal areas such as burrs and flash.

[0003] Current technologies still suffer from the following problems: Manual teaching-based grinding relies on operator experience, resulting in low trajectory generation efficiency and insufficient adaptability to individual differences in castings and variations in burr and flash morphology. Two-dimensional vision inspection lacks accurate three-dimensional depth information, making it difficult to obtain defect height, allowance, and surface normals, and thus cannot directly support robot posture and grinding depth planning. While simple CAD geometric comparison can obtain out-of-tolerance heights, it struggles to distinguish between burrs, flash, and ordinary geometric protrusions, and is prone to missing small edge burrs that affect assembly. While simple deep learning semantic segmentation can identify defect categories, it lacks CAD geometric constraints, easily misclassifying surface textures, rust, reflections, or scanning noise as defects. More importantly, existing methods typically treat defect detection and grinding path planning as two independent processes. The detection stage often only outputs point sets, selected regions, or defect labels, failing to directly drive the adaptive generation of grinding trajectory patterns, tool posture, feed rate, and layer removal strategies. This results in an information gap between the detection results and the robot's execution actions, still requiring significant manual intervention. Summary of the Invention

[0004] This invention provides a casting grinding guidance method that links defect detection with grinding area to overcome the above-mentioned technical problems.

[0005] To achieve the above objectives, the technical solution of the present invention is as follows: S1: Collect the point cloud of the casting surface, transform the point cloud of the casting surface to the robot base coordinate system through the hand-eye calibration matrix and the robot end pose matrix, and perform ICP fine registration fusion and preprocessing on the point cloud of the casting surface to obtain the preprocessed point cloud in the robot base coordinate system. S2: Register the preprocessed point cloud with the casting CAD triangular mesh model to obtain an aligned point cloud in the CAD coordinate system. Calculate the signed distance from each point in the aligned point cloud to the surface of the CAD triangular mesh model to obtain full geometric comparison data containing the three-dimensional coordinates, signed distance, and CAD theoretical unit normal vector of each point. S3: Use the PointNet++ semantic segmentation model to classify the aligned point cloud in the CAD coordinate system point by point to obtain the initial semantic probability map of each point belonging to the three categories of normal, burr, and flash. S4: The signed distance in the full geometric comparison data is fused with the initial semantic probability map to calculate the joint defect score. The points to be polished are selected and clustered according to the joint defect score to obtain at least one effective polishing region and its defect feature descriptor. The defect feature descriptor includes the region point set, region boundary, region center, maximum polishing allowance, CAD theoretical unit normal vector, dominant polishing type and dominant source of the effective polishing region. S5: Based on the dominant grinding type in the defect feature descriptor, define different trajectory patterns and process parameters to generate a grinding program that can be executed by the robot; S6: The robot executes the polishing program to polish the area, calculates the residual positive margin of the polished area to re-inspect the polished area, and if the residual positive margin exceeds the allowable threshold, it triggers closed-loop correction, redefines the defect feature descriptor of the current residual positive margin, and returns to S5 to plan the local polishing path and perform polishing again until it is qualified or the iteration limit is reached.

[0006] Beneficial effects: This invention provides a method for guiding the grinding of castings by linking defect detection with the grinding area, which has the following advantages: 1. This invention unifies the robot pose, hand-eye calibration results, and multi-view point cloud fusion process to provide a consistent three-dimensional spatial basis for subsequent CAD comparison, deep learning recognition, and robot path planning, avoiding occlusion and local missing problems caused by single-view acquisition; 2. This invention can accurately register the actual point cloud of the casting with the CAD theoretical model and output full geometric comparison data, so that each point has a corresponding signed distance and CAD theoretical unit normal vector, avoiding the lack of geometric information for semantic anomalies in subsequent steps, thus providing a complete basis for subsequent geometric-semantic fusion and grinding allowance calculation, and ensuring that geometric detection and semantic detection can be fused under the same data structure. 3. This invention integrates the burr and flash probabilities obtained from PointNet++ semantic segmentation with the CAD geometric deviation results to improve the accuracy and robustness of defect identification; 4. This invention does not rely solely on CAD distance thresholds or solely on deep learning semantic results. Instead, it fuses signed distances and semantic probability maps of different defect types to obtain a joint defect score. The joint defect score is used to screen points to be polished, effectively reducing false detections and missed detections caused by a single detection source. 5. The present invention determines the dominant grinding type based on the defect feature descriptor, and can distinguish burrs, flash, geometric protrusions and noise areas, and only outputs the effective grinding area to the subsequent path planning step, so as to avoid low confidence and low tolerance areas from entering the grinding process. 6. This invention can select different trajectory modes according to different dominant grinding types, realize deterministic linkage between detection results and grinding trajectory shape, and avoid the problem that traditional unified path templates cannot adapt to different defect shapes. 7. This invention can automatically determine the process parameters during the polishing process based on the polishing allowance, thereby improving the stability of polishing quality; 8. This invention can generate tool postures and robot base coordinate system trajectories that meet the robot's execution requirements, avoiding a break in the chain between detection coordinates and execution coordinates; and it forms a closed-loop control through re-inspection after polishing, avoiding the problem of not being able to determine whether it is qualified after one polishing. Attached Figure Description

[0007] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0008] Figure 1 The present invention provides a method flowchart for guiding the grinding of castings by linking defect detection and grinding area. Detailed Implementation

[0009] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0010] This embodiment provides a casting grinding guidance method that links defect detection with the grinding area, such as... Figure 1 As shown, it includes: S1: Collect the point cloud of the casting surface, transform the point cloud of the casting surface to the robot base coordinate system through the hand-eye calibration matrix and the robot end pose matrix, and perform ICP fine registration fusion and preprocessing on the point cloud of the casting surface to obtain the preprocessed point cloud in the robot base coordinate system. S2: Register the preprocessed point cloud with the casting CAD triangular mesh model to obtain an aligned point cloud in the CAD coordinate system. Calculate the signed distance from each point in the aligned point cloud to the surface of the CAD triangular mesh model to obtain full geometric comparison data containing the three-dimensional coordinates, signed distance, and CAD theoretical unit normal vector of each point. S3: Use the PointNet++ semantic segmentation model to classify the aligned point cloud in the CAD coordinate system point by point to obtain the initial semantic probability map of each point belonging to the three categories of normal, burr, and flash. S4: The signed distance in the full geometric comparison data is fused with the initial semantic probability map to calculate the joint defect score. The points to be polished are selected and clustered according to the joint defect score to obtain at least one effective polishing region and its defect feature descriptor. The defect feature descriptor includes the region point set, region boundary, region center, maximum polishing allowance, CAD theoretical unit normal vector, dominant polishing type and dominant source of the effective polishing region. S5: Based on the dominant grinding type in the defect feature descriptor, define different trajectory patterns and process parameters to generate a grinding program that can be executed by the robot; S6: The robot executes the polishing program to polish the area, calculates the residual positive margin of the polished area to re-inspect the polished area, and if the residual positive margin exceeds the allowable threshold, it triggers closed-loop correction, redefines the defect feature descriptor of the current residual positive margin, and returns to S5 to plan the local polishing path and perform polishing again until it is qualified or the iteration limit is reached.

[0011] Specifically, this invention provides a casting grinding guidance method that links defect detection with grinding area. The method uses a robot equipped with a 3D vision sensor to collect point clouds on the casting surface. Geometric deviation information of the casting surface is obtained through multi-view point cloud fusion, CAD model registration, and signed distance calculation. Simultaneously, the semantic probability of surface anomalies such as burrs and flash is obtained through a PointNet++ point cloud semantic segmentation model. Then, the geometric deviation information, semantic probability, CAD theoretical unit normal vector, and region contour are uniformly fused into a defect feature descriptor. Based on the dominant grinding type and maximum grinding allowance in the defect feature descriptor, the robot grinding trajectory, tool posture, feed speed, and layer removal parameters are adaptively generated. Finally, closed-loop control (OK, Replan, NG, Rescan) is achieved through post-grinding re-inspection and residual positive allowance determination.

[0012] In a specific embodiment, the point cloud of the casting surface is acquired, and then transformed into the robot base coordinate system using a hand-eye calibration matrix and a robot end-effector pose matrix. The point cloud is then subjected to ICP fine registration fusion and preprocessing to obtain a preprocessed point cloud in the robot base coordinate system. S11. Perform hand-eye calibration on the casting to obtain the hand-eye calibration matrix from the camera coordinate system to the robot end-effector coordinate system, and obtain the real-time pose matrix from the robot end-effector coordinate system to the robot base coordinate system through the robot controller. S12. Acquire the original point cloud of the casting surface in the camera coordinate system and record the corresponding robot end-effector pose. The set of original point clouds of the casting surface is as follows:

[0013] in, Indicates the first The original point cloud set of the casting surface in the camera coordinate system from each acquisition perspective. Indicates the first From the perspective of the first collection, the first The three-dimensional coordinates of a point in the camera coordinate system Indicates the first Number of point clouds from each acquisition perspective Indicates the sequence number of the acquisition viewpoint. It is a single-viewpoint time; Specifically, in this embodiment, a striped structured light 3D camera mounted on the end effector of a robot is used to collect point clouds on the surface of the casting. The single-view or multi-view acquisition method is selected based on the complexity of the casting structure. In single-view acquisition, the robot moves to a preset shooting pose and triggers the camera to acquire a frame of point cloud; in multi-view acquisition, the robot moves to multiple preset shooting poses in sequence, and the camera is triggered to acquire point cloud at each perspective, and the corresponding robot end-effector pose is recorded. S13. For the original point cloud of the casting surface from each viewpoint, transform it to the robot base coordinate system using the hand-eye calibration matrix and the real-time pose matrix of the robot end effector. The specific steps are as follows: S131: Obtaining the first... based on the hand-eye calibration matrix and the robot end effector's real-time pose matrix. The homogeneous transformation matrix from the camera coordinate system to the robot base coordinate system from each acquisition viewpoint is formulated as follows:

[0014] in, Indicates the first Homogeneous transformation matrix from camera coordinate system to robot base coordinate system from each acquisition viewpoint. Indicates the first The real-time pose matrix from the robot's end effector coordinate system to the robot's base coordinate system from each acquisition viewpoint. This represents the hand-eye calibration matrix from the camera coordinate system to the robot's end effector coordinate system; S132: The homogeneous transformation matrix from the camera coordinate system to the robot base coordinate system transforms the original point cloud of the casting surface from each viewpoint to the robot base coordinate system. The formula is as follows:

[0015] in, Indicates the first The original point cloud from the first acquisition perspective The three-dimensional coordinates of each point after transformation to the robot's base coordinate system; This represents a function that converts camera coordinates to 3D coordinates. S14, Regarding The original point cloud acquired under these conditions is finely registered using point-to-area ICP to obtain a finely registered multi-view fused point cloud. The specific steps are as follows: S141: Obtain the initial fused point cloud after transforming the original point clouds from all views to the robot's base coordinate system. The formula is as follows:

[0016] in, This represents the initial fused point cloud after transforming the original point clouds from all viewpoints to the robot's base coordinate system. Indicates the total number of captured viewpoints. ; S142: Define the first frame of point cloud data as the reference point cloud. From the initial fused point cloud, extract the points to be registered that overlap with the reference point cloud in the original point cloud of each viewpoint, as well as the corresponding points of the points to be registered in the reference point cloud. The formula is as follows:

[0017] in, For the first k The registration association set extracted from each perspective The first point cloud extracted from the initial fused point cloud The first perspective One registration point to be matched This refers to the corresponding point of the point to be registered, found in the reference point cloud through nearest neighbor search. Indicates the reference point cloud in The unit normal vector at that location, The set distance threshold is used to remove non-overlapping noise. Use any point in the reference point cloud; S143: Perform ICP fine registration on the original point cloud and the reference point cloud to obtain rotation and translation vectors. Calculate the optimal rotation matrix and optimal translation vector based on these vectors, and then construct the point-to-surface ICP fine registration error function, the formula of which is:

[0018] in, Indicates the first The optimal rotation matrix of the original point cloud relative to the reference point cloud from each viewpoint. Indicates the first The optimal translation vector of the original point cloud relative to the reference point cloud from each viewpoint This indicates the number of point pairs to be matched that are participating in the ICP fine registration; and This represents the rotation and translation vectors obtained through ICP registration; this formula is used to further eliminate local registration errors between different viewpoints after the initial coordinate unification. S144: Obtain the multi-view fused point cloud after fine registration based on the point-to-surface ICP fine registration error function. The formula is as follows:

[0019]

[0020] in, Indicates the first The original point cloud from the perspective of the first The coordinates of each point in the robot's base coordinate system after ICP fine registration. This represents the multi-view fused point cloud after fine registration; S15. Perform statistical filtering denoising, voxel downsampling, and PCA-based normal vector estimation on the finely registered multi-view fused point cloud or single-view point cloud in sequence to obtain a preprocessed point cloud containing three-dimensional coordinates and unit normal vectors. The specific steps are as follows: S151: Perform statistical filtering on the finely registered multi-view fused point cloud or single-view point cloud to remove outlier noise points with significantly abnormal neighborhood distances. The formula is as follows:

[0021]

[0022] in, For the point cloud points to be judged, For point The Neighboring points, The number of neighboring points. For point The average distance to its neighboring points The mean of the neighborhood distances of all points. The standard deviation of the average neighborhood distance of all points. For statistical filtering threshold coefficients, This is the set of point clouds after statistical filtering. These are the points in the point cloud set after statistical filtering; S152: Voxel downsampling is performed on the statistically filtered point cloud to reduce the amount of point cloud data while maintaining the surface geometry. The formula is as follows:

[0023] in, For point The corresponding voxel index, Let the side length of the voxel mesh be . For the first The set of points within an individual element. For the first The number of points within an individual element. The number retained after downsampling The three-dimensional coordinates of a point in the robot's base coordinate system; S153: Perform PCA-based normal vector estimation on the points retained after voxel downsampling. The formula is as follows:

[0024]

[0025]

[0026] in, For point The three-dimensional coordinates of the geometric center of the neighboring points. For point The The three-dimensional coordinates of the neighboring points For point The covariance matrix of the neighborhood points Covariance matrix The unit eigenvector corresponding to the smallest eigenvalue. For point The unit normal vector in the robot's base coordinate system; S154: Obtain a preprocessed point cloud containing 3D coordinates and unit normal vectors. ,in, This represents a preprocessed point cloud containing three-dimensional coordinates and unit normal vectors.

[0027] In a specific embodiment, the preprocessed point cloud is registered with the casting CAD triangular mesh model to obtain an aligned point cloud in the CAD coordinate system. The signed distance from each point in the aligned point cloud to the surface of the CAD triangular mesh model is calculated to obtain full geometric alignment data containing the three-dimensional coordinates, signed distance, and CAD theoretical unit normal vector of each point. S21. Obtain the CAD triangular mesh model of the casting and establish the transformation relationship from the robot base coordinate system to the CAD coordinate system; S22. Sample the surface of the CAD triangular mesh model to generate a CAD surface sampling point set. Calculate the FPFH features of the preprocessed point cloud and the CAD surface sampling point set respectively. Use sampling consistency initial registration to obtain the initial transformation matrix. The specific steps are as follows: S221: Sample the surface of the CAD triangular mesh model to generate a set of CAD surface sampling points. The formula is as follows:

[0028] in, This is the set of CAD surface sampling points in the CAD coordinate system. For CAD surface number The three-dimensional coordinates of each sampling point For CAD surface number The theoretical unit normal vector at each sampling point This represents the number of sampling points on the CAD surface. S222: Calculate the FPFH features of the preprocessed point cloud and the CAD surface sampling point set, using the following formula:

[0029] in, , This indicates the first point cloud to participate in FPFH feature matching. One point, For point FPFH local geometric feature descriptor, To calculate the number of neighborhood points for FPFH features, This is a fast point feature histogram calculation function constructed based on the relationship between the normal angles of neighboring points; S223: The initial transformation matrix is ​​obtained using sample-consistent initial registration, and its formula is as follows:

[0030] in, This is the initial transformation matrix from the robot's base coordinate system to the CAD coordinate system. This represents the number of matching point pairs retained after geometric consistency filtering. This indicates the first point cloud to participate in FPFH feature matching. One point, Indicates the concentration of CAD surface sampling points with The feature matching points; the geometric consistency screening is to calculate the angle between the lateral axes, the angle between the normals, and the plane angle between the normals between the two points, and determine whether each value is less than a preset angle threshold. If all values ​​are less than the preset angle threshold, the screening is passed. S23. Based on the initial transformation matrix, transform the preprocessed point cloud to the CAD coordinate system, perform fine registration using point-to-surface ICP, obtain the final transformation matrix, and then transform the preprocessed point cloud to the CAD coordinate system to obtain the aligned point cloud. The specific steps are as follows: S231: Transform the preprocessed point cloud to the CAD coordinate system based on the initial registration matrix to generate the initial aligned point cloud. The formula is as follows:

[0031] in, This represents the initial alignment point of the preprocessed point cloud after transformation to the CAD coordinate system using the initial registration matrix; S232: Point-to-surface ICP fine registration is performed on the initial aligned point cloud to obtain the optimal corrected rotation matrix and optimal corrected translation vector from the robot base coordinate system to the CAD coordinate system. The formulas are as follows:

[0032] in, The optimal correction rotation matrix is ​​obtained through fine registration. The optimal correction translation vector obtained for fine registration. For the initial alignment of the point cloud, the first An initial alignment point, i.e., a point in the area to be repeatedly sampled. The distance on the CAD triangular mesh found in the initial aligned point cloud using an AABB tree. The nearest point, For CAD triangular mesh models in The theoretical unit normal vector at that location, For the effective point pairs matched after fine registration; and Let be the corrected rotation matrix and the corrected translation vector to be determined, respectively. S233: The fine registration corrected homogeneous transformation matrix is ​​obtained based on the optimal corrected rotation matrix and the optimal corrected translation vector. Its formula is as follows:

[0033] in, To accurately register the homogeneous transformation matrix; It is a zero vector with one row and three columns; S234: Obtain the final transformation matrix from the robot base coordinate system to the CAD coordinate system based on the fine registration and correction homogeneous transformation matrix. The formula is as follows:

[0034] in, This is the final transformation matrix from the robot's base coordinate system to the CAD coordinate system; S235: Based on the final transformation matrix, the preprocessed point cloud is transformed to the CAD coordinate system to obtain the aligned point cloud, as follows: The first point cloud in the computational preprocessing The 3D coordinates of each point after transformation to the CAD coordinate system and the preprocessed point cloud. The formula for the unit normal vector of a point after transformation to the CAD coordinate system is:

[0035]

[0036] in, For preprocessing point clouds, the first The 3D coordinates of each point after transformation to the CAD coordinate system; For preprocessing point clouds The three-dimensional coordinates of a point in the robot's base coordinate system; The final transformation matrix The rotation matrix part; For preprocessing point clouds The unit normal vector of a point in the robot's base coordinate system; For preprocessing point clouds The unit normal vector of a point after transformation to the CAD coordinate system; This is a vector normalization function used to eliminate numerical calculation errors and ensure that the transformed normal vector remains a unit vector. The formula for constructing an aligned point cloud set is as follows:

[0037] in, This is a set of aligned point clouds in the CAD coordinate system. To align the total number of point clouds; S24. In the aligned point cloud, use an AABB tree to find the nearest point and the theoretical normal of the triangle face containing the nearest point on the CAD triangular mesh model, and calculate the signed distance from the nearest point to the CAD triangular mesh model. The formula is as follows:

[0038] in, To align the midpoint of the point cloud The signed distance to the CAD triangular mesh model; Distance on CAD triangular mesh The nearest point; For CAD triangular mesh models in The theoretical unit normal vector at that location; when When, it indicates that the actual point is located outside the CAD triangular mesh model, belonging to the positive allowance that needs to be removed by grinding; when When the point is not higher than the CAD triangular mesh model, it is not considered as an object for calculating the positive grinding allowance. S25. Calculate the full geometric alignment data based on signed distance, including the 3D coordinates, signed distance, and CAD theoretical unit normal vector of each alignment point in the alignment point cloud. The formula is as follows:

[0039] in, This is the full geometric alignment data.

[0040] In a specific embodiment, the scheme of using the PointNet++ semantic segmentation model to classify the aligned point cloud in the CAD coordinate system point by point to obtain an initial semantic probability map of each point belonging to three categories: normal, burr, and flash is as follows: S31. Use aligned point clouds to create training datasets: Manually label normal points, burr points and flash points in the aligned point cloud to form point-by-point semantic labels and the original training point cloud; S32. Perform data augmentation processing on the original training point cloud, including random rotation, random scaling, random translation, Gaussian noise perturbation, and random point discarding, to obtain an enhanced aligned point cloud. This improves the model's adaptability to different casting poses, point cloud densities, and noise conditions. The formula is as follows:

[0041] in, To enhance the post-training point cloud The coordinates of the points The first point in the original training point cloud The coordinates of the points For random scaling factor, It is a random rotation matrix. It is a random translation vector. This is the Gaussian noise perturbation vector; S33. PointNet++ is used as the point cloud semantic segmentation model. The enhanced aligned point cloud is input into PointNet++, and a class-weighted cross-entropy loss function is constructed to train the model, resulting in the trained PointNet++ semantic segmentation model. The PointNet++ semantic segmentation model is used to extract multi-scale features from the local neighborhood of each point to obtain the initial semantic probability of each point belonging to the three classes: normal, spur, and flash edge, as follows: S331: PointNet++ is used to extract multi-scale features from the local neighborhood of each point to obtain multi-scale local feature vectors; S332: Calculate the initial semantic probability of each point belonging to the three classes: normal, spiky, and fringe. The formula is as follows:

[0042] in, Predict the midpoint of the original training point cloud for the PointNet++ model. Category The initial probability, For deep learning semantic recognition category set, , representing the manually labeled semantic categories of normal points, burr points, and flash points, respectively; To input multi-scale local feature vectors into the classification layer, the resulting model focuses on the points in the original training point cloud. Category The output score, For semantic category indexing; For the model, the midpoint of the original training point cloud Category The output score; S333: To address the issue that the number of normal points far exceeds the number of defective points, a class-weighted cross-entropy loss function is used during model training to improve the model's ability to identify minority class defects such as burrs and flash. The formula is as follows:

[0043] in, The category-weighted cross-entropy loss function, This represents the number of points in the current training batch. For category Loss weights; For indicator functions, when point The real label is The value is 1 if the condition is met, otherwise it is 0. To prevent extremely small positive numbers from being generated in logarithmic operations; S35. After training, the aligned point cloud to be segmented is divided into spatial sub-blocks with overlapping regions. These sub-blocks are then input into the trained PointNet++ semantic segmentation model for inference. The predicted probabilities of the overlapping regions are weighted and fused to obtain an initial semantic probability map for each point belonging to three categories: normal, spur, and fly-edge. The details are as follows: S351: Divide the aligned point cloud to be segmented into spatial sub-blocks with overlapping regions, using the following formula:

[0044] in, For the first The set of points within a spatial sub-block For the first A spatial enclosure box, The side length of the sub-block This represents the overlap width between adjacent sub-blocks; S352: Input the divided spatial sub-blocks into the trained PointNet++ semantic segmentation model for inference to obtain the predicted probability of each spatial sub-block; S353: Weighted fusion of the predicted probabilities for overlapping regions, using the following formula:

[0045] in, To align the midpoint of the point cloud The initial semantic probabilities after fusion For the midpoint of the alignment point cloud The set of all spatial sub-blocks, To align the midpoint of the point cloud In the The fusion weights in each sub-block For the first The PointNet++ semantic segmentation model trained in each sub-block aligns the points in the point cloud. Output class probabilities; S354: Calculate the initial semantic probability map for each point belonging to the three categories of normal, spiky, and flash, using the following formula:

[0046] in, This is the initial semantic probability graph. To align the midpoint of the point cloud The initial probability of belonging to the normal point. To align the midpoint of the point cloud The initial probability of belonging to a spur point. To align the midpoint of the point cloud The initial probability of belonging to a fly edge point.

[0047] In a specific embodiment, the signed distance in the full geometric comparison data is fused with the initial semantic probability map to calculate a joint defect score. Based on the joint defect score, points to be polished are selected and clustered to obtain at least one effective polishing region and its defect feature descriptor. The defect feature descriptor includes the region point set, region boundary, region center, maximum polishing allowance, CAD theoretical unit normal vector, dominant polishing type, and dominant source scheme for the effective polishing region. S41. Match the full geometric alignment data and the initial semantic probability map according to the spatial location of the point cloud; since both are located in the CAD coordinate system, the geometric information and semantic information can be directly matched according to the spatial location of the point cloud. S42. Using the initial semantic probability as a univariate potential function of the conditional random field, and the spatial distance between points in the aligned point cloud and the difference between the CAD theoretical normal as a bivariate potential function, a fully connected conditional random field is established. Spatial consistency optimization is performed on the point-by-point semantic probability to obtain the smoothed semantic confidence. The specific steps are as follows: S421: The initial semantic probability is used as a univariate potential function of the conditional random field, and its formula is:

[0048] in, To align the midpoint of the point cloud Assigned as a category The cost of one yuan; It is a univariate potential function; S422: The spatial distance between points in the alignment point cloud and the difference in the CAD theoretical normal are used as a binary potential function, and its formula is:

[0049] in, For point and points The two potential functions between them For tag compatibility functions, when Punishment will be imposed at that time. For spatially smooth kernel weights, To maintain the kernel weight in the normal direction, These are the scale parameters of the position kernel, the position scale parameters of the appearance kernel, and the normal vector scale parameters of the appearance kernel, respectively. S423: The energy function of a fully connected conditional random field is established based on univariate and bivariate potential functions, and its formula is as follows:

[0050] in, Assigning tags The corresponding conditional random field energy, Assign labels to all points. For point semantic tags; S424: The energy function of the fully connected conditional random field is solved using the mean-field method to optimize the spatial consistency of the pointwise semantic probabilities, resulting in the smoothed semantic confidence score, as shown in the formula:

[0051]

[0052] in, For the point after inference through the conditional random field mean field, Category The smoothed edge probability, For point The smoothed semantic confidence vector; S43. Normalize the signed distance of each point to obtain a geometric score. Take the maximum value between the smoothed glitch probability and the flash edge probability as the semantic defect score. Calculate the joint geometric-semantic defect score according to the preset weights. The specific steps are as follows: S431: Normalize the signed distance of each point into a geometric score, using the following formula:

[0053]

[0054]

[0055] in, The maximum value of the positive signed distance. The range of distances used for geometric score normalization; For the current point Normalized geometric score; For point The signed distance; This is the positive out-of-tolerance threshold; To prevent extremely small positive numbers with a denominator of zero or negative value; This is a limiting function; For any point The signed distance; S432: Use the maximum of the smoothed glitch probability and flash edge probability as the semantic defect score. ; S433: Calculate the geometric-semantic joint defect score according to the preset weights. The formula is as follows:

[0056] in, For point The geometric-semantic joint defect score, These are the geometric score weighting coefficients; S44. The geometric-semantic joint defect score is greater than the fusion threshold. The points are selected as the points to be polished. If the set of points to be polished... If empty, output "No polishing task" and do not proceed with subsequent polishing path planning; otherwise, continue with candidate region clustering. S45. Perform Euclidean clustering on the points to be polished to obtain multiple spatially independent candidate regions, and remove outlier small regions with fewer points than the minimum clustering threshold. The formula is as follows:

[0057] in, This is the set of candidate regions obtained after clustering. The threshold for Euclidean clustering radius. The minimum number of cluster points threshold, For the first Candidate regions, The number of candidate regions; For Euclidean clustering operations; S46. Extract the outer contour boundary point set for each candidate region, calculate the maximum grinding allowance, retrieve the CAD theoretical normal, and determine the dominant grinding type based on the average semantic confidence and maximum grinding allowance of the candidate regions. The dominant grinding type includes burrs, flash, geometric protrusions, and noise regions, where noise regions are not included in the subsequent grinding path planning, thus obtaining the effective grinding region set. The specific steps are as follows: S461: Extract the set of outer contour boundary points for each candidate region, using the following formula:

[0058] in, For the first The set of outer contour boundary points of each candidate region Extract parameters for the boundary of the Alpha Shape; S462: Determine the center of the candidate region and calculate the maximum polishing allowance. The formula is as follows:

[0059]

[0060] in, For the first The regional center of each candidate region, For the first The number of points contained in each candidate region; For the first The maximum polishing allowance for each candidate region; S463: Retrieve CAD theoretical normals based on candidate region centers; the formula is as follows:

[0061]

[0062] in, As regional center The nearest point behind the surface of the projected CAD triangular mesh model. This is the projection function for the nearest point on the surface of a CAD triangular mesh model. For the first The CAD theoretical unit normal vector corresponding to each candidate region This is a function for retrieving surface normals in a CAD triangular mesh model. S464: Calculate the average semantic confidence of candidate regions using the following formula:

[0063] in, For the first Each candidate region belongs to the category The average semantic confidence; S465: The dominant sanding type is determined based on the average semantic confidence and maximum sanding allowance of the candidate regions. The formula is as follows:

[0064] in, For the first The dominant polishing type for each candidate region. It is a burr type. It is a frilly edge type. It is a geometric protrusion type. This is a noise area or a false detection area. For the first The average semantic confidence of each candidate region belonging to the spur. For the first The average semantic confidence of each candidate region belonging to the flyedge. The threshold for determining the semantic confidence of a region; when In this case, the area will not be included in the subsequent polishing path planning, but will be removed as a false detection area, and the remaining candidate areas will be considered as valid polishing areas. S47. Generate a defect feature descriptor for the effective grinding area, including the area point set, area boundary, area center, maximum grinding allowance, CAD theoretical unit normal vector, dominant grinding type, and dominant source. The formula is as follows:

[0065]

[0066] in, For the first Defect feature descriptor for an effective polishing area This is the set of defect feature descriptors for all effective grinding areas. To determine the number of areas to be effectively polished; , For the first A set of effective polishing area points, For the first The outer contour boundary of the effective grinding area For the first An effective polishing area center, For the first Maximum sanding allowance for each effective sanding area. For the first The CAD theoretical unit normal vector corresponding to each effective grinding area. For the first The effective sanding area dominates the sanding type. , For the first The primary source for effective polishing in the region. This is the mode statistics function, which represents the source type that appears most frequently within a region. For point-level dominant sources, the formula is:

[0067] in, Geometry-dominated Semantic-driven, Dominated by both geometry and semantics, The difference threshold is used to determine the source.

[0068] In a specific embodiment, the scheme for generating a robot-executable grinding program by defining different trajectory patterns and process parameters based on the dominant grinding type in the defect feature descriptor is as follows: S51. Set basic process parameters, including basic feed rate, based on the dominant grinding type of each effective grinding area. Spindle speed Maximum allowable removal depth per layer Track spacing and tool tilt angle ; S52. Establish a local coordinate system for each effective grinding area under the CAD coordinate system. The local coordinate system uses the CAD theoretical unit normal vector as the local normal direction and the maximum principal direction of the area point set in the tangent plane as the local principal tangential direction. The local secondary tangential direction is obtained by the cross product of the two, and the formula is as follows:

[0069]

[0070]

[0071] in, For the first The local normal direction of an effective grinding area in the CAD coordinate system; This is the theoretical unit normal vector in CAD. For the first The principal tangential direction of an effective grinding area within the local cutting plane; To extract the PCA function for the maximum principal direction; To effectively refine the area point set Projected onto It is a local tangent plane in the normal direction; For the first The secondary tangential direction of each region; S53. Project the effective grinding area onto a local two-dimensional plane to obtain a two-dimensional closed projection area. Select the trajectory mode according to the dominant grinding type: For burr areas, extract the skeleton lines from the two-dimensional closed projection area and generate an edge tracking trajectory; for flash areas, generate equidistant parallel scan lines within the two-dimensional closed projection area and trim them to obtain a parallel reciprocating coverage trajectory; for geometric protrusion areas, offset the two-dimensional outer contour inward at equal intervals to obtain a contour-following layered trajectory. The specific steps are as follows: S531: Combining the local coordinate system, the effective grinding area is projected onto a local two-dimensional plane to obtain a two-dimensional closed projection area. This ensures that subsequent skeleton extraction, parallel line clipping, and contour offset all have a clearly defined region object. The formula is as follows:

[0072]

[0073] in, For the first The projection function of the three-dimensional points corresponding to each effective grinding area onto the local two-dimensional plane. These are the three-dimensional points of the effective grinding area in the CAD coordinate system. For the first The closed projection area of ​​an effective grinding area in a local two-dimensional plane. This is a function for extracting the boundary of a two-dimensional concave hull. A function that fills a two-dimensional boundary into a closed region. Extract parameters for the boundary of a 2D Alpha Shape; S532: For burr areas, extract skeleton lines from the two-dimensional closed projection area and generate edge tracking trajectories. The formula is as follows:

[0074] in, For the first The skeleton lines of a burr region in a local two-dimensional plane This is a function for extracting skeleton lines from a two-dimensional closed region. For the fly-edge region, equidistant parallel scan lines are generated within the two-dimensional closed projection area and clipped to obtain a parallel reciprocating coverage trajectory. The formula is as follows:

[0075]

[0076] in, For the first The first 2D plane of the local burr edge region Parallel scan lines, In a local two-dimensional plane along the secondary tangential direction coordinates Two-dimensional closed region exist Minimum coordinates in the direction, This is the parallel scan line number, used only for scrambling coverage trajectories. For trajectory spacing, It is a local two-dimensional parallel reciprocating coverage trajectory. This refers to the number of parallel scan lines. The valid trajectory segment that falls within the fly-edge area; For the geometrically convex region, the two-dimensional outer contour of the two-dimensional closed projection region is offset inward at equal intervals to obtain the contour layering trajectory, the formula of which is:

[0077]

[0078] in, For the first A local two-dimensional contour line after inward offset. This is the internal offset contour number, used only for geometric protrusion contouring trajectories. For the first The projection of the outer contour boundary of each region onto the local two-dimensional plane To offset the outline towards the interior of the region The function, The number of internal offset profiles that can be generated. It is a set of local two-dimensional contour-following layered trajectories; S54. Map the two-dimensional trajectory back to the CAD three-dimensional space to form continuous trajectory primitives in the CAD coordinate system, and discretize the trajectory primitives into equally spaced trajectory points. The specific steps are as follows: S541: Mapping a two-dimensional trajectory back to CAD three-dimensional space, the formula is:

[0079] in, To make local two-dimensional points Functions that restore to CAD 3D space For local two-dimensional plane coordinates, This is a function that projects spatial points onto a CAD triangular mesh model. S542: Maps the edge tracking trajectory of the burr area back to CAD 3D space. The formula is as follows:

[0080] in, This refers to the burr edge tracking trajectory in the CAD coordinate system. S543: Map the parallel reciprocating coverage trajectory of the fly edge area back to the CAD 3D space. The formula is as follows:

[0081] in, The parallel reciprocating coverage trajectory of the flash edge in the CAD coordinate system; S544: Maps the contouring layered trajectory of the geometrically raised region back to CAD 3D space. The formula is as follows:

[0082] in, The geometric protrusion contouring layered trajectory in the CAD coordinate system; S545: Forms continuous trajectory primitives in the CAD coordinate system, the formula is:

[0083] in, For the first A continuous trajectory element of an effective grinding area in the CAD coordinate system; S546: Discretize the trajectory primitives into equally spaced trajectory points, the formula is as follows:

[0084]

[0085] in, For the first The first effective polishing area Reference trajectory points for a CAD triangular mesh model For trajectory arc length parameter, The discrete interval of the trajectory, For the first The number of discrete points of the trajectory in each region; S55. Calculate the initial grinding allowance interpolation value for the equidistant trajectory points. Determine the number of grinding layers and the removal depth per layer based on the maximum grinding allowance. Calculate the remaining grinding allowance for the current layer based on the initial grinding allowance interpolation value for the equidistant trajectory points. Then, based on the remaining grinding allowance for the current layer, convert the planned removal depth of each layer into the target contact trajectory points for the corresponding layer, so that the layered grinding is reflected in the spatial position of the robot's execution trajectory. The specific steps are as follows: S551: Calculate the initial grinding allowance interpolation for equally spaced trajectory points. The formula is as follows:

[0086] in, For the first The first effective polishing area Initial grinding allowance at each equally spaced trajectory point. A function that interpolates the positions of equally spaced trajectory points based on the signed distance between points within the effective grinding area point set; S552: Determine the number of grinding layers and the removal depth per layer based on the maximum grinding allowance. For burrs, flash, and geometric protrusions, if the maximum grinding allowance exceeds the maximum allowable removal depth per layer, layer-by-layer removal should be used to avoid excessive single feed. The formula is as follows:

[0087]

[0088] in, For the first Number of polishing layers per effective polishing area This represents the maximum allowable removal depth for a single layer. This is the maximum allowable amount for polishing; For the first The first effective polishing area Layer plan removal depth, This is the polishing layer number. , The completed layer number; S553: ​​Calculate the remaining grinding allowance for the current layer based on the initial grinding allowance interpolated from the equally spaced trajectory points. The formula is as follows:

[0089] in, For the first The first effective polishing area Layer The remaining polishing allowance at each equally spaced trajectory point. For the first The planned removal depth of the layer; S554: Based on the remaining polishing allowance of the current layer, convert the planned removal depth of each layer into the target contact trajectory point of the corresponding layer. The formula is as follows:

[0090] in, For the first The first effective polishing area Layer One target contact trajectory point, For the first The CAD theoretical unit normal vector corresponding to each region; S56. Perform B-spline smoothing on the target contact trajectory of each layer. Calculate the tool attitude based on the tangent of the smoothed target contact trajectory and the CAD theoretical unit normal vector, and orthogonalize the tool attitude to obtain the... The tool posture matrix in the layer CAD coordinate system is determined to ensure that the tool posture matrix corresponding to the actual execution trajectory in each layer meets the robot's execution requirements. The specific steps are as follows: S561: B-spline smoothing is applied to the contact trajectory of each target layer to smooth the trajectory, reduce sudden changes in velocity and acceleration during robot movement, and maintain the layered grinding depth in the trajectory position. The formula is as follows:

[0091] in, For the first The first effective polishing area The target contact trajectory curve after layer smoothing. For the first indivual B-spline basis functions For the first The first effective polishing area The first layer One B-spline control point, To control the number of points, These are the parameters of the B-spline curve; S562: Calculate the... The layer smooths the trajectory tangentially, allowing the tool posture to follow the actual execution trajectory, rather than merely following the CAD theoretical surface reference trajectory. The formula is as follows:

[0092] in, For the first The first region Layer The smooth trajectory unit tangent at each target contact trajectory point For the first The B-spline curve parameters corresponding to each target contact trajectory point It is a vector normalization function; S563: Calculate the... The formula for the layer tool axis is:

[0093] in, For the first The first region Layer At each target contact trajectory point, the tool axis in the CAD coordinate system corresponds to the tool coordinate system. To bypass the first Layer smooth trajectory tangential Tilting angle The rotation matrix, For the tool tilt angle, This is the theoretical unit normal vector in CAD. S564: Based on the actual implementation of the... The layer smoothing target contact trajectory calculation tool pose requires the tangential direction, so that the tool axis follows the first layer. The tangent of the actual execution trajectory of the layer is used to generate the tool axis of the current layer by combining the CAD theoretical normal and the tool tilt angle. The tool posture is then orthogonalized to ensure that the three directions of the tool posture corresponding to the execution trajectory are mutually orthogonal, thus avoiding the posture matrix not meeting the robot's execution requirements. The formula is as follows:

[0094]

[0095]

[0096] in, The temporary tool tangential direction after removing the tool axial component. The orthogonalized tool tangent The orthogonalized tool direction; S565: Obtain the... The tool pose matrix in the layered CAD coordinate system is formulated as follows:

[0097] in, For the first The first region Layer The attitude matrix of the tool coordinate system relative to the CAD coordinate system at each trajectory point; S57. The feed speed is adaptively adjusted based on the remaining grinding allowance. When the allowance is large, the speed is reduced to improve removal stability; when the allowance is small, the speed is increased to improve processing efficiency. The formula is as follows:

[0098] in, For the first The first region Layer The feed rate of each target trajectory point For reference, the amount of polishing allowance, To prevent extremely small positive numbers with a denominator of zero, Minimum allowable feed rate, For the maximum permissible feed rate, This is a limiting function; S58. Perform interference detection in the simulation environment to determine the effective contact section and the non-contact avoidance transition section. For the non-contact avoidance transition section, perform avoidance correction at the non-contact transition point. For the effective grinding contact section, execute the target contact trajectory point. If unavoidable interference occurs, output the abnormal path status and replan or manually review it. The specific steps are as follows: S581: Determine the effective contact section and the non-contact avoidance transition section. The effective contact section uses the target contact point after layered smoothing; the non-contact infeed, retraction, and crossing sections use the avoidance transition point, and the formula is:

[0099]

[0100] in, For the CAD coordinate system trajectory points ultimately used for robot execution, For the first The first effective polishing area Layer One effective grinding contact point For the non-contact avoidance transition point, the formula is:

[0101]

[0102] in, These are the non-contact transition trajectory points within the tool approach, retraction, or transition phases. For the first The first region Avoidance correction vector for each non-contact transition point; The minimum safe distance threshold, For the tool to be located at a non-contact transition point in the simulation environment The minimum distance between the device and the workpiece or environment. To avoid the non-contact transition point of the corrected CAD coordinate system; S59. Convert the trajectory points and tool poses in the CAD coordinate system into executable trajectory poses in the robot base coordinate system through a transformation from the CAD coordinate system to the robot base coordinate system. Then, perform robot inverse kinematics, joint constraints, and singularity detection to obtain... The grinding program executed by the robot includes trajectory points, tool posture, feed rate, spindle speed, and single-layer removal depth, and its steps are as follows: S591: Define the transformation matrix from the CAD coordinate system to the robot base coordinate system, and its formula is:

[0103] in, This is the homogeneous transformation matrix from the CAD coordinate system to the robot's base coordinate system; S592: The trajectory points and tool poses in the CAD coordinate system are transformed into the execution trajectory poses in the robot base coordinate system through a transformation from the CAD coordinate system to the robot base coordinate system. The formula is as follows:

[0104]

[0105] in, To transform the trajectory points to the robot's base coordinate system, For the first The first region Layer At each trajectory point, the pose matrix of the tool coordinate system relative to the robot base coordinate system. This refers to the rotation component in the transformation matrix from the CAD coordinate system to the robot's base coordinate system. S593: Construct the robot's inverse kinematics and reachability constraints, the formula of which is:

[0106]

[0107]

[0108] in, For the first The first effective polishing area Layer The robot joint angles corresponding to each trajectory point; Solving functions for the inverse kinematics of a robot; , Define the lower and upper limits of the robot's joint angles; For the robot's Jacobian matrix; It is the minimum singular value of the robot's Jacobian matrix; This is the singularity safety threshold; Determine whether the generated trajectory satisfies robot reachability, joint constraints, and singularity constraints, and select the final trajectory points that satisfy the constraints. ; S594: Obtain the grinding program executed by the robot, including trajectory points, tool posture, feed rate, spindle speed, and single-layer removal depth, with the following formula:

[0109] in, For the first The robot can execute a polishing program corresponding to each effective polishing area. The first in the robot's base coordinate system Layer tool pose, Main spindle speed; This is a function that converts trajectory, posture, and process parameters into robot control code.

[0110] In this scheme, the layering strategy is determined based on the maximum grinding allowance and the maximum allowable removal depth of a single layer. For burrs, flash, and geometric protrusions, layered removal is adopted as long as the allowance exceeds the maximum allowable removal depth of a single layer to avoid excessive removal in a single operation. At the same time, the planned removal depth of each layer is converted into the target contact trajectory point of the corresponding layer, so that the layered removal is reflected in the spatial position of the robot's execution trajectory. The feed speed is adjusted according to the remaining grinding allowance at the trajectory point to ensure that the grinding process balances removal efficiency and processing stability. The tool posture is calculated based on the tangent of the smoothed target contact trajectory and the unit normal vector of the CAD theory, and the tool posture is orthogonalized to ensure that the tool posture matrix meets the robot's execution requirements. At the same time, the inverse matrix of the final transformation matrix from the robot base coordinate system to the CAD coordinate system is used to transform the trajectory points and tool posture in the CAD coordinate system to the robot base coordinate system, and robot inverse kinematics, joint constraints and singularity detection are performed to ensure that the generated trajectory can be actually executed by the robot.

[0111] In a specific embodiment, the robot executes the polishing program to polish the area, calculates the residual positive margin in the polished area to re-inspect the polished area, and if the residual positive margin exceeds the allowable threshold, a closed-loop correction is triggered. The defect feature descriptor of the current residual positive margin is redefined, and the robot returns to S5 to plan the local polishing path and execute polishing again until it is qualified or the iteration limit is reached. S61. The robot executes the generated polishing program and polishes each effective polishing area according to the corresponding trajectory, posture and process parameters. S62. After polishing is completed, the robot will drive the 3D camera again to perform a local re-scan of the polished area and unify the re-scan point cloud into the robot's base coordinate system. S63. Using the final transformation matrix from the robot base coordinate system to the CAD coordinate system, transform the re-inspection point cloud to the CAD coordinate system, and recalculate the signed distance from the re-inspection point cloud to the CAD theoretical surface. The formula is as follows:

[0112]

[0113] in, To verify the robot's base coordinate system points obtained from the re-examination scan, These are the re-inspection points after conversion to the CAD coordinate system; For re-inspection point Signed distance to the theoretical CAD surface Distance on CAD triangular mesh model The nearest point, For CAD triangular mesh models in The theoretical unit normal vector at that location; S64. Based on the outer contour boundary of the original grinding area and the re-inspection extension margin, assign the re-inspection points to the corresponding original grinding areas to obtain the re-inspection point set for each original grinding area. The formula is as follows:

[0114] in, For the first The set of re-inspection points corresponding to each original polishing area For the first A local two-dimensional projection function of the original polished area For the first The outer contour boundary of the original polishing area. To expand the two-dimensional boundary outward The region expansion function; To allow for additional margin in the re-inspection area; If the number of re-inspection points is less than the minimum valid point threshold for the re-inspection area If the result is negative, it means the re-inspection data is invalid and needs to be re-scanned to avoid the undefined maximum value calculation in the subsequent residual positive margin calculation. S65. Calculate the residual positive allowance of the original polished area using the following formula:

[0115] in, For the first The residual positive allowance after polishing the original polishing area; If the residual positive margin is less than or equal to the allowable residual threshold Furthermore, the number of re-inspection point sets is greater than the minimum effective number of points threshold for the re-inspection area. If the polishing is satisfactory, the area is considered to be properly polished; otherwise, the residual positive allowance still exceeds the allowable residual threshold. If the current iteration count does not exceed the maximum allowed iteration count, then extract the residual excess point set from the re-check point set. ; The residual out-of-poor point set is further clustered to obtain one or more residual out-of-poor sub-regions, and the formula is as follows:

[0116] in, For the first The set of residual out-of-tolerance sub-regions obtained after re-inspection of the original polished areas. For the first The first in the original polishing area A residual out-of-difference subregion For the first The number of residual out-of-range sub-regions within the original polishing area. The threshold for Euclidean clustering radius. The minimum number of cluster points threshold, The index of the residual out-of-difference sub-region; Update the boundaries, center, maximum grinding allowance, and CAD theoretical unit normal vector of each residual out-of-tolerance sub-region, respectively, and convert each residual out-of-tolerance sub-region into a new grinding region. This ensures that the next round of replanning only targets the still out-of-tolerance local regions. The formula is as follows:

[0117]

[0118]

[0119]

[0120]

[0121] in, For the first The first original polishing area A new set of polishing region points is generated from each residual out-of-difference sub-region; This represents the maximum polishing allowance for the remaining sub-region. This represents the outer contour boundary of the residual sub-region; This is the region center of the remaining sub-region; This is the CAD theoretical unit normal vector corresponding to the residual sub-region; For re-examination of signed distance; Extract parameters for the boundary of the Alpha Shape; After forming a new set of defect feature descriptors, return to S5 to replan the local grinding path. The formula for the new set of defect feature descriptors is:

[0122]

[0123] in, This is a new defect feature descriptor generated from the residual out-of-range sub-region. This represents the maximum sanding allowance for the newly sanded area. The original area is the dominant polishing type; if a re-evaluation is required after re-inspection, it can be returned to S4 for reclassification. The original dominant source was from the region. This is the set of new defect feature descriptors corresponding to all residual out-of-range sub-regions; S66. If the maximum allowed number of iterations is exceeded and the result is still unqualified, an NG result will be output, prompting manual review or exception handling. S67. Output the final polishing result, including the status of no polishing task, or the qualified status of each effective polishing area, the status of needing to be rescanned, the NG status, or the status of needing to replan the local polishing path for the area, the residual positive margin, the final execution program, and the area defect information.

[0124] In this embodiment, the polishing area is rescanned and the residual positive margin is calculated. The polishing result is judged by the OK / Replan / NG / Rescan rules. When the re-inspection data is insufficient, the Rescan status is output and the system is rescanned. When the residual positive margin exceeds the threshold but the maximum number of iterations has not been reached, the system extracts the residual out-of-tolerance point set from the re-inspection point set, and clusters the residual out-of-tolerance point set again to obtain one or more residual out-of-tolerance sub-regions. New defect feature descriptors are then generated and the system returns to S5 to replan the local path. When multiple corrections still fail to meet the requirements, the NG is output, prompting manual review. This forms a closed-loop polishing process that can be judged, stopped, corrected, and re-inspected to handle anomalies. It can form a closed-loop control through re-inspection after polishing, avoiding the problem of not being able to judge whether it is qualified after one polishing.

[0125] Example 1: This method is illustrated by taking the grinding of burrs, flash, and local geometric protrusions on the surface of automotive cylinder block castings as an example.

[0126] First, a striped structured light 3D camera is mounted on the robot's end effector, and hand-eye calibration is performed to obtain the transformation matrix from the camera coordinate system to the robot's end effector coordinate system. During actual inspection, the robot moves sequentially to different viewpoints around the cylinder casting according to multiple pre-planned shooting poses. After reaching each viewpoint, the camera is triggered to acquire a frame of high-density point cloud, while simultaneously recording the robot's end effector pose. Using the robot's end effector pose and the hand-eye calibration matrix, each frame of point cloud is transformed from the camera coordinate system to the robot's base coordinate system. For point clouds acquired from multiple viewpoints, after initial coordinate unification, point-to-surface ICP is used for fine registration, and the rotation matrix and translation vector obtained from the fine registration are used to generate a finely registered multi-view fused point cloud.

[0127] Subsequently, statistical filtering is applied to the fused point cloud to remove outliers with significantly abnormal average neighborhood distances. Then, voxel downsampling is used to reduce the number of point clouds while preserving the surface morphology. Finally, PCA is used to estimate the unit normal vector of each point, forming a preprocessed point cloud containing point coordinates and normal vectors.

[0128] Then, the preprocessed point cloud is registered with the cylinder block CAD model. First, the surface of the CAD model is sampled, and the FPFH features of the point cloud and the CAD sampled points are calculated. A coarse registration matrix is ​​obtained through initial registration based on sampling consistency, and an initial aligned point cloud is generated. Then, fine registration is performed using point-to-surface ICP to obtain the final transformation matrix from the robot base coordinate system to the CAD coordinate system. This transformation matrix is ​​used to transform the point cloud to the CAD coordinate system. Afterward, for each point, the nearest point is found on the CAD triangular mesh, and its signed distance to the theoretical CAD surface is calculated. The system outputs full geometric alignment data, including the 3D coordinates, signed distance, and theoretical CAD unit normal vector for each point. Simultaneously, a set of candidate points for geometric out-of-tolerance is extracted based on a positive out-of-tolerance threshold.

[0129] Next, the point cloud in the CAD coordinate system is input into the trained PointNet++ point cloud semantic segmentation model. The model outputs the initial probability of each point belonging to normal, burr, and flash. To adapt to large-scale point cloud inference, the point cloud is divided into multiple spatial sub-blocks with overlapping regions. After inference in each sub-block, the overlapping regions are subjected to probability weighted fusion to obtain the initial semantic probability map of the complete casting point cloud.

[0130] Next, the full geometric alignment data and the initial semantic probability map are input into the geometric-semantic fusion step. The system uses the PointNet++ output probability as a univariate potential function of the conditional random field, and the spatial distance between point cloud points and the difference between the theoretical unit normal vectors of CAD as a binary potential function to optimize the spatial consistency of the semantic probability, obtaining a smoothed semantic confidence score. For each point, the signed distance is normalized to a geometric score, and the maximum probability between burrs and flash edges is used as the semantic defect score. A joint defect score is obtained through weighted fusion. Points with a joint defect score exceeding a threshold are selected as points to be polished. If the set of points to be polished is empty, the system outputs a no-polishing task status; otherwise, multiple candidate regions are formed through Euclidean clustering.

[0131] For each candidate region, the system extracts the outer contour boundary, calculates the region center and maximum grinding allowance, retrieves the theoretical normal vector of the region on the CAD model, and determines the dominant grinding type based on the region's average semantic probability and maximum grinding allowance. If the average probability of burrs is the highest and exceeds the semantic threshold, it is determined to be a burr region; if the average probability of flash is the highest and exceeds the semantic threshold, it is determined to be a flash region; if the region has obvious positive geometric out-of-tolerance but the semantic probabilities of burrs and flash are insufficient, it is determined to be a geometric protrusion region; if the region does not meet either the semantic anomaly threshold or the positive out-of-tolerance threshold, it is determined to be a noise region and is removed. For the retained valid grinding regions, the system generates a defect feature descriptor containing the region point set, boundary, center, maximum grinding allowance, CAD theoretical unit normal vector, dominant grinding type, and dominant source.

[0132] Finally, the robot grinding trajectory is generated based on the defect feature descriptor. For burr areas, the system projects the area onto a local 2D plane, extracts the 2D skeleton lines, and restores them to CAD 3D space to form an edge tracking trajectory. For flash areas, the system generates multiple equidistant parallel scan lines within a local 2D closed area and trims out the effective trajectory segments falling within the area to form a parallel reciprocating coverage trajectory. For geometrically protruding areas, the system offsets the 2D outer contour inward at equal intervals to form a contour-following layered trajectory. The system determines the number of grinding layers based on the maximum grinding allowance and the maximum allowable removal depth per layer. It generates the target contact trajectory points for each layer based on the planned removal depth and performs B-spline smoothing on each layer's target contact trajectory. The system calculates the tool posture based on the tangent of each smoothed trajectory and the CAD theoretical unit normal vector, and ensures the posture matrix is ​​effective through orthogonalization. The system adjusts the feed speed based on the remaining grinding allowance at the trajectory points. After simulation interference detection, each layer's target contact trajectory is converted into trajectory points and postures in the robot's base coordinate system, and a robot-executable grinding program is generated.

[0133] After polishing, the robot rescans the polished area, converts the re-inspection point cloud to the CAD coordinate system, and recalculates the signed distance from the re-inspection points to the CAD theoretical surface. Based on the original polishing area boundary and the re-inspection expansion margin, the system assigns the re-inspection points to the corresponding areas. If the number of points in the re-inspection area is insufficient, it is considered a Rescan and rescanned. If the re-inspection data is valid, the residual positive margin for each area is calculated. If the residual positive margin of an area is less than or equal to the allowable residual threshold, it is considered OK; if the residual positive margin still exceeds the allowable residual threshold and the number of loop closures does not exceed the maximum allowable number, the residual out-of-tolerance point set is extracted from the re-inspection area, and the residual out-of-tolerance point set is clustered again to obtain one or more residual out-of-tolerance sub-regions; the system updates the area boundary, area center, maximum polishing margin, and CAD theoretical unit normal vector for each residual out-of-tolerance sub-region, and regenerates the local polishing path; if it still fails after exceeding the maximum allowable number of passes, it is considered NG and prompts for manual review. This enables closed-loop control of defect detection, grinding path generation, grinding execution, residual material re-inspection, and local replanning.

[0134] In practical implementation, the following example parameters can be set: voxel downsampling side length is 0.5 mm, positive out-of-tolerance threshold is 0.3 mm, semantic confidence threshold is 0.6, fusion defect judgment threshold is 0.65, Euclidean cluster radius is 2 mm, minimum number of cluster points is 50, minimum number of valid points in the re-inspection area is 30, maximum allowable removal depth per layer is 0.2 mm, allowable residual amount threshold is 0.1 mm, and maximum number of closed-loop iterations is 3. These parameters can be adjusted according to the casting material, grinding tool type, robot stiffness, and processing quality requirements.

[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for guiding the grinding of castings by linking defect detection and grinding area, characterized in that, include: S1: Collect the point cloud of the casting surface, transform the point cloud of the casting surface to the robot base coordinate system through the hand-eye calibration matrix and the robot end pose matrix, and perform ICP fine registration fusion and preprocessing on the point cloud of the casting surface to obtain the preprocessed point cloud in the robot base coordinate system. S2: Register the preprocessed point cloud with the casting CAD triangular mesh model to obtain an aligned point cloud in the CAD coordinate system. Calculate the signed distance from each point in the aligned point cloud to the surface of the CAD triangular mesh model to obtain full geometric comparison data containing the three-dimensional coordinates, signed distance, and CAD theoretical unit normal vector of each point. S3: Use the PointNet++ semantic segmentation model to classify the aligned point cloud in the CAD coordinate system point by point to obtain the initial semantic probability map of each point belonging to the three categories of normal, burr, and flash. S4: The signed distance in the full geometric comparison data is fused with the initial semantic probability map to calculate the joint defect score. The points to be polished are selected and clustered according to the joint defect score to obtain at least one effective polishing region and its defect feature descriptor. The defect feature descriptor includes the region point set, region boundary, region center, maximum polishing allowance, CAD theoretical unit normal vector, dominant polishing type and dominant source of the effective polishing region. S5: Based on the dominant grinding type in the defect feature descriptor, define different trajectory patterns and process parameters to generate a grinding program that can be executed by the robot; S6: The robot executes the polishing program to polish the area, calculates the residual positive margin of the polished area to re-inspect the polished area, and if the residual positive margin exceeds the allowable threshold, it triggers closed-loop correction, redefines the defect feature descriptor of the current residual positive margin, and returns to S5 to plan the local polishing path and perform polishing again until it is qualified or the iteration limit is reached.

2. The casting grinding guidance method linking defect detection and grinding area as described in claim 1, characterized in that, Point clouds of the casting surface are acquired, and then transformed to the robot base coordinate system using hand-eye calibration matrices and robot end-effector pose matrices. ICP fine registration and fusion are then performed on the casting surface point clouds to obtain a preprocessed point cloud in the robot base coordinate system, including: S11. Perform hand-eye calibration on the casting to obtain the hand-eye calibration matrix from the camera coordinate system to the robot end-effector coordinate system, and obtain the real-time pose matrix from the robot end-effector coordinate system to the robot base coordinate system through the robot controller. S12. Acquire the original point cloud of the casting surface in the camera coordinate system and record the corresponding robot end-effector pose. The set of original point clouds of the casting surface is as follows: in, Indicates the first The original point cloud set of the casting surface in the camera coordinate system from each acquisition perspective. Indicates the first From the perspective of the first collection, the first The three-dimensional coordinates of a point in the camera coordinate system Indicates the first Number of point clouds from each acquisition perspective Indicates the sequence number of the acquisition viewpoint. It is a single-viewpoint time; S13. For the original point cloud of the casting surface from each viewpoint, transform it to the robot base coordinate system using the hand-eye calibration matrix and the real-time pose matrix of the robot end effector. The specific steps are as follows: S131: Obtaining the first... based on the hand-eye calibration matrix and the robot end effector's real-time pose matrix. The homogeneous transformation matrix from the camera coordinate system to the robot base coordinate system from each acquisition viewpoint is formulated as follows: in, Indicates the first Homogeneous transformation matrix from camera coordinate system to robot base coordinate system from each acquisition viewpoint. Indicates the first The real-time pose matrix from the robot's end effector coordinate system to the robot's base coordinate system from each acquisition viewpoint. This represents the hand-eye calibration matrix from the camera coordinate system to the robot's end effector coordinate system; S132: The homogeneous transformation matrix from the camera coordinate system to the robot base coordinate system transforms the original point cloud of the casting surface from each viewpoint to the robot base coordinate system. The formula is as follows: in, Indicates the first The original point cloud from the first acquisition perspective The three-dimensional coordinates of each point after transformation to the robot's base coordinate system; This represents a function that converts camera coordinates to 3D coordinates. S14, Regarding The original point cloud acquired under these conditions is finely registered using point-to-area ICP to obtain a finely registered multi-view fused point cloud. The specific steps are as follows: S141: Obtain the initial fused point cloud after transforming the original point clouds from all views to the robot's base coordinate system. The formula is as follows: in, This represents the initial fused point cloud after transforming the original point clouds from all viewpoints to the robot's base coordinate system. Indicates the total number of captured viewpoints. ; S142: Define the first frame of point cloud data as the reference point cloud. From the initial fused point cloud, extract the points to be registered that overlap with the reference point cloud in the original point cloud of each viewpoint, as well as the corresponding points of the points to be registered in the reference point cloud. The formula is as follows: in, For the first k The registration association set extracted from each perspective The first point cloud extracted from the initial fused point cloud The first perspective One registration point to be matched This refers to the corresponding point of the point to be registered, found in the reference point cloud through nearest neighbor search. Indicates the reference point cloud in The unit normal vector at that location, The set distance threshold is used to remove non-overlapping noise. Use any point in the reference point cloud; S143: Perform ICP fine registration on the original point cloud and the reference point cloud to obtain rotation and translation vectors. Calculate the optimal rotation matrix and optimal translation vector based on these vectors, and then construct the point-to-surface ICP fine registration error function, the formula of which is: in, Indicates the first The optimal rotation matrix of the original point cloud relative to the reference point cloud from each viewpoint. Indicates the first The optimal translation vector of the original point cloud relative to the reference point cloud from each viewpoint This indicates the number of point pairs to be matched that are participating in the ICP fine registration; and This represents the rotation and translation vectors obtained through ICP registration. S144: Obtain the multi-view fused point cloud after fine registration based on the point-to-surface ICP fine registration error function. The formula is as follows: in, Indicates the first The original point cloud from the perspective of the first The coordinates of each point in the robot's base coordinate system after ICP fine registration. This represents the multi-view fused point cloud after fine registration; S15. Perform statistical filtering denoising, voxel downsampling, and PCA-based normal vector estimation on the finely registered multi-view fused point cloud or single-view point cloud in sequence to obtain a preprocessed point cloud containing three-dimensional coordinates and unit normal vectors. The specific steps are as follows: S151: Perform statistical filtering on the finely registered multi-view fused point cloud or single-view point cloud. The formula is as follows: in, For the point cloud points to be judged, For point The Neighboring points, The number of neighboring points. For point The average distance to its neighboring points The mean of the neighborhood distances of all points. The standard deviation of the average neighborhood distance of all points. For statistical filtering threshold coefficients, This is the set of point clouds after statistical filtering. These are the points in the point cloud set after statistical filtering; S152: Voxel downsampling is performed on the statistically filtered point cloud. The formula is as follows: in, For point The corresponding voxel index, Let the side length of the voxel mesh be . For the first The set of points within an individual element. For the first The number of points within an individual element. The number retained after downsampling The three-dimensional coordinates of a point in the robot's base coordinate system; S153: Perform PCA-based normal vector estimation on the points retained after voxel downsampling. The formula is as follows: in, For point The three-dimensional coordinates of the geometric center of the neighboring points. For point The The three-dimensional coordinates of the neighboring points For point The covariance matrix of the neighborhood points Covariance matrix The unit eigenvector corresponding to the smallest eigenvalue. For point The unit normal vector in the robot's base coordinate system; S154: Obtain a preprocessed point cloud containing 3D coordinates and unit normal vectors. ,in, This represents a preprocessed point cloud containing three-dimensional coordinates and unit normal vectors.

3. The casting grinding guidance method linking defect detection and grinding area as described in claim 2, characterized in that, The preprocessed point cloud is registered with the casting CAD triangular mesh model to obtain an aligned point cloud in the CAD coordinate system. The signed distance from each point in the aligned point cloud to the surface of the CAD triangular mesh model is calculated to obtain full geometric alignment data containing the three-dimensional coordinates, signed distance, and CAD theoretical unit normal vector of each point, including: S21. Obtain the CAD triangular mesh model of the casting and establish the transformation relationship from the robot base coordinate system to the CAD coordinate system; S22. Sample the surface of the CAD triangular mesh model to generate a CAD surface sampling point set. Calculate the FPFH features of the preprocessed point cloud and the CAD surface sampling point set respectively. Use sampling consistency initial registration to obtain the initial transformation matrix. The specific steps are as follows: S221: Sample the surface of the CAD triangular mesh model to generate a set of CAD surface sampling points. The formula is as follows: in, This is the set of CAD surface sampling points in the CAD coordinate system. For CAD surface number The three-dimensional coordinates of each sampling point For CAD surface number The theoretical unit normal vector at each sampling point This represents the number of sampling points on the CAD surface. S222: Calculate the FPFH features of the preprocessed point cloud and the CAD surface sampling point set, using the following formula: in, , This indicates the first point cloud to participate in FPFH feature matching. One point, For point FPFH local geometric feature descriptor, To calculate the number of neighborhood points for FPFH features, This is a fast point feature histogram calculation function constructed based on the relationship between the normal angles of neighboring points; S223: The initial transformation matrix is ​​obtained using sample-consistent initial registration, and its formula is as follows: in, This is the initial transformation matrix from the robot's base coordinate system to the CAD coordinate system. This represents the number of matching point pairs retained after geometric consistency filtering. This indicates the first point cloud to participate in FPFH feature matching. One point, Indicates the concentration of CAD surface sampling points with The feature matching points; the geometric consistency screening is to calculate the angle between the lateral axes, the angle between the normals, and the plane angle between the normals between the two points, and determine whether each value is less than a preset angle threshold. If all values ​​are less than the preset angle threshold, the screening is passed. S23. Based on the initial transformation matrix, transform the preprocessed point cloud to the CAD coordinate system, perform fine registration using point-to-surface ICP, obtain the final transformation matrix, and then transform the preprocessed point cloud to the CAD coordinate system to obtain the aligned point cloud. The specific steps are as follows: S231: Transform the preprocessed point cloud to the CAD coordinate system based on the initial registration matrix to generate the initial aligned point cloud. The formula is as follows: in, This represents the initial alignment point of the preprocessed point cloud after transformation to the CAD coordinate system using the initial registration matrix; S232: Point-to-surface ICP fine registration is performed on the initial aligned point cloud to obtain the optimal corrected rotation matrix and optimal corrected translation vector from the robot base coordinate system to the CAD coordinate system. The formulas are as follows: in, The optimal correction rotation matrix is ​​obtained through fine registration. The optimal correction translation vector obtained for fine registration. For the initial alignment of the point cloud, the first An initial alignment point, i.e., a point in the area to be repeatedly sampled. The distance on the CAD triangular mesh found in the initial aligned point cloud using an AABB tree. The nearest point, For CAD triangular mesh models in The theoretical unit normal vector at that location, For the effective point pairs matched after fine registration; and Let be the corrected rotation matrix and the corrected translation vector to be determined, respectively. S233: The fine registration corrected homogeneous transformation matrix is ​​obtained based on the optimal corrected rotation matrix and the optimal corrected translation vector. Its formula is as follows: in, To accurately register the homogeneous transformation matrix; It is a zero vector with one row and three columns; S234: Obtain the final transformation matrix from the robot base coordinate system to the CAD coordinate system based on the fine registration and correction homogeneous transformation matrix. The formula is as follows: in, This is the final transformation matrix from the robot's base coordinate system to the CAD coordinate system; S235: Based on the final transformation matrix, the preprocessed point cloud is transformed to the CAD coordinate system to obtain the aligned point cloud, as follows: The first point cloud in the computational preprocessing The 3D coordinates of each point after transformation to the CAD coordinate system and the preprocessed point cloud. The formula for the unit normal vector of a point after transformation to the CAD coordinate system is: in, For preprocessing point clouds, the first The 3D coordinates of each point after transformation to the CAD coordinate system; For preprocessing point clouds The three-dimensional coordinates of a point in the robot's base coordinate system; The final transformation matrix The rotation matrix part; For preprocessing point clouds The unit normal vector of a point in the robot's base coordinate system; For preprocessing point clouds The unit normal vector of a point after transformation to the CAD coordinate system; This is a vector normalization function used to eliminate numerical calculation errors and ensure that the transformed normal vector remains a unit vector. The formula for constructing an aligned point cloud set is as follows: in, This is a set of aligned point clouds in the CAD coordinate system. To align the total number of point clouds; S24. In the aligned point cloud, use an AABB tree to find the nearest point and the theoretical normal of the triangle face containing the nearest point on the CAD triangular mesh model, and calculate the signed distance from the nearest point to the CAD triangular mesh model. The formula is as follows: in, To align the midpoint of the point cloud The signed distance to the CAD triangular mesh model; Distance on CAD triangular mesh The nearest point; For CAD triangular mesh models in The theoretical unit normal vector at that location; when When, it indicates that the actual point is located outside the CAD triangular mesh model, belonging to the positive allowance that needs to be removed by grinding; when When the point is not higher than the CAD triangular mesh model, it is not considered as an object for calculating the positive grinding allowance. S25. Calculate the full geometric alignment data based on signed distance, including the 3D coordinates, signed distance, and CAD theoretical unit normal vector of each alignment point in the alignment point cloud. The formula is as follows: in, This is the full geometric alignment data.

4. The casting grinding guidance method linking defect detection and grinding area as described in claim 3, characterized in that, The PointNet++ semantic segmentation model is used to classify the aligned point cloud in the CAD coordinate system point by point, resulting in an initial semantic probability map for each point belonging to three categories: normal, burr, and flash. S31. Use aligned point clouds to create training datasets: Manually label normal points, burr points and flash points in the aligned point cloud to form point-by-point semantic labels and the original training point cloud; S32. Perform data augmentation processing on the original training point cloud, including random rotation, random scaling, random translation, Gaussian noise perturbation, and random point discarding, to obtain the augmented aligned point cloud. The formula is as follows: in, To enhance the post-training point cloud The coordinates of the points The first point in the original training point cloud The coordinates of the points For random scaling factor, It is a random rotation matrix. It is a random translation vector. This is the Gaussian noise perturbation vector; S33. PointNet++ is used as the point cloud semantic segmentation model. The enhanced aligned point cloud is input into PointNet++, and a class-weighted cross-entropy loss function is constructed to train the model, resulting in the trained PointNet++ semantic segmentation model. The PointNet++ semantic segmentation model is used to extract multi-scale features from the local neighborhood of each point to obtain the initial semantic probability of each point belonging to the three classes: normal, spur, and flash edge, as follows: S331: PointNet++ is used to extract multi-scale features from the local neighborhood of each point to obtain multi-scale local feature vectors; S332: Calculate the initial semantic probability of each point belonging to the three classes: normal, spiky, and fringe. The formula is as follows: in, Predict the midpoint of the original training point cloud for the PointNet++ model. Category The initial probability, For deep learning semantic recognition category set, , representing the manually labeled semantic categories of normal points, burr points, and flash points, respectively; To input multi-scale local feature vectors into the classification layer, the resulting model focuses on the points in the original training point cloud. Category The output score, For semantic category indexing; For the model, the midpoint of the original training point cloud Category The output score; S333: The class-weighted cross-entropy loss function is used in model training, and its formula is as follows: in, The category-weighted cross-entropy loss function, This represents the number of points in the current training batch. For category Loss weights; For indicator functions, when point The real label is The value is 1 if the condition is met, otherwise it is 0. To prevent abnormally positive numbers from being generated in logarithmic operations; S35. After training, the aligned point cloud to be segmented is divided into spatial sub-blocks with overlapping regions. These sub-blocks are then input into the trained PointNet++ semantic segmentation model for inference. The predicted probabilities of the overlapping regions are weighted and fused to obtain an initial semantic probability map for each point belonging to three categories: normal, spur, and fly-edge. The details are as follows: S351: Divide the aligned point cloud to be segmented into spatial sub-blocks with overlapping regions, using the following formula: in, For the first The set of points within a spatial sub-block For the first A spatial enclosure box, The side length of the sub-block This represents the overlap width between adjacent sub-blocks; S352: Input the divided spatial sub-blocks into the trained PointNet++ semantic segmentation model for inference to obtain the predicted probability of each spatial sub-block; S353: Weighted fusion of the predicted probabilities for overlapping regions, using the following formula: in, To align the midpoint of the point cloud The initial semantic probabilities after fusion For the midpoint of the alignment point cloud The set of all spatial sub-blocks, To align the midpoint of the point cloud In the The fusion weights in each sub-block For the first The PointNet++ semantic segmentation model trained in each sub-block aligns the points in the point cloud. Output class probabilities; S354: Calculate the initial semantic probability map for each point belonging to the three categories of normal, spiky, and flash, using the following formula: in, This is the initial semantic probability graph. To align the midpoint of the point cloud The initial probability of belonging to the normal point. To align the midpoint of the point cloud The initial probability of belonging to a spur point. To align the midpoint of the point cloud The initial probability of belonging to a fly edge point.

5. The casting grinding guidance method linking defect detection and grinding area as described in claim 4, characterized in that, The signed distances in the full geometric alignment data are fused with the initial semantic probability map to calculate a joint defect score. Based on the joint defect score, points to be polished are selected and clustered to obtain at least one effective polishing region and its defect feature descriptor. The defect feature descriptor includes the region point set, region boundary, region center, maximum polishing allowance, CAD theoretical unit normal vector, dominant polishing type, and dominant source of the effective polishing region, including: S41. Assign correspondences between the full geometric alignment data and the initial semantic probability map according to the spatial location of the point cloud; S42. Using the initial semantic probability as a univariate potential function of the conditional random field, and the spatial distance between points in the aligned point cloud and the difference between the CAD theoretical normal as a bivariate potential function, a fully connected conditional random field is established. Spatial consistency optimization is performed on the point-by-point semantic probability to obtain the smoothed semantic confidence. The specific steps are as follows: S421: The initial semantic probability is used as a univariate potential function of the conditional random field, and its formula is: in, To align the midpoint of the point cloud Assigned as a category The cost of one yuan; It is a univariate potential function; S422: The spatial distance between points in the alignment point cloud and the difference in the CAD theoretical normal are used as a binary potential function, and its formula is: in, For point and points The two potential functions between them For tag compatibility functions, when Punishment will be imposed at that time. For spatially smooth kernel weights, To maintain the kernel weight in the normal direction, These are the scale parameters of the position kernel, the position scale parameters of the appearance kernel, and the normal vector scale parameters of the appearance kernel, respectively. S423: The energy function of a fully connected conditional random field is established based on univariate and bivariate potential functions, and its formula is as follows: in, Assigning tags The corresponding conditional random field energy, Assign labels to all points. For point semantic tags; S424: The energy function of the fully connected conditional random field is solved using the mean-field method to optimize the spatial consistency of the pointwise semantic probabilities, resulting in the smoothed semantic confidence score, as shown in the formula: in, For the point after inference through the conditional random field mean field, Category The smoothed edge probability, For point The smoothed semantic confidence vector; S43. Normalize the signed distance of each point to obtain a geometric score. Take the maximum value between the smoothed glitch probability and the flash edge probability as the semantic defect score. Calculate the joint geometric-semantic defect score according to the preset weights. The specific steps are as follows: S431: Normalize the signed distance of each point into a geometric score, using the following formula: in, The maximum value of the positive signed distance. The range of distances used for geometric score normalization; For the current point Normalized geometric score; For point The signed distance; This is the positive out-of-tolerance threshold; To prevent positive numbers with a denominator of zero or a negative value; This is a limiting function; For any point The signed distance; S432: Use the maximum of the smoothed glitch probability and flash edge probability as the semantic defect score. ; S433: Calculate the geometric-semantic joint defect score according to the preset weights. The formula is as follows: in, For point The geometric-semantic joint defect score, These are the geometric score weighting coefficients; S44. The geometric-semantic joint defect score is greater than the fusion threshold. The points are selected as the points to be polished. If the set of points to be polished... If empty, output "No polishing task" and do not proceed with subsequent polishing path planning; otherwise, continue with candidate region clustering. S45. Perform Euclidean clustering on the points to be polished to obtain multiple spatially independent candidate regions, and remove outlier small regions with fewer points than the minimum clustering threshold. The formula is as follows: in, This is the set of candidate regions obtained after clustering. The threshold for Euclidean clustering radius. The minimum number of cluster points threshold, For the first Candidate regions, The number of candidate regions; For Euclidean clustering operations; S46. Extract the outer contour boundary point set for each candidate region, calculate the maximum grinding allowance, retrieve the CAD theoretical normal, and determine the dominant grinding type based on the average semantic confidence and maximum grinding allowance of the candidate regions. The dominant grinding type includes burrs, flash, geometric protrusions, and noise regions, where noise regions are not included in the subsequent grinding path planning, thus obtaining the effective grinding region set. The specific steps are as follows: S461: Extract the set of outer contour boundary points for each candidate region, using the following formula: in, For the first The set of outer contour boundary points of each candidate region Extract parameters for the boundary of the Alpha Shape; S462: Determine the center of the candidate region and calculate the maximum polishing allowance. The formula is as follows: in, For the first The regional center of each candidate region, For the first The number of points contained in each candidate region; For the first The maximum polishing allowance for each candidate region; S463: Retrieve CAD theoretical normals based on candidate region centers; the formula is as follows: in, As regional center The nearest point behind the surface of the projected CAD triangular mesh model. This is the projection function for the nearest point on the surface of a CAD triangular mesh model. For the first The CAD theoretical unit normal vector corresponding to each candidate region This is a function for retrieving surface normals in a CAD triangular mesh model. S464: Calculate the average semantic confidence of candidate regions using the following formula: in, For the first Each candidate region belongs to the category The average semantic confidence; S465: The dominant sanding type is determined based on the average semantic confidence and maximum sanding allowance of the candidate regions. The formula is as follows: in, For the first The dominant polishing type for each candidate region. It is a burr type. It is a frilly edge type. It is a geometric protrusion type. This is a noise area or a false detection area. For the first The average semantic confidence of each candidate region belonging to the spur. For the first The average semantic confidence of each candidate region belonging to the flyedge. The threshold for determining the semantic confidence of a region; when In this case, the area will not be included in the subsequent polishing path planning, but will be removed as a false detection area, and the remaining candidate areas will be considered as valid polishing areas. S47. Generate a defect feature descriptor for the effective grinding area, including the area point set, area boundary, area center, maximum grinding allowance, CAD theoretical unit normal vector, dominant grinding type, and dominant source. The formula is as follows: in, For the first Defect feature descriptor for an effective polishing area This is the set of defect feature descriptors for all effective grinding areas. To determine the number of areas to be effectively polished; , For the first A set of effective polishing area points, For the first The outer contour boundary of the effective grinding area For the first An effective polishing area center, For the first Maximum sanding allowance for each effective sanding area. For the first The CAD theoretical unit normal vector corresponding to each effective grinding area. For the first The effective sanding area dominates the sanding type. , For the first The primary source for effective polishing in the region. This is the mode statistics function, which represents the source type that appears most frequently within a region. For point-level dominant sources, the formula is: in, Geometry-dominated Semantic-driven, Dominated by both geometry and semantics, The difference threshold is used to determine the source.

6. The casting grinding guidance method linking defect detection and grinding area as described in claim 5, characterized in that, Based on the dominant grinding type in the defect feature descriptor, different trajectory patterns and process parameters are defined to generate a grinding program that can be executed by the robot, including: S51. Set basic process parameters, including basic feed rate, based on the dominant grinding type of each effective grinding area. Spindle speed Maximum allowable removal depth per layer Track spacing and tool tilt angle ; S52. Establish a local coordinate system for each effective grinding area under the CAD coordinate system. The local coordinate system uses the CAD theoretical unit normal vector as the local normal direction and the maximum principal direction of the area point set in the tangent plane as the local principal tangential direction. The local secondary tangential direction is obtained by the cross product of the two, and the formula is as follows: in, For the first The local normal direction of an effective grinding area in the CAD coordinate system; This is the theoretical unit normal vector in CAD. For the first The principal tangential direction of an effective grinding area within the local cutting plane; To extract the PCA function for the maximum principal direction; To effectively refine the area point set Projected onto It is a local tangent plane in the normal direction; For the first The secondary tangential direction of each region; S53. Project the effective grinding area onto a local two-dimensional plane to obtain a two-dimensional closed projection area. Select the trajectory mode according to the dominant grinding type: For burr areas, extract the skeleton lines from the two-dimensional closed projection area and generate an edge tracking trajectory; for flash areas, generate equidistant parallel scan lines within the two-dimensional closed projection area and trim them to obtain a parallel reciprocating coverage trajectory; for geometric protrusion areas, offset the outer contour of the two-dimensional closed projection area inward at equal intervals to obtain a contour-following layered trajectory. The specific steps are as follows: S531: Combining the local coordinate system, the effective grinding area is projected onto a local two-dimensional plane to obtain a two-dimensional closed projection area, the formula of which is: in, For the first The projection function of the three-dimensional points corresponding to each effective grinding area onto the local two-dimensional plane. These are the three-dimensional points of the effective grinding area in the CAD coordinate system. For the first The closed projection area of ​​an effective grinding area in a local two-dimensional plane. This is a function for extracting the boundary of a two-dimensional concave hull. A function that fills a two-dimensional boundary into a closed region. Extract parameters for the boundary of a 2D Alpha Shape; S532: For burr areas, extract skeleton lines from the two-dimensional closed projection area and generate edge tracking trajectories. The formula is as follows: in, For the first The skeleton lines of a burr region in a local two-dimensional plane This is a function for extracting skeleton lines from a two-dimensional closed region. For the fly-edge region, equidistant parallel scan lines are generated within the two-dimensional closed projection area and clipped to obtain a parallel reciprocating coverage trajectory. The formula is as follows: in, For the first The first 2D plane of the local burr edge region Parallel scan lines, In a local two-dimensional plane along the secondary tangential direction coordinates Two-dimensional closed region exist Minimum coordinates in the direction, This is the parallel scan line number, used only for scrambling coverage trajectories. For trajectory spacing, It is a local two-dimensional parallel reciprocating coverage trajectory. This refers to the number of parallel scan lines. The valid trajectory segment that falls within the fly-edge area; For the geometrically convex region, the two-dimensional outer contour of the two-dimensional closed projection region is offset inward at equal intervals to obtain the contour layering trajectory, the formula of which is: in, For the first A local two-dimensional contour line after inward offset. This is the internal offset contour number, used only for geometric protrusion contouring trajectories. For the first The projection of the outer contour boundary of each region onto the local two-dimensional plane To offset the outline towards the interior of the region The function, The number of internal offset profiles that can be generated. It is a set of local two-dimensional contour-following layered trajectories; S54. Map the two-dimensional trajectory back to the CAD three-dimensional space to form continuous trajectory primitives in the CAD coordinate system, and discretize the trajectory primitives into equally spaced trajectory points. The specific steps are as follows: S541: Mapping a two-dimensional trajectory back to CAD three-dimensional space, the formula is: in, To make local two-dimensional points Functions that restore to CAD 3D space For local two-dimensional plane coordinates, This is a function that projects spatial points onto a CAD triangular mesh model. S542: Maps the edge tracking trajectory of the burr area back to CAD 3D space. The formula is as follows: in, This refers to the burr edge tracking trajectory in the CAD coordinate system. S543: Map the parallel reciprocating coverage trajectory of the fly edge area back to the CAD 3D space. The formula is as follows: in, The parallel reciprocating coverage trajectory of the flash edge in the CAD coordinate system; S544: Maps the contouring layered trajectory of the geometrically raised region back to CAD 3D space. The formula is as follows: in, The geometric protrusion contouring layered trajectory in the CAD coordinate system; S545: Forms continuous trajectory primitives in the CAD coordinate system, the formula is: in, For the first A continuous trajectory element of an effective grinding area in the CAD coordinate system; S546: Discretize the trajectory primitives into equally spaced trajectory points, the formula is as follows: in, For the first The first effective polishing area Reference trajectory points for a CAD triangular mesh model For trajectory arc length parameter, The discrete interval of the trajectory, For the first The number of discrete points of the trajectory in each region; S55. Calculate the initial grinding allowance interpolation value for the equidistant trajectory points. Determine the number of grinding layers and the removal depth per layer based on the maximum grinding allowance. Calculate the remaining grinding allowance for the current layer based on the initial grinding allowance interpolation value for the equidistant trajectory points. Then, based on the remaining grinding allowance for the current layer, convert the planned removal depth of each layer into the target contact trajectory points for the corresponding layer, so that the layered grinding is reflected in the spatial position of the robot's execution trajectory. The specific steps are as follows: S551: Calculate the initial grinding allowance interpolation for equally spaced trajectory points. The formula is as follows: in, For the first The first effective polishing area Initial grinding allowance at each equally spaced trajectory point. A function that interpolates the positions of equally spaced trajectory points based on the signed distance between points within the effective grinding area point set; S552: The number of polishing layers and the removal depth per layer are determined based on the maximum polishing allowance. The formula is as follows: in, For the first Number of polishing layers per effective polishing area This represents the maximum allowable removal depth for a single layer. This is the maximum allowable amount for polishing; For the first The first effective polishing area Layer plan removal depth, This is the polishing layer number. , The completed layer number; S553: ​​Calculate the remaining grinding allowance for the current layer based on the initial grinding allowance interpolated from the equally spaced trajectory points. The formula is as follows: in, For the first The first effective polishing area Layer The remaining polishing allowance at each equally spaced trajectory point. For the first The planned removal depth of the layer; S554: Based on the remaining polishing allowance of the current layer, convert the planned removal depth of each layer into the target contact trajectory point of the corresponding layer. The formula is as follows: in, For the first The first effective polishing area Layer One target contact trajectory point, For the first The CAD theoretical unit normal vector corresponding to each region; S56. Perform B-spline smoothing on the target contact trajectory of each layer. Calculate the tool attitude based on the tangent of the smoothed target contact trajectory and the CAD theoretical unit normal vector, and orthogonalize the tool attitude to obtain the... The specific steps for determining the tool pose matrix in the layered CAD coordinate system are as follows: S561: Perform B-spline smoothing on the target contact trajectory of each layer, with the following formula: in, For the first The first effective polishing area The target contact trajectory curve after layer smoothing. For the first indivual B-spline basis functions For the first The first effective polishing area The first layer One B-spline control point, To control the number of points, These are the parameters of the B-spline curve; S562: Calculate the... The formula for the tangential direction of the smoothed trajectory is: in, For the first The first region Layer The smooth trajectory unit tangent at each target contact trajectory point For the first The B-spline curve parameters corresponding to each target contact trajectory point It is a vector normalization function; S563: Calculate the... The formula for the layer tool axis is: in, For the first The first region Layer At each target contact trajectory point, the tool axis in the CAD coordinate system corresponds to the tool coordinate system. To bypass the first Layer smooth trajectory tangential Tilting angle The rotation matrix, For the tool tilt angle, This is the theoretical unit normal vector in CAD. S564: Based on the actual implementation of the... The layer smoothing target contact trajectory calculation tool pose requires the tangential direction, so that the tool axis follows the first layer. The tangent of the actual execution trajectory of the layer is used to generate the tool axis of the current layer by combining the CAD theoretical normal and the tool tilt angle, and the tool posture is orthogonalized. The formula is as follows: in, The temporary tool tangential direction after removing the tool axial component. The orthogonalized tool tangent The orthogonalized tool direction; S565: Obtain the... The tool pose matrix in the layered CAD coordinate system is formulated as follows: in, For the first The first region Layer The attitude matrix of the tool coordinate system relative to the CAD coordinate system at each trajectory point; S57. The feed rate is adaptively adjusted based on the remaining grinding allowance, and the formula is as follows: in, For the first The first region Layer The feed rate of each target trajectory point For reference, the amount of polishing allowance, To prevent positive numbers with a denominator of zero, Minimum allowable feed rate, For the maximum permissible feed rate, This is a limiting function; S58. Perform interference detection in the simulation environment to determine the effective contact section and the non-contact avoidance transition section. For the non-contact avoidance transition section, perform avoidance correction at the non-contact transition point. For the effective grinding contact section, execute the target contact trajectory point. If unavoidable interference occurs, output the abnormal path status and replan or manually review it. The specific steps are as follows: S581: The formula for determining the effective contact section and the non-contact avoidance transition section is as follows: in, For the CAD coordinate system trajectory points ultimately used for robot execution, For the first The first effective polishing area Layer One effective grinding contact point For the non-contact avoidance transition point, the formula is: in, These are the non-contact transition trajectory points within the tool approach, retraction, or transition phases. For the first The first region Avoidance correction vector for each non-contact transition point; The minimum safe distance threshold, For the tool to be located at a non-contact transition point in the simulation environment The minimum distance between the device and the workpiece or environment. To avoid the non-contact transition point of the corrected CAD coordinate system; S59. Convert the trajectory points and tool pose in the CAD coordinate system into executable trajectory poses in the robot base coordinate system through a transformation from the CAD coordinate system to the robot base coordinate system. Then, perform robot inverse kinematics, joint limit, and singularity detection to obtain the grinding program executed by the robot, including trajectory points, tool pose, feed rate, spindle speed, and single-layer removal depth. The steps are as follows: S591: Define the transformation matrix from the CAD coordinate system to the robot base coordinate system, and its formula is: in, This is the homogeneous transformation matrix from the CAD coordinate system to the robot's base coordinate system; S592: The trajectory points and tool poses in the CAD coordinate system are transformed into the execution trajectory poses in the robot base coordinate system through a transformation from the CAD coordinate system to the robot base coordinate system. The formula is as follows: in, To transform the trajectory points to the robot's base coordinate system, For the first The first region Layer At each trajectory point, the pose matrix of the tool coordinate system relative to the robot base coordinate system. This refers to the rotation component in the transformation matrix from the CAD coordinate system to the robot's base coordinate system. S593: Construct the robot's inverse kinematics and reachability constraints, the formula of which is: in, For the first The first effective polishing area Layer The robot joint angles corresponding to each trajectory point; Solving functions for the inverse kinematics of a robot; , Define the lower and upper limits of the robot's joint angles; For the robot's Jacobian matrix; It is the minimum singular value of the robot's Jacobian matrix; This is the singularity safety threshold; Determine whether the generated trajectory satisfies robot reachability, joint constraints, and singularity constraints, and select the final trajectory points that satisfy the constraints. ; S594: Obtain the grinding program executed by the robot, including trajectory points, tool posture, feed rate, spindle speed, and single-layer removal depth, with the following formula: in, For the first The robot can execute a polishing program corresponding to each effective polishing area. The first in the robot's base coordinate system Layer tool pose, Main spindle speed; This is a function that converts trajectory, posture, and process parameters into robot control code.

7. The casting grinding guidance method linking defect detection and grinding area as described in claim 6, characterized in that, The robot executes the polishing program to polish the area, calculates the residual positive margin in the polished area for re-inspection, and if the residual positive margin exceeds the allowable threshold, triggers closed-loop correction, redefines the defect feature descriptor of the current residual positive margin, returns to S5 to plan the local polishing path, and executes polishing again until it is qualified or the iteration limit is reached, including: S61. The robot executes the generated polishing program and polishes each effective polishing area according to the corresponding trajectory, posture and process parameters. S62. After polishing is completed, the robot will drive the 3D camera again to perform a local re-scan of the polished area and unify the re-scan point cloud into the robot's base coordinate system. S63. Using the final transformation matrix from the robot base coordinate system to the CAD coordinate system, transform the re-inspection point cloud to the CAD coordinate system, and recalculate the signed distance from the re-inspection point cloud to the CAD theoretical surface. The formula is as follows: in, To verify the robot's base coordinate system points obtained from the re-examination scan, These are the re-inspection points after conversion to the CAD coordinate system; For re-inspection point Signed distance to the theoretical CAD surface Distance on CAD triangular mesh model The nearest point, For CAD triangular mesh models in The theoretical unit normal vector at that location; S64. Based on the outer contour boundary of the original grinding area and the re-inspection extension margin, assign the re-inspection points to the corresponding original grinding areas to obtain the re-inspection point set for each original grinding area. The formula is as follows: in, For the first The set of re-inspection points corresponding to each original polishing area For the first A local two-dimensional projection function of the original polished area For the first The outer contour boundary of the original polishing area. To expand the two-dimensional boundary outward The region expansion function; To allow for additional margin in the re-inspection area; If the number of re-inspection points is less than the minimum valid point threshold for the re-inspection area If the result is negative, it means the re-examination data is invalid and needs to be rescanned. S65. Calculate the residual positive allowance of the original polished area using the following formula: in, For the first The residual positive allowance after polishing the original polishing area; If the residual positive margin is less than or equal to the allowable residual threshold Furthermore, the number of re-inspection point sets is greater than the minimum effective number of points threshold for the re-inspection area. If the polishing is satisfactory, the area is considered to be properly polished; otherwise, the residual positive allowance still exceeds the allowable residual threshold. If the current iteration count does not exceed the maximum allowed iteration count, then extract the residual excess point set from the re-check point set. ; The residual out-of-poor point set is further clustered to obtain one or more residual out-of-poor sub-regions, and the formula is as follows: in, For the first The set of residual out-of-tolerance sub-regions obtained after re-inspection of the original polished areas. For the first The first in the original polishing area A residual out-of-difference subregion For the first The number of residual out-of-range sub-regions within the original polishing area. The threshold for Euclidean clustering radius. The minimum number of cluster points threshold, The index of the residual out-of-difference sub-region; Update the boundary, center, maximum grinding allowance, and CAD theoretical unit normal vector of each residual out-of-tolerance sub-region respectively, using the following formula: in, For the first The first original polishing area A new set of polishing region points is generated from each residual out-of-difference sub-region; This represents the maximum polishing allowance for the remaining sub-region. This represents the outer contour boundary of the residual sub-region; This is the region center of the remaining sub-region; This is the CAD theoretical unit normal vector corresponding to the residual sub-region; For re-examination of signed distance; Extract parameters for the boundary of the Alpha Shape; After forming a new set of defect feature descriptors, return to S5 to replan the local grinding path. The formula for the new set of defect feature descriptors is: in, This is a new defect feature descriptor generated from the residual out-of-range sub-region. This represents the maximum sanding allowance for the newly sanded area. The original area is the dominant polishing type; if a re-evaluation is required after re-inspection, it can be returned to S4 for reclassification. The original dominant source was from the region. This is the set of new defect feature descriptors corresponding to all residual out-of-range sub-regions; S66. If the maximum allowed number of iterations is exceeded and the result is still unqualified, an NG result will be output, prompting manual review or exception handling. S67. Output the final polishing result, including the status of no polishing task, or the qualified status of each effective polishing area, the status of needing to be rescanned, the NG status, or the status of needing to replan the local polishing path for the area, the residual positive margin, the final execution program, and the area defect information.