Machining track curve fitting method and device, medium, computing equipment and product

By densifying, filtering, smoothing, and segmenting the CNC machining trajectory, and combining it with non-uniform rational spline fitting, the problems of local oscillation and unevenness caused by small line segment trajectories are solved, thereby improving machining accuracy and surface quality.

CN120972760APending Publication Date: 2025-11-18GREE ELECTRIC APPLIANCE INC OF ZHUHAI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511209717.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-27
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

In existing CNC machining, the uneven distribution of discrete points in the trajectory of small line segments causes local oscillations or uneven connections in the fitted curve, resulting in deterioration of the machining surface quality.

Method used

The discrete tool position sequence of the machining trajectory is densified, filtered and smoothed, and segmented to generate intermediate tool positions. The fitting curve is obtained by fitting non-uniform rational splines.

Benefits of technology

It improves the smoothness and continuity of the machining trajectory, and enhances the machining accuracy and surface quality of complex contours.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120972760A_ABST
    Figure CN120972760A_ABST
Patent Text Reader

Abstract

The invention provides a machining track curve fitting method and device, a medium, computing equipment and a product. The method comprises the steps that intensive processing is conducted on a discrete cutter location point sequence of a machining track; performing filtering smoothing processing on the tool location point sequence after the densification processing; track segmentation is carried out on the cutter location point sequence after filtering and smoothing processing, and more than one to-be-fitted area is obtained; and performing non-uniform rational spline fitting on the more than one to-be-fitted area obtained after track segmentation to obtain a fitted curve. According to the scheme provided by the invention, the deviation between the calculated cutter location point and the theoretical contour can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of control, and more particularly to a method, apparatus, medium, computing device, and product for fitting machining trajectory curves. Specifically, it relates to a method, apparatus, storage medium, computing device, and computer program product for fitting CNC machining trajectory curves. Background Technology

[0002] Most CNC machining toolpaths are free curves with complex shapes. Related technologies use CAM software to process numerous tiny line segment trajectory points, then call straight-line and circular-arc commands for machining. Since each straight line segment has an included angle, to ensure accurate arrival at the endpoint, the current method maintains zero speed at each connection point. This causes frequent motor starts and stops, potentially reducing machining accuracy and efficiency. NURBS (non-uniform rational B-spline) curves can accurately represent free curves or surfaces, greatly improving part machining quality and efficiency. To pursue high precision and efficiency, a new type of NURBS curve interpolation is introduced for machining workpieces with complex contour curves. This allows the tool to move directly along the complex path of the geometry itself. This not only reduces the amount of discrete data and shortens code length but also effectively improves the smoothness of speed and acceleration, thereby improving the surface finish of the workpiece.

[0003] However, in CNC machining, the NURBS fitting curve may experience local oscillations or uneven transitions due to tool position defects or uneven distribution of discrete points, resulting in deterioration of the machined surface quality. Summary of the Invention

[0004] The main objective of this invention is to overcome the deficiencies of the aforementioned related technologies and provide a method, apparatus, medium, computing device, and product for fitting processing trajectory curves, so as to solve the problem of local oscillations or uneven connection of fitting curves caused by uneven distribution of discrete points in the processing trajectory of small line segments in the related technologies.

[0005] The present invention provides a method for fitting a CNC machining trajectory curve, comprising: densifying a discrete tool position sequence of the machining trajectory; filtering and smoothing the tool position sequence after densification; segmenting the tool position sequence after filtering and smoothing to obtain one or more regions to be fitted; and performing non-uniform rational spline fitting on the one or more regions to be fitted obtained after trajectory segmentation to obtain a fitted curve.

[0006] Optionally, the discrete tool position sequence of the machining trajectory is densified, including: determining the line segment length between every two adjacent tool positions in the tool position sequence; if the line segment length between two adjacent tool positions is greater than a preset length threshold, then an intermediate tool position is generated between these two adjacent tool positions.

[0007] Optionally, if the length of the line segment between two adjacent cutting point sites is greater than a preset length threshold, an intermediate cutting point site is generated between the two adjacent cutting point sites, including: calculating the number of intermediate cutting point sites generated between the two adjacent cutting point sites by rounding up based on the length of the line segment between the two adjacent cutting point sites; and calculating the position of the intermediate cutting point site generated between the two adjacent cutting point sites based on the calculated number of intermediate cutting point sites generated between the two adjacent cutting point sites and the position of the two adjacent cutting point sites.

[0008] Optionally, the densified tool point sequence is filtered and smoothed, including: traversing the tool point sequence, calculating the line segment length Li between every two adjacent tool points and the included angle θ between two adjacent line segments formed by every three adjacent tool points. i Determine the included angle θ between two adjacent line segments formed by every three adjacent cutter points. i Is it less than the preset included angle threshold θ? min And whether the length Li of each of the two adjacent line segments is greater than a preset threshold; if so, determine the included angle θ i Less than the preset included angle threshold θ min Furthermore, the length Li of each of the two adjacent line segments is greater than the preset threshold L. min If the cutter position is correct, the cutter position between the two adjacent line segments is retained; otherwise, the cutter position between the two adjacent line segments is filtered and corrected.

