Method and system for controlling the number of curvature constraints in trajectory planning
By generating splines and adjusting their curvature during CNC machining, the problems of large curvature change rate and numerous curvature constraint operations are solved, achieving uniform curvature within the spline and reducing processor load, thereby improving machining accuracy and efficiency.
Patent Information
- Application Number
- CN202211558409.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-06
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2042-12-06
AI Technical Summary
In CNC machining, traditional curvature constraint methods result in a large rate of curvature change, leading to sudden changes in acceleration and velocity during machining, which makes it difficult to meet the requirements of high-speed and high-precision machining. Furthermore, the excessive number of curvature constraints increases processor overhead.
By obtaining the original line segments from the NC program, splines are generated through fitting and interpolation. The curvature at the spline junctions is adjusted by the boundary conditions of the cubic splines to make it less than the preset limit value, thereby controlling the number of curvature constraints.
This achieves uniformity in curvature variation within the spline, reduces the number of curvature constraints, lowers processor overhead, and improves machining accuracy and efficiency.
Smart Images

Figure CN115857430B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of numerical control machining, and in particular to a method and system for controlling the number of curvature constraints in trajectory planning. Background Art
[0002] In traditional CNC machining processes, the original curve generated by CAD / CAM software, which connects continuous line segments and arcs, needs to constrain the curvature of each segment's transition during machining.
[0003] Because the length of the generated line segments is small, conventional curvature calculation methods result in a large rate of change in curvature at each connection, and each connection requires a curvature constraint. This constraint method makes it difficult to ensure smooth curvature, resulting in large sudden changes in acceleration and velocity during machining, leading to poor surface finishes on the workpiece. Furthermore, because curvature constraint calculations occur for each connection, the number of curvature constraints required is excessive, resulting in excessive processor overhead and making it difficult to adapt to high-speed, high-precision machining requirements. Summary of the Invention
[0004] In response to the above problems, the present disclosure proposes a method and system for controlling the number of curvature constraints in trajectory planning.
[0005] In order to solve at least one of the above technical problems, the present disclosure proposes the following technical solutions:
[0006] In a first aspect, a method for controlling the number of curvature constraints in trajectory planning is provided, the method comprising the following steps:
[0007] Step 1: Obtain the original line segment in the NC program, perform fitting and interpolation on the original line segment to generate a spline, and the curvature of the spline is less than the preset curvature limit value;
[0008] Step 2: Adjust the curvature of the spline joints by using the boundary conditions of the cubic spline so that the curvature of the spline joints is less than the preset curvature limit value.
[0009] In a second aspect, a system for controlling the number of curvature constraints in trajectory planning is provided, for executing any of the above methods for controlling the number of curvature constraints in trajectory planning, the system comprising:
[0010] The spline curvature constraint module is used to obtain the original line segments in the NC program, fit and interpolate the original line segments, and generate splines. The curvature of the spline is less than the preset curvature limit value;
[0011] The curvature constraint module at the spline joint is used to adjust the curvature at the spline joint through the boundary conditions of the cubic spline so that the curvature at the spline joint is less than a preset curvature limit value.
[0012] In a third aspect, a device for controlling the number of curvature constraints in trajectory planning is provided, the device comprising at least one processor and a memory communicatively connected to the at least one processor, 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 by the processor and executed by any of the above-mentioned methods for controlling the number of curvature constraints in trajectory planning of the present disclosure.
[0013] In a fourth aspect, a computer-readable storage medium is provided, which 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 by a processor and executed by any of the above-mentioned methods for controlling the number of curvature constraints in trajectory planning of the present disclosure.
[0014] The beneficial effect of the present disclosure is that, by merging multiple trajectory points into a spline and limiting the curvature of the merged spline, the curvature change inside the spline is ensured to be uniform, and the curvature is limited by the boundary condition of the cubic spline at the spline connection, which further ensures the uniform curvature change of the merged trajectory, improves the processing accuracy of the product, and at the same time achieves the completion of curvature constraint in the trajectory preprocessing stage, reduces the number of curvature constraints in the entire trajectory planning process, reduces the processor overhead, and improves the processing efficiency and quality of the product.
[0015] In addition, in the technical solutions disclosed herein, anything not specifically stated can be implemented by conventional means in the art. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 A flowchart of a method for controlling the number of curvature constraints in trajectory planning provided by one embodiment of the present disclosure.
[0018] Figure 2 A schematic diagram of a system for controlling the number of curvature constraints in trajectory planning provided by one embodiment of the present disclosure.
[0019] Figure 3 A schematic diagram of the structure of a device for controlling the number of curvature constraints in trajectory planning provided by one embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below with reference to the accompanying 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 of the embodiments, and are only used to explain the present disclosure and are not intended to limit the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present disclosure.
[0021] It should be noted that the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products or devices.
[0022] Example 1:
[0023] Reference Manual Figure 1 , shows a method for controlling the number of curvature constraints in trajectory planning provided by an embodiment of the present application, which may include the following steps:
[0024] Step 1: Obtain the original line segment in the NC program, perform fitting and interpolation on the original line segment, and generate a spline. The curvature of the spline is less than the preset curvature limit value.
[0025] Therefore, by merging the small line segments or small arcs generated by software such as CAD or CAM into splines that meet the curvature limit value, curvature constraints on the connections of each small line segment or small arc are avoided, which greatly reduces the number of curvature constraints in trajectory planning. At the same time, since the overall curvature of the spline is restricted, the curvature change inside the spline is guaranteed to be uniform, avoiding large changes in acceleration and speed that put great pressure on the motor and processor.
[0026] In an optional embodiment, step 1 may specifically include the following steps:
[0027] Step 1.1: Get the data points in the NC program;
[0028] Step 1.2: Select several data points for fitting and interpolation to generate splines;
[0029] Step 1.3: Determine whether the curvature of the spline is less than the preset curvature limit value. If so, proceed to step 1.4; if not, proceed to step 1.5.
[0030] Step 1.4: Save the generated spline;
[0031] Step 1.5: Add spline control points to the original trajectory formed by the original data points;
[0032] Step 1.6: Fit and interpolate the data points after adding the spline control points to generate a spline, and return to step 1.3.
[0033] Therefore, the curvature of the generated spline is controlled by the preset curvature limit value. If the curvature of the spline meets the curvature limit value, there is no need to operate the generated spline. If the overall spline curvature does not meet the curvature limit value, the shape of the spline is changed by adding spline control points to make the overall spline curvature smaller.
[0034] In an optional embodiment, in step 1.2, fitting and interpolating the data points to generate a spline is performed using a Ferguson curve.
[0035] Specifically, the expression of the Ferguson curve is as follows:
[0036] r(u)=r0F0(u)+r1F1(u)+r0′G0(u)+r1′G1(u)
[0037] Where u represents the normalization parameter;
[0038] The matrix expression of the Ferguson curve is as follows:
[0039]
[0040] In order to ensure the smooth continuity of the internal segments of the spline, the position continuity conditions, slope continuity conditions and curvature continuity conditions of the Ferguson spline are obtained as follows:
[0041] r (1) (1) = r (2) (0)
[0042] r′ (2) (0) = r′ (1) (1)
[0043]
[0044] At the same time, the normalization parameter u is set to 2, thereby achieving spline fitting.
[0045] In an optional embodiment, in step 1.2, when the Ferguson curve is selected to implement spline fitting, the selected data points should be no less than ten, thereby satisfying the calculation conditions of the Ferguson curve.
[0046] In an optional embodiment, in step 1.2, the method of selecting a plurality of data points may specifically include the following steps:
[0047] Get the number of all current data points.
[0048] Determine whether the current number of data points is not less than 10,
[0049] If the current number of data points is not less than 10, then select ten consecutive data points from the current data points.
[0050] If the current number of data points is less than 10, then get the ten data points involved in the previous spline and all current data points.
[0051] In this way, the situation where spline fitting and interpolation cannot be performed when there are less than 10 data points is avoided, and all data points in the NC program are involved in spline fitting and subject to curvature constraints, ensuring the accuracy of calculation and the rationality of trajectory planning.
[0052] In an optional embodiment, in step 1.5, the method of adding spline control points to the original trajectory formed by the original data points may specifically include the following steps:
[0053] Assume that the number of data points obtained in step 1.2 is N,
[0054] When N=10, according to the calculation characteristics of the Ferguson curve, if the 10 data points are recorded as point 0, point 1...point 9 respectively, then points 0 to point 3 are regarded as one point, and points 6 to point 8 are regarded as one point, then points 3 to point 6 are actually involved in the calculation. These four data points form three line segments, and two curvatures are calculated from the three line segments, which are recorded as curvature 1 and curvature 2. Comparing the sizes of curvature 1 and curvature 2, if curvature 1 is greater than curvature 2, the spline control point is inserted to the side of point 0 to point 4. If curvature 1 is equal to curvature 2, the spline control point is inserted between point 4 and point 5. If curvature 1 is less than curvature 2, the spline control point is inserted to the side of point 5 to point 9.
[0055] Specifically, the curvature of a curve is the rotation rate of the tangent direction angle of a point on the curve to the arc length. In the present disclosure, the curvature is calculated for the line segment. In essence, the angle between the direction vectors of each line segment is used as the tangent direction angle, the length of the previous line segment is used as the arc length, and the calculated rotation rate is used as the curvature.
[0056] Therefore, the curvature obtained by calculation shows the change of the spline shape. By adding spline control points on the side with larger curvature, the spline shape is corrected and the overall spline curvature is reduced to meet the curvature limit value, thereby achieving the purpose of curvature constraint inside the spline.
[0057] Step 2: Adjust the curvature of the spline joints through the boundary conditions of the cubic spline so that the curvature of each spline joint is less than the preset curvature limit value.
[0058] In an optional embodiment, step 2 may specifically include the following steps:
[0059] Step 2.1: Get the spline function generated in step 1;
[0060] Step 2.2: Adjust the curvature of the spline junction according to the boundary conditions given by the first-order derivative and the second-order derivative at the endpoints of the cubic spline interval so that the curvature of the spline junction is less than a preset curvature limit value;
[0061] Step 2.3: Output the adjusted spline.
[0062] Therefore, according to the boundary conditions given by the first-order derivative and the second-order derivative at the endpoints of the cubic spline interval as curvature constraints, the curvature of the spline segment generated in step 1 at the spline connection is also continuous, the curvature change at the spline connection is uniform, the acceleration and speed changes are within the limit range, and the pressure on the motor caused by sudden changes in speed and acceleration is avoided.
[0063] In an optional embodiment, when fitting and interpolating the data points to generate a spline in step 1.2 is performed using a Ferguson curve, and when the boundary conditions of the Ferguson curve are free boundary conditions, i.e., the second-order derivative at the interval endpoints is always zero, the spline junctions are second-order continuous. This means that the curvature constraints imposed on the spline during spline fitting using the Ferguson curve also apply to the fitted spline. Therefore, the curvature of the spline junctions generated in step 1 is naturally less than the preset curvature constraint, eliminating the need for additional curvature constraints on the spline junctions.
[0064] The beneficial effect of the present disclosure is that, by merging multiple trajectory points into a spline and limiting the curvature of the merged spline, the problem of curvature change that needs to be limited is converted into the shape of the spline for limitation, ensuring that the curvature changes evenly within the spline, and limiting the curvature by the boundary condition of the cubic spline at the spline connection, further ensuring that the curvature of the merged trajectory changes evenly, improving the processing accuracy of the product, and at the same time completing the curvature constraint in the trajectory preprocessing stage, reducing the number of curvature constraints in the entire trajectory planning process, greatly accelerating the generation of the trajectory, optimizing the interpolation effect, reducing the processor overhead, and improving the processing efficiency and quality of the product.
[0065] Example 2:
[0066] Reference Manual Figure 2 , shows a system for controlling the number of curvature constraints in trajectory planning provided by an embodiment of the present application, which is used to execute any of the aforementioned methods for controlling the number of curvature constraints in trajectory planning, including:
[0067] The spline curvature constraint module 21 is used to obtain the original line segments in the NC program, perform fitting and interpolation on the original line segments, and generate splines, wherein the curvature of the spline is less than a preset curvature limit value;
[0068] The spline joint curvature constraint module 22 is used to adjust the curvature of the spline joint according to the boundary conditions of the cubic spline, so that the curvature of the spline joint is less than a preset curvature limit value.
[0069] In an optional embodiment, in the spline curvature constraint module 21, original data points in the NC program are obtained, the original data points are fitted and interpolated, and a spline is generated. The curvature of the spline is less than a preset curvature limit value, which includes:
[0070] Step 1.1: Get the data points in the NC program;
[0071] Step 1.2: Select several data points for fitting and interpolation to generate splines;
[0072] Step 1.3: Determine whether the curvature of the spline is less than the preset curvature limit value. If so, proceed to step 1.4; if not, proceed to step 1.5.
[0073] Step 1.4: Save the generated spline;
[0074] Step 1.5: Add spline control points to the original trajectory formed by the original data points
[0075] Step 1.6: Fit and interpolate the data points after adding the spline control points to generate a spline, and return to step 1.3.
[0076] In the spline curvature constraint module 21, fitting and interpolation of the original line segments are achieved through Ferguson curves.
[0077] In the spline joint curvature constraint module 22, adjusting the curvature of the spline joint by using the boundary conditions of the cubic spline so that the curvature of the spline joint is less than a preset curvature limit value includes:
[0078] Obtaining a spline function generated by the spline curvature constraint module 21;
[0079] Adjusting the curvature of the spline junction according to the boundary conditions given by the first-order derivative and the second-order derivative at the endpoints of the cubic spline interval so that the curvature of the spline junction is less than a preset curvature limit value;
[0080] Output the adjusted spline.
[0081] The beneficial effect of the present disclosure is that, by merging multiple trajectory points into a spline and limiting the curvature of the merged spline, the curvature change inside the spline is ensured to be uniform, and the curvature is limited by the boundary condition of the cubic spline at the spline connection, which further ensures the uniform curvature change of the merged trajectory, improves the processing accuracy of the product, and at the same time achieves the completion of curvature constraint in the trajectory preprocessing stage, reduces the number of curvature constraints in the entire trajectory planning process, reduces the processor overhead, and improves the processing efficiency and quality of the product.
[0082] 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.
[0083] Example 3:
[0084] Reference Manual Figure 3 , provides a device for controlling the number of curvature constraints in trajectory planning, the device comprising:
[0085] One or more processors 31 and memory 32, the instructions are attached Figure 3 A processor 31 is taken as an example.
[0086] The device for controlling the number of curvature constraints in trajectory planning may further include: an input device 33 and an output device 34 .
[0087] Memory 32, 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 method for controlling the number of curvature constraints in trajectory planning in the embodiments of the present application. Processor 31 executes the non-volatile software programs, instructions, and modules stored in memory 32 to execute various server functional applications and data processing, thereby implementing the method for controlling the number of curvature constraints in trajectory planning in the above-mentioned method embodiment.
[0088] The memory 32 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 system for controlling the number of curvature constraints in trajectory planning, etc. In addition, the memory 32 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 32 may optionally include a memory remotely located relative to the processor 31, and these remote memories may be connected to the system for controlling the number of curvature constraints in trajectory planning 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.
[0089] The input device 33 can receive input digital or character information and generate signal input related to user settings and function control. The output device 34 can include a display device such as a display screen.
[0090] One or more modules are stored in the memory 32 , and when executed by one or more processors 31 , perform the method for controlling the number of curvature constraints in trajectory planning in any of the above method embodiments.
[0091] 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.
[0092] Example 4:
[0093] 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.
[0094] 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.
[0095] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by means of hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the prior art can be expressed in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or certain parts of the embodiments.
[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present disclosure.
Claims
1. A method for controlling the number of curvature constraints in trajectory planning, characterized in that: The following steps are involved: Step 1: Obtain the original line segment in the NC program, perform fitting and interpolation on the original line segment to generate a spline, and the curvature of the spline is less than the preset curvature limit value; Step 2: Adjust the curvature of the spline joints by using the boundary conditions of the cubic spline so that the curvature of the spline joints is less than the preset curvature limit value; Step 1 includes: Step 1.1: Get the data points in the NC program; Step 1.2: Select several data points for fitting and interpolation to generate splines; Step 1.3: Determine whether the curvature of the spline is less than the preset curvature limit value. If so, proceed to step 1.4; if not, proceed to step 1.
5. Step 1.4: Save the generated spline; Step 1.5: Add spline control points to the original trajectory formed by the original data points Step 1.6: Fit and interpolate the data points after adding the spline control points to generate a spline, and return to step 1.3; Step 2 includes: Step 2.1: Get the spline function generated in step 1; Step 2.2: Adjust the curvature of the spline junction according to the boundary conditions given by the first-order derivative and the second-order derivative at the endpoints of the cubic spline interval so that the curvature of the spline junction is less than a preset curvature limit value; Step 2.3: Output the adjusted spline.
2. The method for controlling the number of curvature constraints in trajectory planning according to claim 1, characterized in that: Fitting and interpolation of the original line segments are achieved through Ferguson curves.
3. A system for controlling the number of curvature constraints in trajectory planning, for executing the method for controlling the number of curvature constraints in trajectory planning according to any one of claims 1 to 2, characterized in that: include, The spline curvature constraint module is used to obtain the original line segments in the NC program, fit and interpolate the original line segments, and generate splines. The curvature of the spline is less than the preset curvature limit value; The curvature constraint module at the spline joint is used to adjust the curvature at the spline joint through the boundary conditions of the cubic spline so that the curvature at the spline joint is less than a preset curvature limit value.
4. The system for controlling the number of curvature constraints in trajectory planning according to claim 3, characterized in that: In the spline curvature constraint module, the original data points in the NC program are obtained, and the original data points are fitted and interpolated to generate a spline. The curvature of the spline is less than the preset curvature limit value, including: Step 1.1: Get the data points in the NC program; Step 1.2: Select several data points for fitting and interpolation to generate splines; Step 1.3: Determine whether the curvature of the spline is less than the preset curvature limit value. If so, proceed to step 1.4; if not, proceed to step 1.
5. Step 1.4: Save the generated spline; Step 1.5: Add spline control points to the original trajectory formed by the original data points Step 1.6: Fit and interpolate the data points after adding the spline control points to generate a spline, and return to step 1.
3.
5. The system for controlling the number of curvature constraints in trajectory planning according to claim 3, characterized in that: In the spline curvature constraint module, fitting and interpolation of the original line segments are achieved through Ferguson curves.
6. The system for controlling the number of curvature constraints in trajectory planning according to claim 3, characterized in that: In the spline joint curvature constraint module, the curvature of the spline joint is adjusted by the boundary condition of the cubic spline so that the curvature of the spline joint is less than the preset curvature limit value, including: Step 2.1: Obtain the spline function generated by the spline curvature constraint module; Step 2.2: Adjust the curvature of the spline junction according to the boundary conditions given by the first-order derivative and the second-order derivative at the endpoints of the cubic spline interval so that the curvature of the spline junction is less than a preset curvature limit value; Step 2.3: Output the adjusted spline.
7. A device for controlling the number of curvature constraints in trajectory planning, characterized in that: The 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, the at least one program, code set or instruction set is loaded and executed by the processor to implement the method for controlling the number of curvature constraints in trajectory planning as described in any one of claims 1-2.
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 is loaded and executed by the processor to implement the method for controlling the number of curvature constraints in trajectory planning as described in any one of claims 1-2.
Citation Information
Patent Citations
Numerical control machining track smoothing method based on B spline curve fitting
CN114545863A
Method and apparatus for creating a three-dimensional space curve by smoothly connecting a three-dimensional sequence of discretely given paints
US5132913A