A linear machining path fitting method and system with controllable error
By using a linear machining path fitting method with controllable errors in the CNC system and using a quadratic B-spline curve to fit the linear machining path, the problem of frequent acceleration and deceleration of the motor is solved, and higher machining speed and stability are achieved.
Patent Information
- Application Number
- CN202410712897.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2044-06-04
AI Technical Summary
When existing CNC systems deal with complex parts to be processed, traditional linear interpolation methods cause frequent acceleration and deceleration of the motor, affecting the processing speed and stability.
The linear machining path fitting method with controllable error is used to set the maximum approximation error of the fitting curve, set the type value point and control point, determine the quadratic B-spline curve, and fit the linear machining path.
The error controllable of linear machining paths is achieved, the complexity of the algorithm is reduced, the processing speed and stability are improved, and the error controllable and the path is locally smooth.
Smart Images

Figure CN118605388B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer-aided manufacturing and numerical control machining, and particularly relates to a linear machining path fitting method and system with controllable error. Background Art
[0002] The numerical control system is the core component of a machine tool, and the quality of its performance determines the machining stability and machining accuracy of the numerical control machine tool. With the development and progress of modern numerical control technology, higher requirements are put forward for the machining stability, machining speed and machining accuracy of the numerical control system. For relatively complex parts to be machined, in order to meet the requirements of machining accuracy, the complex curve shapes of the model are often divided into a large number of continuous G01 small line segments. How to handle these large numbers of continuous G01 small line segments determines the machining speed and stability of the numerical control system. If the traditional linear interpolation method is used, it will cause the motor to be in a frequent acceleration and deceleration state, thus seriously affecting the machining speed and stability. Summary of the Invention
[0003] The purpose of the present invention is to overcome the defects of the prior art. The present invention provides a linear machining path fitting method and system with controllable error, and the algorithm complexity of the present invention is low and can meet the requirements of controllable machining path error.
[0004] In order to achieve the expected effect, the present invention adopts the following technical solutions:
[0005] The present invention discloses a linear machining path fitting method with controllable error, including:
[0006] S1. Set the maximum approximation error of the fitting curve according to the linear machining path;
[0007] S2. Set a number of type value points on the linear machining path and form a type value point set;
[0008] S3. Set control points based on the type value points in the type value point set and form a control point set;
[0009] S4. Determine a quadratic B-spline curve according to a number of control points in the control point set;
[0010] S5. Fit the linear machining path with the quadratic B-spline curve.
[0011] Further, the S3 specifically includes: connecting adjacent two type value points in the type value point set to form a number of type value point line segments, setting a control point on each of the adjacent two type value point line segments, and the distances from the control points on the adjacent two type value point line segments to the intersection point of the adjacent two type value point line segments are equal.
[0012] Further, the first control point in the control point set coincides with the first value point in the value point set, and the last control point in the control point set coincides with the last value point in the value point set.
[0013] Further, the distance satisfies the following expression:
[0014] d i = min{ε / sin(θ i / 2), ||P i-1 P i || / 3, ||P i P i+1 || / 3};
[0015] where i = 1, 2, …, n - 1, n is a positive integer greater than or equal to 2; ε is the maximum approximation error; P i-1 , P i , P i+1 are all value points, and θ i is the included angle between two adjacent value point line segments P i-1 P i and P i P i+1 .
[0016] Further, the S4 specifically includes: determining a quadratic B-spline curve according to 4 control points in the control point set, where the first control point Q i,0 coincides with the value point P i-1 , the second control point Q i,1 is on the value point line segment P i-1 P i , the third control point Q i,2 is on the value point line segment P i P i+1 , and the fourth control point Q i,3 is on the control point line segment Q i,2 Q i+1,1 , and the curvature values of the quadratic B-spline curve with Q i,0 , Q i,1 , Q i,2 and Q i,3 as control points and the quadratic B-spline curve with Q i+1,0 , Q i+1,1 , Q i+1,2 and Q i+1,3 as control points are equal at the connection point Q i,3 , and Q i+1,0 coincides with Q i,3 .
[0017] Further, the second control point Q i,1 satisfies the following expression: Qi,1 = P i - d i e i , where e i is the unit vector of vector P i- 1P i .
[0018] Furthermore, the third control point Q i,2 satisfies the following expression: Q i,2 = P i + d i e i+1 , where e i+1 is the unit vector of vector P i P i+1 .
[0019] Furthermore, the fourth control point Q i,3 satisfies the following expression:
[0020] Q i,3 = P i + λ i,2 d i e i+1
[0021] where λ i,2 is the ratio of the distance from the fourth control point Q i,3 to P i to the distance from the third control point Q i,2 to P i .
[0022] Furthermore, the quadratic B-spline curve satisfies the following expression:
[0023]
[0024] The present invention also discloses a linear machining path fitting system with controllable error, including:
[0025] An acquisition module, configured to acquire a linear machining path;
[0026] A fitting module, configured to fit the linear machining path according to the method described in any one of the above.
[0027] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention provides a linear machining path fitting method and system with controllable errors. The algorithm of the present invention has low complexity and can meet the requirement of controllable errors in the linear machining path. The present invention can be applied to medium and high-grade numerical control systems, which have controllable errors and can achieve local path smoothing. Two adjacent quadratic B-spline curves of the present invention are both tangent to the segment of the value point where the connection point is located, and the curvature values are equal at the connection point, and the curvature directions are collinear. When the curvature directions of two adjacent quadratic B-spline curves are in the same direction at the connection, G 2 continuity can be achieved, thus facilitating the next-step online speed planning and real-time interpolation. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following-described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0029] Figure 1 FIG. is a schematic diagram of a linear machining path fitting provided by an embodiment of the present invention.
[0030] Figure 2 FIG. is another schematic diagram of a linear machining path fitting provided by an embodiment of the present invention.
[0031] Figure 3 FIG. is still another schematic diagram of a linear machining path fitting provided by an embodiment of the present invention.
[0032] Figure 4 FIG. is a flowchart of a linear machining path fitting method with controllable errors provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0033] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
[0034] Referring to Figures 1 to 4 , the present invention discloses a linear machining path fitting method with controllable errors, including:
[0035] S1. Set the maximum approximation error (i.e., the maximum allowable deviation value) of the fitting curve according to the linear machining path of the machine tool processing tool;
[0036] S2. Set a number of shape points on the linear machining path to form a set of shape points; let the set of shape points be P i , i = 0, 1, …, n, where n is a positive integer greater than or equal to 2;
[0037] S3. Set control points based on the shape points in the set of shape points to form a set of control points;
[0038] Further, S3 specifically includes: Connecting adjacent two shape points in the set of shape points to form a number of shape point line segments, setting one control point on each of the adjacent two shape point line segments, and the distances from the control points on the adjacent two shape point line segments to the intersection of the adjacent two shape point line segments are equal.
[0039] In one embodiment, the first control point in the set of control points coincides with the first shape point in the set of shape points, and the last control point in the set of control points coincides with the last shape point in the set of shape points.
[0040] In another embodiment, the distance satisfies the following expression:
[0041] d i = min{ε / sin(θ i / 2), ||P i-1 P i || / 3, ||P i P i+1 || / 3}
[0042] where i = 1, 2, …, n - 1, n is a positive integer greater than or equal to 2; ε is the maximum approximation error; P i-1 , P i , P i+1 are all shape points, θ i is the turning angle between the adjacent two shape point line segments P i-1 P i and P i P i+1 . This step is to make the fitting error controllable.
[0043] S4. Determine the quadratic B-spline curve according to several control points in the set of control points;
[0044] In one embodiment, S4 specifically includes: Determining the quadratic B-spline curve according to 4 control points in the set of control points, where the first control point Q i,0 coincides with the shape point P i-1 , the second control point Q i,1 is on the shape point line segment P i-1 P i , and the third control point Q i,2 is on the shape point line segment Pi P i+1 above, the fourth control point Q i,3 on the control point line segment Q i,2 Q i+1,1 above, and with Q i,0 , Q i,1 , Q i,2 and Q i,3 as the control points of the quadratic B-spline curve and with Q i+1,0 , Q i+1,1 , Q i+1,2 and Q i+1,3 as the control points of the quadratic B-spline curve at the connection point Q i,3 the curvature values are equal, and Q i+1,0 coincides with Q i,3 .
[0045] In another embodiment, the second control point Q i,1 satisfies the following expression: Q i,1 = P i - d i e i , where e i is the unit vector of the vector P i-1 P i .
[0046] In yet another embodiment, the third control point Q i,2 satisfies the following expression: Q i,2 = P i + d i e i+1 , where e i+1 is the unit vector of the vector P i P i+1 .
[0047] Furthermore, the fourth control point Q i,3 satisfies the following expression:
[0048] Q i,3 = P i + λ i,2 d i e i+1
[0049] where λ i,2 is the ratio of the distance from the fourth control point Q i,3 to P i to the distance from the third control point Q i,2 to P i .
[0050] In one embodiment, the quadratic B-spline curve satisfies the following expression:
[0051]
[0052] Specifically, the curvature values of the quadratic B-spline curve C i (u) at both ends are as follows:
[0053]
[0054] Let l i = ||P i P i+1 ||, then for adjacent quadratic B-spline curves C i (u) and C i+1 (u), the curvature values are equal at the connection point Q i,3 (Q i+1,0 ), and the following expression needs to be satisfied:
[0055]
[0056] By using the elimination method, a unary equation about λ i,2 is obtained as follows: where,
[0057]
[0058] When a = 0, that is, d i sinθ i = d i+1 θ i+1 ,
[0059]
[0060] Since l i > d i + d i+1 , so λ i,2 > 1, λ i+1,1 > 1 holds.
[0061] When a ≠ 0, the discriminant of the unary quadratic equation about λ i,2 is:
[0062]
[0063] Since Δ > 0 always holds, the unary quadratic equation about λ i,2 has real roots.
[0064] Next, it will be proved that one of the roots meets the requirement of being greater than 1.
[0065] Since
[0066] So
[0067]
[0068] S5. Fit the linear machining path using the quadratic B-spline curve.
[0069] The algorithm of the present invention has a low complexity and can meet the requirement of controllable error of the linear machining path. The present invention can be applied to medium and high-grade numerical control systems, which have controllable errors and can achieve local path smoothing. Two adjacent quadratic B-spline curves of the present invention are both tangent to the segment of the value point where the connection point is located, and the curvature values are equal at the connection point, and the curvature directions are collinear. When the curvature directions of two adjacent quadratic B-spline curves are in the same direction at the connection, G 2 continuity can be achieved, thus facilitating the next step of online speed planning and real-time interpolation.
[0070] The present invention also discloses a linear machining path fitting system with controllable error, including:
[0071] An acquisition module, used to acquire the linear machining path;
[0072] A fitting module, used to fit the linear machining path according to the method described in any one of the above.
[0073] The system embodiments can be correspondingly implemented with the foregoing method embodiments one by one, and will not be elaborated here.
[0074] Based on the same inventive concept, the present invention also discloses an electronic device, which may include: a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus. The processor can call the logic instructions in the memory to execute a linear machining path fitting method with controllable error, including:
[0075] S1. Set the maximum approximation error of the fitting curve according to the linear machining path;
[0076] S2. Set a number of value points on the linear machining path to form a value point set;
[0077] S3. Set control points based on the value points in the value point set to form a control point set;
[0078] S4. Determine the quadratic B-spline curve according to several control points in the control point set;
[0079] S5. Fit the linear machining path using the quadratic B-spline curve.
[0080] In addition, when the logical instructions in the above-mentioned memory are implemented in the form of software functional units and sold or used as independent products, they 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 the prior art, or a part of this 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 for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0081] On the other hand, an embodiment of the present invention further provides a computer program product. The computer program product includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute a linear machining path fitting method with controllable error provided by each of the above method embodiments, including:
[0082] S1. Set the maximum approximation error of the fitting curve according to the linear machining path;
[0083] S2. Set several shape value points on the linear machining path and form a shape value point set;
[0084] S3. Set control points based on the shape value points in the shape value point set and form a control point set;
[0085] S4. Determine a quadratic B-spline curve according to several control points in the control point set;
[0086] S5. Use the quadratic B-spline curve to fit the linear machining path.
[0087] On another aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is configured to execute a linear machining path fitting method with controllable error provided by each of the above embodiments, including:
[0088] S1. Set the maximum approximation error of the fitting curve according to the linear machining path;
[0089] S2. Set several shape value points on the linear machining path and form a shape value point set;
[0090] S3. Set control points based on the shape value points in the shape value point set and form a control point set;
[0091] S4. Determine a quadratic B-spline curve according to several control points in the control point set;
[0092] S5. Fit the linear machining path with the quadratic B-spline curve.
[0093] It should be understood that although each step in the flowchart of the accompanying drawings is shown in sequence according to the indication of the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise clearly stated in this article, the execution of these steps has no strict order restriction, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.
[0094] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A linear machining path fitting method with controllable error, characterized in that: include: S1. According to the linear processing path, set the maximum approximation error of the fitting curve; S2. Setting a number of type value points on the linear processing path and forming a type value point set; S3. Setting control points based on the type value points in the type value point set and forming a control point set, specifically comprising: connecting two adjacent type value points in the type value point set to form a number of type value point line segments, setting a control point on each of the two adjacent type value point line segments, and the distances from the control points on the two adjacent type value point line segments to the intersection of the two adjacent type value point line segments are equal; the distances satisfy the following expression: d i =min{ε / sin(θ i / 2),||P i-1 P i | / 3,||P i P i+1 || / 3}; Where i = 1, 2, ..., n-1, n is a positive integer greater than or equal to 2; ε is the maximum approximation error; P i-1 ,P i ,P i+1 are all type value points, θ i P is a line segment of two adjacent type value points i-1 P i and P i P i+1 The corner of S4. Determine a quadratic B-spline curve according to several control points in the control point set, specifically comprising: determining a quadratic B-spline curve according to four control points in the control point set, wherein the first control point Q i,0 With type value point P i-1 Coincident, the second control point Q i,1 At the point P i-1 P i On the third control point Q i,2 At the point P i P i+1 On the fourth control point Q i,3 At the control point line segment Q i,2 Q i+1,1 On, and with Q i,0 ,Q i,1 ,Q i,2 and Q i,3 The quadratic B-spline curve with Q as the control point and i+1,0 ,Q i+1,1 ,Q i+1,2 and Q i+1,3 The quadratic B-spline curve with control points is connected at the point Q i,3 The curvature values at are equal, and Q i+1,0 With Q i,3 coincide; S5. Using the quadratic B-spline curve to fit the linear processing path.
2. A linear machining path fitting method with controllable error as claimed in claim 1, characterized in that: The first control point in the control point set coincides with the first type value point in the type value point set, and the last control point in the control point set coincides with the last type value point in the type value point set.
3. The error-controllable linear machining path fitting method according to claim 1, characterized in that: The second control point Q i,1 Satisfies the following expression: Q i,1 =P i -d i e i , where e i is the vector P i-1 P i The unit vector of .
4. The error-controllable linear machining path fitting method according to claim 1, characterized in that: The third control point Q i,2 Satisfies the following expression: Q i,2 =P i +d i e i+1 , where e i+1 is the vector P i P i+1 The unit vector of .
5. The error-controllable linear machining path fitting method as claimed in claim 1, characterized in that: The fourth control point Q i,3 Satisfies the following expression: Q i,3 =P i +λ i,2 d i and i+1 ; Among them, λ i,2 The fourth control point Q i,3 To P i The distance to the third control point Q i,2 To P i The ratio of the distance.
6. A linear machining path fitting method with controllable error as claimed in any one of claims 3 to 5, characterized in that: The quadratic B-spline curve satisfies the following expression:
7. A linear machining path fitting system with controllable error, characterized in that: include: A collection module, used for collecting linear processing paths; A fitting module, used for fitting a linear machining path according to the method according to any one of claims 1-6.
Citation Information
Patent Citations
A simple quadratic B spline curve fitting method
CN109697272A