[0009] Optionally, the filtered and smoothed tool position sequence is segmented to obtain one or more regions to be fitted, including: determining the line segment length L between every two adjacent tool positions in the filtered and smoothed tool position sequence. i If the length of the line segment between two adjacent cutter points is greater than the preset segment length threshold Rmax, then the latter cutter point among the two adjacent cutter points is determined as the segmentation point; and / or, the included angle θ between two adjacent line segments formed by every three adjacent cutter points in the cutter point sequence after filtering and smoothing is determined. i If the included angle θ between two adjacent line segments formed by three adjacent cutter points i Less than the preset included angle threshold θ minIf the tool position is determined to be the middle tool position among the three adjacent tool positions, then the segmentation point is determined; and / or, each tool position in the region to be fitted obtained by traversing the trajectory segmentation is calculated, and the curvature of the current discrete point is calculated based on the current tool position Pi and the first and last tool positions Ps and Pe of the region to be fitted; based on the curvature of the current discrete point and the curvature of the previous discrete point, it is determined whether the curvature direction is reversed; if the curvature direction is determined to be reversed, then the current tool position is determined to be the segmentation point.

[0010] Optionally, non-uniform rational spline fitting is performed on the one or more regions to be fitted after trajectory segmentation to obtain a fitting curve, including: parameterizing the one or more regions to be fitted after trajectory segmentation and generating node vectors; performing non-uniform rational spline fitting based on the generated node vectors to obtain the fitting curve, and solving for the control points of the fitting curve.

[0011] Another aspect of the present invention provides a CNC machining trajectory curve fitting device, comprising: a first processing unit for densifying a discrete tool position sequence of the machining trajectory; a second processing unit for filtering and smoothing the tool position sequence after densification by the first processing unit; a third processing unit for segmenting the tool position sequence after filtering and smoothing by the second processing unit to obtain one or more regions to be fitted; and a curve fitting unit for performing non-uniform rational spline fitting on the one or more regions to be fitted obtained after trajectory segmentation by the third processing unit to obtain a fitted curve.

[0012] Optionally, the first processing unit performs densification processing on the discrete tool position sequence of the machining trajectory, including: determining the line segment length between every two adjacent tool positions in the tool position sequence; if the line segment length between two adjacent tool positions is greater than a preset length threshold, then an intermediate tool position is generated between these two adjacent tool positions.

[0013] Optionally, the first processing unit generates an intermediate cutting point between two adjacent cutting point locations if the length of the line segment between two adjacent cutting point locations is greater than a preset length threshold. This includes: calculating the number of intermediate cutting point locations generated between the two adjacent cutting point locations by rounding up based on the length of the line segment between the two adjacent cutting point locations; and calculating the position of the intermediate cutting point location generated between the two adjacent cutting point locations based on the calculated number of intermediate cutting point locations generated between the two adjacent cutting point locations and the positions of the two adjacent cutting point locations.

[0014] Optionally, the second processing unit performs filtering and smoothing processing on the knife point sequence after the first processing unit has performed densification processing, including: traversing the knife point sequence, calculating the line segment length Li between every two adjacent knife point positions and the included angle θ between two adjacent line segments formed by every three adjacent knife point positions. i Determine the included angle θ between two adjacent line segments formed by every three adjacent cutter points. i Is it less than the preset included angle threshold θ? min And whether the length Li of each of the two adjacent line segments is greater than a preset threshold; if so, determine the included angle θ i Less than the preset included angle threshold θ min Furthermore, the length Li of each of the two adjacent line segments is greater than the preset threshold L. min If the cutter position is correct, the cutter position between the two adjacent line segments is retained; otherwise, the cutter position between the two adjacent line segments is filtered and corrected.

[0015] Optionally, the third processing unit performs trajectory segmentation on the tool position sequence after filtering and smoothing by the second processing unit to obtain one or more regions to be fitted, including: determining the line segment length L between every two adjacent tool positions in the filtered and smoothed tool position sequence. i If the length of the line segment between two adjacent cutter points is greater than the preset segment length threshold Rmax, then the latter cutter point among the two adjacent cutter points is determined as the segmentation point; and / or, the included angle θ between two adjacent line segments formed by every three adjacent cutter points in the cutter point sequence after filtering and smoothing is determined. i If the included angle θ between two adjacent line segments formed by three adjacent cutter points i Less than the preset included angle threshold θ min Then, the cutter position between the three adjacent cutter positions is determined as the segmentation point; and / or, each cutter position within the fitting region obtained by trajectory segmentation is traversed, and based on the current cutter position P... i And the first and last tool points Ps and Pe of the region to be fitted, calculate the curvature of the current discrete point; based on the curvature of the current discrete point and the curvature of the previous discrete point, determine whether the curvature direction is reversed; if the curvature direction is reversed, then determine the current tool point as the segmentation point.

[0016] Optionally, the curve fitting unit performs non-uniform rational spline fitting on the one or more regions to be fitted obtained after trajectory segmentation by the third processing unit to obtain a fitted curve, including: parameterizing the one or more regions to be fitted obtained after trajectory segmentation and generating node vectors; performing non-uniform rational spline fitting based on the generated node vectors to obtain the fitted curve, and solving for the control points of the fitted curve.

