Method and device for carrying out global path smoothing processing on discrete trajectory

By determining the initial control vertex based on the discrete curvature value and iteratively updating the control vertices to optimize the fitting curve, the problem of large control vertices in the prior art is solved, and efficient path smoothing processing and error control are achieved.

CN119828598AActive Publication Date: 2025-04-15TSINGHUA UNIVERSITY +1

Patent Information

Application Number
CN202411999813.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-15
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

When the prior art performs global path smoothing processing on discrete trajectories, it is difficult to effectively reduce the number of control vertices and data processing volume, and it is difficult to control errors while ensuring fitting efficiency.

Method used

By obtaining the discrete curvature value of discrete data points, the initial control vertex is determined, and the control vertex iteratively is updated based on the error objective function to obtain the optimized fit curve. If the fitting error requirements are not met, a new control vertex is added to the part and the node parameters are updated, and the optimization process is repeated.

Benefits of technology

It significantly improves the smoothness effect of the path, reduces velocity and acceleration fluctuations, improves processing quality and efficiency, and effectively controls fitting errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119828598A_ABST
    Figure CN119828598A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a device for performing global path smoothing processing on a discrete track, which adopt a fitting curve to perform global smoothing on discrete line segments, not only significantly improve the smoothing effect of the path, but also effectively reduce speed and acceleration fluctuation, thereby improving the processing quality and efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to but is not limited to the field of numerical control technology, and in particular to a method and device for performing global path smoothing processing on discrete trajectories. Background Art

[0002] CNC machining is widely used in the production of free-form surface parts in aerospace, precision medical equipment and automotive industries. Typically, CNC machining generates tool paths through a large number of G01 code segments consisting of discrete data points and line segments. However, due to the discontinuity of these paths in the tangent direction and curvature, the machine tool needs to accelerate and decelerate frequently during the machining process, resulting in feed oscillation, which in turn affects the machining quality and reduces efficiency.

[0003] Research has shown that smoothing the path of discrete trajectories is an effective way to solve the above problems.

[0004] High-order continuous spline parameter curves have been widely used in tool path smoothing, mainly including the following two methods: one is to use it as a corner transition curve for local smoothing, which is currently the mainstream method; the other is to use spline curves to approximate or interpolate the overall discrete trajectory for global smoothing. However, these two methods have their own limitations: local smoothing often leads to large extreme values ​​of transition curve curvature due to the small discrete line segments, which causes machine tool speed fluctuations and weakens the smoothing effect. Moreover, each transition curve requires independent control vertices. Therefore, when the number of discrete line segments is large, the number of control vertices also increases, resulting in high computational complexity and data processing volume; although global smoothing can ensure the continuity and smoothness of the tool path, the fitting accuracy of global smoothing is directly related to the number and distribution of control vertices. Too many control vertices will increase the amount of calculation, while too few control vertices may make the fitting error difficult to control, resulting in difficulties in controlling the fitting error.

[0005] In summary, the existing technology lacks a global smoothing method that can effectively reduce the number of control vertices and the amount of data processing, and effectively control the error while ensuring the fitting efficiency. Summary of the invention

[0006] The present application provides a method and device for global path smoothing of discrete trajectories, which can effectively reduce the number of control vertices, reduce the amount of data processing, and effectively control errors while ensuring fitting efficiency.

[0007] The present application provides a method for performing global path smoothing on discrete trajectories, including:

[0008] Obtaining discrete curvature values ​​according to discrete data points in the discrete trajectory to be processed, and determining the initial control vertex of the discrete trajectory to be processed according to the calculated discrete curvature values;

[0009] Based on the error objective function, the control vertices are iteratively updated starting from the initial control vertices to obtain the optimized fitting curve;

[0010] Determine whether the optimized fitting curve meets the fitting error requirement. If it meets the error requirement, output the discrete trajectory to be processed after the global path smoothing process, and end this process. If it does not meet the error requirement, execute the next step.

[0011] Based on the part that does not meet the fitting error requirements, add a step of selecting new control vertices from discrete data points and updating node parameters, and return to the step of determining whether the optimized fitting curve meets the fitting error requirements.

[0012] In an exemplary embodiment, determining the initial control vertex of the discrete trajectory to be processed includes:

[0013] Calculating discrete derivative values ​​of discrete data points in the discrete trajectory to be processed;

[0014] Calculating discrete curvature values ​​of discrete data points in the discrete trajectory to be processed according to the calculated discrete derivative values;

[0015] The initial control vertex is selected from the discrete data points according to the calculated discrete curvature value.

[0016] In an exemplary embodiment, the step of calculating discrete derivative values ​​of discrete data points in a discrete trajectory to be processed includes:

[0017] Calculating the cumulative chord lengths corresponding to the discrete data points in the discrete trajectory to be processed;

