Grinding error compensation method and system based on workpiece surface defect detection
By introducing a random sampling consensus algorithm and an iterative nearest point algorithm with sampling weights into 3D scanning technology, and combining them with principal component analysis and particle swarm optimization algorithms, the problems of false detection and noise misjudgment in surface defect identification in traditional 3D scanning technology are solved, and efficient and high-precision grinding error compensation is achieved.
Patent Information
- Application Number
- CN202510952145.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-10
- Publication Date
- 2025-11-07
AI Technical Summary
Traditional 3D scanning technology struggles to accurately identify surface defects generated during grinding without false or missed detections. Furthermore, random noise in the scan data is easily misjudged as defects, and existing noise reduction algorithms struggle to distinguish between real textures and noise.
A random sampling consensus algorithm based on sampling weights is used for noise reduction. Combined with the iterative nearest point algorithm and principal component analysis algorithm, grinding error compensation is performed through structural difference analysis and particle swarm optimization algorithm. An error model is constructed and parameter compensation is performed.
It improves the accuracy and efficiency of surface defect detection, effectively distinguishes between real texture and noise, achieves high-precision grinding error compensation, and ensures the accuracy and reliability of the workpiece after processing.
Smart Images

Figure CN120912463A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of precision machining, and particularly relates to a grinding error compensation method and system based on workpiece surface defect detection. BACKGROUND
[0002] Grinding is an important machining method in modern precision manufacturing. Through grinding, workpieces can obtain high precision dimensions and excellent surface quality. Grinding plays a crucial role in the manufacturing of precision parts with high requirements. Factors such as heat influence, abrasive wear, and workpiece vibration during grinding often lead to various defects on the workpiece surface, such as scratches, micro-cracks, and local wear. These surface defects not only affect the appearance quality of the workpiece, but also can reduce its mechanical properties, thereby affecting the reliability and service life of the final product. In order to improve the accuracy and efficiency of surface defect detection, three-dimensional scanning technology is introduced into the detection of workpiece surface defects in grinding. Three-dimensional scanning technology can accurately reconstruct the three-dimensional model of the workpiece by obtaining high-precision point cloud data of the workpiece surface, and analyze the subtle changes on the workpiece surface.
[0003] Traditional three-dimensional scanning data processing methods are difficult to accurately identify without false positives or false negatives. How to accurately and efficiently identify and process various surface defects generated during the grinding process using high-precision three-dimensional scanning technology and apply it to the automatic production process has become a major problem. At the same time, random noise in the scanning data is easily misjudged as a defect, and existing noise reduction algorithms are difficult to distinguish between real textures and noise. SUMMARY
[0004] The purpose of the present application is to provide a grinding error compensation method and system based on workpiece surface defect detection.
[0005] In a first aspect, the present application provides a grinding error compensation method based on workpiece surface defect detection, which comprises: Three-dimensional scanning of the measured workpiece is performed at a first resolution to obtain an initial point cloud. The texture features of each point in the initial point cloud are obtained, and the corresponding sampling weights are calculated. The initial point cloud is denoised based on the sampling weights of each point using the random sample consensus algorithm to obtain a denoised point cloud. Structural difference analysis is performed on the denoised point cloud and the ideal point cloud of the measured workpiece to obtain a feature area on the measured workpiece. Three-dimensional scanning of the feature area is performed at a second resolution to obtain a plurality of feature point clouds. All feature point clouds are matched with the denoised point cloud through the iterative closest point algorithm, and the points in the feature point clouds that match the denoised point cloud are used to replace the corresponding points in the denoised point cloud to obtain a final scanning point cloud. The second resolution is higher than the first resolution. The principal component features of the final scanning point cloud and the ideal point cloud are obtained through a principal component analysis algorithm, and a plurality of error indexes are obtained by comparing the principal component features of the final scanning point cloud and the ideal point cloud; an error model is constructed based on the plurality of error indexes, and a compensation parameter is set according to the error model to perform grinding error compensation on the deviation of the workpiece surface.
[0006] As preferred, the specific process of obtaining the sampling weight is as follows: the texture similarity of each point in the initial point cloud and all points in the neighborhood of the point is obtained according to the texture feature of the point; the corresponding sampling weight is obtained based on the texture similarity , and its expression is: , wherein, is the texture similarity of the point in the initial point cloud; is a smoothing term; K is the number of neighborhood points.
[0007] As preferred, the method for obtaining the texture feature is as follows: The initial point cloud is normalized; the neighborhood of each point in the initial point cloud is constructed, and the covariance matrix of the neighborhood is calculated; the eigenvector corresponding to the minimum eigenvalue of the covariance matrix corresponding to each point is taken as the normal vector of the point; the texture matrix corresponding to each point is constructed by the normal vector included angle cosine value of all point pairs in the neighborhood corresponding to the point; the discrete wavelet transform is performed on the texture matrix to obtain a plurality of wavelet coefficient matrixes; the square of each element in the wavelet coefficient matrix is divided by the modulus of the matrix to obtain the local texture energy of the matrix; and the texture feature of each point in the initial point cloud is obtained by fusing a plurality of local texture energies corresponding to the point.
[0008] As preferred, the specific process of the noise reduction processing is as follows: The points for constructing the current sampling point set are extracted from the initial point cloud based on the sampling weight, and a plane model is fitted according to the current sampling point set; the corresponding geometric residual is obtained according to the distance of each point to the plane model; the wavelet coefficient difference corresponding to each point is obtained by detecting the texture inconsistency point through the frequency domain difference; the joint residual of each point is obtained by fusing the geometric residual and the wavelet coefficient difference corresponding to each point in the current sampling point set; the inner points for constructing the current inner point set are selected from the current sampling point set based on the joint residual of each point; if the number of inner points of the current inner point set is greater than the number of inner points of the best inner point set, the current inner point set is taken as the best inner point set; the above process is repeated until the termination condition is reached, and the best inner point set is taken as the noise reduction point cloud.
[0009] As preferred, the specific process of obtaining the feature region is as follows: selecting the nearest point of each point in the denoised point cloud in the ideal point cloud, and filtering a set of out-of-tolerance points from the denoised point cloud based on the distance between each point in the denoised point cloud and its corresponding nearest point; constructing an out-of-tolerance neighborhood for each point according to the distance between different points in the set of out-of-tolerance points; if the number of points in the out-of-tolerance neighborhood is greater than the minimum number of neighborhood points, taking the point corresponding to the out-of-tolerance neighborhood as the core point, and constructing a core point set with the set of core points in the set of out-of-tolerance points; constructing a core point adjacency graph based on the adjacency relationship between different points in the core point set; splitting the core point adjacency graph into multiple connected components, and constructing a cluster point set for each connected component; if there is any point in the set of out-of-tolerance points other than the core point set and the distance between any point in the connected component is less than or equal to the adaptive neighborhood radius, the point in the set of out-of-tolerance points is added to the cluster point set; if the number of points in the cluster point set is greater than the minimum point threshold, the cluster point set belongs to a feature region.
[0010] As a preferred, the specific process of constructing the out-of-tolerance neighborhood is as follows: For the points in the set of out-of-tolerance points a , select the points in the set of out-of-tolerance points whose distance to the point a is less than or equal to the adaptive neighborhood radius to construct the out-of-tolerance neighborhood of the point a ; the adaptive neighborhood radius ; wherein, is a scale factor; is a point cloud density parameter.
[0011] As a preferred, the specific process of matching the feature point cloud and the denoised point cloud is as follows: initializing the rotation matrix and the translation vector; selecting the nearest point of each point in the feature point cloud in the denoised point cloud based on the rotation matrix and the translation vector in the current iteration process, taking the set of nearest points in the denoised point cloud as the feature neighborhood; respectively, the points in the feature point cloud and the feature neighborhood are processed by decentralization, and a covariance matrix is constructed based on the centralized feature point cloud and the feature neighborhood; the decomposition result of the covariance matrix is obtained by singular value decomposition to obtain the rotation matrix and the translation vector in the next iteration; repeat the above process until the termination condition is reached, and the rotation matrix and the translation vector in the next iteration are taken as the optimal rotation matrix and the optimal translation vector to adjust the points in the feature point cloud; for each point in the feature point cloud, select the point in the denoised point cloud that is closest to the point, if the distance is less than the replacement distance threshold, the two points are matched.
[0012] As a preferred, the error index includes defect point coordinates, defect type, defect error and confidence score; the principal component feature includes feature value difference, principal direction angle and reconstruction error.
[0013] As a preferred, the deviation of the workpiece surface is compensated by the particle swarm optimization algorithm based on the error model.
[0014] In a second aspect, the present application provides a grinding error compensation system based on workpiece surface defect detection, which is used to perform the grinding error compensation method described above; the grinding error compensation system comprises a data acquisition module, a noise reduction module, a feature region extraction module, a point cloud matching module, an error model generation module and an error compensation module; the data acquisition module is used to acquire point clouds of a measured workpiece; the noise reduction module is used to perform noise reduction processing on the point clouds; the point cloud matching module is used to match points in different point clouds; the error model generation module is used to generate an error model; and the error compensation module is used to perform grinding error compensation according to the error model.
[0015] The present application has the beneficial effects that: 1、The present application introduces a sampling weight into the random sampling consensus algorithm to construct a sampling point set, so that points in the sampling point set are selected from a texture uniform area, so that the initial model estimation is closer to the true solution, and the convergence speed of the uniform sampling is improved; at the same time, the weight participates in the weighted least squares optimization, suppresses the interference of texture mutation points, combines the geometric-texture dual-mode discrimination formed by the multi-scale frequency domain residual, reduces the false matching rate in the repeated structure or low signal-to-noise ratio scene, and realizes the cooperative optimization of efficiency and accuracy.
[0016] 2、The present application combines texture feature analysis with robust model estimation of the random sampling consensus algorithm to effectively distinguish real surface texture features from noise interference; at the same time, the present application compares the differences between the three-dimensional model and the ideal point cloud through a structure difference analysis model, labels the feature regions according to the results, performs high-resolution scanning modeling on the feature regions according to the analysis results, and performs model fusion, which can further refine the geometric information of these regions.
[0017] 3、The present application uses an iterative closest point algorithm with a dynamic weight distribution strategy to align and refine the high-precision model and the initial model, quickly and effectively corrects the original workpiece model, eliminates scanning errors, and obtains a more accurate workpiece shape; at the same time, according to the registration result of the iterative closest point algorithm, the high-precision model is replaced into the initial model to improve the accuracy of the initial model.
[0018] 4、The present application uses a particle swarm optimization algorithm with local sensitivity added particle initialization to compensate for the deviation of the workpiece, which can automatically adjust the design parameters, optimize the compensation amount, and find the optimal solution in a complex parameter space, so as to ensure that the accuracy of the machined workpiece is close to the ideal point cloud. Through the scanning, modeling, analysis, compensation and trajectory planning process, comprehensive error evaluation and optimization can be performed before machining, so as to reduce the correction work in the later stage. BRIEF DESCRIPTION OF DRAWINGS
[0019] Figure 1 The present application has the beneficial effects that:
[0020] Figure 2 Flow chart for initial point cloud denoising in the present application.
[0021] Figure 3 Flow chart for feature region acquisition in the present application.
[0022] Figure 4 Flow chart for point cloud data matching in the present application.
[0023] Figure 5 Flow chart for error model acquisition in the present application.
[0024] Figure 6 Flow chart for principal component feature comparison in the present application.
[0025] Figure 7 Flow chart for grinding error compensation using particle swarm optimization algorithm in the present application. DETAILED DESCRIPTION
[0026] The present application is further described below in conjunction with the accompanying drawings.
[0027] A grinding error compensation method based on workpiece surface defect detection, which adopts a grinding error compensation system including a data acquisition module, a denoising module, a feature region extraction module, a point cloud matching module, an error model generation module, and an error compensation module. The data acquisition module is used to acquire the point cloud of the measured workpiece. The denoising module is used to perform denoising processing on the point cloud. The point cloud matching module is used to match the points in different point clouds. The error model generation module is used to generate the error model. The error compensation module is used to perform grinding error compensation according to the error model.
[0028] As shown in Figure 1 , the grinding error compensation method includes the following steps: Step one, using a 3D scanning device to perform three-dimensional scanning on the measured workpiece processed by initial grinding at a first resolution to acquire initial point cloud P .
[0029] Step two, as shown in Figure 2 , using a random sample consensus algorithm (RANSAC) to process the initial point cloud P , by introducing a sampling weight in the random sample consensus algorithm, and based on the sampling weight, extracting points from the initial point cloud P to construct a sample point set, and selecting the best inlier set from the sample point set as the denoising point cloud, the specific process is as follows: 2-1. Normalize the initial point cloud Perform coordinate normalization on the initial point cloud P to eliminate the influence of scale difference on texture calculation. After normalization, each point in the initial point cloud P Represented as: in, The coordinates of each point in the initial point cloud before normalization. The mean of the coordinates of all points in the initial point cloud data before normalization. This represents the standard deviation of the coordinates of all points in the point cloud before normalization.
[0030] 2-2. Extracting Texture Features The initial point cloud is constructed using the KNN (Kinness-Neighborhood Interchange) algorithm. P The neighborhood of each point And calculate the neighborhood covariance matrix Its expression is: in, The centroid of the neighboring points; For the neighborhood The point in the middle.
[0031] With covariance matrix The eigenvector corresponding to the smallest eigenvalue is used as the point. normal vector It is represented as: in, It is the set of eigenvectors of the covariance matrix.
[0032] In the neighborhood In the middle, calculate all point pairs The cosine value of the angle between the normal vectors ; Cosine value of the angle between the normal vectors It reflects the curvature changes of the local surface and can be regarded as a proxy feature of geometric texture; its expression is: in, Points and points The normal vector; For the neighborhood The point in the middle.
[0033] The cosine of the angle between the normal vectors of all pairs of points in the neighborhood Constructing a texture matrix ;in, K This represents the number of neighboring points, which is 500 in this embodiment.
[0034] Discrete wavelet transform (DWT) is performed on each point and its neighborhood, and it is decomposed into high frequency components (detail components) and low frequency components (approximation components), which are denoted as follows: wherein, denotes the wavelet coefficient matrix of the i-th layer; denotes the number of decomposition layers. L The local texture energy of the wavelet coefficient matrix of each layer is obtained
[0035] , and its expression is as follows: wherein, denotes the modulus of the wavelet coefficient matrix; denotes the absolute value of the element in the wavelet coefficient matrix.
[0036] The local texture energy is fused in multiple scales to obtain the texture feature , and its expression is as follows: wherein, is the fusion weight, .
[0037] 2-3. Obtaining sampling weight The initial point cloud P is obtained. The texture similarity of each point in the initial point cloud and the points in its neighborhood is obtained, and its expression is as follows: wherein, is an exponential function.
[0038] The higher the texture similarity , the stronger the texture consistency of the region where the point is located. According to the texture similarity , the corresponding sampling weight is obtained, and its expression is as follows: wherein, is a smoothing term to prevent the sampling weight from being 0.
[0039] 2-4. Obtaining the current optimal model parameter Based on the sampling weight , 5000 points are extracted from the initial point cloud P to construct the current sampling point set , so that the region with high texture consistency, i.e. is selected preferentially. The current sample point set fitting the plane model using weighted least square (WLS) solving the weighted least square problem to obtain the current optimal model parameter : wherein, is the current optimal model parameter; is the geometric residual; is the plane model parameter, which includes the plane normal vector of the plane model and the offset of the plane model to the origin.
[0040] The geometric residual is obtained as follows: wherein, is the plane normal vector of the fitted plane model , which needs to satisfy the normalization condition ; d is the offset of the fitted plane model to the origin.
[0041] 2-5. Obtaining the joint residual The texture inconsistency points (noise) are detected by frequency domain difference detection, and the wavelet coefficient difference of each layer is calculated , and the expression is: wherein, is the frequency band weight, ; is the inlier set in the t th iteration; is the plane model prediction value, i.e., the average frequency domain response of the current inlier set ; is the number of inliers in the inlier set ; indicates the wavelet coefficient matrix of the inlier in the th layer.
[0042] The geometric residual and the wavelet coefficient difference corresponding to the current optimal model parameter are weighted and fused to obtain the joint residual P of each point in the initial point cloud , and the expression is: wherein, = 0.6 is the balance coefficient of the geometric and frequency domain residuals.
[0043] 2-6. Interior Point Determination If the joint residual of the points is less than the dynamic threshold If the point is an interior point, then that point is an interior point. Current set of interior points. : Adjust dynamic threshold : in, =0.05 is the threshold decay rate, which controls the adaptive adjustment speed; K For the initial point cloud P The number of midpoints.
[0044] 2-7. If the current number of interior points The number of interior points greater than the optimal interior set Then, using the current optimal model parameters As the best model parameters The current interior set As the best set of interior points .
[0045] 2-8. When the maximum number of iterations is reached or the proportion of interior points exceeds a preset threshold (95%), terminate the iteration process and obtain the optimal set of interior points. and with the best interior set As a noise reduction point cloud .
[0046] Step 3, as follows Figure 3 As shown, for denoised point clouds Ideal point cloud of the workpiece being measured Q Structural difference analysis is performed, which involves matching point cloud data with unprocessed surfaces and then performing distance field analysis to calculate the denoised point cloud. From each point in the ideal point cloud Q The distance between corresponding points is used to determine whether there are areas exceeding the tolerance, thereby obtaining the feature region. The specific process is as follows: 3-1. Nearest Neighbor Search Based on ideal point cloud Q Constructing a spatial index structure (KD-Tree) accelerates nearest neighbor queries and improves noise reduction of point clouds. Each point in Perform nearest neighbor search in a KD-Tree of an ideal point cloud Q: in, The closest point; For Ideal Cloud Pointing Q The point in the middle.
[0047] 3-2. Calculate Euclidean distance Computational Denoising of Point Clouds Each point in to its nearest point Geometric distance: 3-3. Constructing the set of outliers Identifying out-of-tolerance point sets based on distance field. It is represented as: in, This is the preset distance field threshold.
[0048] 3-4. Constructing the core point set Constructing an adaptive neighborhood radius : in, Scale factor; The point cloud density parameter is expressed as follows: in, For the worst-case set The number of midpoints; AABB For axis-aligned bounding boxes; vol (·) indicates the volume to be calculated.
[0049] For the set of out-of-fault points Points in a From the worst-case set Selecting points a Points whose distance is less than or equal to the adaptive neighborhood radius are considered as points. a Super-difference neighborhood ,Right now If the out-of-range neighborhood The number of midpoints is greater than the preset minimum number of neighborhood points. m Then the out-of-range neighborhood The corresponding points are used as the core points, and the set of out-of-range points is used. Constructing a core point set from the set of core points ,Right now In this embodiment, the minimum number of neighborhood points m It is 20.
[0050] 3-5. Construct cluster point sets If the core point set There exist two points in the network whose distance is less than or equal to a preset connectivity threshold. If the two points are adjacent, then they are considered to be adjacent. (Based on the core point set) The adjacency relationship between the different points is used to build a core point adjacency graph , i.e. . The core point adjacency graph is split into multiple connected components ; wherein, ; ; is the number of connected components in the core point adjacency graph .
[0051] For each connected component , a cluster point set is built , if there exists any point in the non-core point set ( ) whose distance to any point in the connected component is less than or equal to the adaptive neighborhood radius , then the point in the non-core point set is added to the cluster point set , i.e. .
[0052] 3-6. Building a feature area According to the number of points in the cluster point set , a feature area is built ; if the number of points in the cluster point set is greater than the preset minimum point threshold , then the cluster point set belongs to the feature area, i.e. . In this embodiment, the minimum point threshold is 100.
[0053] Step four, as shown in Figure 4 , the feature area is scanned again to reconstruct the model, i.e. the feature area is scanned in three dimensions with a second resolution, the mode of the high-precision 3D scanning device is adjusted, a high-resolution scanning mode is used to obtain more detailed surface information, and a plurality of feature point clouds ; wherein, ; is the number of feature point clouds, i.e. the number of cluster point sets in the feature area.
[0054] In this embodiment, the second resolution is higher than the first resolution.
[0055] Point cloud data matching is performed by the iterative closest point algorithm (ICP), i.e. all feature point clouds are matched with the denoised point cloud , and the feature point clouds are merged into the denoised point cloud in a replacement manner to obtain the final scanning point cloud , improve the accuracy of the feature region, and better reveal defects. The feature point cloud is integrated into the denoised point cloud The specific process is as follows: 4-1. Initialization Initialize the rotation matrix , translation vector , maximum number of iterations and convergence threshold ; wherein, is the identity matrix.
[0056] 4-2. Associate the nearest point For each point in the feature point cloud , find the nearest point in the denoised point cloud , which is represented as: wherein, is the rotation matrix in the k th iteration; is the translation vector in the k th iteration.
[0057] Take the set of nearest points of the points in the feature point cloud in the denoised point cloud as the feature neighborhood .
[0058] 4-3. Calculate the centroid Get the centroid of the feature point cloud and the feature neighborhood respectively, which is represented as wherein, and are the centroids of the feature point cloud k and the feature neighborhood in the th iteration, respectively; is the number of points in the feature point cloud .
[0059] 4-4. Decentering Subtract the corresponding centroid from the points in the feature point cloud and the feature neighborhood to get the points in the feature point cloud and the feature neighborhood after decentering, which is represented as: in, and Feature point cloud and feature neighborhood The decentralized points.
[0060] 4-5. Data Update Based on decentralized feature point cloud and feature neighborhood Constructing the covariance matrix It is represented as: Based on SVD (Singular Value Decomposition), the covariance matrix is... It can be decomposed into a left singular vector matrix U, a singular value matrix (diagonal matrix) Σ, and a right singular vector matrix V, i.e. The left singular vector matrix U describes the principal axis direction of the source point cloud; the right singular vector matrix V describes the principal axis direction of the target point cloud; and the singular value matrix (diagonal matrix) Σ represents the scaling factor. The rotation matrix for the next iteration is obtained based on the right singular vector matrix V and the left singular vector matrix U. Its expression is: Based on the k Feature point cloud in the next iteration and feature neighborhood centroid and rotation matrix Obtain the translation vector for the next iteration. Its expression is: Get the k Registration error in the next iteration Its expression is: 4-6. Iteration Stop Determination Repeat the above process until the first... k Registration error in the next iteration With the k Registration error in -1 iteration The difference is less than the preset convergence threshold. Or the current iteration count has reached the maximum iteration count. ( or Stop the iteration and output the optimal rotation matrix of the final transformation. and optimal translation vector .
[0061] 4-7. Point Cloud Fusion Based on the optimal rotation matrix and optimal translation vector Obtain the registered feature point cloud It is represented as: For feature point clouds Each point in From noise-reduced point clouds Select the point with the smallest distance from the given point; if this distance is less than a preset replacement distance threshold... Then the noise reduction point cloud Add this point to the replacement area Replacement area It is expressed as follows: Noise Removal Point Clouds All feature point clouds Corresponding replacement area and all feature point clouds Add noise reduction point cloud In the process, the final scanned point cloud is obtained. .
[0062] Step 5, as follows Figure 5 As shown, the final scanned point cloud Texture difference analysis was performed on the ideal point cloud Q. Principal component analysis (PCA) was used to analyze the distribution characteristics of points in the local neighborhood, extract the principal orientation and shape complexity of the geometric structure, and compare the results with the final scanned point cloud. The principal component features of the ideal point cloud in the same local region are used to obtain the error model through multi-index fusion. The specific process is as follows: 5-1. The final scanned point cloud is constructed using the Kinetic Neighborhood Algorithm (KNN). midpoint neighborhood and obtain each neighborhood center of mass : in, For points within a local neighborhood; The number of neighboring points is 50.
[0063] 5-2. Regarding the neighborhood The points in the matrix are decentralized, and the covariance matrix is obtained based on the processing result. It is represented as: 5-3. Based on the formula Obtain the covariance matrix The corresponding eigenvalues And eigenvectors Arrange the three eigenvalues obtained from large to small, in turn The corresponding eigenvectors .
[0064] The largest eigenvalue : the variance along the principal direction Reflects the extension of the neighborhood along the principal direction (such as the length of the linear structure).
[0065] The intermediate eigenvalue : the variance along the secondary direction Reflects the degree of expansion of the planar structure.
[0066] The smallest eigenvalue : the variance along the normal direction Reflects the flatness of the plane (if ≈ 0, the neighborhood is approximately a plane).
[0067] 5-4. Compare the final scanning point cloud With the principal component characteristics of the ideal point cloud Q in the same local area, the difference is quantified by the eigenvalue difference, the principal direction angle, and the reconstruction error. The specific process is as follows: Obtain the eigenvalue difference Between the final scanning point cloud And the ideal point cloud Q, its expression is: Where, Is the eigenvalue corresponding to the final scanning point cloud; Is the eigenvalue corresponding to the ideal point cloud.
[0068] Obtain the principal direction angle Between the final scanning point cloud And the ideal point cloud Q, its expression is: Where, Is the eigenvector corresponding to the final scanning point cloud; Is the eigenvector corresponding to the ideal point cloud.
[0069] Reconstruction error : Where, Is a point on the final scanning point cloud; Is the centroid corresponding to the ideal point cloud.
[0070] 5-5. Obtain the coordinates of the defect point and the defect type. like Figure 6 As shown, if the reconstruction error Greater than the preset reconstruction error threshold Then the reconstruction error The corresponding point is the defect point. Otherwise, the reconstruction error... The corresponding points are normal points. Based on the feature value differences of defect points. and and the angle of the main direction The rules for determining the defect type of a defect point are as follows: a. If the eigenvalues of the defect points differ Less than or equal to the preset feature value difference threshold If the defect is positive, then the defect type is an uneven defect; otherwise, proceed to the next step. In this embodiment, .
[0071] b. If the angle between the principal directions of the defect point Greater than the preset main direction angle threshold If the defect is found to be positive, then the defect type is a deformation defect; otherwise, proceed to the next step. In this embodiment, =7°.
[0072] c. If the characteristic values of the defect points differ If the defect type is positive, the defect type is a material addition / subtraction defect; otherwise, the defect type is a roughness defect.
[0073] 5-6. Obtaining Defect Error Perform a nearest neighbor search in the KD-Tree of the ideal point cloud Q to obtain the nearest point corresponding to the defect point in the ideal point cloud Q. Its expression is: in, Defect point; For Ideal Cloud Pointing Q The point in the middle.
[0074] Obtaining Defects and the corresponding nearest point The distance between them, i.e., defect error Its expression is: 5-7. Obtain confidence scores Obtain the confidence score corresponding to the defect point. Its expression is: 5-8. Generate an error model based on defect point coordinates, defect type, defect error, and confidence score.
[0075] Step Six, as Figure 7 As shown, the workpiece is designed for compensation, specifically by using the Particle Swarm Optimization (PSO) algorithm based on an error model to compensate for deviations on the workpiece surface. The specific process is as follows: 6-1. Initialize the particle swarm, i.e., initialize the position and velocity of the particles; in the error-sensitive region (i.e., confidence score) 5) Initialize more particles nearby, and set the individual optimal position and the global optimal position.
[0076] 6-2. Construct the fitness function; the goal of the fitness function is to minimize the deviation of the defect region on the workpiece surface. f ( x ),deviation f ( x ) is represented as: in, For the first feature region on the workpiece surface i The actual location of each point after compensation. For the error model, the first i The coordinates of the points; n It is the total number of points within the feature area of the workpiece surface; x The position of the particle represents the compensation parameter.
[0077] The fitness of each particle is evaluated according to the fitness function to determine the quality of the particle's current solution; if the fitness of a particle's current position is better than the fitness of its historical best position, then its individual best position is updated; if the fitness of a particle is better than the fitness of the global best position, then the global best position is updated.
[0078] 6-3. Adjust the particle's position and velocity according to the velocity update formula and the position update formula; the velocity update formula and the position update formula are as follows: in, For the first i The particle in the first t The speed of the wheel; Inertial weight; and For learning factors; and The weighting coefficients are randomly selected within the interval [0, 1]. For particles i The optimal position of an individual; is the position of the first particle in the first round; i is the position of the first particle in the first round; t is the position of the first particle in the first round; g is the global optimal position.
[0079] 6-4. If the iteration number or the accuracy requirement is met, the iteration is stopped, and the best compensation scheme is output. According to the compensation requirements of the workpiece surface, the machining trajectory is planned, that is, the compensation trajectory output by the particle swarm optimization algorithm is extracted as the machining path; based on the compensation trajectory, the tool path of the secondary machining is planned; the secondary machining path is optimized to ensure that it can correct the deviation to the maximum extent while avoiding damage to the workpiece caused by excessive cutting; the planned secondary machining trajectory is simulated using numerical control simulation software to ensure that the machining path is reasonable and will not cause collision and other problems; finally, the optimized secondary machining path is converted into numerical control machining code for machining.
Claims
1. A grinding error compensation method based on workpiece surface defect detection, characterized by: The method comprises: a three-dimensional scan is performed on the measured workpiece at a first resolution to obtain an initial point cloud; a texture feature of each point in the initial point cloud is obtained, and a corresponding sampling weight is calculated; a random sample consensus algorithm is used to perform noise reduction processing on the initial point cloud based on the sampling weight of each point to obtain a denoised point cloud; structure difference analysis is performed on the denoised point cloud and an ideal point cloud of the measured workpiece to obtain a feature region on the measured workpiece; a three-dimensional scan is performed on the feature region at a second resolution to obtain a plurality of feature point clouds; all feature point clouds are matched with the denoised point cloud through an iterative closest point algorithm, and the points in the feature point clouds that are matched with the denoised point cloud are used to replace the corresponding points in the denoised point cloud to obtain a final scanning point cloud; the second resolution is higher than the first resolution; principal component features of the final scanning point cloud and the ideal point cloud are obtained through a principal component analysis algorithm, and a plurality of error indicators are obtained by comparing the principal component features of the final scanning point cloud and the ideal point cloud; an error model is constructed based on the plurality of error indicators, and a compensation parameter is set according to the error model to perform grinding error compensation on the deviation of the workpiece surface.
2. The grinding error compensation method based on workpiece surface defect detection according to claim 1, characterized in that: The specific process of obtaining the sampling weight is: obtaining the texture similarity of each point in the initial point cloud and all points in the neighborhood of the point according to the texture feature of the point; obtaining the corresponding sampling weight based on the texture similarity The expression is: wherein, is a texture similarity of a point in the initial point cloud; is a smoothing term; K is a number of neighborhood points.
3. The grinding error compensation method based on workpiece surface defect detection of claim 1, wherein: The texture feature is obtained as follows: the initial point cloud is normalized; a neighborhood of each point in the initial point cloud is constructed, and a covariance matrix of the neighborhood is calculated; a feature vector corresponding to a minimum eigenvalue of the covariance matrix corresponding to each point is used as a normal vector of the point; a texture matrix corresponding to each point is constructed through the normal vector included angle cosine values of all point pairs in the neighborhood corresponding to the point; a discrete wavelet transform is performed on the texture matrix to obtain a plurality of wavelet coefficient matrices; the square of each element in the wavelet coefficient matrix is divided by the modulus of the matrix to obtain a local texture energy of the matrix; and the texture feature of each point in the initial point cloud is obtained by fusing a plurality of local texture energies corresponding to the point.
4. The grinding error compensation method based on workpiece surface defect detection of claim 1, wherein: The specific process of the noise reduction processing is as follows: points for constructing a current sample point set are extracted from the initial point cloud based on the sampling weight, and a plane model is fitted according to the current sample point set; a geometric residual corresponding to each point is obtained according to the distance of the point to the plane model; texture inconsistent points are detected through frequency domain difference detection to obtain a wavelet coefficient difference corresponding to each point; a joint residual of each point is obtained by fusing the geometric residual and the wavelet coefficient difference corresponding to each point in the current sample point set; an inner point for constructing a current inner point set is selected from the current sample point set based on the joint residual of each point; if the number of inner points of the current inner point set is greater than the number of inner points of the best inner point set, the current inner point set is used as the best inner point set; the above process is repeated until a termination condition is reached, and the best inner point set is used as the denoised point cloud.
5. The grinding error compensation method based on workpiece surface defect detection of claim 1, wherein: The specific process of obtaining the feature region is as follows: The nearest point of each point in the denoising point cloud is selected in the ideal point cloud, and a set of out-of-tolerance points is screened from the denoising point cloud based on the distance between each point in the denoising point cloud and the corresponding nearest point; a neighborhood of each point in the out-of-tolerance point set is constructed according to the distance between different points in the out-of-tolerance point set; if the number of points in the neighborhood is greater than the minimum number of neighborhood points, the point corresponding to the neighborhood is taken as the core point, and the set of core points is constructed based on the set of core points in the out-of-tolerance point set; a core point adjacency graph is constructed based on the adjacency relationship between different points in the core point set; the core point adjacency graph is divided into multiple connected components, and a clustering point set is constructed for each connected component; If the distance between any point in the core point set and any point in the connected component is less than or equal to the adaptive neighborhood radius, the point in the out-of-tolerance point set is added to the clustering point set; If the number of points in the clustering point set is greater than the minimum point threshold, the clustering point set belongs to a feature region.
6. The grinding error compensation method based on workpiece surface defect detection according to claim 5, characterized in that: The specific process of constructing the neighborhood is as follows: For the points in the excess point set a Select points from the set of points with out-of-tolerance. a Points whose distance is less than or equal to the adaptive neighborhood radius are used to construct points. a The out-of-range neighborhood; the adaptive neighborhood radius ;in, Scale factor; This refers to the point cloud density parameters.
7. The grinding error compensation method based on workpiece surface defect detection of claim 1, wherein: The specific process of matching the feature point cloud and the denoising point cloud is as follows: Initialize the rotation matrix and the translation vector; select the nearest point of each point in the feature point cloud in the denoising point cloud based on the rotation matrix and the translation vector in the current iteration process, and take the set of nearest points in the denoising point cloud as the feature neighborhood; respectively, the feature point cloud and the points in the feature neighborhood are processed, and a covariance matrix is constructed based on the centered feature point cloud and the feature neighborhood; the rotation matrix and the translation vector in the next iteration are obtained by singular value decomposition of the decomposition result of the covariance matrix; repeat the above process until the termination condition is reached, and the rotation matrix and the translation vector in the next iteration are taken as the optimal rotation matrix and the optimal translation vector to adjust the points in the feature point cloud; for each point in the feature point cloud, select the point with the minimum distance from the denoising point cloud, and if the distance is less than the replacement distance threshold, the two points are matched.
8. The grinding error compensation method based on workpiece surface defect detection of claim 1, wherein: The error index includes defect point coordinates, defect type, defect error and confidence score; the principal component feature includes feature value difference, principal direction angle and reconstruction error.
9. The grinding error compensation method based on workpiece surface defect detection of claim 1, wherein: The particle swarm optimization algorithm is used to compensate the grinding error of the workpiece surface based on the error model.
10. A grinding error compensation system based on workpiece surface defect detection, characterized by: A grinding error compensation method based on workpiece surface defect detection is used to execute the grinding error compensation method of claim 1; the grinding error compensation system includes a data acquisition module, a noise reduction module, a feature region extraction module, a point cloud matching module, an error model generation module and an error compensation module; the data acquisition module is used to acquire the point cloud of the measured workpiece; the noise reduction module is used to reduce the noise of the point cloud; the point cloud matching module is used to match the points in different point clouds; the error model generation module is used to generate the error model; The error compensation module is used to compensate the grinding error according to the error model.
Citation Information
Cited By
Laser processing adaptive path planning method and system based on measuring head data analysis
CN121165619A
Vertical and horizontal integrated gantry boring, milling and grinding composite numerical control machine tool and control method
CN121657571A