A local smoothing method for five-axis CNC trajectory based on B-spline curve
By adopting a local smoothing method based on B-spline curve in five-axis CNC machining, the characteristic length of the transition curve is adaptively adjusted, and the problem of limited increase in feed speed at corners is solved, achieving more efficient processing speed and accuracy.
Patent Information
- Application Number
- CN202211212361.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2042-09-30
AI Technical Summary
In five-axis CNC machining, the existing local smoothing scheme has a limited increase in feed speed at corners, and the curvature of the transition curve is large, resulting in fluctuations in feed rate and low processing efficiency.
The local smoothing method based on the B-spline curve is adopted to adaptively adjust the characteristic length of the transition curve, insert the transition curve with the smallest curvature possible, optimize the feed speed difference, and reduce the curvature of the transition curve.
Significantly increase the feed speed at the corners, reduce feed rate fluctuations, and improve processing speed and accuracy.
Smart Images

Figure CN115616977B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of numerical control machining and manufacturing, and in particular relates to a local smoothing method of a five-axis numerical control trajectory based on a B-spline curve. Background Art
[0002] In five-axis CNC machining, the tool path is usually represented by G01 code, which consists of a number of continuous straight line segments. At the end points of the line segments, the trajectory is only 0-order continuous, resulting in discontinuous machining speed here, which causes feed rate fluctuations. In order to reduce feed rate fluctuations at corners, the tool needs to stop completely at the end points and change the machining direction before moving, which will seriously affect the machining efficiency.
[0003] In order to solve the above problems, it is necessary to improve the smoothness of the trajectory. The current trajectory smoothing solutions are mainly divided into two categories: (1) Global smoothing solution: This solution uses parametric curves to interpolate or fit the original G01 trajectory. (2) Local smoothing solution: This solution uses parametric curves to transition part of the corner of the original G01 trajectory. Among them, the contour error of the global solution is difficult to control, usually requires multiple iterations and is unstable, so the local smoothing solution is more concerned. In five-axis local smoothing, the following requirements must be met: (1) The contour error of the tool position trajectory should be limited to a certain range; (2) The contour error of the tool axis direction trajectory should be limited to a certain range; (3) The transition curves between the tool position and tool axis direction trajectories should meet the continuity condition.
[0004] Most existing local smoothing solutions use symmetrical spline curves as transition curves. On the other hand, in order to prevent adjacent transition curves from overlapping, the transition length of the transition curve is usually limited to no more than half the length of the straight line segments on both sides. Both of these settings make insufficient use of the straight line segment trajectory, resulting in a smaller scale and larger curvature of the transition curve, which results in a limited increase in feed speed at corners. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a local smoothing method for a five-axis CNC trajectory based on a B-spline curve, which can insert a transition curve with the smallest possible curvature at the corner under the premise of limiting the contour error and non-overlapping of the transition curve, and take the minimum feed speed difference as the optimization goal, and adaptively adjust the characteristic length of two adjacent transition curves. It can reduce the curvature of the transition curve while eliminating overlap, and increase the feed speed at the corner, thereby reducing subsequent feed rate fluctuations and improving processing speed and accuracy.
[0006] The local smoothing method of the five-axis numerical control trajectory based on the B-spline curve in the present invention comprises the following steps:
[0007] S1. Temporarily determine the characteristic length value of the transition curve of the tool trajectory according to the limitation of contour error.
[0008] Assume that the tool position of the given original G01 trajectory is {P 0 , P 1 , ..., P n}, the tool axis direction point is {R 0 , R 1 , ..., R n}, where P i =(X i , Y i , Z i ), R i =(A i , C i ). During the tool movement, there are n-1 sharp corners on the tool path, at points P i (i=1,...,n-1). There are also n-1 sharp corners in the tool axis direction, at points r i (i=1, ..., n-1). At each sharp corner, a transition curve is required to achieve local smoothness.
[0009] Assume that the maximum allowable tool position profile error is ε p,max , the maximum contour error in the tool axis direction is ε r,max . Note the knife position P i Transition curve B at (i=1, ..., n-1) i The characteristic lengths of (u) are l 1,i (i=1, ..., n-1) and l 2,i (i=1,...,n-1), axial point R i Transition curve at (i=1,...,n-1) The characteristic lengths are and First, calculate the angle θ of the tool path tip angle i (i=1, ..., n-1), can be calculated by the following formula (1):
[0010]
[0011] in represents the inner product of these two vectors, Indicates the modulus of the vector. Transition curve B of the tool path i The upper limit of the characteristic length of (u) max,i (i=1, ..., n-1), can be calculated by the following formula (2):
[0012]
[0013] So for P i The sharp corners at (i=1,...,n-1) are used for local smoothing B i The characteristic length of (u) is temporarily set to l 1,i = l 2,i = l max,i (i=1,...,n-1).
[0014] S2. Adjust the characteristic length value of the transition curve of the tool trajectory according to the non-overlapping restriction.
[0015] In step S1, the upper limit of the characteristic length of the transition curve of the tool path under the limitation of the contour error is given, and the characteristic length is temporarily set as the upper limit. In step S2, in order to prevent the overlapping of adjacent transition curves, the characteristic length of the transition curve at the overlap is adjusted.
[0016] Specifically, if This means that B i (u) and B i+1 (u) overlap occurs, where L i =|P i -P i+1 | is the length of the original tool path. At this time, it is necessary to appropriately reduce l 2,i and l 1,i+1 The present invention constructs the following constrained optimization model to adjust the characteristic length value:
[0017]
[0018] in The coefficient that represents the approximate relationship between the speed and the square root of the characteristic length at the front and rear corners. K = 1 / 3 represents the ratio of the length of each transition curve to the length of the original tool path, in order to prevent a transition curve from being too small.
[0019] Solve l according to the following process 2,i and l 1,i+1 :
[0020] ①If but Go to ⑥; otherwise go to ②.
[0021] ②If but Turn to ⑥; otherwise, turn to ③.
[0022] ③ Order and
[0023] ④If u<u l , then let u=u l . If u>u r, then let u=u r .
[0024] ⑤ Order and
[0025] ⑥ Output l 2,i and l 1,i+1 .
[0026] In addition, for B 1 (u) and B n-1 (u), and also prevent their transition length from exceeding the length of the original tool path. Specifically, let and
[0027] S3. Determine the characteristic length value of the transition curve between the tool position and the tool axis direction trajectory according to the continuity requirement.
[0028] In step S1 and step S2, the characteristic length value of the transition curve of the tool path is temporarily determined. For the tool axis direction trajectory, not only the contour error must be less than or equal to ε r,max , the change of tool axis direction with respect to tool position displacement should be continuous.
[0029] First define in is the length of the original tool axis trajectory. The characteristic value of the transition curve of the tool axis trajectory is first determined as:
[0030]
[0031] At this point, it satisfies:
[0032]
[0033] The change of tool axis direction with respect to tool position displacement is continuous, and there is no overlap between the transition curves of the tool axis direction trajectory.
[0034] In order to limit the transition error, for i=1, 2, ..., n-1, if in is the tool axis direction angle in space and The angle between should be reduced to At the same time 1,i Reduce to if but Reduce to At the same time 2,i Reduce to
[0035] S4. Determine the control points of the transition curve between the tool position and the tool axis direction trajectory.
[0036] In step S3, the characteristic length l of each transition curve at the tool position and tool axis direction trajectory is determined. 1,i , l 2,i , and Next, we give P i and R i The control points and expressions of the transition curve of the sharp corner at (i=1,...,n-1).
[0037] The calculation formula (6) for the control points of the transition curve of the tool path is as follows:
[0038]
[0039] in
[0040] After obtaining these control points, the expression (7) of the transition curve of the tool path is as follows:
[0041]
[0042] Where N j,p (u) is the B-spline basis function defined on the knot vector U = [0, 0, 0, 0, 0, 0.5, 1, 1, 1, 1, 1, 1]. i (u) This transition curve replaces the transition curve from b i,0 To P i to b i,6 These two straight line segments complete the i The sharp corners are locally smooth.
[0043] The calculation formula (8) for the control points of the transition curve of the tool axis trajectory is as follows:
[0044]
[0045] in
[0046] After obtaining these control points, the expression (9) of the transition curve of the tool axis trajectory is as follows:
[0047]
[0048] use This transition curve replaces the to R i arrive These two straight line segments complete the i The sharp corners are locally smooth.
[0049] P i and R i The sharp corners at (i=1, ..., n-1) are all locally smooth, and the smooth trajectory of the original five-axis G01 trajectory is obtained.
[0050] The beneficial effects of the present invention are:
[0051] The present invention extracts spline curve features, adopts multi-constrained linear trajectory approximation, and optimizes the problem construction and solution methods. It uses high-order continuous curves to transition the sharp corners in the tool position and tool axis direction trajectory, thereby improving the continuity of the five-axis CNC trajectory, thereby reducing subsequent feed rate fluctuations and improving processing speed and accuracy.
[0052] In the local smoothing scheme, the maximum distance between the original trajectory and the smooth trajectory, that is, the contour error, should be limited to a certain range, and the transition curves cannot overlap. The present invention uses a classic B-spline curve as the transition curve to replace a part of the sharp corner of the original G01 trajectory, thereby improving the continuity of the trajectory. The transition curve is determined by two characteristic lengths. First, according to the limitation of the tool position contour error, the characteristic length value of the transition curve of the tool position trajectory is temporarily determined. When two adjacent transition curves in the tool position trajectory overlap, an optimization problem is constructed and solved to adjust the characteristic length value of the transition curve of the tool position trajectory. Then, the characteristic length value of the transition curve of the tool axis direction trajectory is determined according to the continuity condition, and it is appropriately adjusted according to the limitation of the tool axis direction contour error. Finally, according to the characteristic length of the transition curve of the tool position and tool axis direction trajectory and the endpoints on the original trajectory, the control point of each transition curve is determined, thereby determining the transition curve.
[0053] In order to insert a transition curve with the smallest curvature possible at the corner under the premise of limiting the contour error and the transition curve not overlapping, the present invention designs a local smoothing method based on an asymmetric B-spline curve. In this method, there is no simple restriction that the transition length of the transition curve does not exceed half of the length of the straight line segments on both sides of it, but firstly only the transition curve is temporarily limited according to the contour error. Then, in the overlapping part, the characteristic length of the two adjacent transition curves is adaptively adjusted with the minimum feed speed difference as the optimization goal, so as to reduce the curvature of the transition curve and increase the feed speed at the corner while eliminating the overlap. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 is a schematic diagram of the G01 tool path in Example 1;
[0055] Figure 2 is a schematic diagram of the G01 tool axis trajectory in Example 1;
[0056] Figure 3It is the overall flow chart of the present invention;
[0057] Figure 4 YesP 4 Schematic diagram of local smoothness at ;
[0058] Figure 5 YesR 4 Schematic diagram of local smoothness at ;
[0059] Figure 6 It is the smooth trajectory of the G01 tool path in Example 1;
[0060] Figure 7 It is the smooth trajectory of the G01 tool axis trajectory in Example 1. DETAILED DESCRIPTION
[0061] The specific implementation modes of the present invention are described below in conjunction with examples. However, the following examples are only used to illustrate the present invention in detail and are not intended to limit the scope of the present invention in any way.
[0062] Embodiment 1: A local smoothing method for a five-axis CNC trajectory based on a B-spline curve, Figure 1 , Figure 2 Taking a G01 trajectory as an example, the above steps of the present invention are implemented. The overall process of the present invention is as follows Figure 3 The tool position and tool axis direction trajectory point coordinates of this trajectory are shown in Table 1.
[0063] Table 1 Tool position and tool axis direction coordinates of G01 trajectory points
[0064] X(mm) Y(mm) Z(mm) A(deg) C(deg) <![CDATA[P 0 ]]> 32.2500 -17.8350 -18.9370 <![CDATA[R 0 ]]> 83.2637 87.8129 <![CDATA[P 1 ]]> 32.0180 -18.2330 -17.9050 <![CDATA[R 1 ]]> 83.9555 87.5333 <![CDATA[P 2 ]]> 32.0090 -18.2360 -17.2170 <![CDATA[R 2 ]]> 84.3011 87.3849 <![CDATA[P 3 ]]> 32.1000 -18.0540 -16.5470 <![CDATA[R 3 ]]> 84.5775 87.2537 <![CDATA[P 4 ]]> 32.3280 -17.6080 -15.8650 <![CDATA[R 4 ]]> 84.7616 87.1220 <![CDATA[P 5 ]]> 32.6450 -16.9670 -15.4210 <![CDATA[R 5 ]]> 84.7731 87.0183 <![CDATA[P 6 ]]> 32.9390 -16.3510 -15.2720 <![CDATA[R 6 ]]> 84.6695 86.9429 <![CDATA[P 7 ]]> 33.2410 -15.6950 -15.3290 R7 84.4681 86.8727 <![CDATA[P 8 ]]> 33.7760 -14.4610 -15.9200 <![CDATA[R 8 ]]> 83.8461 86.8000 <![CDATA[P 9 ]]> 34.3520 -12.9810 -16.6840 <![CDATA[R 9 ]]> 82.8712 86.8457
[0065] In step S1, the maximum permissible contour error is given as ε p,max =0.1, calculate P according to formula (1) i The angle θ of the sharp corner at (i=1, ..., 8) i Substitute the angle value into formula (2) to calculate the upper limit l of the characteristic length of the transition curve of the tool path max,i , we get l max,1 =0.6556, l max,2 =0.8784,l max,3 =0.7912, l max,4 =0.7027, l max,5 =0.7859, l max,6 =0.9103,l max,7 =0.7975 and l max,8 =5.4791.
[0066] If the maximum value is taken directly, there will be overlap between two adjacent transition curves. Eliminate the overlap according to the steps in step S2 and get l 1,i and l 2,i The values are shown in Table 2 below.
[0067] Table 2 l obtained by eliminating overlap 1,i and l 2,i Value
[0068]
[0069]
[0070] In step S3, the characteristic length of the transition curve of the tool axis trajectory is calculated according to formula (4), and the specific values are shown in Table 3 below.
[0071] Table 3 Characteristic length values of transition curve of tool axis trajectory
[0072]
[0073] Since the contour error at this point is less than the given threshold, the feature length is not further adjusted.
[0074] In step S4, the characteristic length calculated in the previous step is substituted into formulas (6) and (8) to obtain the control points of the transition curve, and the expression of the transition curve is obtained from formulas (7) and (9). The transition curve is used to replace part of the straight line segment trajectory, where P 4 and R 4 For example. Figure 4 , Figure 5 The dotted line indicates P 4 and P 4 The straight line segments on both sides of the point are traced, the solid line is the transition curve, and the broken line segment b 4,0 -P 4 -b 4,6 and is replaced by the transition curve. Similarly, by replacing a part of each corner with the transition curve, the smooth trajectory of the original trajectory is obtained. The smooth trajectory of this example is Figure 6 , Figure 7 shown.
[0075] The present invention is a local smoothing method for a five-axis CNC trajectory based on an asymmetric B-spline curve. First, the maximum contour error allowed for the tool position and the tool axis direction trajectory is given, and based on this, the maximum value of the characteristic length of the transition curve of the tool position trajectory is first calculated. Then, in order to prevent the overlap of two adjacent transition curves, an optimization model considering the speed on the two transition curves is given, and a solution process is given. After determining the characteristic length value of the transition curve of the tool position trajectory, the characteristic length value of the transition curve of the tool axis direction trajectory is determined according to the continuity condition, and they are adjusted when the contour error on the tool axis direction trajectory exceeds a given threshold. Finally, the control point of the transition curve is calculated by the characteristic length to obtain the expression of the transition curve. The transition curve is used to replace a part of the straight line segment to obtain a high-order continuous five-axis smooth trajectory. Experimental results show that the method proposed by the present invention can obtain a high-order smooth trajectory with the smallest curvature change as much as possible under the premise of ensuring contour error and non-overlap, which is more conducive to trajectory processing.
[0076] The present invention has been described in detail above in conjunction with the embodiments. However, those skilled in the art will appreciate that, without departing from the spirit of the present invention, the specific parameters in the above embodiments may be changed to form a plurality of specific embodiments, which are all within the common variation range of the present invention and will not be described in detail herein.
Claims
1. A local smoothing method for a five-axis CNC trajectory based on a B-spline curve, characterized in that: The following steps are involved: S1, temporarily determine the characteristic length value of the transition curve of the tool trajectory according to the limitation of the contour error; Assume that the tool position of the given original G01 trajectory is {P0, P1, ..., P n }, the tool axis direction points are {R0, R1,…, R n }, where P i =(X i ,Y i ,Z i ), R i =(A i ,C i ); During the tool movement, there are n-1 sharp corners on the tool trajectory, at point P i (i=1,…,n-1); there are also n-1 sharp corners in the tool axis direction, respectively at point R i (i=1,…,n-1); at each sharp corner, a transition curve is needed to achieve local smoothness; Assume that the maximum allowable tool position profile error is ε p,max , the maximum contour error in the tool axis direction is ε r,max ; Record the knife position P i Transition curve B at (i=1,…,n-1) i The characteristic lengths of (u) are l 1,i (i=1,…,n-1) and l 2,i (i=1,…,n-1), axial point R i Transition curve at (i=1,…,n-1) The characteristic lengths are and According to the angle θ of the tool path tip i (i=1,…,n-1), calculate the transition curve B of the tool path i The upper limit of the characteristic length of (u) max,i (i=1,…,n-1); For P i The sharp corner at (i=1,…,n-1) will temporarily set the characteristic length used for local smoothing to l 1,i = l 2,i = l max,i (i=1,…,n-1); S2, adjusting the characteristic length value of the transition curve of the tool trajectory according to the non-overlapping restriction; In order to prevent adjacent transition curves from overlapping, the characteristic length of the transition curves at the overlapping locations is adjusted; like This means that B i (u) and B i+1 (u) overlap occurs, where L i =|P i -P i+1 | is the length of the original tool path. At this time, l needs to be appropriately reduced. 2,i and l 1,i+1 , The characteristic length value is adjusted by constructing a constrained optimization model; S3, determining the characteristic length value of the transition curve of the tool position and the tool axis direction trajectory according to the continuity requirement; definition in is the length of the original tool axis trajectory; the characteristic value of the transition curve of the tool axis trajectory is first determined as: At this point, it satisfies: The change of tool axis direction with respect to tool position displacement is continuous, and the transition curves of tool axis direction trajectory do not overlap. In order to limit the transition error, for i = 1, 2, ..., n-1, if in is the tool axis direction angle in space and The angle between should be reduced to At the same time 1,i Reduce to if but Reduce to At the same time 2,i Reduce to S4, determining the control points of the transition curve between the tool position and the tool axis direction trajectory; According to the characteristic length l of each transition curve at the tool position and tool axis direction trajectory determined in step S3 1,i , l 2,i , and Given P i and R i The control points and expressions of the transition curve of the sharp corner at (i=1,…,n-1) are i and R i The sharp corners at (i=1,…,n-1) are locally smoothed, and the smooth trajectory of the original five-axis G01 trajectory is obtained.
2. The local smoothing method of a five-axis CNC trajectory based on a B-spline curve according to claim 1, characterized in that: In step S1, the included angle θ of the tool path sharp angle i (i=1,…,n-1), calculated by the following formula (1): in represents the inner product of these two vectors, Represents the magnitude of a vector; Transition curve B of tool path i The upper limit of the characteristic length of (u) max,i (i=1,…,n-1), calculated by the following formula (2):
3. The local smoothing method of a five-axis CNC trajectory based on a B-spline curve according to claim 1, characterized in that: In step S2, the characteristic length value is adjusted by constructing the following constrained optimization model: in The coefficient that represents the approximate relationship between the speed and the square root of the characteristic length at the front and rear corners; K=1 / 3 represents the ratio of the length of each transition curve to the length of the original tool trajectory.
4. The local smoothing method of a five-axis CNC trajectory based on a B-spline curve according to claim 3 is characterized in that: In step S2, solve l according to the following process 2,i and l 1,i+1 : ①If but Turn ⑥; Otherwise, go to ②; ②If but Turn ⑥; Otherwise, go to ③; ③ Order and ④Young u l , Rule u = u l ; Young r , Rule u = u r ; ⑤ Order and ⑥ Output l 2,i and l 1,i+1 ; For B1(u) and B n-1 (u), in order to prevent their transition length from exceeding the length of the original tool path, let and 5. The local smoothing method of a five-axis CNC trajectory based on a B-spline curve according to claim 1, characterized in that: In step S4, the calculation formula (6) of the control point of the transition curve of the tool path is as follows: in After obtaining these control points, the expression (7) of the tool path transition curve is as follows: Where N j,p (u) is the B-spline basis function defined on the knot vector U = [0,0,0,0,0,0,0.5,1,1,1,1,1,1]; i (u) This transition curve replaces the transition curve from b i,0 To P i to b i,6 These two straight line segments complete the i The sharp corners are locally smooth; The calculation formula (8) for the control points of the transition curve of the tool axis trajectory is as follows: in After obtaining these control points, the expression of the transition curve of the tool axis trajectory is as follows: use This transition curve replaces the to R i arrive These two straight line segments complete the i The sharp corners are locally smooth; P i and R i The sharp corners at (i=1,…,n-1) are locally smoothed, and the smooth trajectory of the original five-axis G01 trajectory is obtained.
Citation Information
Patent Citations
Numerical control machining tool path optimization method based on asymmetric PH curve
CN114721327A
Motion mixing corner smoothing method based on combined feed rate
CN114995298A