[0018] Reconstructing discrete data points in the discrete trajectory to be processed using the accumulated chord length;

[0019] For each reconstructed discrete data point, a first discrete derivative value is obtained by using its neighboring points for weighted calculation, and a second discrete derivative value is obtained by using its neighboring points for weighted calculation based on the first discrete derivative value.

[0020] In an exemplary embodiment, selecting initial control vertices from discrete data points according to the calculated discrete curvature values ​​includes:

[0021] Calculating a local difference value of curvature of each discrete data point according to the discrete curvature value;

[0022] All discrete data points are traversed, and discrete data points that meet the extreme value condition are determined as the initial control vertices.

[0023] In an exemplary embodiment, the extreme value condition is: the local difference value of the curvature is a local maximum value and is greater than 0.

[0024] In an exemplary embodiment, the iterative updating of the control vertices starting from the initial control vertices to obtain the optimized fitting curve includes:

[0025] Using the initial control vertex P i 0 and the node vector U corresponding to the defined fitting curve, calculating the initial fitting curve;

[0026] The error objective function is constructed, and the initial fitting curve is optimized by iteratively updating the control vertices to obtain the optimized fitting curve.

[0027] In an exemplary embodiment, the fitting curve is a B-spline fitting curve; and the error objective function is an approximation error minimum objective function.

[0028] In an exemplary embodiment, the step of determining whether the optimized fitting curve meets the fitting error requirement includes:

[0029] The straight-line distance between each discrete data point and the optimized fitting curve is calculated as the fitting error. When all straight-line distances are less than a set fitting error threshold, it is considered that the fitting error requirement is met.

[0030] In an exemplary embodiment, the adding selects new control vertices from discrete data points and updates node parameters, including:

[0031] Each node interval whose fitting error exceeds the fitting error threshold is defined as an insertable interval, and the insertable interval contains at least two discrete data points;

[0032] Calculate the fitting error of the insertable interval and insert a new node and a corresponding control vertex in the insertable interval when the fitting error is greater than a fitting error threshold;

[0033] After completing the node insertion, the newly inserted node corresponds to the new control vertex, and all nodes and control vertex sets are updated.

[0034] In an exemplary embodiment, updating the node parameters includes:

[0035] Select the initial value of the node parameter, use the Newton iteration method to calculate the node parameter until the stop iteration condition is met, and obtain the updated node parameter.

[0036] In an exemplary embodiment, the method of calculating the node parameters using the Newton iteration method until a stop iteration condition is satisfied to obtain updated node parameters includes:

[0037] The fitting curve is subdivided to obtain node intervals corresponding to the subdivisions, and the left and right endpoints of the node parameters when all node interval endpoints are traversed and the minimum distance is obtained are selected as guessed intervals, and then the guessed interval is traversed to obtain the initial value of the node parameter.

[0038] An embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute any of the above-described methods for performing global path smoothing on discrete trajectories.

[0039] An embodiment of the present application further provides a computer device, including a memory and a processor, wherein the memory stores the following instructions executable by the processor: used to execute the steps of any of the above-mentioned methods for performing global path smoothing on discrete trajectories.

[0040] The embodiment of the present application also provides a device for performing global path smoothing processing on discrete trajectories, comprising: a determination module, an optimization module, a judgment module, and a processing module; wherein,

[0041] A determination module, used to obtain discrete curvature values ​​according to discrete data points in the discrete trajectory to be processed, and determine the initial control vertex of the discrete trajectory to be processed according to the calculated discrete curvature values;

[0042] An optimization module, for iteratively updating the control vertices starting from the initial control vertices based on the error objective function to obtain an optimized fitting curve;

[0043] A judgment module is used to judge whether the optimized fitting curve meets the fitting error requirement. When the error requirement is met, the discrete trajectory to be processed after the global path smoothing is output and the process ends. When the error requirement is not met, the process enters the processing module.

[0044] The processing module is used to add new control vertices selected from discrete data points and update node parameters based on the parts that do not meet the fitting error requirements, and return to the optimization module to continue optimization.

[0045] The method and device for global path smoothing of discrete trajectories provided in the embodiments of the present application use fitting curves to perform global smoothing on discrete line segments, which not only significantly improves the smoothing effect of the path, but also effectively reduces speed and acceleration fluctuations, thereby improving processing quality and efficiency.

[0046] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings are used to provide further understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.

[0048] Figure 1 This is a flow chart of a method for performing global path smoothing on discrete trajectories in an embodiment of the present application;

[0049] Figure 2 A distribution diagram of initial control vertices screened by given discrete data points in an embodiment of the present application;

[0050] Figure 3 This is a schematic diagram of the initial value search in the node parameter update in the embodiment of the present application;

[0051] Figure 4 A schematic diagram showing whether node parameters are updated or not in an embodiment of the present application;