[0017] In another aspect, the present invention provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described above.

[0018] In another aspect, the present invention provides a computing device including a processor, a memory, and a computer program stored in the memory that can run on the processor, wherein the processor executes the program to implement the steps of any of the methods described above.

[0019] In another aspect, the present invention provides a computing device, including any of the aforementioned machining trajectory curve fitting devices.

[0020] In another aspect, the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the methods described above.

[0021] According to the technical solution of the present invention, the tool position points are denoised and smoothed to reduce the deviation between the calculated tool position points and the theoretical contour, suppress the fitting bow height deviation caused by tool position anomalies and unevenness, and improve the machining accuracy and surface quality of complex contours.

[0022] In related technologies, single interpolation or global approximation methods struggle to balance trajectory smoothness and accuracy stability. According to the technical solution of this invention, adaptive interpolation is performed between known points on the machining contour to generate intermediate tool position points. A sliding window technique is used to construct a local data point set, and a polynomial geometric feature model is established for the data points within each window. Based on the local geometric feature model, the original tool position points are smoothed and optimized, outputting a new tool position point set with higher uniformity and continuity. This provides better tool position data for subsequent NURBS curve fitting, effectively improving the smoothness and continuity of the final machining trajectory. Attached Figure Description

[0023] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings:

[0024] Figure 1 This is a schematic diagram of an embodiment of the machining trajectory curve fitting method provided by the present invention;

[0025] Figure 2 A schematic diagram illustrating the steps for generating an intermediate tool position between two adjacent tool positions is shown.

[0026] Figure 3 A schematic diagram of the blade sites after intensive processing is shown;

[0027] Figure 4A schematic diagram of the steps for filtering and smoothing the knife point sequence after densification is shown.

[0028] Figure 5 A schematic diagram of the tool position after filtering and smoothing is shown;

[0029] Figure 6 The diagram illustrates the steps of performing non-uniform rational spline fitting on one or more regions to be fitted after trajectory segmentation to obtain a fitted curve.

[0030] Figure 7 The fitted curve after fitting with non-uniform rational splines is shown.

[0031] Figure 8 A schematic diagram of multi-feature segmentation region division is shown;

[0032] Figure 9 This is a schematic diagram of a specific embodiment of the CNC machining trajectory curve fitting method provided by the present invention;

[0033] Figure 10 This is a structural block diagram of an embodiment of the CNC machining trajectory curve fitting device provided by the present invention. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0035] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0036] This invention provides a method for fitting CNC machining trajectory curves. This method is mainly used for curve fitting of CNC machining trajectories, such as for fitting the tool trajectory in CNC machining.

[0037] Figure 1 This is a schematic diagram of an embodiment of the machining trajectory curve fitting method provided by the present invention.

[0038] like Figure 1 As shown, according to an embodiment of the present invention, the processing trajectory curve fitting method includes at least steps S110, S120, S130 and S140.

[0039] Step S110: The discrete tool position sequence of the machining trajectory is densified.

[0040] Specifically, the length of the line segment between every two adjacent cutter points in the cutter point sequence is determined; if the length of the line segment between two adjacent cutter points is greater than a preset length threshold, an intermediate cutter point is generated between these two adjacent cutter points.

[0041] For example, setting a preset length threshold of Lmin, calculate the line segment length Li between every two adjacent cutter sites:

[0042]

[0043] Among them, two adjacent knife sites are respectively (x is y is , z is ) and (x ie y ie , z ie That is, the starting point s of the line segment is (x is y is , z is The endpoint e is (x ie y ie , z ie );

[0044] When the length of the line segment between two adjacent cutter points is greater than the preset length threshold Lmin, i.e. L i >L min An intermediate cutter site is generated between these two adjacent cutter sites.

[0045] Figure 2 A schematic diagram illustrating the steps for generating an intermediate tool position between two adjacent tool positions is shown. Figure 2 As shown, in one specific embodiment, generating an intermediate cutting point between two adjacent cutting point sites may specifically include steps S1 and S2.

[0046] Step S1: Based on the line segment length between the two adjacent tool points, calculate the number of intermediate tool points generated between the two adjacent tool points by rounding up.

[0047]

[0048] That is, the number of interpolation points is calculated by rounding up.

[0049] Step S2: Based on the calculated number of intermediate tool points generated between the two adjacent tool points and the positions of the two adjacent tool points, calculate the position of the intermediate tool point generated between the two adjacent tool points.

[0050] Specifically, based on the starting cutter position of the small line segment (x s y s , z s ) and the position of the end of the knife (x) e y e , z e ), calculate the position of the j-th new interpolation point (intermediate tool point) between every two adjacent tool points as follows:

[0051]

[0052] Figure 3 A schematic diagram of the tool position after densification is shown. The tool position after densification can be referenced. Figure 3 As shown, the original programming point is the original tool position point; the interpolation point is the generated intermediate tool position point.

[0053] Step S120: The knife point sequence after densification is filtered and smoothed.

[0054] Figure 4 A schematic diagram illustrates the steps involved in filtering and smoothing the knife point sequence after densification. For example... Figure 4 As shown, in one specific embodiment, step S120 includes: step S121, step S122 and step S123.

[0055] Step S121: Traverse the sequence of cutting tool points, calculate the length Li of the line segment between every two adjacent cutting tool points and the angle θ between two adjacent line segments formed by every three adjacent cutting tool points. i :

[0056]

[0057] Where a, b, and c are the lengths of the three sides of the triangle formed by the three adjacent cutter points, and c is the included angle θ. i The opposite side.

[0058] Step S122: Determine the included angle θ between two adjacent line segments formed by every three adjacent cutter points.i Is it less than the preset included angle threshold θ? min And whether the length Li of each of the two adjacent line segments is greater than a preset threshold;

[0059] Step S123, if the included angle θ is determined i Less than the preset included angle threshold θ min Furthermore, the length Li of each of the two adjacent line segments is greater than the preset threshold L. min If the cutter point between the two adjacent line segments is determined to be the middle cutter point among the three adjacent cutter points, then the cutter point is retained; otherwise, the cutter point between the two adjacent line segments is filtered and corrected.

[0060] In one specific implementation, filtering correction is performed on the knife point between the two adjacent line segments, including:

[0061] The fitted polynomial is:

[0062]

[0063] Let the window width be N (an odd number), and use the least squares method. Solving for the polynomial coefficients γ i Based on the solved parameters, calculate the new tool position p(X) after filtering correction. i ).

