Tool path smoothing method and system based on maximum curvature optimization

By optimizing the discrete point position of the tool trajectory and constructing the initial cubic B-spline fitting curve, the curvature optimization problem of B-spline curve in the prior art is solved, and more efficient CNC machining is achieved.

CN115857432BActive Publication Date: 2025-06-13SHANGHAI JIAOTONG UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211474786.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-23
Publication Date
2025-06-13
Estimated Expiration
2042-11-23

AI Technical Summary

Technical Problem

The prior art is difficult to effectively optimize the curvature of the B-spline curve in CNC machining, resulting in fluctuations in the speed and acceleration of the processing path, and reducing processing efficiency and quality.

Method used

By calculating the discrete curvature of the discrete points of the tool trajectory, the original trajectory is divided into multiple sub-trajectories, the discrete point positions on the sub-trajectory are optimized, the maximum discrete curvature of the sub-trajectory is reduced, and the initial cubic B-spline fitting curve is constructed, and the control points iteratively increases and updates are added to each other until a B-spline fitting curve meets the tolerance requirements are generated.

Benefits of technology

The maximum curvature value of the B-spline fitting curve is effectively reduced, the computing efficiency is improved, the fitting accuracy of discrete points is ensured, and the processing quality and efficiency of CNC machining is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115857432B_ABST
    Figure CN115857432B_ABST
Patent Text Reader

Abstract

The present invention provides a tool path smoothing method and system based on the optimization of the maximum curvature, including: Step 1: Calculate the discrete curvature of the discrete points constituting the tool path, and divide the original path into multiple sub-paths according to the discrete curvature; Step 2: Optimize the positions of the discrete points on the sub-paths to reduce the maximum value of the discrete curvature of the sub-paths and obtain the optimized new discrete points; Step 3: Perform chord length parameterization on the new discrete points, obtain their corresponding parameters, extract feature points therefrom, determine the node vector, and construct an initial cubic B-spline fitting curve; Step 4: Calculate the fitting error of the new discrete points, iteratively increase and update the control points of the B-spline curve until a B-spline fitting curve meeting the tolerance requirements is generated. The present invention reduces the maximum value of the curvature of the B-spline fitting curve on the premise of ensuring the fitting accuracy of the discrete points.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of tool path fairing, and specifically, to a tool path fairing method and system based on the optimization of the maximum curvature. Background Art

[0002] In numerical control machining, most tool paths consist of a large number of linear path segments. Direct operation will cause fluctuations or even mutations in speed and acceleration at the intersections of linear segments, reducing the machining efficiency and quality. The current mainstream solution is to generate a continuously smooth parametric curve machining path within the tolerance range to replace the original linear path. Among various parametric curves, B-spline curves are the most widely used. Therefore, it is of great significance for improving the machining quality and efficiency of numerical control machining, and choosing a suitable B-spline fairing method is crucial for improving the quality of the B-spline machining path.

[0003] Currently, the B-spline fairing methods for tool paths can be divided into two categories: local fairing and global fairing. The local fairing method mainly inserts B-spline curves that meet the tolerance requirements at the corners of linear segments to fair the sharp corners. This method is easy to execute and has a small amount of calculation. However, the fairing machining path after that is a mixture of linear segments and B-spline curve segments, which brings difficulties to the interpolation of the numerical control system. In addition, the local fairing method has poor fairing effect on sharp corners at the micron scale. The global fairing method uses a B-spline curve to replace multiple linear paths and can be further divided into the interpolation method and the fitting method. Among them, the number of control points of the B-spline curve generated by the interpolation method is the same as the number of trajectory discrete points, and it will accurately pass through each discrete point; the fitting method allows the generation of a B-spline curve with fewer control points and controls the distance from the discrete points to the B-spline curve to meet the tolerance. Both the interpolation method and the fitting method focus on the fitting accuracy of the trajectory discrete points and ignore the geometric information of the B-spline curve between points, such as the curvature distribution, the bow height error between the curve and the linear segment, etc. However, the curvature information of the B-spline curve will directly affect the speed planning and interpolation of the numerical control system for the B-spline tool path and will ultimately be reflected in the machining efficiency and machining quality, and should not be ignored.

[0004] Patent document CN114675601A (application number 202210316526.5) discloses a B-spline fitting method for a linear tool path based on dominant points. First, dominant points that can reflect the geometric characteristics of the trajectory are selected, and a B-spline curve is obtained based on least-squares fitting. Then, the B-spline curve is corrected by adding dominant points to meet the error requirements. Patent document CN114545863A (application number 202210221917.9) discloses a trajectory smoothing method for numerical control machining based on B-spline curve fitting. It selects characteristic points according to the curvature information of the trajectory discrete points, and interpolates the characteristic points with a cubic B-spline curve. The accuracy of the B-spline curve can be improved by adding interpolation points. The above two methods both focus on reducing the fitting error of the trajectory discrete points and do not optimize the curvature of the B-spline curve. Summary of the Invention

[0005] Aiming at the defects in the prior art, the purpose of the present invention is to provide a tool path smoothing method and system based on the optimization of the maximum curvature.

[0006] According to the tool path smoothing method based on the optimization of the maximum curvature provided by the present invention, it includes:

[0007] Step 1: Calculate the discrete curvature of the discrete points constituting the tool path, and divide the original trajectory into multiple sub-trajectories according to the discrete curvature;

[0008] Step 2: Optimize the positions of the discrete points on the sub-trajectory, reduce the maximum value of the discrete curvature of the sub-trajectory, and obtain the optimized new discrete points;

[0009] Step 3: Perform chord length parameterization on the new discrete points, obtain their corresponding parameters, extract characteristic points from them, determine the knot vector, and construct an initial cubic B-spline fitting curve;

[0010] Step 4: Calculate the fitting error of the new discrete points, iteratively increase and update the control points of the B-spline curve until a B-spline fitting curve that meets the tolerance requirements is generated.

