Curvature uniformizing method and system based on non-convex optimization model
By generating a cubic B-spline curve with uniform curvature based on a non-convex optimization model, the problem of uneven trajectory curvature in CNC machining is solved, and the machining quality and efficiency are improved.
Patent Information
- Application Number
- CN202510902978.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-01
- Publication Date
- 2025-10-10
AI Technical Summary
In traditional CNC machining, the geometric continuity of the machining trajectory affects the product surface quality and machining efficiency. The curvature of the cubic spline trajectory cannot meet the curvature uniformity requirement, resulting in feed speed fluctuations and tool vibration.
A method based on a non-convex optimization model is adopted to construct a cubic B-spline curve by obtaining data points, judging the trajectory error and second-order difference constraints, and updating the control points to meet the constraints, thus generating a cubic B-spline curve with uniform curvature.
It improves the smoothing effect of the curve, avoids acceleration jumps, suppresses processing vibration, and achieves higher speed planning and better surface finish.
Smart Images

Figure CN120762353A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of numerical control machining, and in particular to a curvature uniformity method and system based on a non-convex optimization model. Background Art
[0002] In traditional CNC machining processes, the geometric continuity of the machining trajectory directly affects the product surface quality, machining efficiency, and machine tool dynamics. Traditional machining trajectory generation methods, such as CAM software, usually directly generate corresponding straight or circular trajectories from 3D models without considering the actual geometric continuity. Direct machining of such trajectories can easily lead to feed rate fluctuations, tool vibration, and contour errors, making it difficult to meet high-precision machining requirements. The trajectory properties of the cubic spline function itself depend on the position of the control points. Since the control point positions cannot be adjusted arbitrarily, the curvature of the cubic spline trajectory still cannot meet the requirements for curvature uniformity. Summary of the Invention
[0003] In response to the above problems, the present disclosure proposes a curvature uniformity method and system based on a non-convex optimization model.
[0004] In order to solve at least one of the above technical problems, the present disclosure proposes the following technical solutions:
[0005] First, a curvature uniformity method based on a non-convex optimization model is provided.
[0006] Get the data points,
[0007] The acquired data points are used as control points to construct a cubic B-spline curve.
[0008] Determine whether the cubic B-spline curve can simultaneously satisfy the trajectory error constraint and the second-order difference constraint. If the cubic B-spline curve satisfies both the trajectory error constraint and the second-order difference constraint, output the cubic B-spline curve. If the cubic B-spline curve does not satisfy at least one of the trajectory error constraint and the second-order difference constraint, update the control points and then construct the cubic B-spline curve until a cubic B-spline curve that satisfies both the trajectory error constraint and the second-order difference constraint is generated.
[0009] In a second aspect, a curvature uniformity system based on a non-convex optimization model is provided, for executing any of the above-mentioned curvature uniformity methods based on a non-convex optimization model, the system comprising:
[0010] Data point acquisition module, used to obtain data points,
[0011] The cubic B-spline curve generation module is used to construct the cubic B-spline curve.
[0012] The error judgment module is configured to judge whether the cubic B-spline curve can simultaneously satisfy the trajectory error constraint condition and the second-order difference constraint condition, and output the cubic B-spline curve if the cubic B-spline curve simultaneously satisfies the trajectory error constraint condition and the second-order difference constraint condition.
[0013] The control point updating module is configured to update the control point when the cubic B-spline curve does not satisfy at least one of the trajectory error constraint condition and the second-order difference constraint condition.
[0014] In a third aspect, a numerical control device is provided, which includes at least one processor and a memory connected to the at least one processor in communication, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the curvature uniform method based on the non-convex optimization model of any one of the above aspects.
[0015] In a fourth aspect, a computer-readable storage medium is provided, which stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the curvature uniform method based on the non-convex optimization model of any one of the above aspects.
[0016] The present disclosure has the beneficial effect that, by simultaneously performing trajectory error constraint and second-order difference constraint on the spline function and iteratively calculating by updating the control point, the overall fairing effect of the curve can be improved, the curve can have fewer inflection points in shape, the output cubic B-spline curve has more uniform reflected light, and the surface effect is closer to the mirror effect and better finish; when performing speed planning, the jump of acceleration can be avoided, the vibration during machining is suppressed, the curve has more uniform curvature, and when performing acceleration and deceleration planning, a higher speed can be achieved, and the change rate of acceleration and deceleration has a larger support interval.
[0017] In addition, in the technical solutions of the present disclosure, any unexplained matters can be realized by using conventional means in the art. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings needed in the specific embodiments or prior art description will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0019] Figure 1A flowchart of the curvature uniform method based on a non-convex optimization model is provided for an embodiment of the present disclosure.
[0020] Figure 2 A structural diagram of the curvature uniform system based on a non-convex optimization model is provided for an embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] In order to make the purposes, technical solutions and advantages of the present disclosure clearer, the present disclosure is further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are part of the embodiments of the present disclosure, rather than all the embodiments, and are only used to explain the present disclosure, and do not limit the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present disclosure.
[0022] It should be noted that the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or server comprising a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0023] Embodiment 1:
[0024] Referring to the drawings accompanying the specification Figure 1 , a curvature uniform method based on a non-convex optimization model is provided for an embodiment of the present application.
[0025] The curvature uniform method based on a non-convex optimization model can specifically include the following steps:
[0026] Step 1: obtaining data points,
[0027] Step 2: constructing a cubic B-spline curve with the obtained data points as control points,
[0028] Step 3: determining whether the cubic B-spline curve can simultaneously satisfy the trajectory error constraint condition and the second-order difference constraint condition, if the cubic B-spline curve simultaneously satisfies the trajectory error constraint condition and the second-order difference constraint condition, then executing Step 4, if the cubic B-spline curve does not satisfy at least one of the trajectory error constraint condition and the second-order difference constraint condition, then executing Step 5;
[0029] Step 4: outputting the cubic B-spline curve,
[0030] Step 5: updating the control points and returning to Step 3.
[0031] In an optional embodiment, the data points in Step 1 can be trajectory points in an NC program.
[0032] In step 2, constructing a cubic B-spline curve using the acquired data points as control points can be achieved through spline fitting or interpolation calculation.
[0033] In step 3, determining whether the cubic B-spline curve satisfies the trajectory error constraint condition may include:
[0034] The spline function of the cubic B-spline curve is denoted as f(u), where u represents the spline parameter.
[0035] The coordinates of the points on the original trajectory corresponding to the spline parameter u are marked as f(x, y, z).
[0036] Then the expression for calculating the trajectory error is f(x, y, z)-f(u);
[0037] The set trajectory error constraint value is recorded as ε,
[0038] Then determine whether the cubic B-spline curve meets the trajectory error constraint condition, that is, determine whether f(x, y, z)-f(u)≤ε is established. If so, it is determined that the cubic B-spline curve meets the trajectory error constraint condition. If not, it is determined that the cubic B-spline curve does not meet the trajectory error constraint condition.
[0039] In step 3, determining whether the cubic B-spline curve satisfies the second-order difference constraint condition may include:
[0040] Calculate the second-order difference vector of the curvature vector of the cubic B-spline curve, and obtain the number X of non-zero elements in the second-order difference vector of the cubic B-spline curve.
[0041] The set second-order difference constraint value is recorded as Y, where Y is a natural number
[0042] Then determine whether the cubic B-spline curve satisfies the second-order difference constraint, that is, determine whether X≤Y holds. If so, it is determined that the cubic B-spline curve satisfies the second-order difference constraint. If not, it is determined that the cubic B-spline curve does not satisfy the second-order difference constraint.
[0043] Therefore, it is judged whether the number of non-zero elements in the second-order difference vector of the cubic B-spline curve meets the preset constraints. When the number of non-zero elements in the second-order difference vector of the cubic B-spline curve is smaller, it means that the number of inflection points of the curvature is smaller, and the corresponding cubic B-spline curve has fewer inflection points, and the smoothness of the cubic B-spline curve is higher.
[0044] Specifically, the method for calculating the second-order difference vector of the curvature vector of the cubic B-spline curve includes:
[0045] A function of the cubic B-spline curve is f(t), the cubic B-spline curve has n control points, n is a natural number not less than 4, wherein the node vector of the cubic B-spline curve is t, the definition type value point is di, at this time the value range of i is [0, n], the curvature vector κ(t) is the curvature corresponding to the type value point di, the expressions of the cubic B-spline curve in the x direction and the y direction are x(t) and y(t) respectively,
[0046] The curvature of the cubic B-spline curve at the type value point di is calculated, and the calculation formula is as follows:
[0047]
[0048] Wherein, the value range of i is [0, n], n is a natural number not less than 4;
[0049] At this time, the expression of the curvature vector ci of the cubic B-spline curve is as follows:
[0050] c i =κ(t i )
[0051] Wherein, the value range of i is [0, n], n is a natural number not less than 4;
[0052] The calculation formula of the second order difference ei of the curvature vector is as follows:
[0053]
[0054] Since the second order difference cannot be calculated at the initial type value point position, in the calculation formula of the second order difference of the curvature vector, the value range of i is [1, n-3], n is a natural number not less than 4;
[0055] Then the second order difference vector of the curvature vector of the cubic B-spline curve is e={e1,…e n-3}。
[0056] Therefore, the second order difference constraint condition is set, the fewer the number of non-zero elements in the second order difference vector, the fewer the number of inflection points of the curvature, so as to obtain the minimum number of curve inflection points and improve the smoothness of the curve.
[0057] In the optional embodiment, after updating the control points in step 5, when returning to step 3 to judge the constraint condition, whether the cubic B-spline curve can meet the trajectory error constraint condition and the second order difference constraint condition at the same time can be judged by using the following non-convex optimization model, and the expression of the non-convex optimization model is:
[0058]
[0059] In the formula, represents the coordinates of the value point di calculated by the updated control point after the control point is updated, and d represents the coordinates of the value point on the original trajectory. represents the second-order difference vector of the curvature vector of the cubic B-spline curve calculated after updating the control points, ε represents the preset trajectory error constraint value, The zero norm of the second-order difference vector of the curvature vector of the cubic B-spline curve is represented by the zero norm of the second-order difference vector. The zero norm of the second-order difference vector represents the number of non-zero elements in the second-order difference vector. Therefore, the solution is obtained through iterative solution, and the control points are continuously updated in the loop to obtain a solution that meets the constraints.
[0060] In step 5, the method for updating the control points includes:
[0061] Get the currently calculated trajectory error,
[0062] Move the control point of the current cubic B-spline along the normal direction. The moving distance is 1 / M of the currently calculated trajectory error, where M is greater than 1.
[0063] Use the moved control point as the updated control point.
[0064] Specifically, the value of M can be 2.
[0065] Therefore, moving the control point along the normal direction makes the control point update simpler and more controllable. When the moving distance is inappropriate, it can be compensated along the normal direction, making the control point update more convenient and accurate.
[0066] The beneficial effect of the present disclosure is that by simultaneously performing trajectory error constraints and second-order difference constraints on the spline function and performing iterative calculations by updating the control points, the overall smoothing effect of the curve can be improved, so that the curve can have fewer inflection points in shape, and the output cubic B-spline curve has a more uniform overall performance of reflected light, and the surface effect is closer to a mirror effect and a better smoothing effect; when performing speed planning, it can avoid acceleration jumps and suppress vibrations during processing. The curve has a more uniform curvature, and can achieve a higher speed when performing acceleration and deceleration planning, and has a larger support range for the rate of change of acceleration and deceleration.
[0067] Example 2:
[0068] The present application also provides a curvature uniformity system based on a non-convex optimization model, which is used to execute any of the aforementioned curvature uniformity methods based on a non-convex optimization model, including:
[0069] The data point acquisition module 101 is used to acquire data points.
[0070] The cubic B-spline curve generation module 102 is used to construct a cubic B-spline curve.
[0071] An error judgment module 103 is used to judge whether the cubic B-spline curve can simultaneously satisfy the trajectory error constraint condition and the second-order difference constraint condition. If the cubic B-spline curve satisfies the trajectory error constraint condition and the second-order difference constraint condition, the cubic B-spline curve is output;
[0072] The control point updating module 104 is configured to update the control points when the cubic B-spline curve does not satisfy at least one of the trajectory error constraint and the second-order difference constraint.
[0073] The beneficial effect of the present disclosure is that by simultaneously performing trajectory error constraints and second-order difference constraints on the spline function and performing iterative calculations by updating the control points, the overall smoothing effect of the curve can be improved, so that the curve can have fewer inflection points in shape, and the output cubic B-spline curve has a more uniform overall performance of reflected light, and the surface effect is closer to a mirror effect and a better smoothing effect; when performing speed planning, it can avoid acceleration jumps and suppress vibrations during processing. The curve has a more uniform curvature, and can achieve a higher speed when performing acceleration and deceleration planning, and has a larger support range for the rate of change of acceleration and deceleration.
[0074] The systems provided in the above embodiments are illustrated by the division of the above functional modules when implementing their functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the systems and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0075] Example 3:
[0076] The present application provides a numerical control device, which includes:
[0077] One or more processors and memory.
[0078] The numerical control device may also include: an input device and an output device.
[0079] The memory, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as the program instructions / modules corresponding to the curvature uniformity method based on a non-convex optimization model in the embodiments of the present application. The processor executes the non-volatile software programs, instructions, and modules stored in the memory to execute various functional applications and data processing of the server, thereby implementing the curvature uniformity method based on a non-convex optimization model in the above method embodiments.
[0080] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the curvature uniform system based on the non-convex optimization model, etc. In addition, the memory may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely located relative to the processor, and these remote memories may be connected to the curvature uniform system based on the non-convex optimization model via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0081] The input device can receive input digital or character information and generate signal input related to user settings and function control. The output device can include display devices such as display screens.
[0082] One or more modules are stored in the memory, and when executed by one or more processors, perform the curvature uniformity method based on the non-convex optimization model in any of the above method embodiments.
[0083] The above-mentioned device can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of the present application.
[0084] Example 4:
[0085] On the other hand, embodiment 4 of the present disclosure provides a computer-readable storage medium, which stores one or more programs including execution instructions. The execution instructions can be read and executed by a device (including but not limited to a computer, server or network device, etc.) to execute the relevant steps in the above method embodiment.
[0086] The embodiments described above are merely illustrative. The units or modules described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected based on actual needs to achieve the objectives of the embodiments. Persons of ordinary skill in the art will be able to understand and implement the embodiments without inventive effort.
[0087] Those skilled in the art can clearly understand the implementation of the various embodiments by means of software and the necessary general hardware platform from the above description of the embodiments, and of course, the embodiments can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions to make a computer device (possibly a personal computer, a server, or a network device, etc.) execute the methods of the various embodiments or some parts of the embodiments.
[0088] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present disclosure, and not to limit them; although the present disclosure has been described in detail with reference to the foregoing examples, those of ordinary skill in the art should understand that: it can still modify the technical solutions recorded in the foregoing examples, or make equivalent replacement for some of the technical features; and these modifications or replacements do not make the corresponding technical solutions essentially depart from the spirit and scope of the technical solutions of the various embodiments of the present disclosure.
Claims
1. A curvature uniformity method based on a non-convex optimization model, characterized in that: Get the data points, The acquired data points are used as control points to construct a cubic B-spline curve. Determine whether the cubic B-spline curve can simultaneously satisfy the trajectory error constraint and the second-order difference constraint. If the cubic B-spline curve satisfies both the trajectory error constraint and the second-order difference constraint, output the cubic B-spline curve. If the cubic B-spline curve does not satisfy at least one of the trajectory error constraint and the second-order difference constraint, update the control points and then construct the cubic B-spline curve until a cubic B-spline curve that satisfies both the trajectory error constraint and the second-order difference constraint is generated.
2. The curvature uniformity method based on a non-convex optimization model according to claim 1, characterized in that: Determining whether the cubic B-spline curve satisfies the trajectory error and whether it satisfies the constraint conditions includes: The spline function of the cubic B-spline curve is denoted as f(u), where u represents the spline parameter. The coordinates of the points on the original trajectory corresponding to the spline parameter u are marked as f(x, y, z). Then the expression of trajectory error is f(x, y, z)-f(u); The set trajectory error constraint value is recorded as ε, Then determine whether the cubic B-spline curve meets the trajectory error constraint, that is, determine whether f(x, y, z)-f(u)≤ε is established. If so, the cubic B-spline curve meets the trajectory error constraint. If not, it is determined that the cubic B-spline curve does not meet the trajectory error constraint.
3. The curvature uniformity method based on a non-convex optimization model according to claim 1, characterized in that: Determining whether a cubic B-spline curve satisfies the second-order difference constraint conditions includes: Calculate the second-order difference vector of the curvature vector of the cubic B-spline curve, and obtain the number X of non-zero elements in the second-order difference vector of the cubic B-spline curve. The set second-order difference constraint value is recorded as Y, Then determine whether the cubic B-spline curve satisfies the second-order difference constraint, that is, determine whether X≤Y holds. If so, it is determined that the cubic B-spline curve satisfies the second-order difference constraint. If not, it is determined that the cubic B-spline curve does not satisfy the second-order difference constraint.
4. The curvature uniformity method based on a non-convex optimization model according to claim 3, characterized in that: The calculation method of the second-order difference vector of the curvature vector of the cubic B-spline curve includes: Let the function of the cubic B-spline curve be f(t), the cubic B-spline curve has n control points, n is a natural number not less than 4, t represents the node vector of the cubic B-spline curve, let the shape point be di, the value range of i is [0, n], let the curvature vector κ(t) be the curvature at the corresponding shape point di, let the expressions of the cubic B-spline curve in the x direction and y direction be x(t) and y(t) respectively, Calculate the curvature of the cubic B-spline curve at the value point di. The calculation formula is as follows: The value range of i is [0, n], and n is a natural number not less than 4; Then the expression of the curvature vector ci of the cubic B-spline curve is as follows: c i =κ(t i ) The value range of i is [0, n], and n is a natural number not less than 4; The calculation formula of the second-order difference ei of the curvature vector is as follows: The value range of i is [1, n-3], and n is a natural number not less than 4; Then the second-order difference vector of the curvature vector of the cubic B-spline curve is e={e1,…e n-3 }.
5. The curvature uniformity method based on a non-convex optimization model according to claim 4, characterized in that: After updating the control points, when executing step 3, it is determined whether the cubic B-spline curve can simultaneously satisfy the trajectory error constraint and the second-order difference constraint. The non-convex optimization model is used for this. The expression of the non-convex optimization model is: Where, represents the coordinates of the type value point calculated by the updated control point after the control point is updated, and d represents the coordinates of the type value point on the original trajectory. represents the second-order difference vector of the curvature vector of the cubic B-spline curve calculated after updating the control points, ε represents the preset trajectory error constraint value, The zero norm of the second-order difference vector of the curvature vector of the cubic B-spline curve is represented by the zero norm of the second-order difference vector. The zero norm of the second-order difference vector represents the number of nonzero elements in the second-order difference vector.
6. A curvature uniformity system based on a non-convex optimization model, used to execute the curvature uniformity method based on a non-convex optimization model according to any one of claims 1 to 5, characterized in that: include, Data point acquisition module, used to obtain data points, The cubic B-spline curve generation module is used to construct the cubic B-spline curve. An error judgment module is used to judge whether the cubic B-spline curve can simultaneously meet the trajectory error constraint condition and the second-order difference constraint condition. If the cubic B-spline curve satisfies the trajectory error constraint condition and the second-order difference constraint condition, the cubic B-spline curve is output; The control point updating module is used to update the control points when the cubic B-spline curve does not satisfy at least one of the trajectory error constraint condition and the second-order difference constraint condition.
7. A numerical control device, characterized in that: The numerical control device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the curvature uniformity method based on the non-convex optimization model as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the curvature uniformity method based on the non-convex optimization model described in any one of claims 1-5.