[0064] This invention employs a sliding window technique to construct a local data point set, establishing a polynomial geometric feature model for each data point within the window. Based on this local geometric feature model, the original tool position points are smoothed and optimized, outputting a new tool position point set with higher uniformity and continuity. This provides better tool position data for subsequent NURBS curve fitting, effectively improving the smoothness and continuity of the final machining trajectory.

[0065] Figure 5 A schematic diagram of the tool position after filtering and smoothing is shown. (Example) Figure 5 As shown, the original programming point is the original tool position point; the interpolation point is the generated intermediate tool position point; and the smoothing point is the tool position point after filtering and balancing.

[0066] Step S130: The knife point sequence after filtering and smoothing is segmented to obtain one or more regions to be fitted.

[0067] Specifically, for the filtered and smoothed tool position sequence, the line segment length L between every two adjacent tool positions is used as the basis for the calculation. i The angle θ between two adjacent line segments formed by every three adjacent cutter points iAnd / or the curvature direction of every two adjacent tool points, the trajectory is segmented to obtain the region to be fitted {P}. s ,…,P i ,…,P e}

[0068] In one specific implementation, based on the line segment length L between every two adjacent cutter points... i Trajectory segmentation is performed, specifically including: determining the line segment length L between every two adjacent tool positions in the filtered and smoothed tool position sequence. i If the length of the line segment between two adjacent cutter points is greater than the preset segment length threshold Rmax, then the latter cutter point among the two adjacent cutter points is determined as the segment point.

[0069] In one specific implementation, the angle θ between the included angles of two adjacent line segments formed by every three adjacent cutter points is used. i Trajectory segmentation specifically includes: determining the angle θ between two adjacent line segments formed by every three adjacent tool points in the filtered and smoothed tool point sequence. i If the included angle θ between two adjacent line segments formed by three adjacent cutter points i Less than the preset included angle threshold θ min Then, the cutter point in the middle of the three adjacent cutter points is determined as the segmentation point.

[0070] In one specific implementation, trajectory segmentation is performed based on the curvature direction of every two adjacent tool points, including: segmenting based on the line segment length L between every two adjacent tool points. i Perform trajectory segmentation and / or based on the angle θ between two adjacent line segments formed by every three adjacent tool points. i After segmenting the trajectory, traverse the region to be fitted {P} obtained from the trajectory segmentation. s ,…,P i ,…,P e For each tool position within}, based on the current tool position P i And the first and last two tool points Ps and Pe of the region to be fitted, calculate the current discrete point (point P). i Curvature; based on the curvature of the current discrete point and the previous discrete point (point P) i-1 The curvature is determined to determine whether the curvature direction is reversed; if the curvature direction is reversed, the current tool position point is determined to be the segmentation point.

[0071] That is, the curvature κ of the current discrete point is calculated based on the current cutter position Pi and the first and last cutter positions Ps and Pe of the region to be fitted.

[0072]

[0073] Where Ps and Pe are the first and last cutter positions of the region to be fitted, respectively, and Pi is the current cutter position.

[0074] Similarly, the previous point P can be calculated. i-1 The curvature κ′. Based on the current point P. i The curvature κ and the point P above i-1 The curvature κ′ is calculated. If the curvature direction is reversed, κ×κ′=-1, then the current point P is determined. i This is the segmentation point.

[0075] Preferably, the length L of the line segment between every two adjacent cutter points is first determined. i The trajectory is segmented, and then the segmented region to be fitted is determined by the angle θ between two adjacent line segments formed by every three adjacent tool points. i The trajectory is segmented, and then further segmented according to the curvature direction of every two adjacent tool points.

[0076] In fact, to simplify the traversal process, only one traversal is needed. The length, angle, and curvature are calculated, and the segmentation point is generated when the condition is not met. The tool position of the region cached at that segmentation point is then fitted.