[0052] Figure 5 A schematic diagram of a discrete trajectory smoothing result given in an embodiment of the present application;

[0053] Figure 6 This is a schematic diagram of the fitting error after smoothing in the embodiment of the present application;

[0054] Figure 7 Schematic diagram of the composition structure of the device for performing global path smoothing on discrete trajectories in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and advantages of the present application more clear, the embodiments of the present application will be described in detail with reference to the accompanying drawings. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other arbitrarily without conflict.

[0056] In order to facilitate understanding of the present application, the present application will be described more fully below with reference to the relevant drawings. Embodiments of the present application are provided in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.

[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.

[0058] It is understood that the terms "first" and "second" used in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0059] It can be understood that the “connection” in the following embodiments should be understood as “electrical connection”, “communication connection”, etc. if the connected circuits, modules, units, etc. have electrical signals or data transmission between each other.

[0060] When used herein, the singular forms "a", "an", and "said / the" may also include plural forms, unless the context clearly indicates otherwise. It should also be understood that the terms "include / comprise" or "have" and the like specify the presence of stated features, wholes, steps, operations, components, parts, or combinations thereof, but do not exclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts, or combinations thereof. At the same time, the term "and / or" used in this specification includes any and all combinations of the relevant listed items.

[0061] Figure 1 FIG. 1 is a flow chart of a method for performing global path smoothing on discrete trajectories in an embodiment of the present application. Figure 1 As shown, it may include:

[0062] Step 100: Obtain discrete curvature values ​​according to discrete data points in the discrete trajectory to be processed, and determine the initial control vertex of the discrete trajectory to be processed according to the calculated discrete curvature values.

[0063] In an exemplary embodiment, the discrete trajectory to be processed may be, but is not limited to, a tool tip discrete trajectory in numerical control machining.

[0064] In one exemplary embodiment, step 100 may include:

[0065] Calculate discrete derivative values ​​of discrete data points in the discrete trajectory to be processed;

[0066] Calculate the discrete curvature values ​​of the discrete data points in the discrete trajectory to be processed according to the calculated discrete derivative values;

[0067] Initial control vertices are selected from discrete data points according to the calculated discrete curvature values.

[0068] In an exemplary embodiment, calculating discrete derivative values ​​of discrete data points in a discrete trajectory to be processed may include:

[0069] Calculate the cumulative chord length corresponding to the discrete data points in the discrete trajectory to be processed;

[0070] Reconstruct discrete data points in the discrete trajectory to be processed using the accumulated chord length;

[0071] For each reconstructed discrete data point, a first discrete derivative value is obtained by using its neighboring points for weighted calculation, and a second discrete derivative value is obtained by using its neighboring points for weighted calculation based on the first discrete derivative value.

[0072] In one embodiment, for a discrete data point D in a two-dimensional plane or a three-dimensional space i =(x i ,y i ,z i )(0<<i<<n), n represents the number of discrete data points minus one; initialize the starting point cumulative chord length parameter s0 = 0, calculate its corresponding cumulative chord length parameter s i As shown in formula (1):

[0073]

[0074] In formula (1), |D k+1 -D k | represents the Euclidean distance between adjacent points; i represents the index of a trajectory point; n represents the upper bound of the index, which is the end point of the trajectory.

[0075] The discrete data points in the discrete trajectory to be processed are reconstructed using the accumulated chord length, that is, the discrete curve segment is represented by the chord length parameter as shown in formula (2):

[0076] D i (s i )={(x(s i ),y(s i ),z(s i ))},s i ∈{s0,s1,…,s n} (2)

[0077] Formula (2) uses the cumulative chord length parameter to reconstruct the discrete points into a function form.

[0078] In one embodiment, for each reconstructed discrete data point, a weighted calculation is performed using its neighboring points to obtain a first discrete derivative value, that is, a first-order derivative value: D i ' (s i )={(x ' (s i ),y ' (s i ),z ' (s i))}, the calculation is shown in formula (3):

[0079]

[0080] Among them, m is the number of neighboring points.

[0081] In one embodiment, based on the first discrete derivative value, a weighted calculation is performed using its neighboring points to obtain a second discrete derivative value, that is, a second-order derivative value: D″ i (s i )={(x″(s i ),y"(s i ),z"(s i ))}, the calculation is shown in formula (4):

[0082]

[0083] In an exemplary embodiment, calculating the discrete curvature values ​​of discrete data points in the discrete trajectory to be processed according to the calculated discrete derivative values ​​may include:

[0084] The curvature of the continuous curve is discretized to obtain discrete curvature values, wherein the discrete data points in the discrete trajectory to be processed are sampling points of the continuous curve.

[0085] In one embodiment, for a continuous function f(t)=(x(t), y(t), z(t))(t0≤t≤t1) in three-dimensional space, the curvature κ(t) of the continuous curve is as shown in formula (5):