[0011] Preferably, the step 1 includes:

[0012] The discrete curvature of the discrete points is obtained by using the method of estimating the second derivative with the second-order difference quotient. Let two adjacent linear segments Q j-1 Q j and Q j Q j+1 on the tool path contain three discrete points Q j-1 、Q j 、Q j+1 , then the discrete curvature of the point Q j is:

[0013]

[0014] Among them, α j represents the included angle between ;

[0015] According to the discrete curvature of all discrete points, find all the maximum and minimum values of the discrete curvature, and sort the maximum and minimum values in the order of their corresponding points respectively. Among the points where the minimum value of the discrete curvature is obtained, select the segmentation points to divide the tool path into multiple sub-paths. The curvature κ j of the selected segmentation points needs to meet the following conditions:

[0016]

[0017] Among them, is the previous maximum curvature value of κ j ; is the next maximum curvature value of κ j , and δ f is a filtering parameter introduced to avoid too dense segmentation points.

[0018] Preferably, the step 2 includes:

[0019] When the maximum curvature value of the discrete points included in the sub-path is greater than the set threshold, optimize the discrete points on the sub-path. For the sub-path divided by two segmentation points Q s and Q e , the optimization problem of its discrete points is described by the following optimization model:

[0020]

[0021] Among them, q s , q e are the change vectors of the segmentation points Q s and Q e , and the optimization variable q j represents the change vector of the discrete point position; d is the upper bound of q j , representing the maximum distance between the optimized discrete point and the original discrete point, which should be less than the curve fitting tolerance; s, j, e are the serial numbers of the corresponding position points; κ j ′ represents the discrete curvature of the optimized discrete point, and is obtained through the following calculation:

[0022]

[0023] Among them, Q′ j is the new optimized discrete point, and α j ′ is the included angle between the vector and

[0024] Preferably, step 3 includes:

[0025] Perform chord length parameterization on the new discrete points and obtain the corresponding parameter t j The method is as follows:

[0026]

[0027] The process of extracting feature points is as follows:

[0028] Calculate the difference between the discrete curvature of each point and the average value of the discrete curvatures of other points in the neighborhood centered on it:

[0029]

[0030] where s is the half-width of the neighborhood;

[0031] The selected feature points satisfy the following conditions:

[0032] σ j > 0, σ j > σ j-1 σ j > σ j+1

[0033] The larger the value of the half-width of the neighborhood, the fewer the number of selected feature points. If there is a width of one neighborhood between two adjacent feature points Q′ a and Q′ b , that is, b - a ≥ 2s, then a new feature point Q′ a and Q′ b is selected between them, where c a, b, c are the neighborhood widths of the corresponding feature points;

[0034] The process of determining the knot vector and constructing the initial cubic B-spline fitting curve is as follows:

[0035] Suppose there are m + 1 selected feature points, 3 ≤ m < n, and regard the selected feature points as the control points of the initial cubic B-spline curve Then the elements of the B-spline curve knot vector are determined as follows:

[0036]

[0037] where the function f(i) returns the number of the selected feature point in the new discrete point sequence ;

[0038] The vector representation of the initial knot is U 0 = [u 0 , u 1 , …, u m+3 ​, u m+4 ];

[0039] Construct the initial cubic B-spline curve as:

[0040]

[0041] where, represents the cubic B-spline basis function defined under the initial knot vector U 0 .

[0042] Preferably, step 4 includes:

[0043] The method for calculating the fitting error of the new discrete points is as follows:

[0044] The cubic B-spline curve after k iterations is denoted as The B-spline fitting error of the discrete points is calculated as follows:

[0045] δ k = Q′ - A k P k

[0046] where, Record the deviation vectors of all discrete points to the B-spline curve; Q′ = (Q′ 0 , Q′ 1 , …, Q′ n ) T Record the matrix of the position information of all optimized discrete points; Save the control points of the cubic B-spline curve after k iterations; The elements in matrix A k are the values of each basis function at the corresponding parameters of the discrete points after k iterations, and are further expressed as:

[0047]

[0048] The method for judging whether the B-spline fitting curve meets the fitting tolerance is:

[0049] If the curve fitting tolerance is ε tol , when the following conditions are met, it is considered that the B-spline curve meets the tolerance requirements:

[0050]

[0051] where, w j is the error amplification factor for the optimized discrete points, and is determined by the following formula:

[0052]

[0053] ​Among them, d is the maximum distance between the optimized discrete points and the original discrete points specified in step 2;

[0054] The process of adding control points is as follows:

[0055] If the B-spline curve after k iterations does not meet the tolerance requirements, the degrees of freedom of each control point of the B-spline curve are measured by calculating the following parameters:

[0056]

[0057] Among them, the matrix (A k ) T is the transpose of the matrix A k ;