[0077] Step S140: Perform non-uniform rational spline fitting on the one or more regions to be fitted obtained after trajectory segmentation to obtain the fitted curve.

[0078] Figure 6 The diagram illustrates the steps of performing non-uniform rational spline fitting on one or more regions to be fitted after trajectory segmentation to obtain a fitted curve. Figure 6 As shown, in one specific embodiment, step S140 includes: step S141 and step S142.

[0079] Step S141: Parameterize the one or more regions to be fitted obtained after trajectory segmentation and generate node vectors.

[0080] Specifically, one fitting curve is generated for each region to be fitted, and the parameter values ​​of discrete points are calculated using the chord length parameterization method. First, based on the data point set Q of each region to be fitted, the total length of each region is calculated. Calculate nodes based on total length The non-uniform node vector U is generated as follows:

[0081]

[0082] Where n is the number of control points, p is the order, and m is the number of tool points.

[0083] Step S142: Based on the generated node vector, perform non-uniform rational spline (NURBS) fitting to obtain the fitted curve, and solve for the control points of the fitted curve.

[0084] The fitted curve was obtained according to the NUBRS formula:

[0085]

[0086] Wherein, basis functions

[0087]

[0088] The solution formula is constructed using the least squares global approximation algorithm. Solving for the control points {P} of the NURBS fitted curve j}

[0089] Optionally, after obtaining the fitting curve for each region to be fitted, the fitting curve is checked for tool position deviation and / or bow height error.

[0090] Tool position deviation verification, i.e., calculating the tool position point P. i To the fitted curve C(u) i Tool position deviation like Increase the number of control points by j+1 and resolve for the control points.

[0091] Bow height error verification, that is, calculating point H on the fitted curve. i The height error of the AB segment formed by the first and last points of the fitted curve like If the fit is determined to be an oscillation, the original small line segment is output; otherwise, the fitted curve is output.

[0092] Figure 7 The fitted curve after fitting with non-uniform rational splines is shown. Figure 7 As shown, the initial programming point is the original tool position; the interpolation point is the generated intermediate tool position; the smoothing point is the tool position after filtering and balancing; and 1 is the fitted curve.

[0093] Figure 8 A schematic diagram of multi-feature segmentation region division is shown.

[0094] S1: Beginning;

[0095] S2: Obtain three programming points, including the previous programming point, the current programming point, and the next programming point;

[0096] S3: Determine whether the length of the line segment formed by the three programming points is ≤ a preset length threshold. If not, proceed to step S8; if yes, proceed to step S4.

[0097] S4: Determine whether the included angle formed by the three programming points is ≥ a preset angle threshold. If not, proceed to step S8; if yes, proceed to step S5.

[0098] S5: Determine whether the curvature vector direction of the current point and the first and last points of the queue is consistent with the curvature vector direction of the previous point. If not, proceed to step S8; if yes, proceed to step S6.

[0099] S6: Add the current programming point to the fit cache queue;

[0100] S7: Determine whether the number of programming points in the cache queue to be fitted is ≥ a preset number threshold. If not, return to step S2; if yes, proceed to step S9.

[0101] S8: Determine if the number of programming points is ≥4. If not, output the small line segment directly without fitting; if yes, proceed to step S9.

[0102] S9: The NURBS fitting algorithm is used to fit the programming points in the cache queue to be fitted;

[0103] S10: Determine whether the fitted tool position deviation is less than the preset tool position deviation threshold. If not, increase the number of control points and return to step S9; if yes, proceed to step S11.

[0104] S11: Determine whether the fitted bow height deviation is less than the preset bow height threshold. If yes, output the fitted curve and proceed to step S12; otherwise, output the small line segment and proceed to step S12.

[0105] S12: Determine if this is the last programming point. If not, return to step S2; if yes, end.

[0106] To clearly illustrate the technical solution of the present invention, the execution flow of the CNC machining trajectory curve fitting method provided by the present invention will be described below with a specific embodiment.

[0107] Figure 9 This is a schematic diagram of a specific embodiment of the CNC machining trajectory curve fitting method provided by the present invention. Figure 9 As shown, firstly, the programming points are densified and smoothed, then feature segmentation is performed, and global fitting is done. Finally, deviation verification is performed, and the fitted curve is output.

[0108] This invention also provides a CNC machining trajectory curve fitting device. It is used to perform curve fitting on the tool trajectory of CNC machining.

[0109] Figure 10 This is a structural block diagram of an embodiment of the CNC machining trajectory curve fitting device provided by the present invention. Figure 10 As shown, the CNC machining trajectory curve fitting device 100 includes: a first processing unit 110, a second processing unit 120, a third processing unit 130, and a curve fitting unit 140.

[0110] The first processing unit 110 is used to perform density processing on the discrete tool position sequence of the machining trajectory.

[0111] Specifically, the length of the line segment between every two adjacent cutter points in the cutter point sequence is determined; if the length of the line segment between two adjacent cutter points is greater than a preset length threshold, an intermediate cutter point is generated between these two adjacent cutter points.