[0086]

[0087] In formula (5), f′(t) is the first-order derivative, which represents the tangent vector of the curve; f″(t) is the second-order derivative, which represents the acceleration vector of the curve; |f′(t)×f″(t)| is the vector cross product modulus of the first-order derivative and the second-order derivative, which represents the curvature of the curve; |f′(t)| 3 is the cube of the first derivative modulus, normalized to remove scale effects.

[0088] In one embodiment, the curvature of the discretized continuous curve is to substitute the estimated discrete derivative value into formula (5) to obtain the discrete curvature value of the discrete data point in the discrete trajectory to be processed as shown in formula (6):

[0089]

[0090] In formula (6), D′(s) and D″(s) represent the first discrete derivative value, i.e., the first-order derivative, and the second discrete derivative value, i.e., the second-order derivative, respectively; s represents the cumulative chord length parameter of the discrete data points.

[0091] In an exemplary embodiment, selecting initial control vertices from discrete data points according to the calculated discrete curvature values ​​may include:

[0092] Calculate the local difference value of curvature of each discrete data point according to the discrete curvature value;

[0093] All discrete data points are traversed, and discrete data points that meet the extreme value condition are determined as initial control vertices. In one embodiment, the extreme value condition is: the local difference value of the curvature is a local maximum value and is greater than 0.

[0094] In one embodiment, the local difference value ξ of the curvature of the discrete curvature value can be calculated according to formula (7): j :

[0095]

[0096] In formula (7), κ j Represents the discrete curvature value of the jth discrete data point; σ is a positive integer that defines the domain, represents the size of the neighborhood, determines the calculation range of the local difference value of the curvature, and affects the sparsity of the selected control vertices; n is the number of discrete points. represents the sum of the discrete curvature values ​​of the σ points before the jth point, represents the sum of the discrete curvature values ​​of σ points after the jth point, and the local difference value of curvature ξ j It represents the difference between the discrete curvature value of the jth point and the average discrete curvature value of the neighborhood, reflecting whether the discrete curvature value of the point is significantly higher or lower than the local average.

[0097] In one embodiment, when the local difference value ξ of the curvature corresponding to a discrete data point is satisfied j is greater than the local difference value of curvature corresponding to the previous discrete data point, and also greater than the local difference value of curvature corresponding to the next discrete data point. At the same time, the local difference value of curvature corresponding to the current discrete data point is ξ j When it is greater than 0, the local difference value ξ of the curvature j The corresponding discrete data points are selected as the initial control vertices, which are expressed as shown in formula (8):

[0098]

[0099] In formula (8), ξ i is the local difference value of curvature corresponding to the i-th discrete data point, ξ i-1 is the local difference value of curvature corresponding to the i-1th discrete data point, ξ i+1 is the local difference value of curvature corresponding to the i+1th discrete data point.

[0100] Figure 21 is a schematic diagram of the distribution of initial control vertices selected by given discrete data points in an embodiment of the present application. Taking 1000 discrete data points as initial points from a butterfly curve as an example, the algorithm shown in step 100 is applied to select the initial control vertices, such as Figure 2 As shown in the butterfly curve on the left, when σ = 1, there are 137 initial control vertices (as shown by the small black dots on the butterfly curve); Figure 2 As shown in the butterfly curve on the right, when σ=5, there are 84 initial control vertices (as shown by the small black dots on the butterfly curve).

[0101] In one embodiment, the embodiment of the present application uses discrete derivative values ​​to accurately calculate discrete curvature values, selects the curvature extreme points corresponding to the local differential curvature values ​​that meet the conditions as the initial control vertices, and effectively compresses the data volume while ensuring the fitting accuracy.

[0102] Step 101: Based on the error objective function, iteratively update the control vertices starting from the initial control vertices to obtain an optimized fitting curve.

[0103] In an exemplary embodiment, step 101 may include:

[0104] Using the initial control vertex P i 0 The node vector U corresponding to the defined fitting curve is used to calculate the initial fitting curve;

[0105] An error objective function is constructed, and the initial fitting curve is optimized by iteratively updating the control vertices to obtain the optimized fitting curve.

[0106] In one embodiment, the fitting curve includes, but is not limited to, a B-spline fitting curve.

[0107] In one embodiment, the error objective function may include but is not limited to an approximation error minimization objective function, that is, guiding the iterative update of the control vertices based on a progressive least squares iterative approximation method.

[0108] In an exemplary embodiment, taking the fitting curve as a B-spline fitting curve as an example, the B-spline curve is first defined as shown in formula (9):

[0109]