[0058] The degree of freedom of the knot interval [u a , u a+1 is evaluated by the following formula:

[0059]

[0060] Select the knot interval with the largest value, take the value in the interval as the parameter of the newly inserted knot, and use the existing B-spline knot insertion algorithm to determine the corresponding newly added control points. The iterative update of each step of the control points is expressed as:

[0061] P k+1 = P k + μ(A k ) T δ k

[0062] Among them, when the coefficient , the iteration has the fastest convergence speed; λ max and λ min are respectively the maximum and minimum values of the eigenvalues of the matrix (A k ) T A k . Thus, the new B-spline fitting curve is

[0063]

[0064] Every ten steps of iteration, it is necessary to correct the parameters of each discrete point, and at the same time update the knot vector and the matrix A to ensure the accuracy of the fitting error calculation. Use the parameter tf j of the foot point of the discrete point on the B-spline curve to replace its original parameter, and tf j is obtained by using Newton's method to solve the following equation:

[0065]

[0066] If there are multiple foot points of the same discrete point on the B-spline curve, change the initial value condition of the Newton method to solve multiple times, and take the parameter of the foot point closest to the discrete point.

[0067] According to the tool path smoothing system based on the optimization of the maximum curvature provided by the present invention, it includes:

[0068] Module M1: Calculate the discrete curvature of the discrete points forming the tool path, and divide the original path into multiple sub-paths according to the discrete curvature;

[0069] Module M2: Optimize the positions of the discrete points on the sub-path, reduce the maximum value of the discrete curvature of the sub-path, and obtain the optimized new discrete points;

[0070] Module M3: Perform chord length parameterization on the new discrete points, obtain their corresponding parameters, extract feature points from them, determine the knot vector, and construct an initial cubic B-spline fitting curve;

[0071] Module M4: Calculate the fitting error of the new discrete points, iteratively increase and update the control points of the B-spline curve until a B-spline fitting curve that meets the tolerance requirements is generated.

[0072] Preferably, the module M1 includes:

[0073] Use the method of estimating the second derivative with the second-order difference quotient to obtain the discrete curvature of the discrete points. Let two adjacent linear segments Q j-1 Q j and Q j Q j+1 contain three discrete points Q j-1 、Q j 、Q j+1 , then the discrete curvature of the point Q j is:

[0074]

[0075] where, α j represents the angle formed by the vectors and ;

[0076] According to the discrete curvature of all discrete points, find all the maximum and minimum values of the discrete curvature, and sort the maximum and minimum values respectively in the order of their corresponding points. Select the splitting points among the points where the minimum value of the discrete curvature is obtained, and divide the tool path into multiple sub-paths. The curvature κ j of the selected splitting points needs to meet the following conditions:

[0077]

[0078] where, is κj the previous curvature maximum value; is κ j the next curvature maximum value of j , and δ f is a filtering parameter introduced to avoid over-dense segmentation points.

[0079] Preferably, the module M2 includes:

[0080] When the maximum curvature value of the discrete points included in the sub-trajectory is greater than the set threshold, optimize the discrete points on the sub-trajectory. For the sub-trajectory divided by two segmentation points Q s and Q e The optimization problem of its discrete points is described by the following optimization model:

[0081]

[0082] where q s , q e are the change vectors of the segmentation points Q s and Q e , and the optimization variable q j represents the change vector of the discrete point position; d is the upper bound of q j , representing the maximum distance between the optimized discrete point and the original discrete point, which should be less than the curve fitting tolerance; s, j, e are the serial numbers of the corresponding position points; κ j ′ represents the discrete curvature of the optimized discrete point, and is obtained by the following calculation:

[0083]

[0084] where Q′ j is the new optimized discrete point, and α j ′ is the angle between the vector and .

[0085] Preferably, the module M3 includes:

[0086] The method for chord length parameterization of the new discrete point to obtain its corresponding parameter t j is as follows:

[0087]

[0088] The process of extracting feature points is as follows:

[0089] Calculate the difference between the discrete curvature of each point and the average value of the discrete curvatures of other points in the neighborhood centered on it:

[0090]

[0091] where s is the half-width of the neighborhood;

[0092] The selected feature points satisfy the following conditions:

[0093] σ j > 0, σ j > σ j-1 σ j > σ j+1

[0094] The larger the value of the half-width of the neighborhood, the fewer the number of selected feature points. If two adjacent feature points Q' a and Q' b are separated by the width of one neighborhood, i.e., b - a ≥ 2s, then a new feature point Q' a and Q' b is selected between them, where c a, b, and c are the neighborhood widths of the corresponding feature points; a, b, c are the neighborhood widths of the corresponding feature points;

[0095] The process of determining the knot vector and constructing the initial cubic B-spline fitting curve is as follows:

[0096] Suppose there are m + 1 selected feature points, 3 ≤ m < n. The selected feature points are regarded as the control points of the initial cubic B-spline curve Then the elements of the B-spline curve knot vector are determined as follows:

[0097]

[0098] where the function f(i) returns the number of the selected feature point in the new discrete point sequence ;

[0099] The vector representation of the initial knot is U 0 = [u 0 , u 1 , …, u m+3 , u m+4 ;

[0100] The initial cubic B-spline curve is constructed as:

[0101]

[0102] where represents the cubic B-spline basis function defined under the initial knot vector U 0 .

[0103] Preferably, the module M4 includes:

[0104] The method for calculating the fitting error of the new discrete points is as follows:

[0105] The cubic B-spline curve after k iterations is recorded as The B-spline fitting error of discrete points is calculated as follows:

[0106] δ k =Q′-A k P k

[0107] in, Record the deviation vectors from all discrete points to the B-spline curve; Q′=(Q′ 0 ,Q′ 1 ,…,Q′ n ) T A matrix that records the position information of all optimized discrete points; Save the control points of the cubic B-spline curve after k iterations; matrix A k The elements in are the parameters corresponding to each basis function at discrete points after k iterations. The value at is further expressed as:

[0108]

[0109] The method for judging whether the B-spline fitting curve meets the fitting tolerance is:

[0110] If the curve fitting tolerance is ε tol , when the following conditions are met, the B-spline curve is considered to meet the tolerance requirements:

[0111]

[0112] Among them, w j The error amplification factor for the optimized discrete points is determined by the following formula:

[0113]

[0114] Where d is the maximum distance between the optimized discrete points and the original discrete points specified in module M2;

[0115] The process of adding a control point is as follows:

[0116] If the B-spline curve after k iterations does not meet the tolerance requirements, the following parameters are calculated to measure the degree of freedom of each control point of the B-spline curve:

[0117]

[0118] Among them, the matrix (A k ) T is the matrix A k The transpose of

[0119] Node interval [u a ,ua+1 ) The degree of freedom is evaluated by the following formula:

[0120]

[0121] Select the node interval with the largest value, take the value in the interval as the parameter of the newly inserted node, and use the existing B-spline node insertion algorithm to determine the corresponding newly added control points. The iterative update of each step of the control points is expressed as:

[0122] P k+1 = P k + μ(A k ) T δ k

[0123] where, when the coefficient , the iteration has the fastest convergence speed; λ max and λ min are respectively the maximum and minimum values of the eigenvalues of the matrix (A k ) T A k . Thus, the new B-spline fitting curve is

[0124]

[0125] Every ten steps of iteration, it is necessary to correct the parameters of each discrete point, and at the same time update the node vector and matrix A to ensure the accuracy of the fitting error calculation. Use the parameter tf j of the foot point of the discrete point on the B-spline curve j to replace its original parameter. tf

[0126]

[0127] is obtained by using Newton's method to solve the following equation:

[0128] If there are multiple foot points of the same discrete point on the B-spline curve, change the initial value condition of Newton's method to solve it multiple times, and take the parameter of the foot point closest to the discrete point.

[0129] Compared with the prior art, the present invention has the following beneficial effects: Brief Description of the Drawings

[0130] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments read in conjunction with the accompanying drawings:

[0131] Figure 1 It is a flowchart of a B-spline tool path smoothing method optimized based on the maximum curvature;

[0132] Figure 2 It is a butterfly-shaped tool path diagram adopted in the embodiment;

[0133] Figure 3 It is a schematic diagram of the split point selection method described in step 1;

[0134] Figure 4 It is a schematic diagram of the discrete points to be optimized on the butterfly-shaped tool path;

[0135] Figure 5 It is a schematic diagram of the B-spline fitting curve of the finally generated butterfly-shaped tool path;

[0136] Figure 6 It is a schematic diagram of the fitting error of the B-spline fitting curve to the original discrete points;

[0137] Figure 7 It is a local curvature comparison diagram of the B-spline fitting curves obtained by different methods. Specific Embodiments

[0138] The present invention will be described in detail below with reference to specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but do not limit the present invention in any form. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several changes and improvements can still be made. These all belong to the protection scope of the present invention.

[0139] Embodiment 1:

[0140] The present invention provides a B-spline tool path smoothing method optimized based on the maximum curvature, and its flowchart is as shown in Figure 1 shown. In this embodiment, the butterfly-shaped trajectory shown in Figure 2 is selected to describe the content of the present invention in detail, which mainly includes four steps:

[0141] Step S1: Calculate the discrete curvature of the discrete points constituting the tool path, and divide the original trajectory into multiple sub-trajectories according to the discrete curvature information:

[0142] Suppose the discrete point sequence constituting the butterfly-shaped tool path is Then the discrete curvature of point Q j can be calculated as follows:

[0143]

[0144] Among them, α j represents a vector and the included angle formed. The discrete curvature at the start and end points of the trajectory is 0.

[0145] Based on the discrete curvature of all discrete points, all local maxima and minima of the discrete curvature can be found, and the local maxima and minima are sorted according to the order of their corresponding points respectively. As Figure 3 shown, a segmentation point is selected among the discrete points where the discrete curvature minimum value is obtained, and the tool path is divided into multiple sub-paths. The curvature κ j of the selected segmentation point needs to satisfy the following conditions:

[0146]

[0147] Among them, is the previous local maximum value of κ j ; is the next local maximum value of κ j , and δ f is a filtering parameter introduced to avoid overly dense segmentation points. In particular, the start and end points of the tool path will definitely be selected as segmentation points.

[0148] Step S2: Optimize the positions of the discrete points on the sub-path, reduce the local maximum value of the discrete curvature of the sub-path, and obtain the optimized new discrete points; when the maximum value of the curvature of the discrete points included in the sub-path is greater than the set threshold, optimize the discrete points on the sub-path. The discrete points that need to be position-optimized on the butterfly-shaped tool path are as Figure 4 shown.

[0149] For the sub-path divided by two segmentation points Q s and Q e , the optimization problem of its discrete points can be described by the following optimization model:

[0150]

[0151] Among them, the optimization variable q j represents the change vector of the discrete point position; d is the upper bound of q j , representing the maximum distance between the optimized discrete point and the original discrete point, which should be less than the curve fitting tolerance; κ j ′ represents the discrete curvature of the optimized discrete point and can be obtained through the following calculation:

[0152]

[0153] Among them, Q′ j is the optimized new discrete point, and α j ′ is then the vector The included angle with between them.

[0154] After steps S1 and S2, a new discrete point sequence can be obtained

[0155] Step S3: Perform chord length parameterization on the new discrete points, obtain their corresponding parameters, extract feature points therefrom, determine the knot vector, and construct an initial cubic B-spline fitting curve;

[0156] Perform chord length parameterization on the new discrete points, and the parameters corresponding to each point are determined as follows:

[0157]

[0158] Select feature points from the new discrete points that can reflect the geometric information of the tool path. First, calculate the difference between the discrete curvature of each point and the average of the discrete curvatures of other points within the neighborhood centered on it:

[0159]

[0160] where s is the half-width of the neighborhood. The selected feature points satisfy the following conditions:

[0161] σ j > 0, σ j > σ j-1 σ j > σ j+1

[0162] If the distance between two adjacent feature points Q′ a and Q′ b is one neighborhood width apart, i.e., b - a ≥ 2s, then select a new feature point Q′ a between Q′ b and Q′ c , where

[0163] Treat the selected feature points as the control points of the initial cubic B-spline curve Then the elements of the B-spline curve knot vector can be determined as follows:

[0164]

[0165] where the function f(i) returns the number of the selected feature point in the new discrete point sequence . The initial knot vector can be expressed as U 0 = [u 0 , u 1 , …, u m+3 , u m+4 .

[0166] Therefore, the initial cubic B-spline curve can be constructed as follows:

[0167]

[0168] where, represents the cubic B-spline basis function defined under the initial knot vector U 0 .

[0169] Step S4: Calculate the fitting error of the new discrete points, and iteratively increase and update the control points of the B-spline curve until a B-spline fitting curve that meets the tolerance requirements is generated:

[0170] The cubic B-spline curve after k iterations is denoted as The B-spline fitting error of the discrete points is calculated as follows:

[0171] δ k = Q′ - A k P k

[0172] where, records the deviation vectors of all discrete points to the B-spline curve; Q′ = (Q′ 0 , Q′ 1 , …, Q′ n ) T is a matrix that records the position information of all optimized discrete points; saves the control points of the cubic B-spline curve after k iterations; the elements in matrix A k are the values of the respective basis functions at the corresponding parameters of the discrete points after k iterations , and can be further expressed as:

[0173]

[0174] If the curve fitting tolerance is ε tol , when the following conditions are met, the B-spline curve is considered to meet the tolerance requirements:

[0175]

[0176] where, w j is the error amplification factor for the optimized discrete points, and can be determined by the following formula:

[0177]

[0178] where, d is the maximum distance between the optimized discrete points and the original discrete points specified in Step S2.

[0179] If the B-spline curve after k iterations does not meet the tolerance requirements, the degrees of freedom of each control point of the B-spline curve are measured by calculating the following parameters:

[0180]

[0181] where the matrix (A k ) T is the transpose of matrix A k . The degree of freedom of the knot interval [u a , u a+1 can be evaluated by the following formula:

[0182]

[0183] Select the knot interval with the largest value, take the mid-value of the interval as the parameter of the newly inserted knot, and use the existing B-spline knot insertion algorithm to determine the corresponding newly added control points.

[0184] Specifically, every ten steps of iteration, the parameters of each discrete point need to be corrected to ensure the accuracy of the fitting error calculation. Use the parameter tf j of the foot point of the discrete point on the B-spline curve to replace its original parameter. tf j can be obtained by using Newton's method to solve the following equation:

[0185]

[0186] If there are multiple foot points of the same discrete point on the B-spline curve, change the initial value condition of Newton's method to solve it multiple times, and take the parameter of the foot point closest to the discrete point.

[0187] After obtaining the parameters of the newly inserted knots, the newly added control points, and the new parameters corresponding to each discrete point, it is necessary to update the knot vector and matrix A, and determine the positions of the control points of the new B-spline curve. The update of each step of the control point can be expressed as:

[0188] P k+1 = P k + μ(A k ) T δ k

[0189] where, when , the iteration has the fastest convergence speed; λ max and λ min are respectively the maximum and minimum values of the eigenvalues of the matrix (A k ) T A k . Thus, the new B-spline fitting curve can be obtained as

[0190] The final B-spline fitting curve of the butterfly tool path is as Figure 5 shown. The fitting error of the original discrete points on the path is as Figure 6 shown, and the fitting error of all discrete points is less than the set fitting tolerance value.

[0191] Specifically, the butterfly tool path is respectively fitted by using the method of the present invention and the B-spline smoothing method without maximum curvature optimization (without steps S1 and S2). The local comparison of the curvatures of the B-spline curves obtained by the two methods is as Figure 7 shown, and the maximum value of the curvature of the B-spline curve obtained by the method of the present invention is significantly reduced.

[0192] Example 2:

[0193] The present invention also provides a tool path smoothing system based on maximum curvature optimization. The tool path smoothing system based on maximum curvature optimization can be implemented by executing the process steps of the tool path smoothing method based on maximum curvature optimization. That is, those skilled in the art can understand the tool path smoothing method based on maximum curvature optimization as the preferred implementation manner of the tool path smoothing system based on maximum curvature optimization.

[0194] According to the tool path smoothing system based on maximum curvature optimization provided by the present invention, it includes: Module M1: calculating the discrete curvature of the discrete points forming the tool path, and dividing the original path into multiple sub-paths according to the discrete curvature; Module M2: optimizing the positions of the discrete points on the sub-paths, reducing the maximum value of the discrete curvature of the sub-paths, and obtaining the optimized new discrete points; Module M3: performing chord length parameterization on the new discrete points, obtaining their corresponding parameters, extracting feature points therefrom, determining the knot vector, and constructing an initial cubic B-spline fitting curve; Module M4: calculating the fitting error of the new discrete points, iteratively increasing and updating the control points of the B-spline curve until a B-spline fitting curve that meets the tolerance requirements is generated.

[0195] The Module M1 includes: obtaining the discrete curvature of the discrete points by using the method of estimating the second derivative with the second-order difference quotient. Suppose there are two adjacent linear segments Q j-1 Q j and Q j Q j+1 on the tool path, which contain three discrete points Q j-1 、Q j 、Q j+1 , then the discrete curvature of the point Q j is:

[0196]

[0197] where α j represents the vector and The included angle formed;

[0198] According to the discrete curvature of all discrete points, find all discrete curvature maxima and minima, and sort the maxima and minima respectively in the order of their corresponding points. Select a segmentation point among the points where the discrete curvature minimum is obtained, and divide the tool path into multiple sub-paths. The curvature κ of the selected segmentation point j Needs to meet the following conditions:

[0199]

[0200] Among them, is the previous curvature maximum value of κ j ; is the next curvature maximum value of κ j , and δ f is a filtering parameter introduced to avoid overly dense segmentation points.

[0201] The module M2 includes: when the maximum curvature value of the discrete points included in the sub-path is greater than the set threshold, optimize the discrete points on the sub-path. For the sub-path divided by two segmentation points Q s and Q e , the optimization problem of its discrete points is described by the following optimization model:

[0202]

[0203] Among them, q s , q e are the change vectors of the segmentation points Q s and Q e , and the optimization variable q j represents the change vector of the discrete point position; d is the upper bound of q j , representing the maximum distance between the optimized discrete point and the original discrete point, which should be less than the curve fitting tolerance; s, j, e are the serial numbers of the corresponding position points; κ j ′ represents the discrete curvature of the optimized discrete point and is obtained through the following calculation:

[0204]

[0205] Among them, Q′ j is the new optimized discrete point, and α j ′ is the angle between the vector and .

[0206] The module M3 includes: the method for chord length parameterization of the new discrete points and obtaining the corresponding parameter t j is as follows:

[0207]

[0208] The process of extracting feature points is as follows:

[0209] Calculate the difference between the discrete curvature of each point and the average of the discrete curvatures of other points in the neighborhood centered on it:

[0210]

[0211] where s is the half-width of the neighborhood;

[0212] The selected feature points satisfy the following conditions:

[0213] σ j > 0, σ j > σ j-1 , σ j > σ j+1

[0214] The larger the value of the half-width of the neighborhood, the fewer the number of selected feature points. If the distance between two adjacent feature points Q′ a and Q′ b is equal to the width of one neighborhood, i.e., b - a ≥ 2s, then a new feature point Q′ a is selected between Q′ b and Q′ c , where a, b, and c are the neighborhood widths of the corresponding feature points;

[0215] The process of determining the knot vector and constructing the initial cubic B-spline fitting curve is as follows:

[0216] Assume that there are m + 1 selected feature points, 3 ≤ m < n, and regard the selected feature points as the control points of the initial cubic B-spline curve Then the elements of the B-spline curve knot vector are determined as follows:

[0217]

[0218] where the function f(i) returns the number of the selected feature point in the new discrete point sequence ;

[0219] The vector representation of the initial knot is U 0 = [u 0 , u 1 , …, u m+3 , u m+4 ;

[0220] The initial cubic B-spline curve is constructed as:

[0221]

[0222] Among them, represents the cubic B-spline basis function defined under the initial nodal vector U 0 .

[0223] The module M4 includes: The method for calculating the fitting error of the new discrete points is as follows:

[0224] The cubic B-spline curve after k iterations is denoted as The B-spline fitting error of the discrete points is calculated as follows:

[0225] δ k = Q′ - A k P k

[0226] Among them, records the deviation vectors of all discrete points to the B-spline curve; Q′ = (Q′ 0 , Q′ 1 , …, Q′ n ) T is the matrix recording the position information of all optimized discrete points; saves the control points of the cubic B-spline curve after k iterations; the elements in the matrix A k are the values of each basis function at the corresponding parameters of the discrete points after k iterations, and are further expressed as: The method for judging whether the B-spline fitting curve meets the fitting tolerance is as follows:

[0227]

[0228] If the curve fitting tolerance is ε

[0229] , when the following conditions are met, it is considered that the B-spline curve meets the tolerance requirements: tol

[0230]

[0231] Among them, w j is the error amplification factor for the optimized discrete points, and is determined by the following formula:

[0232]

[0233] Among them, d is the maximum distance between the optimized discrete points and the original discrete points specified in module M2;

[0234] The process of adding new control points is as follows:

[0235] If the B-spline curve after k iterations does not meet the tolerance requirements, the degrees of freedom of each control point of the B-spline curve are measured by calculating the following parameters: ​

[0236]

[0237] Among them, the matrix (A k ) T is the transpose of matrix A k .

[0238] The degrees of freedom of the node interval [u a , u a+1 are evaluated by the following formula:

[0239]

[0240] Select the node interval with the largest value, take the value in the interval as the parameter of the newly inserted node, and use the existing B-spline node insertion algorithm to determine the corresponding newly added control points. Each step of iterative update of the control points is expressed as:

[0241] P k+1 = P k + μ(A k ) T δ k

[0242] Among them, when the coefficient , the iteration has the fastest convergence speed; λ max and λ min are respectively the maximum and minimum values of the eigenvalues of the matrix (A k ) T A k . Thus, the new B-spline fitting curve is

[0243]

[0244] Every ten steps of iteration, it is necessary to correct the parameters of each discrete point, and at the same time update the node vector and matrix A to ensure the accuracy of the fitting error calculation. Use the parameter tf j of the foot point of the discrete point on the B-spline curve to replace its original parameter, and tf j is obtained by using Newton's method to solve the following equation:

[0245]

[0246] If there are multiple foot points of the same discrete point on the B-spline curve, change the initial value condition of Newton's method to solve multiple times, and take the parameter of the foot point closest to the discrete point.

[0247] Those skilled in the art know that in addition to implementing the systems, devices, and their respective modules provided by the present invention in the form of pure computer-readable program code, it is entirely possible to logically program the method steps to enable the systems, devices, and their respective modules provided by the present invention to be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. to achieve the same program. Therefore, the systems, devices, and their respective modules provided by the present invention can be considered as a kind of hardware component, and the modules included therein for implementing various programs can also be regarded as the structures within the hardware component; the modules for implementing various functions can also be regarded as either software programs for implementing the method or the structures within the hardware component.

[0248] The specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. Without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A tool path smoothing method based on the optimization of the maximum curvature, characterized in that, it includes: Step 1: Calculate the discrete curvature of the discrete points that make up the tool path, and divide the original path into multiple sub-paths according to the discrete curvature; Step 2: Optimize the positions of the discrete points on the sub-paths to reduce the maximum value of the discrete curvature of the sub-paths, and obtain the optimized new discrete points; Step 3: Perform chord length parameterization on the new discrete points, obtain their corresponding parameters, extract feature points therefrom, determine the knot vector, and construct an initial cubic B-spline fitting curve; Step 4: Calculate the fitting error of the new discrete points, iteratively increase and update the control points of the B-spline curve until a B-spline fitting curve that meets the tolerance requirements is generated.

2. The tool path smoothing method based on the optimization of the maximum curvature according to claim 1, characterized in that, the said Step 1 includes: The discrete curvature of discrete points is obtained by using the method of estimating the second-order derivative with the second-order difference quotient. Let two adjacent linear segments Q j-1 Q j and Q j Q j+1 contain three discrete points Q j-1 、Q j 、Q j+1 . Then the discrete curvature of point Q j is: Among them, α j represents the included angle between vectors and Find all the discrete curvature maxima and minima based on the discrete curvatures of all discrete points, sort the maxima and minima respectively in the order of their corresponding points, select splitting points from the points where the discrete curvature minima are obtained, divide the tool path into multiple sub-paths, and the curvature κ of the selected splitting points j shall satisfy the following conditions: Among them, is the previous curvature maximum value of κ j ; is the next curvature maximum value of κ j , and δ f is a filtering parameter introduced to avoid overly dense segmentation points.

3. The tool path smoothing method based on the optimization of the maximum curvature according to claim 1, characterized in that, the said Step 2 includes: When the maximum curvature of the discrete points included in the sub-trajectory is greater than the set threshold, optimize the discrete points on the sub-trajectory. For the sub-trajectory divided by two segmentation points Q s and Q e The optimization problem of its discrete points is described by the following optimization model: s.t.||q s ||=0, ||q e ||=0, ||q j ||≤d, s < j < e where q s and q e are the change vectors of the segmentation points Q s and Q e . The optimized variable q j represents the change vector of the discrete point position; d is the upper bound of q j , representing the maximum distance between the optimized discrete point and the original discrete point, which should be less than the curve fitting tolerance; s, j, e are the sequence numbers of the corresponding position points; κ j ' represents the discrete curvature of the optimized discrete point and is obtained by the following calculation: Among them, Q' j is the new optimized discrete point, and α j ' is the angle between the vector and .

4. The tool path smoothing method based on the optimization of the maximum curvature according to claim 1, characterized in that, the said Step 3 includes: Perform chord length parameterization on the new discrete points to obtain the corresponding parameter t j The method is as follows: The process of extracting feature points is as follows: Calculate the difference between the discrete curvature of each point and the average value of the discrete curvatures of other points in the neighborhood centered on it: where s is the half-width of the neighborhood; The selected feature points meet the following conditions: σ j > 0, σ j > σ j-1 , σ j > σ j+1 The larger the value of the half-width of the neighborhood, the fewer the number of feature points selected. If two adjacent feature points Q′ a and Q′ b are separated by the width of one neighborhood, that is, b - a ≥ 2s, then a new feature point Q′ a and Q′ b is selected between them, and Q′ c , where a, b, and c are the neighborhood widths corresponding to the feature points; The process of determining the knot vector and constructing the initial cubic B-spline fitting curve is as follows: Suppose there are a total of m + 1 feature points selected, where 3 ≤ m < n, and the selected feature points are used as the control points of the initial cubic B-spline curve Then the elements of the B-spline curve knot vector are determined as follows: Among them, the function f(i) returns the selected feature points in the new discrete point sequence and its number The vector representation of the initial node is U 0 =[u 0 ,u 1 ,…,u m+3 ,u m+4 ; Construct the initial cubic B-spline curve as: Among them, represents the cubic B-spline basis function defined under the initial nodal vector U 0 .

5. The tool path smoothing method based on the optimization of the maximum curvature according to claim 1, characterized in that, the said Step 4 includes: The method of calculating the fitting error of the new discrete points is as follows: The cubic B-spline curve after k iterations is denoted as The B-spline fitting error of discrete points is calculated as follows: δ k = Q' - A k P k Among them, Record the deviation vectors of all discrete points from the B-spline curve; Q′ = (Q′ 0 , Q 1 ′, …, Q′ n ) T A matrix recording the position information of all optimized discrete points; Save the control points of the cubic B-spline curve after k iterations; The elements in matrix A k are the values of each basis function at the corresponding parameters of the discrete points after k iterations, and are further expressed as: At this point, The method of judging whether the B-spline fitting curve meets the fitting tolerance is: If the curve fitting tolerance is ε tol , when the following conditions are met, the B-spline curve is considered to meet the tolerance requirements: where w j is the error amplification factor for the optimized discrete points and is determined by the following formula: where d is the maximum distance between the optimized discrete points and the original discrete points specified in Step 2; The process of adding new control points is as follows: If the B-spline curve after k iterations does not meet the tolerance requirements, then calculate the following parameters to measure the degrees of freedom of each control point of the B-spline curve: Among them, matrix (A k ) T is the transpose of matrix A k . The degrees of freedom of the node interval [u a , u a+1 ) are evaluated by the following formula: Select the node interval with the largest value, use the value in the interval as the parameter of the newly inserted node, and utilize the existing B-spline node insertion algorithm to determine the corresponding newly added control points. Each step of iterative update of the control points is expressed as: P k+1 = P k + μ(A k ) T δ k Among them, when the coefficient , the iteration has the fastest convergence rate; λ max and λ min are respectively the maximum and minimum values of the eigenvalues of the matrix (A k ), T A k and the new B-spline fitting curve obtained therefrom is Every ten-step iteration requires parameter correction for each discrete point and simultaneously updates the node vector and matrix A to ensure the accuracy of the fitting error calculation. The parameter tf of the foot point of the discrete point on the B-spline curve is used j to replace its original parameter, tf j which is obtained by solving the following equation using Newton's method: If there are multiple foot points of the same discrete point on the B-spline curve, then change the initial value conditions of the Newton method to perform multiple solutions, and take the parameter of the foot point closest to the discrete point.

6. A tool path smoothing system based on the optimization of the maximum curvature, characterized in that, it includes: Module M1: Calculate the discrete curvature of the discrete points that make up the tool path, and divide the original path into multiple sub-paths according to the discrete curvature; Module M2: Optimize the positions of the discrete points on the sub-paths to reduce the maximum value of the discrete curvature of the sub-paths, and obtain the optimized new discrete points; Module M3: Perform chord length parameterization on the new discrete points, obtain their corresponding parameters, extract feature points therefrom, determine the knot vector, and construct an initial cubic B-spline fitting curve; Module M4: Calculate the fitting error of the new discrete points, iteratively increase and update the control points of the B-spline curve until a B-spline fitting curve that meets the tolerance requirements is generated.

7. The tool path smoothing system based on the optimization of the maximum curvature according to claim 6, characterized in that, the said Module M1 includes: The discrete curvature of discrete points is obtained by using the method of estimating the second-order derivative with the second-order difference quotient. Let two adjacent linear segments Q j-1 Q j and Q j Q j+1 on the tool path contain three discrete points Q j-1 、Q j 、Q j+1 . Then the discrete curvature of point Q j is: Among them, α j represents the included angle formed by vectors and Find all the discrete curvature maxima and minima based on the discrete curvatures of all discrete points, sort the maxima and minima respectively according to the order of their corresponding points, select a splitting point among the points where the discrete curvature minima are obtained, divide the tool path into multiple sub-paths, and the curvature κ of the selected splitting point j shall satisfy the following conditions: Among them, is the previous maximum curvature value of κ j ; is the next maximum curvature value of κ j , and δ f is a filtering parameter introduced to avoid overly dense segmentation points.

8. The tool path smoothing system based on the optimization of the maximum curvature according to claim 6, It is characterized in that the module M2 includes: When the maximum curvature of the discrete points included in the sub-trajectory is greater than the set threshold, optimize the discrete points on the sub-trajectory. For the sub-trajectory divided by two segmentation points Q s and Q e , the optimization problem of its discrete points is described by the following optimization model: s.t.||q s ||=0, ||q e ||=0, ||q j ||≤d, s < j < e where q s and q e are the change vectors of the segmentation points Q s and Q e . The optimization variable q j represents the change vector of the discrete point position; d is the upper bound of q j , representing the maximum distance between the optimized discrete point and the original discrete point, which should be less than the curve fitting tolerance; s, j, e are the sequence numbers of the corresponding position points; κ j ' represents the discrete curvature of the optimized discrete point and is obtained by the following calculation: Among them, Q′ j is the new optimized discrete point, and α j ′ is the angle between and 9. The tool path fairing system based on the optimization of the maximum curvature according to claim 6 It is characterized in that the module M3 includes: Perform chord length parameterization on the new discrete points to obtain the corresponding parameter t j The method is as follows: The process of extracting feature points is as follows: Calculate the difference between the discrete curvature of each point and the average of the discrete curvatures of other points in the neighborhood centered on it: where s is the half-width of the neighborhood; The selected feature points satisfy the following conditions: σ j > 0, σ j > σ j-1 , σ j > σ j+1 The larger the value of the half-width of the neighborhood, the fewer the number of feature points selected. If two adjacent feature points Q′ a and Q′ b are separated by the width of one neighborhood, that is, b - a ≥ 2s, then a new feature point Q′ a and Q′ b is selected between them, and the new feature point is Q′ c , where a, b, and c are the neighborhood widths corresponding to the feature points; The process of determining the knot vector and constructing the initial cubic B-spline fitting curve is as follows: Suppose there are a total of m + 1 feature points selected, where 3 ≤ m < n, and the selected feature points are regarded as the control points of the initial cubic B-spline curve. Then the elements of the B-spline curve knot vector are determined as follows: Among them, the function f(i) returns the selected feature points in the new discrete point sequence and its number; The vector representation of the initial node is U 0 = [u 0 , u 1 , …, u m+3 , u m+4 ; Construct the initial cubic B-spline curve as: Among them, represents the cubic B-spline basis function defined under the initial nodal vector U 0 .

10. The tool path fairing system based on the optimization of the maximum curvature according to claim 6 It is characterized in that the module M4 includes: The method for calculating the fitting error of the new discrete points is as follows: The cubic B-spline curve after k iterations is denoted as The B-spline fitting error of the discrete points is calculated as follows: δ k = Q' - A k P k Among them, Record the deviation vectors of all discrete points to the B-spline curve; Q′ = (Q′ 0 , Q 1 ′, …, Q′ n ) T A matrix that records the position information of all optimized discrete points; Save the control points of the cubic B-spline curve after k iterations; The elements in matrix A k are the values of each basis function at the corresponding parameters of the discrete points after k iterations, and are further expressed as: At this point, it is further expressed as: The method for judging whether the B-spline fitting curve meets the fitting tolerance is: If the curve fitting tolerance is ε tol , the B-spline curve is considered to meet the tolerance requirements when the following conditions are satisfied: where w j is the error amplification factor for the optimized discrete points and is determined by the following formula: where d is the maximum distance between the optimized discrete points and the original discrete points specified in module M2; The process of adding new control points is as follows: If the B-spline curve after k iterations does not meet the tolerance requirements, the degrees of freedom of each control point of the B-spline curve are measured by calculating the following parameters: Among them, the matrix (A k ) T is the transpose of matrix A k . The degrees of freedom of the node interval [u a , u a+1 ) are evaluated by the following formula: Select the node interval with the largest value, use the value in the interval as the parameter of the newly inserted node, and utilize the existing B-spline node insertion algorithm to determine the corresponding newly added control points. Each step of iterative update of the control points is expressed as: P k+1 = P k + μ(A k ) T δ k Among them, when the coefficient , the iteration has the fastest convergence rate; λ max and λ min are respectively the maximum and minimum values of the eigenvalues of the matrix (A k ) T A k . Thus, the new B-spline fitting curve is Every ten-step iteration, parameter correction needs to be performed on each discrete point, and at the same time, the knot vector and matrix A are updated to ensure the accuracy of the fitting error calculation. The parameter tf of the foot of the perpendicular from the discrete point to the B-spline curve is used. j Replace its original parameter, tf j It is obtained by using Newton's method to solve the following equation: If there are multiple foot points of the same discrete point on the B-spline curve, the initial value condition of the Newton method is changed to perform multiple solutions, and the parameter of the foot point closest to the discrete point is taken.

Citation Information

Patent Citations

  • Numerical control machining track smoothing method based on B spline curve fitting

    CN114545863A

  • Advantage point-based B-spline fitting method for linear tool path

    CN114675601A

  • Global curvature continuous smoothing method aiming at micro-line segment processing

    CN109976262A

  • Five-axis micro-line segment processing path smoothing method

    CN110716493A