[0112] For example, setting a preset length threshold of Lmin, calculate the line segment length Li between every two adjacent cutter sites:

[0113]

[0114] Among them, two adjacent knife sites are respectively (x is y is , z is ) and (x ie y ie , z ie That is, the starting point s of the line segment is (x is y is , z is The endpoint e is (x ie y ie , z ie );

[0115] When the length of the line segment between two adjacent cutter points is greater than the preset length threshold Lmin, i.e. L i >L min An intermediate cutter site is generated between these two adjacent cutter sites.

[0116] Figure 2 A schematic diagram illustrating the steps for generating an intermediate tool position between two adjacent tool positions is shown. Figure 2 As shown, in one specific embodiment, the first processing unit 110 generating an intermediate cutting point between two adjacent cutting points may specifically include steps S1 and S2.

[0117] Step S1: Based on the line segment length between the two adjacent tool points, calculate the number of intermediate tool points generated between the two adjacent tool points by rounding up.

[0118]

[0119] That is, the number of interpolation points is calculated by rounding up.

[0120] Step S2: Based on the calculated number of intermediate tool points generated between the two adjacent tool points and the positions of the two adjacent tool points, calculate the position of the intermediate tool point generated between the two adjacent tool points.

[0121] Specifically, based on the starting cutter position of the small line segment (x s y s , z s ) and the position of the end of the knife (x) e y e , z e ), calculate the position of the j-th new interpolation point (intermediate tool point) between every two adjacent tool points as follows:

[0122]

[0123] Figure 3 A schematic diagram of the tool position after densification is shown. The tool position after densification can be referenced. Figure 3 As shown, the original programming point is the original tool position point; the interpolation point is the generated intermediate tool position point.

[0124] The second processing unit 120 is used to perform filtering and smoothing processing on the knife point sequence after the first processing unit has performed intensive processing.

[0125] In one specific embodiment, the second processing unit 120 performs filtering and smoothing processing on the knife point sequence after densification, which may specifically include the following steps:

[0126] (1) Traverse the sequence of knife point positions, and calculate the line segment length Li between every two adjacent knife point positions and the included angle θ between two adjacent line segments formed by every three adjacent knife point positions. i :

[0127]

[0128] Where a, b, and c are the lengths of the three sides of the triangle formed by the three adjacent cutter points, and c is the included angle θ. i The opposite side.

[0129] (2) Determine the included angle θ between two adjacent line segments formed by every three adjacent knife points. i Is it less than the preset included angle threshold θ? min And whether the length Li of each of the two adjacent line segments is greater than a preset threshold, and if so, determine the included angle θ. i Less than the preset included angle threshold θ min Furthermore, the length Li of each of the two adjacent line segments is greater than the preset threshold L.min If the cutter point between the two adjacent line segments is determined to be the middle cutter point among the three adjacent cutter points, then the cutter point is retained; otherwise, the cutter point between the two adjacent line segments is filtered and corrected.

[0130] In one specific implementation, filtering correction is performed on the knife point between the two adjacent line segments, including:

[0131] The fitted polynomial is:

[0132]

[0133] Let the window width be N (an odd number), and use the least squares method. Solving for the polynomial coefficients γ i Based on the solved parameters, calculate the new tool position p(X) after filtering correction. i ).

[0134] This invention employs a sliding window technique to construct a local data point set, establishing a polynomial geometric feature model for each data point within the window. Based on this local geometric feature model, the original tool position points are smoothed and optimized, outputting a new tool position point set with higher uniformity and continuity. This provides better tool position data for subsequent NURBS curve fitting, effectively improving the smoothness and continuity of the final machining trajectory.

[0135] The third processing unit 130 is used to perform trajectory segmentation on the knife point sequence after filtering and smoothing by the second processing unit to obtain one or more regions to be fitted.

[0136] Specifically, for the filtered and smoothed tool position sequence, the line segment length L between every two adjacent tool positions is used as the basis for the calculation. i The angle θ between two adjacent line segments formed by every three adjacent cutter points i And / or the curvature direction of every two adjacent tool points, the trajectory is segmented to obtain the region to be fitted {P}. s ,…,P i ,…,P e}

[0137] In one specific implementation, based on the line segment length L between every two adjacent cutter points... i Trajectory segmentation is performed, specifically including: determining the line segment length L between every two adjacent tool positions in the filtered and smoothed tool position sequence. i If the length of the line segment between two adjacent cutter points is greater than the preset segment length threshold Rmax, then the latter cutter point among the two adjacent cutter points is determined as the segment point.

[0138] In one specific implementation, the angle θ between the included angles of two adjacent line segments formed by every three adjacent cutter points is used. i Trajectory segmentation specifically includes: determining the angle θ between two adjacent line segments formed by every three adjacent tool points in the filtered and smoothed tool point sequence. i If the included angle θ between two adjacent line segments formed by three adjacent cutter points i Less than the preset included angle threshold θ min Then, the cutter point in the middle of the three adjacent cutter points is determined as the segmentation point.