[0110] In formula (9), P i Represents the control vertex; i,k (u) represents the B-spline basis function; U = [u0,u1,…,u n] represents the knot vector. The knot vector is a core concept of B-spline curves, which is used to define the effective range of B-spline basis functions and control the change position of the curve shape. The knot vector is an ordered numerical sequence used to divide the parameter interval and determine the continuity and smoothness between curve segments.

[0111] In an exemplary embodiment, the generation of the node vector may include: i Calculate the parameter value ψ i ; According to the parameter value ψ i Generates a node vector.

[0112] In one embodiment, the parameter value ψ can be calculated according to formula (10): i :

[0113]

[0114] In formula (10), The parameter values ​​corresponding to the endpoints are Ψ0=0, Ψn=1.

[0115] In one embodiment, the node vector may be generated according to formula (11):

[0116]

[0117] In formula (11), k is the order of the B-spline function, and m is the number of control vertices.

[0118] In one embodiment, the basis function can be calculated by De Boor recursive relation, as shown in formula (12):

[0119]

[0120] In formula (12), B i,0 (u) is the zero-order basis function; B i,k (u) is a high-order basis function; As a special case, in the B-spline basis function, It is a numerical processing convention to avoid errors in calculations.

[0121] In an exemplary embodiment, the initial control vertex P can be used through formula (13) i 0 The node vector corresponding to the defined fitting curve is U=[u0,u1,…,u n ], calculate the initial fitting curve:

[0122]

[0123] In formula (13), Bi (u)>0.

[0124] In an exemplary embodiment, taking the error objective function as an approximation error minimum objective function as an example, the matrix equation of the approximation error minimum objective function can be constructed using formula (14):

[0125] E(P)=(ZP-D) T (ZP-D) (14)

[0126] In formula (14), D=[D0,D1,…D n ] T is a discrete data point; Z is the basis function matrix, and the elements are Z j,i =B i,k (u j ), as shown in formula (15):

[0127]

[0128] In formula (15), k represents the matrix equation at the kth iteration.

[0129] In an exemplary example, taking the error objective function as the approximation error minimum objective function as an example, the optimized fitting curve can be obtained by optimizing the initial fitting curve by iteratively updating the control vertex through formula (16):

[0130]

[0131] In formula (16), is the distance between the jth discrete data point and the point on the corresponding node parameter calculation curve at the kth iteration, that is, the error between the current fitting curve and the discrete data point; It is the distance that the control vertex moves; is the position of the control vertex at the k+1th iteration; μ is a constant that affects the iterative convergence speed, where λ max ,λ min The matrices ZZ are T The maximum and minimum eigenvalues ​​of .

[0132] In this way, the k+1th B-spline curve is shown in formula (17):

[0133]

[0134] Formula (17) updates the fitting curve according to the optimized control vertices to obtain the optimized fitting curve.

[0135] The initial and terminal points remain unchanged during the update iteration process, as shown in formula (18):

[0136]

[0137] In formula (18), Indicates that the first control vertex is the first discrete data point; Indicates that the last control vertex is the last discrete data point.

[0138] In one embodiment, the embodiment of the present application uses the progressive iterative approximation least squares method to fit discrete data points, which effectively avoids the numerical instability problem in large matrix operations of the traditional least squares method.

[0139] Step 102: Determine whether the optimized fitting curve meets the fitting error requirement. If the error requirement is met, output the discrete trajectory to be processed after the global path smoothing process, and end this process. If the error requirement is not met, execute step 103.

[0140] In an exemplary embodiment, determining whether the optimized fitting curve meets the fitting error requirement may include:

[0141] The straight-line distance between each discrete data point and the optimized fitting curve is calculated as the fitting error. When all straight-line distances are less than the set fitting error threshold, it is considered that the fitting error requirement is met.

[0142] In one embodiment, the fitting error can be calculated according to formula (19):

[0143] ε i =||D i -A(u i )||,i=0,1,…,n (19)

[0144] In formula (19), ε i is the error of the ith discrete data point. If max(ε i )≤ε o , ε o is the set fitting error threshold. At this time, the error objective function converges and is considered to meet the fitting error requirements. The fitting curve with the minimum fitting error is obtained and the final fitting curve A(u) is output. The node parameter u i Represents discrete data points D i At the projection point position on the fitting curve A(u), this process ends.

[0145] Step 103: Based on the part that does not meet the fitting error requirement, add new control vertices selected from discrete data points and update node parameters, and return to step 102.

[0146] In an exemplary embodiment, adding a new control vertex selected from discrete data points may include: adding a new control vertex between control vertices whose fitting errors are greater than a fitting error threshold, and inserting a new node. In an embodiment, it may include:

[0147] First, define the insertable interval: each interval where the fitting error exceeds the fitting error threshold is the node interval: The interval contains at least two discrete data points.

[0148] Then, the fitting error of the insertable interval is calculated as shown in formula (20):

[0149]

