Track smoothing method and device and electronic equipment
By constructing two-dimensional planar transition curves and vertical change curves in the CNC system, the problem of tangential matching between helical lines and straight lines in three-dimensional space was solved, achieving smooth transition and stable machining.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-10
- Publication Date
- 2026-03-31
AI Technical Summary
When connecting helical and straight lines, the commonly used trajectory smoothing methods in existing CNC systems cannot achieve tangential matching in three-dimensional space, resulting in geometric discontinuities and sudden changes in feed rate, which affects the smoothness of machining.
By acquiring the target plane of the straight line trajectory and the spiral trajectory, projection processing is performed to obtain the projected straight line and circle, constructing a two-dimensional plane transition curve, and determining the two-dimensional transition circle according to the first-order tangent and the direction angle, generating a vertical change curve to adapt to spiral-straight line combinations of different specifications.
It achieves a smooth transition between spirals and straight lines in three-dimensional space, avoids sudden speed changes, and improves processing stability and surface quality.
Smart Images

Figure CN121763928A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of CNC machining technology, and in particular to a trajectory smoothing method, apparatus, and electronic device. Background Technology
[0002] The spiral-to-straight-line transition trajectory is a common feature in CNC machining, especially in processes such as spiral cut into cavities and unidirectional spiral feed on external surfaces. Achieving a smooth transition between the spiral and the straight line is of great significance for avoiding machining vibration, eliminating tool marks, improving surface quality, and extending tool life.
[0003] Currently, the most common trajectory smoothing method in CNC systems is to insert transition curves between adjacent program segments based on preset accuracy parameters to ensure geometric continuity or higher-order continuity. Common transition curves include circular arc transitions and parametric free curve transitions.
[0004] However, since circular arcs are planar curves in space, when the tangential directions of the straight segments and helical segments that need to be connected are not coplanar, a single circular arc cannot achieve tangential matching with both in three-dimensional space at the same time. This can lead to geometric discontinuities at the transition point, which in turn can cause sudden changes in feed rate and affect the smoothness of machining.
[0005] While parametric free curves can solve the transition problem in non-coplanar cases, they achieve tangential continuity in space through control point configuration. After a transition point is given, only the first-order tangential vector direction at that point can be determined. The parameterization rate of the tangential vector largely depends on the operator's experience to be manually set or adjusted, making it difficult to adapt to different specifications of helical-straight line combinations. Summary of the Invention
[0006] To address the problems existing in the prior art, the present invention provides a trajectory smoothing method, apparatus, and electronic device.
[0007] This invention provides a trajectory smoothing method, comprising: Obtain the straight line trajectory and the spiral trajectory, and determine the target plane; Projection processing is performed based on the target plane to obtain the projected straight line of the straight line trajectory and the projected circle of the spiral trajectory; A two-dimensional plane transition curve is obtained based on the projected straight line and the projected circle, and a first transition point on the straight line trajectory and a second transition point on the spiral trajectory are determined based on the two-dimensional plane transition curve. A vertical change curve is obtained based on the first transition point and the second transition point, and a spatial transition curve is determined based on the vertical change curve and the two-dimensional plane transition curve.
[0008] According to a trajectory smoothing method provided by the present invention, obtaining a two-dimensional plane transition curve based on the projected straight line and the projected circle includes: Determine the first first-order tangent vector of the projected line and the second first-order tangent vector at the starting point of the projected circle; The two-dimensional plane transition curve is obtained based on the first and second first-order tangents.
[0009] According to a trajectory smoothing method provided by the present invention, before obtaining the two-dimensional planar transition curve based on the first first-order tangent and the second first-order tangent, the method further includes: The directional angle is determined based on the first first-order tangent and the second first-order tangent; The chord height error is obtained, and the first radius of the two-dimensional transition circle is determined based on the chord height error and the direction angle. Obtain the unidirectional trajectory deviation parameter, and determine the second radius of the two-dimensional transition circle based on the unidirectional trajectory deviation parameter and the direction angle; The lengths of the straight line trajectory and the spiral trajectory are obtained, and the third radius of the two-dimensional transition circle is determined based on the lengths of the straight line trajectory, the spiral trajectory, and the directional angle. The minimum value among the first radius, the second radius, and the third radius is determined as the radius of the two-dimensional transition circle.
[0010] According to a trajectory smoothing method provided by the present invention, before obtaining the two-dimensional planar transition curve based on the first first-order tangent and the second first-order tangent, the method further includes: Based on the radius of the two-dimensional transition circle, a geometric transformation is performed to obtain the center of the two-dimensional transition circle that is simultaneously tangent to the first and second first-order tangent vectors.
[0011] According to a trajectory smoothing method provided by the present invention, the step of performing a geometric transformation based on the radius of the two-dimensional transition circle to obtain the center of the two-dimensional transition circle that is simultaneously tangent to the first first-order tangent vector and the second first-order tangent vector includes: Obtain the center representation of the two-dimensional transition circle and the direction vector of the straight line trajectory, so as to obtain the center representation of the intermediate circle that is simultaneously tangent to the projected straight line and the projected circle based on the direction vector of the straight line trajectory and the center representation of the two-dimensional transition circle; wherein, the radius of the intermediate circle is the same as the radius of the transition circle. Obtain the radius of the projection circle, and determine the distance between the center of the projection circle and the center of the intermediate circle based on the radius of the projection circle and the radius of the intermediate circle; Obtain the center of the projected circle. The center of the two-dimensional transition circle is obtained by solving the characterization of the center of the intermediate circle based on the center of the projected circle and the distance.
[0012] According to a trajectory smoothing method provided by the present invention, a two-dimensional planar transition curve is obtained based on the projected straight line and the projected circle, and a first transition point on the straight line trajectory and a second transition point on the spiral trajectory are determined based on the two-dimensional planar transition curve, comprising: The first tangent point with the projected line and the second tangent point with the projected circle are determined based on the center and radius of the two-dimensional transition circle, so as to obtain a two-dimensional planar transition curve based on the first tangent point and the second tangent point; The first transition point on the straight trajectory is determined by geometric transformation based on the first tangent point of the two-dimensional plane transition curve, and the second transition point on the spiral trajectory is determined by geometric transformation based on the second tangent point of the two-dimensional plane transition curve.
[0013] According to a trajectory smoothing method provided by the present invention, obtaining a vertical change curve based on a first transition point and a second transition point includes: The first spatial first-order tangent vector of the straight line trajectory at the first transition point and the first two-dimensional first-order tangent vector of the two-dimensional plane transition curve at the first tangent point are determined respectively, so as to determine the second spatial first-order tangent vector of the spatial transition curve at the first transition point based on the first spatial first-order tangent vector and the first two-dimensional first-order tangent vector. Determine the third spatial first-order tangent vector of the spiral trajectory at the second transition point, and determine the second two-dimensional first-order tangent vector of the two-dimensional plane transition curve at the second tangent point, so as to determine the fourth spatial first-order tangent vector of the spatial transition curve at the second transition point based on the second spatial first-order tangent vector and the second two-dimensional first-order tangent vector. The vertical change curve is obtained based on the first transition point, the second transition point, the second spatial first-order tangent, and the fourth spatial first-order tangent.
[0014] According to a trajectory smoothing method provided by the present invention, the step of obtaining a vertical change curve based on a first transition point, a second transition point, a second spatial first-order tangent vector, and a fourth spatial first-order tangent vector includes: By setting an intermediate point, the first and second transition curve representations of the spatial transition curves are obtained. The first transition curve represents the intermediate point, the first transition point, and the first-order tangent vector of the second space; the second transition curve represents the intermediate point, the second transition point, and the first-order tangent vector of the fourth space. The solution yields the first vertical change curve of the first transition curve and the second vertical change curve of the second transition curve; The determination of the spatial transition curve based on the two-dimensional planar transition curve and the vertical change curve includes: The spatial transition curve is determined based on the two-dimensional planar transition curve, the first vertical change curve, and the second vertical change curve.
[0015] The present invention also provides a trajectory smoothing device, comprising: The plane determination module is used to acquire straight line trajectories and spiral trajectories, and to determine the target plane; The projection module is used to perform projection processing based on the target plane to obtain the projected straight line of the straight line trajectory and the projected circle of the spiral trajectory; The transition point determination module is used to obtain a two-dimensional plane transition curve based on the projected straight line and the projected circle, and to determine a first transition point on the straight line trajectory and a second transition point on the spiral trajectory based on the two-dimensional plane transition curve. The spatial transition curve determination module is used to obtain a vertical change curve based on the first transition point and the second transition point, and to determine a spatial transition curve based on the vertical change curve and the two-dimensional plane transition curve.
[0016] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the trajectory smoothing method as described above.
[0017] The trajectory smoothing method, apparatus, and electronic device provided by this invention determine a target plane by acquiring straight line trajectories and spiral trajectories, and then perform projection processing on the target plane to obtain a projected straight line and a projected circle to obtain a two-dimensional plane transition curve. This two-dimensional plane transition curve can describe the angular changes of the spatial transition curve on the target plane. Then, based on the two-dimensional plane transition curve, a first transition point on the straight line trajectory and a second transition point on the spiral trajectory are determined to obtain a vertical change curve. This vertical change curve can describe the changes of the spatial transition curve in the vertical direction of the target plane. Therefore, based on the vertical change curve and the two-dimensional plane transition curve, the spatial transition curve is automatically determined to adapt to combinations of spirals and straight lines of different specifications. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0019] Figure 1 This is a schematic flowchart of the trajectory smoothing method provided by the present invention.
[0020] Figure 2 This is one of the schematic diagrams illustrating the trajectory smoothing method provided by the present invention.
[0021] Figure 3 This is a second example of the trajectory smoothing method provided by the present invention.
[0022] Figure 4 This is the third example of the trajectory smoothing method provided by the present invention.
[0023] Figure 5 This is the fourth example of the trajectory smoothing method provided by the present invention.
[0024] Figure 6 This is the fifth example of the trajectory smoothing method provided by the present invention.
[0025] Figure 7 This is the sixth example of the trajectory smoothing method provided by the present invention.
[0026] Figure 8 This is a schematic diagram of the trajectory smoothing device provided by the present invention.
[0027] Figure 9 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0029] Helical-straight line feature machining is a commonly used machining mode in CNC. Similar to G01 and G02 / G03 interpolation commands, most economical machine tools support helical interpolation. When the tangent directions of the straight line segment and the helical segment to be connected are not coplanar, a free curve transition, such as a cubic Bezier curve or a cubic polynomial curve, is generally used. In the process of constructing the free curve, the transition point position and the first-order tangent direction at the transition point are usually automatically determined based on accuracy control parameters such as chord height error. Then, the modulus of the first-order tangent is defined manually based on empirical parameters.
[0030] For example, when machining a workpiece with a spiral-straight line feature in UG, the transition start / end point can be determined automatically according to the curve shape to add a transition curve, and the generated transition curve can be displayed to the user through a visualization window to receive modification instructions input by the user. The transition curve can be adjusted by adjusting the first-order tangent length according to the modification instructions to obtain the final free curve.
[0031] However, if such a strategy is provided directly through machine tool equipment, on the one hand, empirical parameters cannot guarantee applicability to all specifications of helical-straight features, and on the other hand, the self-adjustment of the die length becomes difficult due to the limitations of the interactive interface.
[0032] Based on the above problems, the technical solutions of the present invention will be described below with reference to the accompanying drawings in the embodiments of the present invention.
[0033] Figure 1 This is one of the flowcharts illustrating the trajectory smoothing method provided by the present invention, such as... Figure 1 As shown, the method includes the following steps.
[0034] Step 101: Obtain the straight line trajectory and the spiral trajectory, and determine the target plane.
[0035] It should be noted that this embodiment can be used in Figure 2 The scenario shown illustrates a scenario where a spatial transition curve is generated between the straight line trajectory and the spiral trajectory for trajectory smoothing. For example, the straight line trajectory and the spiral trajectory can be obtained from adjacent program blocks to be processed in the CNC machining code, and the main machining plane of the standard circle corresponding to the spiral trajectory is determined as the target plane.
[0036] Here, the target plane refers to the projection plane of adjacent trajectories processed by the trajectory smoothing method. For example, the target plane refers to the projection plane of adjacent straight line trajectories and spiral trajectories, used to generate a two-dimensional plane transition curve for spatial transition curves, which provides angular parameters.
[0037] Both linear and helical trajectories are tool movement trajectories. For example, a linear trajectory can be the trajectory of a tool moving linearly on a CNC machine controlled by CNC code. A helical trajectory can be the trajectory of a tool moving helically downwards on a CNC machine controlled by CNC code.
[0038] Understandably, within the main machining plane of the standard circle corresponding to the spiral trajectory, the spiral projection is a standard circle, and the straight line projection is still a straight line, which can reduce the complexity of determining the two-dimensional plane transition curve.
[0039] Step 102: Perform projection processing based on the target plane to obtain the projected straight line of the straight line trajectory and the projected circle of the spiral trajectory.
[0040] It should be noted that after determining the target plane, a straight line trajectory in three-dimensional space can be vertically projected onto the target plane to obtain a projected straight line, and a spiral trajectory in three-dimensional space can be vertically projected onto the target plane to obtain a projected circle. The projected circle of the spiral trajectory is a standard circle, and the starting and ending points of the projected straight line correspond to the two endpoints of the original straight line trajectory in three-dimensional space.
[0041] Step 103: Obtain a two-dimensional plane transition curve based on the projected straight line and the projected circle, and determine the first transition point on the straight line trajectory and the second transition point on the spiral trajectory based on the two-dimensional plane transition curve.
[0042] Among them, the two-dimensional plane transition curve refers to a smooth parametric curve constructed in the target plane to connect the projected straight line and the projected circle.
[0043] It should be noted that there are many ways to obtain the two-dimensional plane transition curve based on the projected straight line and the projected circle, such as through circular arcs, free curves, etc., and this embodiment does not limit this.
[0044] The projection point of the first transition point can be obtained from the intersection of the two-dimensional plane transition curve and the projected straight line, and then the first transition point can be determined by combining the two endpoints of the straight line trajectory and the direction vector.
[0045] The projection point of the second transition point can be obtained from the intersection of the two-dimensional plane transition curve and the spiral trajectory. Then, by combining the spiral trajectory and its clockwise / counterclockwise characteristics, the projection point of the second transition point is determined to be the one closest to the starting point of the spiral trajectory in the vertical direction, thus obtaining the second transition point on the spiral trajectory.
[0046] Step 104: Obtain the vertical change curve based on the first transition point and the second transition point, and determine the spatial transition curve based on the vertical change curve and the two-dimensional plane transition curve.
[0047] The vertical transition curve describes the change of the spatial transition curve in the direction perpendicular to the target plane. The spatial transition curve can be used to generate control commands, guiding the CNC cutting tool to transform from a linear trajectory to a helical trajectory along the spatial transition curve. The first transition point can be taken as the new end point of the linear trajectory, and the second transition point as the new starting point of the helical trajectory.
[0048] It should be noted that the vertical transition curve can be obtained by interpolation based on the first and second transition points. Taking the target plane as the XY plane as an example, the vertical transition curve can describe the change of the spatial transition curve in the Z direction, and the two-dimensional plane transition curve can describe the change of the spatial transition curve in the XY plane. Therefore, based on the vertical transition curve and the two-dimensional plane transition curve, a complete three-dimensional spatial transition curve can be obtained, ensuring geometric first-order continuity and realizing the smooth trajectory construction of the spiral and the straight line in three-dimensional space.
[0049] The trajectory smoothing method provided in this invention determines a target plane by acquiring a straight line trajectory and a spiral trajectory, and then performs projection processing on the target plane to obtain a projected straight line and a projected circle to obtain a two-dimensional plane transition curve. This two-dimensional plane transition curve can describe the angular change of the spatial transition curve on the target plane. Then, based on the two-dimensional plane transition curve, a first transition point on the straight line trajectory and a second transition point on the spiral trajectory are determined to obtain a vertical change curve. This vertical change curve can describe the change of the spatial transition curve in the vertical direction of the target plane. Therefore, based on the vertical change curve and the two-dimensional plane transition curve, the spatial transition curve is automatically determined to adapt to combinations of spirals and straight lines of different specifications.
[0050] Based on the above embodiments, obtaining a two-dimensional plane transition curve based on the projected straight line and the projected circle includes: determining a first first-order tangent vector of the projected straight line and a second first-order tangent vector at the starting point of the projected circle; and obtaining a two-dimensional plane transition curve based on the first first-order tangent vector and the second first-order tangent vector.
[0051] Specifically, the first-order tangent vector of the straight line trajectory can be determined based on the three-dimensional position information of the starting and ending points of the straight line trajectory. Selecting the corresponding component of this first-order tangent vector on the target plane yields the first-order tangent vector of the projected straight line. Alternatively, the center of the projection circle of the helical trajectory can be obtained first, and the starting point of the projection circle can be determined by perpendicular projection based on the starting point of the helical trajectory. Then, the second-order tangent vector at the starting point of the projection circle can be determined based on the center of the projection circle, the starting point of the projection circle, and the machining direction of the helical line.
[0052] It is understandable that precise geometric constraints can be applied based on the first tangent vector of the projected straight line and the second tangent vector at the starting point of the projected circle. The two-dimensional plane transition curve obtained based on the precise geometric constraints can be strictly matched with the projected straight line and the projected circle, respectively. This provides a basis for the continuity of the spatial transition curve mapped back to three-dimensional space with the straight line trajectory and the spiral trajectory, so that the tool feed speed can smoothly transition at the straight-spiral junction point, avoiding machine tool vibration and machining marks caused by sudden speed changes.
[0053] Based on any of the above embodiments, before obtaining the two-dimensional planar transition curve based on the first first-order tangent and the second first-order tangent, the method further includes: The directional angle is determined based on the first first-order tangent and the second first-order tangent; The chord height error is obtained, and the first radius of the two-dimensional transition circle is determined based on the chord height error and the direction angle. Obtain the unidirectional trajectory deviation parameter, and determine the second radius of the two-dimensional transition circle based on the unidirectional trajectory deviation parameter and the direction angle; The lengths of the straight line trajectory and the spiral trajectory are obtained, and the third radius of the two-dimensional transition circle is determined based on the lengths of the straight line trajectory, the spiral trajectory, and the directional angle. The minimum value among the first radius, the second radius, and the third radius is determined as the radius of the two-dimensional transition circle.
[0054] like Figure 3 As shown, in some embodiments, the first first-order tangent vector can be normalized to obtain the first first-order unit tangent vector T1 of the projected line, and the second first-order tangent vector can be normalized to obtain the second first-order unit tangent vector T2 at the starting point of the projected circle.
[0055] For example, the directional angle can be calculated based on the first first-order unit tangent T1 and the second first-order unit tangent T2. : The first radius of the two-dimensional transition circle can be calculated based on the following formula. : in, It is the chord height error.
[0056] The second radius of the two-dimensional transition circle can be calculated based on the following formula. : in, It is the radius of the projection circle of the spiral trajectory. It is the starting point of the cut. It is the starting point of the spiral trajectory. It is the length of the straight line trajectory.
[0057] It should be noted that determining the third radius of the two-dimensional transition circle based on the length of the straight trajectory, the length of the spiral trajectory, and the included angle of direction can constrain the radius of the transition circle according to the length of the spiral trajectory and the length of the straight trajectory. This ensures that the transition points at both ends of the spatial transition curve constructed based on the transition circle fall within the length range of the straight trajectory and the spiral trajectory, respectively, thus ensuring that the spatial transition curve constructed based on the transition circle connects to the straight trajectory and the spiral trajectory.
[0058] The third radius of the two-dimensional transition circle can be calculated based on the following formula. : in, It is a one-way trajectory deviation parameter. It is the angle between the first-order unit tangent T1 and the target plane. It is the angle between the second-order unit tangent T2 and the target plane.
[0059] like Figure 4 As shown, the unidirectional trajectory deviation parameter is the allowable trajectory deviation parameter in one direction. Taking the target plane as the XY plane as an example, the unidirectional trajectory deviation parameter can be used to determine the allowable trajectory deviation in the Z direction.
[0060] The radius of the two-dimensional transition circle can be determined using the following formula. : It is understandable that the chord height error and unidirectional trajectory deviation can be preset parameters of the system or obtained according to user instructions. After obtaining the chord height error and unidirectional trajectory deviation, constraints can be established based on the chord height error, unidirectional trajectory deviation, and the straight line trajectory information and helical trajectory information in the CNC code to solve and determine the radius of the two-dimensional transition circle. This facilitates the automatic determination of the corresponding spatial transition curve, avoids reliance on the experience of manual settings by operators, and achieves repeatability in the method of determining the spatial transition curve, thereby adapting to different specifications of helical-straight line combinations.
[0061] Based on any of the above embodiments, before obtaining the two-dimensional planar transition curve based on the first first-order tangent and the second first-order tangent, the method further includes: Based on the radius of the two-dimensional transition circle, a geometric transformation is performed to obtain the center of the two-dimensional transition circle that is simultaneously tangent to the first and second first-order tangent vectors.
[0062] Understandably, by accurately determining the center of the two-dimensional transition circle through geometric transformation, a two-dimensional transition circle can be obtained based on the center and radius of the two-dimensional transition circle. This circle is consistent with the first-order tangential direction of the projection of the straight line segment at the transition point and with the first-order tangential direction of the spiral projection circle at another transition point. This provides a basis for the subsequent generation of spatial transition curves that are tangentially continuous with the non-coplanar straight line trajectory and spiral trajectory in space.
[0063] Furthermore, the radius of the two-dimensional transition circle is determined under the constraint of the system's accuracy requirements. Geometric transformation based on the radius of the two-dimensional transition circle can ensure that the two-dimensional transition circle obtained from the center and radius of the two-dimensional transition circle meets the system's accuracy requirements, thus avoiding the problem of excessive deviation in the transition section.
[0064] Based on any of the above embodiments, the step of performing a geometric transformation based on the radius of the two-dimensional transition circle to obtain the center of the two-dimensional transition circle that is simultaneously tangent to the first first-order tangent vector and the second first-order tangent vector includes: Obtain the center representation of the two-dimensional transition circle and the direction vector of the straight line trajectory, so as to obtain the center representation of the intermediate circle that is simultaneously tangent to the projected straight line and the projected circle based on the direction vector of the straight line trajectory and the center representation of the two-dimensional transition circle; wherein, the radius of the intermediate circle is the same as the radius of the transition circle. Obtain the radius of the projection circle, and determine the distance between the center of the projection circle and the center of the intermediate circle based on the radius of the projection circle and the radius of the intermediate circle; Obtain the center of the projected circle. The center of the two-dimensional transition circle is obtained by solving the characterization of the center of the intermediate circle based on the center of the projected circle and the distance.
[0065] The representation of the center of the two-dimensional transition circle can also be called the vectorized representation of the two-dimensional transition circle, which is an expression that can be calculated through parameters.
[0066] It should be noted that, firstly, two points on the straight line trajectory can be obtained, and the direction vector of the straight line trajectory can be calculated based on the coordinates of these two points. Then, as follows... Figure 5 As shown, based on the direction vector of the straight line trajectory and the center representation of the two-dimensional transition circle, the center representation of the intermediate circle where the two-dimensional transition circle moves along the direction to the position tangent to the projection circle is obtained, so that the center of the two-dimensional transition circle can be obtained by solving the known radius of the two-dimensional transition circle, the radius of the projection circle, and the center of the projection circle obtained above.
[0067] For example, it can be used The direction vector representing the trajectory of a straight line is represented by... As the center representation of the two-dimensional transition circle, the center representation of the intermediate circle can be obtained as follows: It can be used. Indicates the center of the projected circle.
[0068] Given the radius of the two-dimensional transition circle, the radius of the projection circle, and the center of the projection circle, the center of the projection circle at the given location can be constructed using the following expression: Solving the above expression will yield the center of the two-dimensional transition circle.
[0069] Specifically, it can be simplified to ,in: The parameters can be obtained by solving the above system of equations. The specific values that can be taken. Among them, when there are two... When setting the value, the center of the two-dimensional transition circle can be selected. and the starting point of the projection circle Closer value.
[0070] It is understandable that in this embodiment, the two-dimensional transition circle is moved by the direction vector of the straight trajectory to obtain an intermediate circle tangent to the projection circle to construct a strict distance constraint. Based on this distance constraint, a geometric transformation is performed to obtain the center of the two-dimensional transition circle, which can avoid the uncertainty error caused by manual experience estimation or trial and error adjustment.
[0071] Furthermore, in this embodiment, the process of solving for the radius and center of the two-dimensional transition circle can be determined through geometric relationships without the need for visualization. This allows for fast and stable execution in the CNC system, meeting the needs for real-time trajectory calculation and interpolation in actual machining.
[0072] Based on any of the above embodiments, a two-dimensional plane transition curve is obtained according to the projected straight line and the projected circle, and a first transition point on the straight line trajectory and a second transition point on the spiral trajectory are determined according to the two-dimensional plane transition curve, including: The first tangent point with the projected line and the second tangent point with the projected circle are determined based on the center and radius of the two-dimensional transition circle, so as to obtain a two-dimensional planar transition curve based on the first tangent point and the second tangent point; The first transition point on the straight trajectory is determined by geometric transformation based on the first tangent point of the two-dimensional plane transition curve, and the second transition point on the spiral trajectory is determined by geometric transformation based on the second tangent point of the two-dimensional plane transition curve.
[0073] For example, the first tangent point of the projected line can be calculated using the following formula. : The second tangent point of the projected line can be calculated using the following formula. : The two-dimensional plane transition curve can be determined based on the first tangent point, the second tangent point, and the two-dimensional plane transition circle as follows: or in, The angle parameter corresponding to the first tangent point. This refers to the angle parameter corresponding to the second tangent point.
[0074] It should be noted that, as Figure 6 As shown, substituting the information of the first tangent point on the target plane, such as its coordinates, into the straight line trajectory determines the first transition point on the straight line trajectory. Substituting the information of the second tangent point on the target plane, such as the coordinates of the first tangent point, into the spiral trajectory yields multiple candidate transition points. Based on the clockwise / counterclockwise characteristic of the spiral, the candidate transition point closest to the starting point of the spiral trajectory is determined as the second transition point.
[0075] Based on any of the above embodiments, obtaining the vertical change curve according to the first transition point and the second transition point includes: The first spatial first-order tangent vector of the straight line trajectory at the first transition point and the first two-dimensional first-order tangent vector of the two-dimensional plane transition curve at the first tangent point are determined respectively, so as to determine the second spatial first-order tangent vector of the spatial transition curve at the first transition point based on the first spatial first-order tangent vector and the first two-dimensional first-order tangent vector. Determine the third spatial first-order tangent vector of the spiral trajectory at the second transition point, and determine the second two-dimensional first-order tangent vector of the two-dimensional plane transition curve at the second tangent point, so as to determine the fourth spatial first-order tangent vector of the spatial transition curve at the second transition point based on the second spatial first-order tangent vector and the second two-dimensional first-order tangent vector. The vertical change curve is obtained based on the first transition point, the second transition point, the second spatial first-order tangent, and the fourth spatial first-order tangent.
[0076] It should be noted that there are many ways to determine the first-order tangent vector based on the known trajectory, and the method can be determined according to the actual working conditions. This embodiment does not limit this method.
[0077] For example, it can be used The first spatial tangent vector of the straight line trajectory at the first transition point is represented by... Let the first two-dimensional first-order tangent vector of the two-dimensional planar transition curve at the first tangent point be represented. Based on the first spatial first-order tangent vector and the first two-dimensional first-order tangent vector, the vertical component of the second spatial first-order tangent vector of the spatial transition curve at the first transition point is obtained in the target plane. The second spatial first-order tangent of the spatial transition curve at the first transition point can be obtained based on the first two-dimensional first-order tangent and the component in the vertical direction.
[0078] Similarly, it can be used The third-space first-order tangent vector of the helical trajectory at the second transition point is represented by... The second two-dimensional first-order tangent vector represents the two-dimensional planar transition curve at the first tangent point. Based on the third and second two-dimensional first-order tangent vectors, the vertical component of the fourth spatial first-order tangent vector of the spatial transition curve at the second transition point is obtained. The fourth spatial first-order tangent of the spatial transition curve at the second transition point can be obtained based on the second two-dimensional first-order tangent and the component of the vertical direction.
[0079] It is understood that in this embodiment, the two-dimensional first-order tangent vector of the projected straight line at the first tangent point is the same as the two-dimensional first-order tangent vector of the two-dimensional plane transition curve, and the two-dimensional first-order tangent vector of the projected circle at the second tangent point is the same as the two-dimensional first-order tangent vector of the two-dimensional plane transition curve. Based on this, the vertical change curve of the two-dimensional plane transition curve is determined according to the spatial first-order tangent vector of the straight line trajectory and the spiral trajectory, and it is elevated to a three-dimensional spatial transition curve. This can ensure the first-order continuity of the spatial transition curve in space, maintain the tangential continuity between the spatial transition curve and the straight line trajectory and the spiral trajectory, and naturally connect in the vertical direction of the target plane, so as to achieve continuous synthesis axis velocity, avoid corner impact and tool marks, and improve machining quality and machining stability.
[0080] Specifically, based on the first-order tangent vector in the third space and the first-order tangent vector in the second two-dimensional space, the vertical component of the target plane of the fourth-order tangent vector of the spatial transition curve at the second transition point is obtained. This enables the linear mapping relationship between the spatial transition curve and the vertical direction change when it changes along the target plane to be the same as the linear mapping relationship between the straight trajectory and the vertical direction change when it changes along the target plane. This ensures that the direction of the synthesized velocity vector is smoothly connected to the velocity direction of the straight trajectory, avoiding sudden velocity changes.
[0081] Based on any of the above embodiments, obtaining the vertical change curve based on the first transition point, the second transition point, the second spatial first-order tangent vector, and the fourth spatial first-order tangent vector includes: By setting an intermediate point, the first and second transition curve representations of the spatial transition curves are obtained. The first transition curve represents the intermediate point, the first transition point, and the first-order tangent vector of the second space; the second transition curve represents the intermediate point, the second transition point, and the first-order tangent vector of the fourth space. The solution yields the first vertical change curve of the first transition curve and the second vertical change curve of the second transition curve; The determination of the spatial transition curve based on the two-dimensional planar transition curve and the vertical change curve includes: The spatial transition curve is determined based on the two-dimensional planar transition curve, the first vertical change curve, and the second vertical change curve.
[0082] The first transition curve can be represented as a quadratic polynomial equation containing unknown coefficients. The second transition curve can be represented as a quadratic polynomial equation containing unknown coefficients. The final, undesirable spatial transition curve is as follows: Figure 7 As shown.
[0083] For example, the first transition curve can be used to represent the first transition point according to the following formula: The first transition curve can be used to represent the first-order tangent vector of the second space according to the following formula: The second transition curve can be used to represent the second transition point according to the following formula: The second transition curve can be used to represent the first-order tangent vector of the fourth space according to the following formula: The first and second transition curve representations of the intermediate points can be achieved using the following formulas: The first and second transition curve representations of the first-order tangent vector at the intermediate point can be realized using the following formulas: Where a1, b1, and c1 are the unknown coefficients of the first transition curve, and a2, b2, and c2 are the unknown coefficients of the second transition curve.
[0084] Understandably, by constructing transition curves in segments and adding constraints at intermediate points, this method can accurately match the predetermined spatial position and direction of the end point of the straight line segment and the starting point of the spiral, ensuring that the three-dimensional spatial transition curve has no sudden changes in velocity direction at the two connection points and the intermediate point, thus fundamentally eliminating machining vibration and tool marks.
[0085] Furthermore, by setting intermediate points and solving in segments, additional controllable degrees of freedom can be provided for spatial transition curves, enabling them to more flexibly adapt to the complex relative positions and orientations of straight lines and spirals in three-dimensional space, overcoming the limitation that a single curve may not be able to simultaneously satisfy multiple geometric constraints.
[0086] For example, Figure 2 , 4 The units for all axes of coordinates 6 and 7 can be millimeters.
[0087] The trajectory smoothing device provided by the present invention is described below. The trajectory smoothing device described below and the trajectory smoothing method described above can be referred to in correspondence.
[0088] Figure 8 This is a schematic diagram of the trajectory smoothing device provided by the present invention, as shown below. Figure 8 As shown, the device includes the following modules: The plane determination module 810 is used to acquire straight line trajectories and spiral trajectories, and to determine the target plane; The projection module 820 is used to perform projection processing based on the target plane to obtain the projected straight line of the straight line trajectory and the projected circle of the spiral trajectory; The transition point determination module 830 is used to obtain a two-dimensional plane transition curve based on the projected straight line and the projected circle, and to determine a first transition point on the straight line trajectory and a second transition point on the spiral trajectory based on the two-dimensional plane transition curve. The spatial transition curve determination module 840 is used to obtain a vertical change curve based on the first transition point and the second transition point, so as to determine a spatial transition curve based on the vertical change curve and the two-dimensional plane transition curve.
[0089] Figure 9 An example is a schematic diagram of the structure of an electronic device, such as... Figure 9As shown, the electronic device may include: a processor 910, a communications interface 920, a memory 930, and a communication bus 940, wherein the processor 910, the communications interface 920, and the memory 930 communicate with each other through the communication bus 940. The processor 910 can call logical instructions in the memory 930 to execute a trajectory smoothing method. This method includes: acquiring a straight trajectory and a spiral trajectory, determining a target plane, performing projection processing based on the target plane to obtain a projected straight line of the straight trajectory and a projected circle of the spiral trajectory, obtaining a two-dimensional planar transition curve based on the projected straight line and the projected circle, determining a first transition point on the straight trajectory and a second transition point on the spiral trajectory based on the two-dimensional planar transition curve, obtaining a vertical change curve based on the first transition point and the second transition point, and determining a spatial transition curve based on the vertical change curve and the two-dimensional planar transition curve.
[0090] Furthermore, the logical instructions in the aforementioned memory 930 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0091] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the trajectory smoothing method provided by the above methods. The method includes: acquiring a straight trajectory and a spiral trajectory, and determining a target plane; performing projection processing based on the target plane to obtain a projected straight line of the straight trajectory and a projected circle of the spiral trajectory; obtaining a two-dimensional plane transition curve based on the projected straight line and the projected circle; determining a first transition point on the straight trajectory and a second transition point on the spiral trajectory based on the two-dimensional plane transition curve; obtaining a vertical change curve based on the first transition point and the second transition point; and determining a spatial transition curve based on the vertical change curve and the two-dimensional plane transition curve.
[0092] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the trajectory smoothing method provided by the methods described above. The method includes: acquiring a straight trajectory and a spiral trajectory, and determining a target plane; performing projection processing based on the target plane to obtain a projected straight line of the straight trajectory and a projected circle of the spiral trajectory; obtaining a two-dimensional planar transition curve based on the projected straight line and the projected circle; determining a first transition point on the straight trajectory and a second transition point on the spiral trajectory based on the two-dimensional planar transition curve; obtaining a vertical change curve based on the first transition point and the second transition point; and determining a spatial transition curve based on the vertical change curve and the two-dimensional planar transition curve.
[0093] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0094] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A trajectory smoothing method characterized by, The method comprises the following steps: acquiring a straight line track and a spiral line track, and determining a target plane; performing projection processing based on the target plane to obtain a projection straight line of the straight line track and a projection circle of the spiral line track; obtaining a two-dimensional plane transition curve according to the projection straight line and the projection circle, and determining a first transition point on the straight line track and a second transition point on the spiral line track according to the two-dimensional plane transition curve; obtaining a vertical change curve according to the first transition point and the second transition point, and determining a space transition curve based on the vertical change curve and the two-dimensional plane transition curve.
2. The trajectory smoothing method of claim 1, wherein, The method further comprises the following steps before the step of obtaining the two-dimensional plane transition curve according to the projection straight line and the projection circle: determining a first first-order tangent vector of the projection straight line and a second first-order tangent vector at a starting point of the projection circle; obtaining a two-dimensional plane transition curve according to the first first-order tangent vector and the second first-order tangent vector.
3. The trajectory smoothing method of claim 2, wherein, The method further comprises the following steps before the step of obtaining the two-dimensional plane transition curve according to the first first-order tangent vector and the second first-order tangent vector: determining a direction included angle according to the first first-order tangent vector and the second first-order tangent vector; acquiring a chord height error, and determining a first radius of a two-dimensional transition circle based on the chord height error and the direction included angle; acquiring a one-way track deviation parameter, and determining a second radius of the two-dimensional transition circle based on the one-way track deviation parameter and the direction included angle; acquiring a length of the straight line track and a length of the spiral line track, and determining a third radius of the two-dimensional transition circle based on the length of the straight line track, the length of the spiral line track and the direction included angle; determining a minimum value among the first radius, the second radius and the third radius as a two-dimensional transition circle radius.
4. The trajectory smoothing method of claim 3, wherein, The method further comprises the following steps before the step of obtaining the two-dimensional plane transition curve according to the first first-order tangent vector and the second first-order tangent vector: performing geometric transformation based on the two-dimensional transition circle radius to obtain a center of the two-dimensional transition circle which is tangent to the first first-order tangent vector and the second first-order tangent vector at the same time.
5. The trajectory smoothing method of claim 4, wherein, The step of performing geometric transformation based on the two-dimensional transition circle radius to obtain the center of the two-dimensional transition circle which is tangent to the first first-order tangent vector and the second first-order tangent vector at the same time comprises the following steps: acquiring a center representation of the two-dimensional transition circle and a direction vector of the straight line track, and obtaining a center representation of an intermediate circle which is tangent to the projection straight line and the projection circle at the same time according to the direction vector of the straight line track and the center representation of the two-dimensional transition circle, wherein a radius of the intermediate circle is the same as the transition circle radius; acquiring a projection circle radius, and determining a distance between a center of the projection circle and a center of the intermediate circle according to the projection circle radius and the intermediate circle radius; obtaining the center of the projection circle, and solving the center representation of the intermediate circle according to the center of the projection circle and the distance to obtain a center of the two-dimensional transition circle.
6. The trajectory smoothing method of claim 4, wherein, The step of obtaining the two-dimensional plane transition curve according to the projection straight line and the projection circle, and determining the first transition point on the straight line track and the second transition point on the spiral line track according to the two-dimensional plane transition curve comprises the following steps: determine a first tangent point on the straight line track according to the first tangent point of the two-dimensional plane transition curve, and determine a second tangent point on the helical line track according to the second tangent point of the two-dimensional plane transition curve. The vertical change curve is determined according to the first tangent point and the second tangent point, and includes:
7. The trajectory smoothing method of claim 6, wherein, respectively determine a first spatial first-order tangent vector of the straight line track at the first tangent point and a first two-dimensional first-order tangent vector of the two-dimensional plane transition curve at the first tangent point, and determine a second spatial first-order tangent vector of the spatial transition curve at the first tangent point according to the first spatial first-order tangent vector and the first two-dimensional first-order tangent vector; determine a third spatial first-order tangent vector of the helical line track at the second tangent point, determine a second two-dimensional first-order tangent vector of the two-dimensional plane transition curve at the second tangent point, and determine a fourth spatial first-order tangent vector of the spatial transition curve at the second tangent point according to the second spatial first-order tangent vector and the second two-dimensional first-order tangent vector; determine a vertical change curve based on the first tangent point, the second tangent point, the second spatial first-order tangent vector and the fourth spatial first-order tangent vector. The vertical change curve is determined based on the first tangent point, the second tangent point, the second spatial first-order tangent vector and the fourth spatial first-order tangent vector, and includes:
8. The trajectory smoothing method of claim 7, wherein, set an intermediate point to obtain a first transition curve representation and a second transition curve representation of the spatial transition curve; represent the intermediate point, the first tangent point and the second spatial first-order tangent vector according to the first transition curve representation, and represent the intermediate point, the second tangent point and the fourth spatial first-order tangent vector according to the second transition curve representation; solve to obtain a first vertical change curve of the first transition curve and a second vertical change curve of the second transition curve; The spatial transition curve is determined based on the two-dimensional plane transition curve and the vertical change curve, and includes: determine the spatial transition curve based on the two-dimensional plane transition curve and the first vertical change curve and the second vertical change curve. includes:
9. A trajectory smoothing apparatus characterized by comprising: a plane determination module configured to acquire a straight line track and a helical line track, and determine a target plane; a projection module configured to perform projection processing based on the target plane to obtain a projection straight line of the straight line track and a projection circle of the helical line track; a transition point determination module configured to obtain a two-dimensional plane transition curve according to the projection straight line and the projection circle, and determine a first transition point on the straight line track and a second transition point on the helical line track according to the two-dimensional plane transition curve; a spatial transition curve determination module configured to obtain a vertical change curve according to the first transition point and the second transition point, and determine a spatial transition curve based on the vertical change curve and the two-dimensional plane transition curve. The processor executes the computer program to implement the trajectory smoothing method according to any one of claims 1 to 8.
10. An electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that,