[0139] In one specific implementation, trajectory segmentation is performed based on the curvature direction of every two adjacent tool points, including: segmenting based on the line segment length L between every two adjacent tool points. i Perform trajectory segmentation and / or based on the angle θ between two adjacent line segments formed by every three adjacent tool points. i After segmenting the trajectory, traverse the region to be fitted {P} obtained from the trajectory segmentation. s ,…,P i ,…,P e For each cutter position within the region, calculate the current discrete point (point P) based on the current cutter position Pi and the first and last cutter positions Ps and Pe of the region to be fitted. i Curvature; based on the curvature of the current discrete point and the curvature of the previous discrete point (point P) i-1 The curvature is determined to determine whether the curvature direction is reversed; if the curvature direction is reversed, the current tool position point is determined to be the segmentation point.

[0140] That is, the curvature κ of the current discrete point is calculated based on the current point Pi and the first and last tool points Ps and Pe of the region to be fitted.

[0141]

[0142] Where Ps and Pe are the first and last cutter positions of the region to be fitted, respectively, and Pi is the current cutter position.

[0143] Similarly, a point P on Pi can be calculated. i-1 The curvature κ′, based on the current point P i The curvature κ and the point P above i-1 The curvature κ′ is calculated. If the curvature direction is reversed, κ×κ′=-1, then the current point P is determined. i This is the segmentation point.

[0144] Preferably, the length L of the line segment between every two adjacent cutter points is first determined. i The trajectory is segmented, and then the segmented region to be fitted is determined by the angle θ between two adjacent line segments formed by every three adjacent tool points. iThe trajectory is segmented, and then further segmented according to the curvature direction of every two adjacent tool points.

[0145] In fact, to simplify the traversal process, only one traversal is needed. The length, angle, and curvature are calculated, and the segmentation point is generated when the condition is not met. The tool position of the region cached at that segmentation point is then fitted.

[0146] The curve fitting unit 140 is used to perform non-uniform rational spline fitting on the one or more regions to be fitted obtained after trajectory segmentation by the third processing unit to obtain a fitted curve.

[0147] In one specific embodiment, the curve fitting unit 140 performs non-uniform rational spline fitting on the one or more regions to be fitted obtained after trajectory segmentation through the following steps.

[0148] (1) Parameterize the one or more regions to be fitted obtained after trajectory segmentation and generate node vectors.

[0149] Specifically, one fitting curve is generated for each region to be fitted, and the parameter values ​​of discrete points are calculated using the chord length parameterization method. First, based on the data point set Q of each region to be fitted, the total length of each region is calculated. Calculate nodes based on total length The non-uniform node vector U is generated as follows:

[0150]

[0151] Where n is the number of control points, p is the order, and m is the number of tool points.

[0152] (2) Based on the generated node vector, perform non-uniform rational spline (NURBS) fitting to obtain the fitting curve, and solve for the control points of the fitting curve.

[0153] The fitted curve was obtained according to the NUBRS formula:

[0154]

[0155] Wherein, basis functions

[0156]

[0157] The solution formula is constructed using the least squares global approximation algorithm. Solving for the control points {P} of the NURBS fitted curve j}

[0158] Optionally, after obtaining the fitting curve for each region to be fitted, the fitting curve is checked for tool position deviation and / or bow height error.

[0159] Tool position deviation verification, that is, calculating the tool position point P. i To the fitted curve C(u) i Tool position deviation like Increase the number of control points by j+1 and resolve for the control points.

[0160] Bow height error verification, that is, calculating point H on the fitted curve. i The height error of the AB segment formed by the first and last points of the fitted curve like If the fit is determined to be an oscillation, the original small line segment is output; otherwise, the fitted curve is output.

[0161] Figure 7 The following diagram shows the fitted curves obtained after fitting non-uniform rational splines. Figure 7 As shown, the initial programming point is the original tool position; the interpolation point is the generated intermediate tool position; the smoothing point is the tool position after filtering and balancing; and 1 is the fitted curve.

[0162] The present invention also provides a storage medium corresponding to the machining trajectory curve fitting method, wherein a computer program is stored thereon, and when the program is executed by a processor, it implements the steps of any of the aforementioned methods.

[0163] The present invention also provides a computing device corresponding to the aforementioned machining trajectory curve fitting method, comprising a processor, a memory, and a computer program stored in the memory that can run on the processor, wherein the processor executes the program to implement the steps of any of the aforementioned methods.

[0164] The present invention also provides a computing device corresponding to the machining trajectory curve fitting device, including any of the aforementioned machining trajectory curve fitting devices.

[0165] The present invention also provides a computer program product corresponding to the aforementioned machining trajectory curve fitting method, comprising a computer program that, when executed by a processor, implements the steps of any of the aforementioned methods.

[0166] Accordingly, the solution provided by the present invention performs noise reduction and encryption smoothing on the tool position points, reduces the deviation between the calculated tool position points and the theoretical contour, suppresses the fitting bow height deviation caused by tool position anomalies and unevenness, and improves the machining accuracy and surface quality of complex contours.

[0167] According to the technical solution of this invention, adaptive interpolation is performed between known points on the machining contour to generate intermediate tool positions. A sliding window technique is used to construct a local data point set, and a polynomial geometric feature model is established for the data points within each window. Based on the local geometric feature model, the original tool positions are smoothed and optimized, outputting a new tool position set with higher uniformity and continuity. This provides better tool position data for subsequent NURBS curve fitting, effectively improving the smoothness and continuity of the final machining trajectory.