[0150] When the fitting error is greater than the fitting error threshold, a new node and the corresponding control vertex are inserted in the insertable interval. If the discrete data points in the insertable interval only include two such as D j , D j+1 , then inserting a new node at the midpoint of the insertable interval is: If there are more than two discrete data points in the insertable interval, such as D j , D j+1 …D j+a , the corresponding node parameter values ​​are u, u j+1 …u j+a , then the new node inserted is: And satisfy:

[0151]

[0152]

[0153] Finally, after completing the node insertion, the newly inserted node will correspond to the new control vertex, and all nodes and control vertex sets will be updated.

[0154] In an exemplary embodiment, updating the node parameters in step 103 may include:

[0155] First, the initial value u0 of the node parameter is selected, and the node parameters are calculated using the Newton iteration method until the stop iteration condition is met to obtain the updated node parameters.

[0156] In the embodiment of the present application, the node parameter u i Represents discrete data points D i At the projection point position on the fitting curve A(u), the goal of updating the node parameters is to find the most suitable u i , so that the discrete data point D i The error projected onto the curve A(u) is minimal. The projection condition satisfied by the projection process is shown in formula (21):

[0157] r(u)=9D-A(u))·A′(u)=0 (21)

[0158] In formula (21), D is a discrete data point, A(u) is the curve value of the fitting curve at parameter u, u is the node parameter value of the projection, and A′(u) is the first-order derivative of the fitting curve, which represents the tangent vector of the fitting curve. The goal of updating the node parameters is to solve the value of u so that the projection error r(u) is zero. In the embodiment of the present application, the nonlinear equation can be solved by Newton's iteration method.

[0159] In an exemplary embodiment, selecting an initial value u0 of a node parameter, calculating the node parameter using the Newton iteration method until a stop iteration condition is satisfied, and obtaining an updated node parameter may include:

[0160] The fitting curve is subdivided to obtain the node interval corresponding to the subdivision, and the left and right endpoints of the node parameter when traversing all node interval endpoints and obtaining the minimum distance are selected as the guessing interval, and then the guessing interval is traversed to obtain the initial value u0 of the node parameter.

[0161] In one embodiment, the selection of the initial value u0 of the node parameter is very important to the convergence and efficiency of the iteration. A reasonable initial interval can be found by, for example, curve subdivision and the minimum distance principle, and then the initial interval can be further subdivided to find the point with the minimum distance as the initial value u0 of the node parameter.

[0162] In one embodiment, further subdividing the initial interval to find the point with the smallest distance as the initial value u0 of the node parameter may include:

[0163] First, calculate the search step size: from u ξ Searching rightwards: From u ξ Searching to the left:

[0164] Next, taking the right search as an example, at each subdivision point, calculate the projection error r(u k ):u k =u ξ +i·Δ right u, u k+1 =u ξ +(i+1)·Δ right u, determine whether r(u k )·r(u k+1 )≤0, if r(u k )·r(u k+1 )≤0, then the initial value of the node parameter If r(u k )·r(uk+1 )>0, then further refine the search and calculate the new step size Continue searching and recalculate u k =u k +i·Δu u k+1 =u k +(i+1)·Δu and judge r(u k )·r(u k+1 )≤0 until Δu≤ε, where ε is the preset convergence error threshold;

[0165] If in the current interval [u ξ ,u ξ+1 ] does not exist k That is, it is impossible to satisfy r(u k )·r(u k+1 )≤0, then try to find the interval [u ξ-1 ,u ξ ] until the convergence error threshold is met.

[0166] In the process of searching for the initial node parameter u0, after searching rightward or leftward, multiple candidate u0s, i.e., candidate point sets, may be found. In one embodiment, these candidate points may be evaluated and a candidate point with the smallest distance error may be selected as the final initial node parameter u0. The distance d(u0) corresponding to each candidate point is d(u0)=|D i -A(u0)|, the candidate point corresponding to the minimum value is used as the final initial node parameter u0.

[0167] In one embodiment, the embodiment of the present application proposes a node parameter updating method, which improves the fitting efficiency and iteratively updates the curve based on the fitting error to obtain a smooth path that meets the fitting accuracy requirements.

[0168] In one embodiment, taking the discrete trajectory to be processed as the discrete trajectory of the tool tip in CNC machining as an example, the embodiment of the present application uses a cubic B-spline curve to fit the discrete tool tip trajectory, obtains a smooth tool trajectory, compresses the data volume, and strictly controls the accuracy of the fitting curve.

[0169] Figure 3 Schematic diagram of initial value search in node parameter update in the embodiment of the present application, such as Figure 3 As shown, it shows that through multiple nodes (such as u0, u0...u n ) is the process of searching for initial values. Vertex D represents the node that needs to be optimized, which involves calculating the distance d0, d min ,d n+k+1 Etc., to determine the best initial node value, that is, to find the candidate point with the smallest distance error as the final initial node parameter u0.

