A tool position point trajectory real-time optimization method in numerical control machining process and application
By dividing the tool position trajectory into multiple preprocessing intervals and using Bezier curves and dynamic Gaussian filtering algorithms to optimize the tool tip and rotary axis trajectories, the problem of uneven tool position trajectory in CNC machining is solved, achieving efficient real-time optimization and uniform tool position trajectory, thus improving machining quality and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAZHONG UNIV OF SCI & TECH
- Filing Date
- 2023-05-05
- Publication Date
- 2026-05-01
AI Technical Summary
In existing CNC machining, the tool path of freeform workpieces is uneven, which leads to a decrease in machining efficiency and quality. Existing solutions require modification of CAD models or CAM parameters, which results in a long adjustment cycle.
The tool position trajectory is divided into multiple preprocessing intervals. The tool tip and rotation axis trajectories of each interval are optimized by fitting and sampling. Bezier curves and dynamic Gaussian filtering algorithms are used to achieve real-time optimization of the tool position trajectory.
It improves the uniformity of tool path and speed planning performance, reduces machining cycle time, improves machining quality and efficiency, and simplifies operation process.
Smart Images

Figure CN116594348B_ABST
Abstract
Description
A method for real-time optimization of tool path trajectory in CNC machining and its application Technical Field
[0001] This invention belongs to the field of CNC technology, and more specifically, relates to a method and application for real-time optimization of tool position trajectory in CNC machining process. Background Technology
[0002] In multi-axis CNC machining, the workpiece surfaces to be machined are often free-form surfaces. The G-code for machining such workpieces is generally generated by a CAM system as continuous small line segments. When planning the toolpath, the CAM system primarily ensures tolerance constraints, without fully considering the smoothness of the toolpath trajectory and speed planning performance. This results in uneven toolpath trajectories in the generated machining programs, specifically manifested as uneven lengths, angles, and tool axis variations between tool points. When handling uneven trajectories in program segments, the flexibility and accuracy of the system's speed planning are limited by various parameter thresholds, leading to excessively long low-speed ranges or drastic speed fluctuations, affecting the machining efficiency and quality of the workpiece.
[0003] For machining defects caused by uneven trajectories, common solutions include modifying the CAD model to improve its smoothness or modifying CAM parameters to replan the machining trajectory. However, these solutions require high standards for model design and process programming, and the adjustment cycle is also long. Therefore, CNC system users prefer to have a real-time machining trajectory optimization module built into the CNC system to perform real-time preprocessing of the trajectory during machining, improve the uniformity of the trajectory and speed planning performance, thereby improving the workpiece machining quality and efficiency, and enhancing the system's adaptability to different quality G-codes. Summary of the Invention
[0004] In view of the above-mentioned defects or improvement needs of the existing technology, the present invention provides a method and application for real-time optimization of tool position trajectory in CNC machining process, so as to solve the technical problem that the existing technology cannot optimize the tool position trajectory in real time with high efficiency, thereby obtaining a uniform tool position.
[0005] To achieve the above objectives, in a first aspect, the present invention provides a method for real-time optimization of tool path trajectory during CNC machining, comprising:
[0006] Based on the current CNC machining process parameters and trajectory geometry, the entire tool position trajectory is divided into multiple preprocessing intervals; among them, the tool position trajectory includes: the tool position sequence; the tool position includes the tool tip position and the position of each rotation axis of the corresponding tool axis;
[0007] The tool trajectory in each preprocessing interval is optimized separately:
[0008] The tool tip position in the tool position trajectory in the preprocessing interval is fitted to obtain the tool tip curve; the travel distance of each tool tip is obtained by calculating the arc length between each tool tip and the first tool position on the tool tip curve.
[0009] For each rotation axis corresponding to each tool tip point in the tool position trajectory in the preprocessing interval, the relationship between its position and the stroke of the corresponding tool tip point is fitted to obtain the trajectory curve of each rotation axis.
[0010] The tool tip curve is sampled with equal arc length to obtain the tool tip sampling point position. The trajectory curve of each rotation axis is sampled based on the stroke of the tool tip sampling point to obtain the position of the sampling point of each rotation axis. Based on the tool tip sampling point position and the corresponding positions of each rotation axis sampling point, a new tool point position sequence is obtained, thus obtaining the tool point trajectory in the optimized preprocessing interval.
[0011] More preferably, the method for fitting the tool tip position in the tool position trajectory within the preprocessing interval includes:
[0012] For each pair of adjacent blade tip points on the blade tip trajectory in the preprocessing interval, a cubic Bezier curve C(u) is used to fit the trajectory segments; u∈[0,1];
[0013] The control points for the cubic Bezier curve include P0, P1, P2, and P3.
[0014] P0, P1, P2, and P3 all satisfy the condition that the modulus of the derivative of C(u) is equal when u takes the values of 0, 0.5, and 1, respectively.
[0015] Control points P0 and P3 are the first and last tool tip points of the above trajectory line segment, respectively;
[0016] P1 and P2 are points on the tangent vector direction of the tool tip point trajectory of P0 and P3 in the preprocessing interval, respectively, and it is ensured that line segment P1P2 is parallel to line segment P0P3, and the distance between line segment P1P2 and line segment P0P3 is within the maximum allowable contour deviation range; the tool tip point trajectory is the line connecting the positions of each tool tip point on it.
[0017] More preferably, the position of the tool tip in the tool position trajectory is fitted using Bessel interpolation.
[0018] More preferably, the tool position in the new tool position sequence includes the tool tip sampling point position and the corresponding sampling point positions of each rotation axis.
[0019] More preferably, the tool point positions in the above-mentioned new tool point position sequence include the preprocessed tool tip sampling point positions and the corresponding positions of each rotation axis sampling point;
[0020] The method for obtaining the location of the preprocessed tool tip sampling point includes:
[0021] The tool tip sampling point position is filtered, and when the filtered tool tip sampling point position exceeds the contour error constraint, the filtered tool tip sampling point position is adjusted.
[0022] More preferably, a dynamic Gaussian filtering algorithm is used to filter the sampling point position of the blade tip.
[0023] More preferably, the dividing points when dividing the entire tool position trajectory into several preprocessing intervals include: the first and last tool positions of the trajectory line segments corresponding to the G00, G02, and G03 commands in the tool position trajectory; the points where the commanded feed rate changes in the tool position trajectory; the first and last tool positions of the trajectory line segments where the distance between the tool tip points is greater than a preset length in the tool position trajectory; and the transition points where the external rotation angle of the tool tip points in the tool position trajectory is greater than a preset angle; the trajectory line segment is the line connecting two adjacent tool positions in the tool position trajectory.
[0024] In a second aspect, the present invention provides a real-time tool position trajectory optimization system, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the real-time tool position trajectory optimization method provided in the first aspect of the present invention.
[0025] Thirdly, the present invention provides a numerical control system, comprising:
[0026] The tool position trajectory optimization module is used to execute the real-time tool position trajectory optimization method provided in the first aspect of the present invention.
[0027] The tool position trajectory interpolation module is used to interpolate the optimized tool position trajectory and transmit the interpolation information to the machine tool servo system to drive the machine tool to process the material.
[0028] Fourthly, a computer-readable storage medium includes a stored computer program, wherein when the computer program is run by a processor, it controls the device where the storage medium is located to execute the real-time tool position trajectory optimization method provided in the first aspect of the present invention.
[0029] In summary, the above-described technical solutions conceived in this invention can achieve the following beneficial effects:
[0030] 1. This invention provides a real-time optimization method for tool position trajectory during CNC machining. The method divides the entire tool position trajectory into multiple preprocessing intervals and optimizes the tool position trajectory within each interval. In this process, the optimization of the entire tool position trajectory can be performed locally. While preserving the original trajectory geometry and process characteristics, it reduces the computational load of each optimization process and the number of program segments that the CNC system needs to pre-read. Furthermore, fitting the tool tip point of the tool position trajectory within each preprocessing interval can eliminate sharp angles between the original adjacent tool tip point trajectories. This invention makes the rotation angle of the trajectory more uniform; fitting the rotation axis trajectory can eliminate sharp angles in the rotation axis trajectory in the stroke space; sampling the tool tip curve with equal arc length can obtain a tool tip trajectory with uniform length and rotation angle; sampling the rotation axis trajectory can obtain a more uniform rotation axis position; this invention does not require modification of the CAD model or CAM parameters. By optimizing the tool position trajectory online during machining, it reduces the operation steps in production and machining, has a shorter machining cycle and higher ease of use, and can optimize the tool position trajectory in real time with high efficiency, thereby obtaining a uniform tool position.
[0031] 2. The real-time tool position trajectory optimization method provided by this invention makes the control points P1 and P2 of the Bézier curve located in the tangent vector direction of P0 and P3, so that the shape of the spline is closer to the actual desired machining trajectory. At the same time, the circumscribed spline is obtained. By fitting the tool tip position with the circumscribed spline, a longer transition curve can be obtained, making the change of the tool tip angle smoother.
[0032] 3. The real-time tool position trajectory optimization method provided by the present invention performs uniform processing on the tool position trajectory before transition smoothing, so that the transition smoothing result is not limited by the length of the tool tip unit in the original program segment, which can improve the flexibility and accuracy of the system in the subsequent speed range division process, thereby improving the machining quality. Attached Figure Description
[0033] Figure 1 is a flowchart of optimizing the knife point trajectory in each preprocessing interval according to Embodiment 1 of the present invention;
[0034] Figure 2 is a schematic diagram of stroke space trajectory smoothing provided in Embodiment 1 of the present invention;
[0035] Figure 3 is a flowchart of the method for constructing Bezier spline curves provided in Embodiment 1 of the present invention;
[0036] Figure 4 is a schematic diagram of equal arc length sampling of the blade tip provided in Embodiment 1 of the present invention;
[0037] Figure 5 is a schematic diagram of synchronous sampling of the driven shaft provided in Embodiment 1 of the present invention;
[0038] Figure 6 is a schematic diagram of the adjusted blade tip point after filtering according to Embodiment 1 of the present invention;
[0039] Figure 7 is a schematic diagram of the tool trajectory before optimization using the real-time tool position trajectory optimization method provided in Embodiment 1 of the present invention;
[0040] Figure 8 is a schematic diagram of the tool trajectory optimized by the real-time tool position trajectory optimization method provided in Embodiment 1 of the present invention;
[0041] Figure 9 is a schematic diagram of the machining effect before optimization using the real-time tool position trajectory optimization method provided in Embodiment 1 of the present invention;
[0042] Figure 10 is a schematic diagram of the machining effect after optimization using the real-time tool position trajectory optimization method provided in Embodiment 1 of the present invention; Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0044] Example 1
[0045] A method for real-time optimization of tool path trajectory during CNC machining includes:
[0046] 1) Based on the current CNC machining process parameters and trajectory geometry, the entire tool position trajectory is divided into several preprocessing intervals; among which, the tool position trajectory includes: the tool position sequence; the tool position includes the tool tip position in the workpiece coordinate system and the position of each rotation axis of the corresponding tool axis in the machine tool coordinate system;
[0047] The CNC system reads and parses the G-code program segment information line by line, and divides the entire tool position trajectory into several preprocessing intervals based on the current CNC machining process parameters and trajectory geometry. In this embodiment, the division points when dividing the entire tool position trajectory into several preprocessing intervals include: the first and last tool positions of the trajectory line segments corresponding to G00, G02, and G03 instructions in the tool position trajectory; the points where the commanded feed rate changes in the tool position trajectory; the first and last tool positions of the trajectory line segments where the distance between the tool tip points is greater than a preset length (in this embodiment, the preset length is 10mm); and the transition points where the external rotation angle of the tool tip point is greater than a preset angle (in this embodiment, the preset angle is 15°). The trajectory line segment is the line connecting two adjacent tool positions in the tool position trajectory.
[0048] Preferably, in order to improve efficiency, after dividing the entire tool position trajectory based on the above-mentioned dividing points, the number of trajectory segments in each interval is counted, and the interval with the number of trajectory segments greater than a preset number (3 in this embodiment) is taken as the preprocessing interval, so as to perform subsequent optimization processing on the tool position trajectory in each preprocessing interval; the tool position trajectory in the interval with the number of trajectory segments greater than the above-mentioned preset number is not subject to subsequent optimization processing.
[0049] 2) Optimize the tool trajectory in each preprocessing interval to optimize the entire tool trajectory; as shown in Figure 1, the specific process is as follows:
[0050] S1. Fit the tool tip position in the tool position trajectory in the preprocessing interval to obtain the tool tip curve; calculate the arc length between each tool tip and the first tool position on the tool tip curve to obtain the travel of each tool tip.
[0051] Specifically, methods such as Bessel interpolation, B-spline fitting, and Akima spline fitting can be used to fit the tool tip position in the tool position trajectory within the preprocessing interval.
[0052] Preferably, in one optional embodiment, the method for fitting the tool tip position in the tool position trajectory within the preprocessing interval includes:
[0053] Calculate the tangent vector of each blade tip on the blade tip trajectory in the preprocessing interval; the blade tip trajectory is the line connecting the positions of each blade tip on it; in one optional implementation, the tangent vector of the blade tip trajectory corresponding to each blade tip can be estimated by extrapolation and interpolation based on the position of each blade tip on the blade tip trajectory; specifically, for the blade tip at the first and last positions on the blade tip trajectory, the tangent vector is estimated by extrapolation, and for the blade tip at other positions, the tangent vector is estimated by interpolation.
[0054] Based on the tangent vector and contour error requirements of each tool tip, a smooth, spliced cubic Bezier curve interpolation trajectory is constructed between each tool tip. The specific process is as follows:
[0055] For each pair of adjacent blade tip points on the blade tip trajectory in the preprocessing interval, a cubic Bezier curve C(u) is used to fit the trajectory segments; u∈[0,1];
[0056] The control points for the cubic Bezier curve include P0, P1, P2, and P3.
[0057] P0, P1, P2 and P3 all satisfy the condition that the modulus of the derivative of C(u) is equal when u takes the values of 0, 0.5 and 1 respectively, that is, |C′(0)|=|C′(0.5)|=|C′(1)|;
[0058] Control points P0 and P3 are the first and last tool tip points of the above trajectory line segment, respectively;
[0059] P1 and P2 are points on the tangent vector direction of the tool tip trajectory of P0 and P3 in the preprocessing interval, respectively, and it is ensured that line segment P1P2 is parallel to line segment P0P3, and the distance between line segment P1P2 and line segment P0P3 is within the maximum allowable contour deviation range.
[0060] Specifically, let T0 and T3 be the unit tangent vectors of the curve at the control points P0 and P3 at the beginning and end points. Based on α=|C′(0)|=|C′(0.5)|=|C′(1)|, then we have:
[0061]
[0062]
[0063] Differentiating C(u) with respect to u = 0.5, we have:
[0064]
[0065]
[0066] The simultaneous equations yield the following results:
[0067] aα 2 +bα+c=0
[0068] in
[0069] a = 16 - |T0 + T3| 2
[0070] b = 12(P3 - P0)(T0 + T3)
[0071] c = -36|P3 - P0| 2
[0072] Solving this equation and taking the positive root yields the initial value of α, α1; let the maximum permissible profile deviation be denoted as... according to We can solve for α ε To meet the trajectory deviation requirement, we take α = min(α1, α2). ε ).
[0073] Substitute α into the expression and P1 and P2 can be calculated, thus obtaining the expression for the cubic Bezier curve mentioned above.
[0074] C(u)=(1-u) 3 P0+3(1-u) 2 uP1+3(1-u)u 2 P2+u 3 P3
[0075] By constructing Bezier interpolation curves between each tool tip point, a smooth tool tip point interpolation trajectory (tool tip point curve) that satisfies the error constraint can be obtained.
[0076] Furthermore, in one alternative implementation, when calculating the arc length between the cutting tip point A and the first cutting point O on the cutting tip point curve, the arc length between the two can be calculated directly; alternatively, the arc lengths between all adjacent cutting tip points before cutting tip point A can be calculated first, and then summed to obtain the arc length between cutting tip point A and the first cutting point O on the cutting tip point curve.
[0077] S2. For each rotation axis corresponding to each tool tip point in the tool position trajectory in the preprocessing interval, fit the relationship between its position and the stroke of the corresponding tool tip point to obtain the trajectory curve of each rotation axis.
[0078] It should be noted that if the original tool tip position is directly correlated with the rotation axis position, a new tool tip position will be obtained after sampling the tool tip point on the tool tip point curve. However, the new tool tip point position may not be the tool tip point in the original tool tip point trajectory. Therefore, the corresponding rotation axis position cannot be obtained. Therefore, this invention fits the relationship between the rotation axis position and the stroke of the corresponding tool tip point to avoid the above problem and eliminate the sharp angle of the rotation axis trajectory in the stroke space.
[0079] Specifically, for each rotation axis corresponding to each tool tip point of the tool position trajectory in the preprocessing interval, the relationship between its position and the stroke of the corresponding tool tip point can be fitted using methods such as Bezier interpolation, B-spline fitting, Akima spline fitting algorithm, and double Bezier trajectory smoothing method based on minimum curvature fluctuation (see Research on Optimization Method of Five-Axis Linkage CNC Machining Based on Machine Tool Characteristics [D]. Gao Song, Huazhong University of Science and Technology).
[0080] In one alternative implementation, a dual Bezier trajectory smoothing method based on minimum curvature fluctuation is used to fit the relationship between its position and the stroke of the corresponding tool tip. A Bezier spline curve satisfying error constraints is constructed in the stroke space corresponding to each rotation axis to obtain the trajectory curve for each rotation axis.
[0081] Specifically, with the motion of the blade tip as the primary motion and the motion of each rotational axis as the secondary motion, a corresponding master-slave cooperative stroke space {s} is constructed. p ,s q The trajectory curve for each rotation axis is represented by a coordinate system; that is, a two-dimensional travel domain coordinate system is constructed with the main motion stroke as the horizontal axis and the position of the rotation axis as the vertical axis, and master-slave coordinated rotation axis smoothing is performed. Where s p The cumulative stroke of the tool entry point in the workpiece coordinate system, s q This corresponds to the position of the rotation axis q; in this embodiment, q = A, C.
[0082] The methods for constructing Bezier spline curves in the travel space corresponding to each rotation axis include:
[0083] As shown in Figure 2, for every three consecutive tool positions CL0, CL1, and CL2 in the stroke space, the maximum tool axis tolerance is... At that time, calculate the Bezier spline curve control points corresponding to the line connecting the tool position points CL0, CL1, and CL2:
[0084] 1) Initialize the rotation axis fitting error
[0085] 2) Obtain the midpoint P of line segment CL0CL1 a And the midpoint P of line segment CL1CL2 b ;
[0086] 3) Obtain a point q with a distance of ε from point CL1 along the direction of rotation (from the direction of motion);
[0087] 4) Obtain points a1 and b1 on the line connecting CL0, CL1, and CL2, such that line segment a1b1 passes through point q and intersects with point P. a P b parallel;
[0088] 5) Calculation
[0089]
[0090] in,
[0091]
[0092] Furthermore, the formula for calculating the proportional parameters related to the curve control points is as follows:
[0093]
[0094] The formula for calculating the spline scale parameter is:
[0095]
[0096] in,
[0097]
[0098]
[0099] a1, a2, a3, b1, b2, b3 are the coordinates of a1, a2, a3, b1, b2, b3 in the travel space, respectively; θ1 is the angle between line segment a1b1 and line segment CL0CL1, and θ2 is the angle between line segment a1b1 and line segment CL1CL2.
[0100] Let min(kk1,kk′1) = 0.76;
[0101] When g≥1, kk1≥kk′1, then let kk′1=0.76, kk′2=0.37, and other control polygon scale parameters are calculated in the order shown in Table 1.
[0102] Table 1
[0103]
[0104] When g < 1, kk1 < kk′1, then let kk1 = 0.76, kk2 = 0.37, and other control polygon scale parameters are calculated in the order shown in Table 2.
[0105] Table 2
[0106]
[0107] 6) Error Adjustment:
[0108] Calculate the ratio of the control polygon's side length to its maximum side length:
[0109]
[0110]
[0111] in,
[0112]
[0113]
[0114] Let h = max(h1, h2). When h > 1, the side length of the control point exceeds the maximum allowable value. In this case, the required error value ε will be reduced by a factor of h.
[0115]
[0116] Repeat steps 3)-6) to obtain the Bezier spline curve.
[0117] After obtaining the Bezier spline curve for each rotary axis, the Bezier spline curve for each rotary axis is adjusted based on error constraints. The specific process is shown in Figure 3. Taking a five-axis machine tool as an example, let the travel distances of its two rotary axes α1 and α2 be s respectively. q and s r Then it is necessary to construct a three-dimensional travel space {s}. p ,s q ,s r The tool axis trajectory under}, this three-dimensional travel space can be decomposed into two two-dimensional travel spaces {s p ,s p} and {s p ,s r Assuming a trajectory p1p2p3, and establishing a local coordinate system at point p2, then points p1 and p2 lie in the planar space {s}. p ,s q} and {s p ,s r Projection points exist on the surface. In the decomposed two-dimensional travel space, Bezier spline curves can be constructed in each travel space using the aforementioned method. The constructed curves are then subjected to tool position total contour error verification and spline reconstruction.
[0118] 1) First, calculate the error adjustment ratio, assuming {s} p ,s q} and {s p ,s r The coordinates of the midpoint q are respectively and
[0119]
[0120] 2) If δ < 1, then adjust {s} simultaneously. p ,s q} and {s p ,s r The position of the midpoint q
[0121]
[0122] 3) Reconstruct the transition curve by referring to the above method for constructing Bezier spline curves to obtain the trajectory curve of the rotation axis.
[0123] S3. Perform equal arc length sampling on the tool tip curve to obtain the tool tip sampling point position, and sample the trajectory curve of each rotation axis based on the stroke of the tool tip sampling point to obtain the position of each rotation axis sampling point; based on the tool tip sampling point position and the corresponding rotation axis sampling point position, obtain a new tool point position sequence to optimize the tool point trajectory in the preprocessing interval.
[0124] Specifically, the actual sampling step size is calculated based on the set target sampling step size and the length of the tool tip trajectory within the preprocessing interval. Then, equal-arc-length sampling is performed on the tool tip curve using the actual sampling step size to obtain the tool tip sampling point position sequence. Specifically, as shown in Figure 4, the total cumulative arc length of the tool tip curve within the preprocessing interval is denoted as L. acc The ideal sampling length is d. First, estimate the total number of sampling segments n = And select the actual sampling length On the knife tip interpolation curve, with d a Sampling is performed at arc length intervals to obtain the blade tip sampling point.
[0125] Based on the travel distance corresponding to the tool tip sampling point, synchronous sampling is performed on the trajectory curve of each rotation axis to obtain the rotation axis components (positions) corresponding to each tool tip sampling point. Specifically, as shown in Figure 5, when sampling at the tool tip point, the tool tip travel distance corresponding to point i is denoted as m. i On the trajectory curve of each rotation axis, m i The trajectory point corresponding to the horizontal coordinate may lie on the transition spline trajectory or a straight line segment. When the tool tip sampling point is on the transition spline, a cubic equation in one variable about the spline parameter u can be solved using the Shengjin formula, and the root of the equation between 0 and 1 is selected as the parameter u. i , will u i By substituting the spline parameter model, the corresponding tool axis coordinates can be obtained. When the sampled tool tip is on a straight line trajectory, its corresponding rotation axis position can be obtained through linear interpolation.
[0126] In one alternative implementation, the tool position in the new tool position sequence includes the tool tip sampling point position and the corresponding sampling point positions of each rotation axis.
[0127] In another optional implementation, the tool point positions in the new tool point position sequence above include the preprocessed tool tip sampling point positions and the corresponding positions of each rotation axis sampling point;
[0128] The method for obtaining the location of the preprocessed tool tip sampling point includes:
[0129] The tool tip sampling point position is filtered to make the tool tip sampling point position smooth, and when the filtered tool tip sampling point position exceeds the contour error constraint, the filtered tool tip sampling point position is adjusted.
[0130] It should be noted that dynamic Gaussian filtering, mean filtering, median filtering, and other methods can be used to filter the position of the blade tip sampling point; in this embodiment, dynamic Gaussian filtering is preferred to eliminate high-frequency fluctuations in the trajectory while retaining its key features.
[0131] Specifically, firstly, a dynamic Gaussian filtering algorithm is used to filter the tool tip sampling point positions. During the filtering process, the size of the Gaussian filtering window is dynamically adjusted according to the position of the tool tip point in the filtering interval. When the filtering center point is close to the endpoint of the preprocessing interval, the width of the filtering window is reduced according to the index of the filtering center point in the preprocessing interval. Specifically, in the preprocessing interval, a Gaussian filter is used to smooth the tool tip sampling point position sequence. Let the tool tip sampling point sequence in the preprocessing interval be P = {p i |i=1,2,…,n}, the filter target window size is w0, for p i When filtering points, if the following conditions are met... Adjust the filter window w1 = min(i,ni)*2+1.
[0132] Then, the tool tip point is adjusted based on the profile tolerance constraint. After tool tip point filtering, a profile error constraint is established between the tool tip point trajectory before and after filtering. The positions of tool tip points that do not meet the error constraint are adjusted to be within the given tolerance range. Specifically, as shown in Figure 6, after Gaussian filtering, a deviation band is constructed based on the tool tip point trajectory before filtering and the maximum tool tip point tolerance. The filtered tool tip points are then verified. For tool tip points that exceed the deviation band, they are adjusted to the nearest deviation band boundary position.
[0133] In this embodiment, a method of synchronous sampling of the tool tip point and tool axis trajectory is used to optimize the machining trajectory in real time, improving the uniformity of the tool trajectory and the speed planning performance. Figures 7 and 8 show a comparison of the trajectories before and after optimization using the real-time tool position trajectory optimization method provided by this invention. In actual machining, the real-time preprocessing method of the CNC system for re-dividing tool position trajectory points can improve the workpiece machining quality. As shown in Figures 9 and 10, before preprocessing, tool marks and cutting marks were generated in the corner area of the workpiece, but these disappeared after preprocessing.
[0134] In summary, this invention provides a preprocessing method for real-time re-division of tool path points during CNC machining. After the interpreter completes the G-code parsing, the entire tool path is preprocessed to improve the uniformity of the path length, angle, and tool axis changes between tool points, resulting in a uniform tool path sequence. This enhances the flexibility and accuracy of system speed planning, reduces abnormal speed fluctuations during machining, and improves the machining quality of the workpiece.
[0135] Furthermore, compared to offline methods for replanning or optimizing tool paths, this invention enables online optimization of tool paths during machining, reducing operational steps in production and resulting in shorter machining cycles and greater ease of use, making it easier to promote and apply.
[0136] Furthermore, compared to trajectory smoothing schemes based on corner smoothing or transition smoothing, this method re-divides the tool path points before transition smoothing, is not limited by the length of the tool tip unit in the original program segment, and enables subsequent speed planning to be more flexible and accurate.
[0137] In summary, the real-time tool path optimization method proposed in this invention can optimize the tool path in real time during machining, improve the uniformity of the length, angle and tool axis changes between tool points, and enhance the performance of path speed planning. It avoids the problems of complex operation and long machining cycle of existing offline optimization methods. At the same time, compared with the path smoothing method based on corner smoothing, this method is not limited by the length of the tool tip unit in the original program segment, which can improve the flexibility and accuracy of the system in the subsequent speed range division process, thereby improving the machining quality.
[0138] Example 2
[0139] A real-time tool position trajectory optimization system includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the real-time tool position trajectory optimization method provided in Embodiment 1 of the present invention.
[0140] The relevant technical solutions are the same as those in Embodiment 1 of this invention, and will not be described in detail here.
[0141] Example 3
[0142] A numerical control system includes:
[0143] The tool position trajectory optimization module is used to execute the real-time tool position trajectory optimization method provided in Embodiment 1 of the present invention.
[0144] The tool position trajectory interpolation module is used to interpolate the optimized tool position trajectory and transmit the interpolation information to the machine tool servo system to drive the machine tool to process the material.
[0145] The relevant technical solutions are the same as those in Embodiment 1 of this invention, and will not be described in detail here.
[0146] Example 4
[0147] A computer-readable storage medium includes a stored computer program, wherein when the computer program is run by a processor, it controls the device where the storage medium is located to execute the real-time tool position trajectory optimization method provided in Embodiment 1 of the present invention.
[0148] The relevant technical solutions are the same as those in Embodiment 1 of this invention, and will not be described in detail here.
[0149] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for real-time optimization of tool path trajectory during CNC machining, characterized in that, include: Based on the current CNC machining process parameters and trajectory geometry, the entire tool position trajectory is divided into multiple preprocessing intervals; The tool position trajectory includes: a sequence of tool position locations; the tool position locations include the tool tip location and the location of each rotation axis corresponding to the tool axis; the tool position trajectory in each preprocessing interval is optimized as follows: the tool tip location in the tool position trajectory in the preprocessing interval is fitted to obtain a tool tip curve; the arc length between each tool tip and the first tool position is calculated on the tool tip curve to obtain the travel distance of each tool tip; for each rotation axis corresponding to each tool tip in the tool position trajectory in the preprocessing interval, the relationship between its position and the travel distance of the corresponding tool tip is fitted to obtain the trajectory curve of each rotation axis; the tool tip curve is sampled with equal arc length. The tool tip sampling point position is obtained, and the trajectory curve of each rotation axis is sampled based on the travel of the tool tip sampling point to obtain the position of the sampling point of each rotation axis; based on the tool tip sampling point position and the corresponding position of each rotation axis sampling point, a new tool point position sequence is obtained, thus obtaining the optimized tool point trajectory in the preprocessing interval; the method for fitting the tool tip position in the tool point trajectory in the preprocessing interval includes: fitting the trajectory line segment between each pair of adjacent tool tip points on the tool point trajectory in the preprocessing interval with a cubic Bezier curve C(u); u∈[0,1]; wherein, the control points of the cubic Bezier curve include 、 、 and ; 、 、 and All satisfy the condition that the magnitude of the derivative of C(u) is equal when u takes the values of 0, 0.5, and 1, respectively; control points and These are the first and last two blade tip points of the trajectory line segment; 、 They are respectively 、 Points in the direction of the tangent vector of the tool tip trajectory within the preprocessing interval, ensuring that the line segment... With line segment Parallel, and line segments With line segment The distance between them is within the maximum allowable contour deviation range; the tool tip trajectory is the line connecting the positions of each tool tip point.
2. The real-time optimization method for tool position trajectory according to claim 1, characterized in that, The new tool position sequence includes the preprocessed tool tip sampling point position and the corresponding sampling point positions of each rotation axis. The method for obtaining the preprocessed tool tip sampling point position includes: filtering the tool tip sampling point position, and adjusting the filtered tool tip sampling point position when the filtered tool tip sampling point position exceeds the contour error constraint.
3. The real-time tool position trajectory optimization method according to claim 2, characterized in that, A dynamic Gaussian filtering algorithm is used to filter the sampling point position of the blade tip.
4. The real-time tool position trajectory optimization method according to any one of claims 1-3, characterized in that, The dividing points when dividing the entire tool position trajectory into several preprocessing intervals include: the first and last tool positions of the trajectory line segments corresponding to the G00, G02, and G03 commands in the tool position trajectory; the points where the commanded feed rate changes in the tool position trajectory; the first and last tool positions of the trajectory line segments where the distance between the tool tip points is greater than the preset length in the tool position trajectory; and the transition points where the external rotation angle of the tool tip points in the tool position trajectory is greater than the preset angle; the trajectory line segment is the line connecting two adjacent tool positions in the tool position trajectory.
5. A real-time tool position trajectory optimization system, characterized in that, include: The system includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the real-time tool position trajectory optimization method according to any one of claims 1-4.
6. A numerical control system, characterized in that, include: A tool position trajectory optimization module is used to execute the real-time tool position trajectory optimization method according to any one of claims 1-4; The tool position trajectory interpolation module is used to interpolate the optimized tool position trajectory and transmit the interpolation information to the machine tool servo system to drive the machine tool to process the material.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein when the computer program is run by a processor, it controls the device where the storage medium is located to execute the real-time tool position trajectory optimization method according to any one of claims 1-4.
Citation Information
Patent Citations
Method for directly generating tool path based on measured data
CN102608954A
Numerical control machining tool path optimization method based on asymmetric PH curve
CN114721327A