[0168] The functions described herein can be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, the functions can be stored as one or more instructions or codes on or transmitted via a computer-readable medium. Other examples and embodiments are within the scope and spirit of this invention and the appended claims. For example, due to the nature of software, the functions described above can be implemented using software executed by a processor, hardware, firmware, hardwired, or any combination thereof. Furthermore, the functional units can be integrated into a single processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit.

[0169] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0170] The units described as separate components may or may not be physically separate. Similarly, the components of the control device may or may not be physical units; they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0171] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to related technologies, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0172] The above description is merely an embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of the claims of the present invention.

Claims

1. A method for fitting a processing trajectory curve, characterized in that, include: The discrete tool position sequence of the machining trajectory is densified; The knife point sequence after densification is filtered and smoothed. The trajectory of the knife point sequence after filtering and smoothing is segmented to obtain more than one region to be fitted. For the one or more regions to be fitted obtained after trajectory segmentation, non-uniform rational spline fitting is performed to obtain the fitted curve.

2. The method according to claim 1, characterized in that, The discrete tool position sequence of the machining trajectory is densified, including: Determine the length of the line segment between every two adjacent cutter points in the cutter point sequence; If the length of the line segment between two adjacent cutter points is greater than a preset length threshold, an intermediate cutter point will be generated between these two adjacent cutter points.

3. The method according to claim 2, characterized in that, If the length of the line segment between two adjacent cutter points is greater than a preset length threshold, an intermediate cutter point is generated between these two adjacent cutter points, including: The number of intermediate tool points generated between the two adjacent tool points is calculated by rounding up based on the length of the line segment between the two adjacent tool points. Based on the calculated number of intermediate cutting points generated between the two adjacent cutting points and the positions of the two adjacent cutting points, the position of the intermediate cutting point generated between the two adjacent cutting points is calculated.

4. The method according to any one of claims 1-3, characterized in that, The knife point sequence after densification is filtered and smoothed, including: Traverse the sequence of cutting tool points, calculate the length Li of the line segment between every two adjacent cutting tool points, and the angle θ between two adjacent line segments formed by every three adjacent cutting tool points. i ; Determine the included angle θ between two adjacent line segments formed by every three adjacent cutter points. i Is it less than the preset included angle threshold θ? min And whether the length Li of each of the two adjacent line segments is greater than a preset threshold; If the included angle θ is determined i Less than the preset included angle threshold θ min Furthermore, the length Li of each of the two adjacent line segments is greater than the preset threshold L. min If the cutter position is correct, the cutter position between the two adjacent line segments is retained; otherwise, the cutter position between the two adjacent line segments is filtered and corrected.

5. The method according to claim 4, characterized in that, The trajectory of the filtered and smoothed knife point sequence is segmented to obtain more than one region to be fitted, including: Determine the length L of the line segment between every two adjacent tool points in the tool point sequence after filtering and smoothing. i If the length of the line segment between two adjacent cutter points is greater than the preset segment length threshold Rmax, then the latter cutter point among the two adjacent cutter points is determined as the segment point. And / or, Determine the angle θ between two adjacent line segments formed by every three adjacent tool points in the filtered and smoothed tool point sequence. i If the included angle θ between two adjacent line segments formed by three adjacent cutter points i Less than the preset included angle threshold θ min Then the cutter point in the middle of the three adjacent cutter points is determined as the segmentation point; And / or, Iterate through each tool position point within the region to be fitted obtained by trajectory segmentation, and calculate based on the current tool position point P. i And the first and last tool points Ps and Pe of the region to be fitted, calculate the curvature of the current discrete point; based on the curvature of the current discrete point and the curvature of the previous discrete point, determine whether the curvature direction is reversed; if the curvature direction is reversed, then determine the current tool point as the segmentation point.

6. The method according to any one of claims 1-3, characterized in that, For the one or more regions to be fitted obtained after trajectory segmentation, non-uniform rational spline fitting is performed to obtain the fitted curve, including: The more than one region to be fitted obtained after trajectory segmentation is parameterized and node vectors are generated. Based on the generated node vectors, a non-uniform rational spline fitting is performed to obtain the fitted curve, and the control points of the fitted curve are solved.

7. A processing trajectory curve fitting device, characterized in that, include: The first processing unit is used to perform density processing on the discrete tool position sequence of the machining trajectory; The second processing unit is used to perform filtering and smoothing processing on the knife point sequence after the first processing unit has performed intensive processing. The third processing unit is used to perform trajectory segmentation on the knife point sequence after filtering and smoothing by the second processing unit to obtain one or more regions to be fitted. The curve fitting unit is used to perform non-uniform rational spline fitting on the one or more regions to be fitted obtained after trajectory segmentation by the third processing unit to obtain a fitted curve.

8. A storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-6.

9. A computing device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory that can run on the processor, wherein the processor executes the program to implement the steps of any of the methods of claims 1-6, or includes the machining trajectory curve fitting device as described in claim 7.

10. A computer program product, characterized in that, Includes a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1-6.