[0170] Figure 4 Schematic diagram of comparing whether node parameters are updated or not in the embodiment of the present application. Figure 4 The left and right figures in the figure respectively represent the trajectory fitting before and after the node parameters are updated. Figure 4 As shown in Figure 1, there is a large error between the trajectory of the unupdated node parameters and the discrete points; while the updated node parameters optimize the fitting curve, making it smoother and closer to the discrete points.

[0171] After obtaining accurate initial values ​​of node parameters, continue Newton iteration method and use u i represents the parameter value obtained by the i-th Newton iteration method. The Newton iteration is shown in formula (22):

[0172]

[0173] In formula (22), u i is the current node parameter value; r(u i ) is the projection error function, defined as: r(u i )=[A(u i )-D i ]·A′(u i ); r′(u i ) is the first-order derivative of the projection error function. It is defined as: r′(u i )=[A(u i )-D i ]·A″(u i )+A′(u i )·A′(u i ).

[0174] Thus, starting from the initial value u0, calculate r(u i ) and r′(u i ), update u according to Newton iteration formula (22) i+1 .

[0175] The convergence criteria can include any of the following conditions, that is, the Newton iteration ends when any of the following conditions are met:

[0176] Distance error condition: |A(u i )-D i |≤η1, used to determine whether the points coincide with each other

[0177] Cosine error conditions: Used to determine whether the cosine value is zero.

[0178] Parameter change conditions: |(u i+1 -u i )A′(u i )|≤η1.

[0179] In the above formula, η1 is used to measure whether the Euclidean distance is zero, and η2 is used to measure whether the cosine value is zero. In one embodiment, if one of the distance error condition and the cosine error condition does not converge, the new u is calculated. i+1 In one embodiment, if the parameter does not change much after multiple Newton iterations, the parameter change condition is detected again, and the iteration is stopped if one of the distance error condition, the cosine error condition and the parameter change condition is met.

[0180] Figure 5 is a schematic diagram of a discrete trajectory smoothing result given in an embodiment of the present application, Figure 5 In , the linear path points represent discrete trajectories, and the B-spline curve represents the smoothed (i.e., faired) path. Figure 5 As shown in Figure 3, the smoothing results show that the optimized path is smoother and can better connect the original discrete trajectory points. Figure 6 This is a schematic diagram of the fitting error after smoothing in the embodiment of the present application. Figure 6 In the figure, the horizontal axis is the cumulative arc length (unit: mm), and the vertical axis is the error value (unit: mm). For example, the error threshold is set to 0.02 mm. Figure 6 As shown, the curve shows the fitting error of each point after smoothing, indicating that the error value is small and within the allowable range.

[0181] The method for global path smoothing of discrete trajectories provided in the embodiment of the present application uses fitting curves to perform global smoothing on discrete line segments, which not only significantly improves the smoothing effect of the path, but also effectively reduces speed and acceleration fluctuations, thereby improving processing quality and efficiency.

[0182] The present application also provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute any of the above-mentioned methods for performing global path smoothing on discrete trajectories.

[0183] The present application further provides a computer device, including a memory and a processor, wherein the memory stores the following instructions executable by the processor: used to execute the steps of any of the above-mentioned methods for performing global path smoothing on discrete trajectories.

[0184] Figure 7 Schematic diagram of the structure of the device for performing global path smoothing on discrete trajectories in an embodiment of the present application. Figure 7 As shown, it may include: a determination module, an optimization module, a judgment module, and a processing module; wherein,

[0185] A determination module, used to obtain discrete curvature values ​​according to discrete data points in the discrete trajectory to be processed, and determine the initial control vertex of the discrete trajectory to be processed according to the calculated discrete curvature values;

[0186] An optimization module, for iteratively updating the control vertices starting from the initial control vertices based on the error objective function to obtain an optimized fitting curve;

[0187] A judgment module is used to judge whether the optimized fitting curve meets the fitting error requirement. When the error requirement is met, the discrete trajectory to be processed after the global path smoothing is output and the process ends. When the error requirement is not met, the process enters the processing module.

[0188] The processing module is used to add new control vertices selected from discrete data points and update node parameters based on the parts that do not meet the fitting error requirements, and return to the optimization module to continue optimization.

[0189] The device for performing global path smoothing on discrete trajectories provided in the embodiment of the present application uses fitting curves to perform global smoothing on discrete line segments, which not only significantly improves the smoothing effect of the path, but also effectively reduces speed and acceleration fluctuations, thereby improving processing quality and efficiency.

[0190] Although the embodiments disclosed in this application are as above, the contents described are only embodiments adopted to facilitate understanding of this application and are not intended to limit this application. Any technician in the field to which this application belongs can make any modifications and changes in the form and details of implementation without departing from the spirit and scope disclosed in this application, but the scope of patent protection of this application shall still be based on the scope defined in the attached claims.

Claims

1. A method for global path smoothing of discrete trajectories, characterized in that: include: Obtaining discrete curvature values ​​according to discrete data points in the discrete trajectory to be processed, and determining the initial control vertex of the discrete trajectory to be processed according to the calculated discrete curvature values; Based on the error objective function, the control vertices are iteratively updated starting from the initial control vertices to obtain the optimized fitting curve; Determine whether the optimized fitting curve meets the fitting error requirement. If it meets the error requirement, output the discrete trajectory to be processed after the global path smoothing process, and end this process. If it does not meet the error requirement, execute the next step. Based on the part that does not meet the fitting error requirements, add a step of selecting new control vertices from discrete data points and updating node parameters, and return to the step of determining whether the optimized fitting curve meets the fitting error requirements.

2. The method according to claim 1, wherein: The step of determining the initial control vertex of the discrete trajectory to be processed includes: Calculating discrete derivative values ​​of discrete data points in the discrete trajectory to be processed; Calculating discrete curvature values ​​of discrete data points in the discrete trajectory to be processed according to the calculated discrete derivative values; The initial control vertex is selected from the discrete data points according to the calculated discrete curvature value.

3. The method according to claim 2, wherein: The step of calculating discrete derivative values ​​of discrete data points in the discrete trajectory to be processed includes: Calculating the cumulative chord lengths corresponding to the discrete data points in the discrete trajectory to be processed; Reconstructing discrete data points in the discrete trajectory to be processed using the accumulated chord length; For each reconstructed discrete data point, a first discrete derivative value is obtained by using its neighboring points for weighted calculation, and a second discrete derivative value is obtained by using its neighboring points for weighted calculation based on the first discrete derivative value.

4. The method according to claim 2, wherein: The step of selecting initial control vertices from discrete data points according to the calculated discrete curvature values ​​includes: Calculating a local difference value of curvature of each discrete data point according to the discrete curvature value; Traversing all discrete data points, and determining the discrete data points satisfying the extreme value condition as the initial control vertex; The extreme value condition is that the local difference value of the curvature is a local maximum value and is greater than 0.

5. The method according to claim 1, wherein: The iterative updating of the control vertices from the initial control vertices to obtain the optimized fitting curve comprises: Using Initial Control Vertices and the node vector U corresponding to the defined fitting curve, calculating the initial fitting curve; Constructing the error objective function, optimizing the initial fitting curve by iteratively updating the control vertices to obtain the optimized fitting curve; The fitting curve is a B-spline fitting curve; and the error objective function is an approximation error minimum objective function.

6. The method according to claim 1, wherein: The step of judging whether the optimized fitting curve meets the fitting error requirement includes: The straight-line distance between each discrete data point and the optimized fitting curve is calculated as the fitting error. When all straight-line distances are less than a set fitting error threshold, it is considered that the fitting error requirement is met.

7. The method according to claim 6, wherein: The adding selects new control vertices from discrete data points and updates node parameters, including: Each node interval whose fitting error exceeds the fitting error threshold is defined as an insertable interval, and the insertable interval contains at least two discrete data points; Calculate the fitting error of the insertable interval and insert a new node and a corresponding control vertex in the insertable interval when the fitting error is greater than a fitting error threshold; After completing the node insertion, the newly inserted node corresponds to the new control vertex, and all nodes and control vertex sets are updated.

8. The method according to claim 7, wherein: The updating of node parameters includes: Select the initial value of the node parameter, use the Newton iteration method to calculate the node parameter until the stop iteration condition is met, and obtain the updated node parameter.

9. The method according to claim 8, wherein: The method of calculating the node parameters by using the Newton iteration method until the iteration stop condition is met to obtain the updated node parameters includes: The fitting curve is subdivided to obtain node intervals corresponding to the subdivisions, and the left and right endpoints of the node parameters when all node interval endpoints are traversed and the minimum distance is obtained are selected as guessed intervals, and then the guessed interval is traversed to obtain the initial value of the node parameter.

10. A device for performing global path smoothing on discrete trajectories, comprising a memory and a processor, wherein: The memory stores the following instructions executable by the processor: used to execute the steps of the method for performing global path smoothing on discrete trajectories as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Prospective interpolation system for compressing and smoothening small segment paths

    CN104007705A

  • Curve fitting method for discrete cutter path

    CN105425725A

  • Fairing algorithm for global curvature of automatic fiber laying trajectory

    CN108415367A

  • Arc length parameter curve processing track generation method of free curved surface

    CN108549325A

  • Global curvature continuous smoothing method aiming at micro-line segment processing

    CN109976262A

Cited By

  • Path generation method, device and equipment of moving body and medium

    CN121143189A