Trajectory smoothing methods, CNC machine tools, and computer-readable storage media
By determining the straight-line position and error accuracy of the three-dimensional spatial trajectory, and using the trajectory smoothing circular arc or third-order Bézier curve method, the smoothing problem between three-dimensional spatial trajectories is solved, improving the trajectory closure and computational efficiency.
Patent Information
- Application Number
- CN202210783926.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-05
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2042-07-05
AI Technical Summary
Existing technologies are not ideal for smoothing between three-dimensional trajectories, especially in machine tool processing. Current smoothing technologies mainly focus on two-dimensional planes and cannot effectively solve the problem of smooth transition between three-dimensional trajectories.
By determining whether the first and second straight lines of the trajectory to be smoothed are located in the same plane, it is determined whether the common perpendicular segment is less than the preset error accuracy value. If it is within the error, the midpoint is taken as the coplanar intersection point, and the trajectory smoothing arc is determined based on the coplanar intersection point and the error value. If it is not within the error, the straight line is projected onto an auxiliary plane and smoothed by a third-order Bézier curve.
It achieves effective and smooth transition of three-dimensional spatial trajectory, reduces abrupt jumps in motion axis speed and acceleration during machine tool processing, improves the efficiency and closure of trajectory smoothing processing, and simplifies the amount of calculation.
Smart Images

Figure CN115205457B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine tool processing technology, and in particular to a trajectory smoothing method, a CNC machine tool, and a computer-readable storage medium. Background Technology
[0002] In the field of machine tool machining trajectory planning, smoothing between trajectories is an essential part. Due to the special nature of CNC devices in CNC machine tools, most CNC machine tools only have linear interpolation and circular interpolation functions. Therefore, during trajectory planning, the trajectory must ultimately be converted into a straight line or a circular arc. However, for spatial trajectories, they may exist in the form of skew lines. Therefore, in order to make the trajectory closed and reduce abrupt jumps in the speed and acceleration of each motion axis during machining, trajectory smoothing is very necessary.
[0003] Existing research on trajectory smoothing techniques such as circular arc smoothing, elliptical arc smoothing, and polynomial curve smoothing mainly focuses on two-dimensional planes and cannot be directly applied to three-dimensional space. Furthermore, in the field of machine tool machining trajectory planning, there is relatively little research on smoothing techniques between three-dimensional trajectories, and existing smoothing processes often only achieve geometric smoothing, resulting in less than ideal smoothing effects between three-dimensional trajectories. Summary of the Invention
[0004] The main objective of this invention is to provide a trajectory smoothing method, a CNC machine tool, and a computer-readable storage medium, aiming to solve the technical problem that the transition smoothing effect between three-dimensional spatial trajectories in machine tool machining trajectory planning is not ideal.
[0005] To achieve the above objectives, the present invention provides a trajectory smoothing method, which includes the following steps:
[0006] Determine the first and second straight lines of the trajectory to be smoothed, and determine whether the first and second straight lines are located in the same plane;
[0007] If the first straight line and the second straight line are not located on the same plane, then obtain the common perpendicular line segment between the first straight line and the second straight line, and determine whether the common perpendicular line segment is less than or equal to the preset first distance error accuracy value;
[0008] If the common perpendicular segment is less than or equal to the preset first distance error accuracy value, then the midpoint of the common perpendicular segment is taken as the coplanar intersection point between the first straight line and the second straight line.
[0009] Based on the coplanar intersection points and the preset second distance error accuracy value, determine the trajectory smoothing arc corresponding to the trajectory to be smoothed, and perform trajectory smoothing based on the trajectory smoothing arc.
[0010] Optionally, after the step of determining whether the first straight line and the second straight line are located in the same plane, the method further includes:
[0011] If the first line and the second line are located in the same plane, then obtain the coplanar intersection point between the first line and the second line in the plane;
[0012] Perform the step of determining the trajectory smoothing arc corresponding to the trajectory to be smoothed based on the coplanar intersection points and the preset second distance error accuracy value.
[0013] Optionally, after the step of determining whether the common perpendicular segment is less than or equal to a preset first distance error accuracy value, the method further includes:
[0014] If the common perpendicular segment is greater than the first distance error accuracy value, then the third-order Bézier curve corresponding to the trajectory to be smoothed is determined, and the third-order Bézier curve is used to smooth the trajectory to be smoothed.
[0015] Optionally, the step of determining the third-order Bézier curve corresponding to the trajectory to be smoothed includes:
[0016] An auxiliary plane parallel to the first line and the second line is determined based on the midpoint of the common perpendicular segment;
[0017] The first straight line is projected onto the auxiliary plane to obtain a first projected straight line, and the second straight line is projected onto the auxiliary plane to obtain a second projected straight line;
[0018] The third-order Bézier curve corresponding to the trajectory to be smoothed is determined based on the first projected line and the second projected line.
[0019] Optionally, the step of determining the third-order Bézier curve corresponding to the trajectory to be smoothed based on the first projected line and the second projected line includes:
[0020] Determine the projection intersection point between the first projection line and the second projection line;
[0021] Based on the projection intersection point and the preset third distance error accuracy value, determine the projection smooth arc that corresponds to both the first projection line and the second projection line;
[0022] Based on the first projected straight line, the second projected straight line, and the projected smoothed circular arc, determine the third-order Bézier curve corresponding to the trajectory to be smoothed.
[0023] Optionally, the step of determining the third-order Bézier curve corresponding to the trajectory to be smoothed based on the first projected straight line, the second projected straight line, and the projected smoothed circular arc includes:
[0024] Determine the first tangent point and the second tangent point between the first projected line and the second projected line and the projected smooth arc, respectively, and determine the tangent line formed by the first tangent point and the second tangent point;
[0025] Determine the vertex of the projected smooth arc, and determine a parallel line that is parallel to the line of tangency based on the vertex;
[0026] Determine the third and fourth tangent points where the parallel line intersects the first projected line and the second projected line, respectively;
[0027] Based on the first tangent point, the second tangent point, the third tangent point, and the fourth tangent point, determine the four tangent points corresponding to the first straight line and the second straight line respectively;
[0028] The four tangent points are used as control points for the third-order Bézier curve to determine the third-order Bézier curve corresponding to the trajectory to be smoothed.
[0029] Optionally, the step of determining the trajectory smoothing arc corresponding to the trajectory to be smoothed based on the coplanar intersection points and a preset second distance error accuracy value includes:
[0030] The second distance error accuracy value is taken as the shortest distance from the coplanar intersection point to the smooth arc of the trajectory.
[0031] Obtain the angle between the first straight line and the second straight line, and determine the origin and radius of the trajectory smoothing arc corresponding to the trajectory to be smoothed by using the angle and the second distance error accuracy value, which is the shortest distance.
[0032] Optionally, the step of determining the first and second straight lines of the trajectory to be smoothed includes:
[0033] Determine if the trajectory to be smoothed contains a curve;
[0034] If the trajectory to be smoothed contains a curve, then the tangent line corresponding to the first endpoint of the curve is determined as the first straight line of the trajectory to be smoothed, and the tangent line corresponding to the second endpoint of the curve is determined as the second straight line of the trajectory to be smoothed.
[0035] Furthermore, to achieve the above objectives, the present invention also provides a trajectory smoothing device, comprising:
[0036] The geometric recognition module is used to determine the first and second straight lines of the trajectory to be smoothed, and to determine whether the first and second straight lines are located in the same plane.
[0037] The geometric calculation module is used to obtain the common perpendicular segment between the first line and the second line if the first line and the second line are not located in the same plane, and to determine whether the common perpendicular segment is less than or equal to a preset first distance error precision value; if the common perpendicular segment is less than or equal to the preset first distance error precision value, the midpoint of the common perpendicular segment is taken as the coplanar intersection point between the first line and the second line.
[0038] The smoothing module is used to determine the trajectory smoothing arc corresponding to the trajectory to be smoothed based on the coplanar intersection points and a preset second distance error accuracy value, so as to perform trajectory smoothing based on the trajectory smoothing arc.
[0039] In addition, to achieve the above objectives, the present invention also provides a CNC machine tool, including a processor, a memory, and a trajectory smoothing program stored in the memory that can be executed by the processor, wherein when the trajectory smoothing program is executed by the processor, the steps of the trajectory smoothing method as described above are implemented.
[0040] The present invention also provides a computer-readable storage medium storing a trajectory smoothing program, wherein when the trajectory smoothing program is executed by a processor, it implements the steps of the trajectory smoothing method as described above.
[0041] The trajectory smoothing method in this invention, by determining the first and second straight lines of the trajectory to be smoothed and judging whether the first and second straight lines are located in the same plane, simplifies the processing of the trajectory to be smoothed, whether it includes only straight lines or curved lines, by using straight lines, thereby reducing the amount of calculation during smoothing and improving the efficiency of smoothing the trajectory. Furthermore, by obtaining the common perpendicular segment between the first and second straight lines if they are not located in the same plane, and judging whether the common perpendicular segment is less than or equal to a preset first distance error precision value, and taking the midpoint of the common perpendicular segment as the coplanar intersection point between the first and second straight lines if the common perpendicular segment is less than or equal to the preset first distance error precision value, the two straight lines in three-dimensional space are approximately coplanar within a preset precision, thus achieving a smooth transition of the trajectory to be smoothed in three-dimensional space.
[0042] Finally, based on the coplanar intersection points and the preset second distance error accuracy value, the trajectory smoothing arc corresponding to the trajectory to be smoothed is determined. The step of smoothing the trajectory based on the trajectory smoothing arc can achieve a smooth transition of the trajectory to be smoothed in three-dimensional space in the form of arc smoothing. This makes the trajectory to be smoothed in three-dimensional space have good closure, reduces the sudden jumps in the speed and acceleration of each motion axis during machine tool processing, and based on the characteristics of the arc, the smoothing arc has good symmetry. Its maximum curvature is also easy to calculate, which provides convenience for the subsequent acceleration planning of the motion axis. Attached Figure Description
[0043] Figure 1 This is a schematic diagram of the terminal structure of the hardware operating environment of the CNC machine tool involved in the embodiments of the present invention;
[0044] Figure 2 This is a flowchart illustrating the first embodiment of the trajectory smoothing method of the present invention;
[0045] Figure 3 This is a schematic diagram of the arc smoothing method involved in the trajectory smoothing method of the present invention;
[0046] Figure 4 This is a flowchart illustrating a second embodiment of the trajectory smoothing method of the present invention;
[0047] Figure 5 This is a detailed flowchart of step S300 in the second embodiment of the trajectory smoothing method of the present invention;
[0048] Figure 6 This is a schematic diagram of the projection control points involved in the trajectory smoothing method of the present invention;
[0049] Figure 7 This is a schematic diagram of the third-order Bezier smoothing involved in the trajectory smoothing method of the present invention;
[0050] Figure 8 This is a schematic diagram illustrating the overall process of a specific application of the trajectory smoothing method of the present invention;
[0051] Figure 9 This is a schematic diagram of the frame structure of the trajectory smoothing device of the present invention.
[0052] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0053] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0054] Summary of the embodiments in the technical solution of the present invention:
[0055] Currently, there is relatively little research on trajectory smoothing in three-dimensional space in the field of machine tool trajectory planning, and most of the research is still in the theoretical stage. Most of the research focuses on two-dimensional plane, and commonly used smoothing techniques include elliptical arc smoothing and polynomial curve smoothing.
[0056] This invention addresses the smoothing (smoothing transition) of trajectories in three-dimensional space. These trajectories include both straight-line and curved-line smoothing, specifically smoothing between straight-line pairs, straight-line pairs with curves, curve pairs with straight-line pairs, and curve pairs with curves. In the case of straight-line pairs, two skew lines can be directly obtained. In the cases of direct curve pairing, curve-line pairing, or curve-curve pairing, the endpoints of the curves can be tangented to form two skew lines. If the common perpendicular segment between the two skew lines is within a preset first distance error precision value, the two skew lines can be approximated as coplanar. Then, based on the intersection of the two tangents and a preset second distance error precision value (the shortest distance from the intersection point to the smoothing arc), a smoothing arc is obtained through geometric relationships. This smoothing arc is then used to perform a smooth transition on the trajectory. If the common perpendicular segment between two skew lines exceeds the first distance error accuracy value, the trajectory to be smoothed cannot be smoothed using a smoothing arc. Instead, the two skew lines can be projected onto the same projection plane to obtain two coplanar intersecting lines. Then, the two intersection points of the smoothing arc with the two coplanar intersecting lines and the line formed by the two intersection points can be obtained through arc smoothing. Based on this smoothing arc, a line parallel to the line formed by the two intersection points is obtained. This parallel line intersects the two coplanar intersecting lines at two points, thus obtaining the aforementioned four intersection points on the projection plane. According to the geometric relationship of the projection, four points on the original two skew lines are obtained, and these four points are used as the four control points of the third-order Bézier curve. Thus, the trajectory to be smoothed is smoothed using the third-order Bézier curve method.
[0057] This invention provides a CNC machine tool. The CNC machine tool can include any type of CNC machine tool such as a CNC milling machine, CNC lathe, CNC drilling machine, CNC grinding machine, and CNC gear processing machine tool, and is not limited thereto.
[0058] like Figure 1 As shown, Figure 1 This is a schematic diagram of the hardware operating environment of the CNC machine tool involved in the embodiments of the present invention.
[0059] like Figure 1As shown, the CNC machine tool may include: a processor 1001, such as a CPU; a network interface 1004; a user interface 1003; a memory 1005; and a communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display or an input unit such as a control panel; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001. The memory 1005, as a computer storage medium, may include a trajectory smoothing program.
[0060] Those skilled in the art will understand that Figure 1 The hardware structure shown does not constitute a limitation on the device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0061] Continue to refer to Figure 1 , Figure 1 The memory 1005, which is a computer-readable storage medium, may include an operating system, a user interface module, a network communication module, and a trajectory smoothing program.
[0062] exist Figure 1 In this embodiment, the network communication module is mainly used to connect to the server and communicate data with the server; while the processor 1001 can call the trajectory smoothing program stored in the memory 1005 and execute the steps in the following embodiments.
[0063] Based on the hardware structure of the controller described above, various embodiments of the trajectory smoothing method of the present invention are proposed.
[0064] This invention provides a trajectory smoothing method.
[0065] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating a first embodiment of the trajectory smoothing method of the present invention; in the first embodiment of the present invention, the trajectory smoothing method includes the following steps:
[0066] Step S10: Determine the first straight line and the second straight line of the trajectory to be smoothed, and determine whether the first straight line and the second straight line are located in the same plane;
[0067] In this embodiment, the selection of which trajectories need to be smoothed during machine tool processing can be set according to the actual processing requirements. The trajectories to be smoothed include straight-line trajectories, straight-line-curve trajectories, curve-straight-line trajectories, and curve-curve trajectories.
[0068] For example, on a straight-curve trajectory to be smoothed, smoothing is required between the straight line and the curve so that the moving parts of the machine tool can smoothly transition from the straight line to the curve, thus avoiding leaving sharp corners or gaps on the workpiece.
[0069] For the first and second straight lines of the trajectory to be smoothed, if the trajectory is a straight-line-straight-line trajectory, the first and second straight lines are directly obtained. One of the two straight lines (strictly speaking, line segments) in the straight-line-straight-line trajectory can be designated as the first straight line, and the other as the second straight line. If the trajectory to be smoothed is any of the straight-line-curve trajectory, curve-straight-line trajectory, or curve-curve trajectory, due to the presence of a curve, tangent processing of the curve is required. Specifically, at the endpoints of the curve, i.e., the intersection of the two line segments, a tangent line to the corresponding curve is drawn. If it is a straight-line-curve trajectory or a curve-straight-line trajectory, then the straight line in the trajectory to be smoothed is designated as the first or second straight line, and the tangent line at the endpoint where the curve intersects the straight line is designated as the second or first straight line.
[0070] Determine whether the first and second straight lines are located in the same plane, thereby determining whether the trajectory to be smoothed is in a two-dimensional plane or in three-dimensional space.
[0071] Specifically, in one embodiment, the step of determining the first straight line and the second straight line of the trajectory to be smoothed includes:
[0072] Step a: Determine if the trajectory to be smoothed contains a curve;
[0073] Step b: If the trajectory to be smoothed has a curve, then the tangent line corresponding to the first endpoint of the two endpoints of the curve is determined as the first straight line of the trajectory to be smoothed, and the tangent line corresponding to the second endpoint of the two endpoints of the curve is determined as the second straight line of the trajectory to be smoothed.
[0074] In this embodiment, it is necessary to identify and determine the shape of the line segments contained in the trajectory to be smoothed. The most important aspect is determining whether the trajectory contains curved line segments. If the trajectory contains curves, i.e., the straight-line-curve trajectory, curve-straight-line trajectory, and curve-curve trajectory mentioned above, then two corresponding tangent lines can be drawn at the endpoints of the curve. Whether these two tangent lines serve as the first or second straight line depends on the line segments connecting the two endpoints of the curve. For example, if the trajectory to be smoothed is a straight-line-curve trajectory, and the straight line segment is the first straight line, then the tangent line corresponding to the endpoint of the curved line segment connecting with the straight line can be the second straight line. Similarly, if the trajectory to be smoothed is a curve-straight-line trajectory, and the tangent line corresponding to the endpoint of the curved line segment connecting with the straight line is the first straight line, then that straight line segment can be the second straight line. It is not necessary to clearly distinguish which of the two connecting segments in the trajectory to be smoothed is the first or second straight line; it is sufficient to set different first and second straight lines within the trajectory.
[0075] This embodiment enables the straight-line treatment of curves even if there are curved line segments in the trajectory to be smoothed. This reduces the amount of calculation of geometric relationships and speeds up the smoothing process of the trajectory.
[0076] Step S20: If the first straight line and the second straight line are not located on the same plane, then obtain the common perpendicular line segment between the first straight line and the second straight line, and determine whether the common perpendicular line segment is less than or equal to the preset first distance error accuracy value.
[0077] If the first and second straight lines are not on the same plane, it indicates that the trajectory to be smoothed is in three-dimensional space. Based on the geometric positional relationship of skew lines, the common perpendicular segment between the first and second straight lines can be obtained, that is, the segment of the common perpendicular between the first and second straight lines. Then, it is determined whether the common perpendicular segment is within the first distance error accuracy value. This first distance error accuracy value can be set according to the user's actual processing requirements, such as 0.1mm, 0.3mm, 1mm, 5mm, etc., and is not limited here.
[0078] Step S30: If the common perpendicular segment is less than or equal to the preset first distance error accuracy value, then the midpoint of the common perpendicular segment is taken as the coplanar intersection point between the first straight line and the second straight line.
[0079] If the common perpendicular segment is less than or equal to the preset first distance error accuracy value, it means that the common perpendicular segment between the first straight line and the second straight line is within the first distance error accuracy value. Then, the midpoint of the common perpendicular segment is determined and taken as the coplanar intersection point between the first straight line and the second straight line, which is also within the first distance error accuracy value. The trajectory to be smoothed in three-dimensional space can be processed into a two-dimensional plane. The midpoint of the common perpendicular segment is set as the coplanar intersection point between the first straight line and the second straight line (which is not actually in space). However, this will not affect the subsequent smoothing process of the trajectory to be smoothed, because it is still within the range of controllable accuracy.
[0080] Step S40: Based on the coplanar intersection points and the preset second distance error accuracy value, determine the trajectory smoothing arc corresponding to the trajectory to be smoothed, and perform trajectory smoothing based on the trajectory smoothing arc.
[0081] By utilizing the coplanar intersection point, the second distance error accuracy value, and the coplanar angle between the first and second straight lines, the smoothing arc of the trajectory corresponding to the trajectory to be smoothed can be obtained using the geometric positional relationship between the geometric elements. The second distance error accuracy value is distinct from the first distance error accuracy value; they have different uses, and the second distance error accuracy value can be set according to actual needs, such as 0.7mm, 1.3mm, etc., without limitation here.
[0082] To better understand step S40, please refer to... Figure 3 , Figure 3 This is a schematic diagram of arc smoothing involved in the trajectory smoothing method of the present invention.
[0083] Specifically, step S40 includes:
[0084] Step c, take the second distance error accuracy value as the shortest distance from the coplanar intersection point to the smooth arc of the trajectory;
[0085] Step d: Obtain the angle between the first straight line and the second straight line, and determine the origin and radius of the trajectory smoothing arc corresponding to the trajectory to be smoothed by using the angle and the second distance error accuracy value, which is the shortest distance.
[0086] like Figure 3As shown, AB can be either the first or second straight line, and DC can be either the second or first straight line. Their coplanar intersection point is G. The angle between the first straight line AB and the second straight line DC is obtained. Based on the second distance error accuracy value, a line segment GH is drawn through the midpoint of this coplanar angle. This line segment GH serves as the shortest distance from point G to the smoothed arc to be constructed. Using the known angle and the length of line segment GH, the origin and radius of the smoothed arc of the trajectory to be smoothed can be determined by referring to the geometric relationship shown in the figure. This ultimately determines the smoothed arc of the trajectory (the trajectory smoothing arc), allowing for a smooth transition of the trajectory.
[0087] In one embodiment, after step S10, the method further includes:
[0088] Step e: If the first line and the second line are located in the same plane, then obtain the coplanar intersection point between the first line and the second line in the plane;
[0089] Step f involves performing the step of determining the trajectory smoothing arc corresponding to the trajectory to be smoothed based on the coplanar intersection points and a preset second distance error accuracy value.
[0090] If the first and second lines lie in the same plane, it means the trajectory to be smoothed exists only in a two-dimensional plane, and therefore the coplanar intersection point between the first and second lines can be directly obtained. Then, referring to... Figure 3 The same calculation method as above can directly generate the smoothing arc corresponding to the trajectory to be smoothed, realizing the smoothing transition of the trajectory to be smoothed in the two-dimensional plane. The smoothing arc has excellent closure and symmetry, which makes it easy for the moving parts of the CNC machine tool to plan the trajectory to be smoothed and their own motion parameters.
[0091] The trajectory smoothing method in this invention, by determining the first and second straight lines of the trajectory to be smoothed and judging whether the first and second straight lines are located in the same plane, simplifies the processing of both trajectories containing only straight lines and those containing curves by using straight lines, thereby reducing the computational load during smoothing and improving the efficiency of smoothing the trajectory. Furthermore, if the first and second straight lines are not located in the same plane, the method obtains the common perpendicular segment between the first and second straight lines and judges whether the common perpendicular segment is less than or equal to a preset first distance error precision value. If the common perpendicular segment is less than or equal to the preset first distance error precision value, the midpoint of the common perpendicular segment is taken as the first... The step of finding the coplanar intersection point between the first line and the second line, and making the two lines in three-dimensional space approximately coplanar within a preset accuracy, can achieve a smooth transition of the trajectory to be smoothed in three-dimensional space. Finally, based on the coplanar intersection point and the preset second distance error accuracy value, the trajectory smoothing arc corresponding to the trajectory to be smoothed is determined. The step of smoothing the trajectory based on the trajectory smoothing arc can achieve a smooth transition of the trajectory to be smoothed in three-dimensional space in the form of arc smoothing. This makes the trajectory to be smoothed in three-dimensional space have good closure, reduces the sudden jumps in the speed and acceleration of each motion axis during machine tool processing, and based on the characteristics of the arc, the smoothing arc has good symmetry, and its maximum curvature is easy to calculate, which provides convenience for the subsequent acceleration planning of the motion axis.
[0092] Please refer to Figure 4 , Figure 4 This is a flowchart illustrating a second embodiment of the trajectory smoothing method of the present invention. Further, based on the first embodiment of the trajectory smoothing method of the present invention, a second embodiment of the trajectory smoothing method of the present invention is proposed. In this embodiment, after the step S20 of determining whether the common perpendicular segment is less than or equal to a preset first distance error accuracy value, the method further includes:
[0093] Step g: If the common perpendicular segment is greater than the first distance error accuracy value, then determine the third-order Bézier curve corresponding to the trajectory to be smoothed, so as to use the third-order Bézier curve to smooth the trajectory to be smoothed.
[0094] In this embodiment, if the common perpendicular segment is greater than a preset first distance error accuracy value, that is, if the common perpendicular segment is not within the first distance error accuracy value, then the trajectory to be smoothed in three-dimensional space cannot be smoothed by circular arc smoothing. Instead, a third-order Bézier curve needs to be introduced to smooth the trajectory.
[0095] Specifically, such as Figure 4 As shown, the step of determining the third-order Bézier curve corresponding to the trajectory to be smoothed includes:
[0096] Step S100: Determine an auxiliary plane parallel to the first straight line and the second straight line based on the midpoint of the common perpendicular segment;
[0097] Step S200: Project the first straight line onto the auxiliary plane to obtain a first projected straight line, and project the second straight line onto the auxiliary plane to obtain a second projected straight line;
[0098] Step S300: Determine the third-order Bézier curve corresponding to the trajectory to be smoothed based on the first projected line and the second projected line.
[0099] You can refer to Figure 6 , Figure 6 This is a schematic diagram of the projection control points involved in the trajectory smoothing method of the present invention.
[0100] In this embodiment, after determining the midpoint of the common perpendicular segment, an auxiliary plane is created that passes through the midpoint and is parallel to both the first and second lines. The first and second lines in three-dimensional space are then projected onto this auxiliary plane, thus completing the geometric transformation from three-dimensional to two-dimensional. Figure 6 As shown, the first shadow line New_Line1 and the second projection line New_Line2 are obtained. Then, the four control points of the third-order Bézier curves on the original first and second lines are obtained through the first shadow line New_Line1, the second projection line New_Line2, and the preset third distance error accuracy value. Finally, the smooth curve of the trajectory to be smoothed is obtained.
[0101] More specifically, refer to Figure 5 , Figure 5 This is a detailed flowchart of step S300 in the second embodiment of the trajectory smoothing method of the present invention. Step S300 includes:
[0102] Step S310: Determine the projection intersection point between the first projection line and the second projection line;
[0103] Step S320: Based on the projection intersection point and the preset third distance error accuracy value, determine the projection smooth arc that corresponds to both the first projection line and the second projection line.
[0104] Step S330: Determine the third-order Bézier curve corresponding to the trajectory to be smoothed based on the first projected straight line, the second projected straight line, and the projected smoothed arc.
[0105] Please continue to refer to Figure 6The projection intersection point between the first and second projected lines is D. The preset third distance error accuracy value has a different purpose than the first and second distance error accuracy values mentioned above. They are not the same concept, but their values can overlap. For example, the third distance error accuracy value can be 0.1mm, 0.7mm, 1.5mm, etc., and there are no restrictions here.
[0106] Having determined the projection intersection point D and the third distance error accuracy value, which is also the shortest distance from the first and second projected lines to the smooth arc that can be drawn (i.e., the shortest distance DM to the projected smooth arc), and having also obtained the angle between the first and second projected lines, the projected smooth arcs corresponding to the first and second projected lines can be determined through geometric relationships based on the projection intersection point D, the third distance error accuracy value DM, and the angle between the first and second projected lines. Furthermore, the third-order Bézier curve corresponding to the trajectory to be smoothed can be determined through the first projected line, the second projected line, and the projected smooth arc.
[0107] More specifically, step S330 includes:
[0108] Step h: Determine the first tangent point and the second tangent point between the first projected line and the second projected line and the projected smooth arc, respectively, and determine the tangent line formed by the first tangent point and the second tangent point;
[0109] Step i: Determine the vertex of the projected smooth arc, and determine a parallel line parallel to the tangent line based on the vertex;
[0110] Step j: Determine the third and fourth tangent points where the parallel line intersects the first projected line and the second projected line, respectively;
[0111] Step k: Based on the first tangent point, the second tangent point, the third tangent point, and the fourth tangent point, determine the four tangent points corresponding to the first straight line and the second straight line respectively;
[0112] Step 1: Use the four tangent points as control points for the third-order Bézier curve to determine the third-order Bézier curve corresponding to the trajectory to be smoothed.
[0113] Please continue to refer to Figure 6First, determine the first tangent point E and the second tangent point F between the first projected line New_Line1 and the second projected line New_Line2 and the projected smoothing arc, respectively, as well as the line EF. Then, create a line GH through the vertex M of the projected smoothing arc, intersecting the first and second projected lines at points G and H, respectively. This yields four points E, F, G, and H on the first and second projected lines. Based on the correspondence between the projection and the original graphic, determine the four tangent points E', F', G', and H' on the first and second lines corresponding to points E, F, G, and H, respectively. Using E', F', G', and H' as control points for the third-order Bézier curve, the third-order Bézier curve corresponding to the trajectory to be smoothed is obtained, and curve smoothing is performed on the trajectory. To distinguish between the third-order Bézier curve and the smoothing arc, refer to... Figure 7 , Figure 7 This is a schematic diagram of the third-order Bézier smoothing method involved in the trajectory smoothing method of the present invention, wherein the control points of the third-order Bézier curve are marked with four circles, corresponding to... Figure 7 The curve in the figure is a third-order Bézier curve, and the figure also shows the xyz three-dimensional coordinate axes. This figure is only for illustration and will not be discussed in detail here.
[0114] Through the second embodiment of the present invention described above, when the trajectory to be smoothed in three-dimensional space exceeds the first distance error accuracy value, the trajectory to be smoothed can be smoothed by a third-order Bézier curve, which can make the trajectory have good closure, reduce the sudden jumps in the speed and acceleration of each motion axis of the machine tool during processing, and the smoothing curve has good symmetry, and the maximum curvature is easy to calculate, which provides convenience for the acceleration planning of subsequent motion axes and other moving parts. By performing circular arc smoothing or curve smoothing on the trajectory to be smoothed, the problem of trajectory smoothing in three-dimensional space can be solved well, and it has broad application prospects.
[0115] The above embodiments can be combined to form the overall technical solution of the present invention. For a clearer understanding of the present invention, please refer to... Figure 8 , Figure 8 This is a schematic diagram illustrating the overall process of a specific application of the trajectory smoothing method of the present invention.
[0116] In actual machine tool processing, there are usually many trajectories to be smoothed. Therefore, in order to complete a production processing task, multiple trajectories to be smoothed can be smoothed.
[0117] like Figure 8 As shown, the overall trajectory smoothing process is as follows:
[0118] Let N be the number of trajectories to be smoothed, and let i = 1.
[0119] Step 1: Determine if i <= (N-1) is true. If true, proceed to Step 2; otherwise, proceed to Step 6.
[0120] Step 2: Extract Line1 and Line2 from the i-th and (i+1)-th trajectories, which means determining the first and second straight lines in the trajectory to be smoothed. Determine whether line segments Line1 and Line2 are coplanar. If they are coplanar, proceed to Step 3; otherwise, proceed to Step 4.
[0121] Step 3: Smooth the line segments Line1 and Line2 with arcs, let i = i + 1, and proceed to Step 1;
[0122] Step 4: Determine whether the length value dis of the common perpendicular segment between line segments Line1 and Line2 is less than the first distance error precision value First_dis. If it is less, proceed to step 2 for arc smoothing; otherwise, proceed to step 5 for third-order Bezier curve smoothing.
[0123] Step 5: Smooth the line segments Line1 and Line2 using a third-order Bezier curve, let i = i + 1, and proceed to step 1;
[0124] Step 6, End.
[0125] In addition, refer to Figure 9 The present invention also proposes a trajectory smoothing device, the trajectory smoothing device comprising:
[0126] The geometric recognition module A10 is used to determine the first straight line and the second straight line of the trajectory to be smoothed, and to determine whether the first straight line and the second straight line are located in the same plane;
[0127] The geometric calculation module A20 is used to obtain the common perpendicular segment between the first line and the second line if the first line and the second line are not located in the same plane, and to determine whether the common perpendicular segment is less than or equal to a preset first distance error precision value; if the common perpendicular segment is less than or equal to the preset first distance error precision value, the midpoint of the common perpendicular segment is taken as the coplanar intersection point between the first line and the second line.
[0128] The smoothing module A30 is used to determine the trajectory smoothing arc corresponding to the trajectory to be smoothed based on the coplanar intersection point and the preset second distance error accuracy value, so as to perform trajectory smoothing based on the trajectory smoothing arc.
[0129] Optionally, the geometry calculation module A20 is also used for:
[0130] If the first line and the second line are located in the same plane, then obtain the coplanar intersection point between the first line and the second line in the plane;
[0131] Perform the step of determining the trajectory smoothing arc corresponding to the trajectory to be smoothed based on the coplanar intersection points and the preset second distance error accuracy value.
[0132] Optionally, the smoothing module A30 is also used for:
[0133] If the common perpendicular segment is greater than the first distance error accuracy value, then the third-order Bézier curve corresponding to the trajectory to be smoothed is determined, and the third-order Bézier curve is used to smooth the trajectory to be smoothed.
[0134] Optionally, the geometry calculation module A20 is also used for:
[0135] An auxiliary plane parallel to the first line and the second line is determined based on the midpoint of the common perpendicular segment;
[0136] The first straight line is projected onto the auxiliary plane to obtain a first projected straight line, and the second straight line is projected onto the auxiliary plane to obtain a second projected straight line;
[0137] The third-order Bézier curve corresponding to the trajectory to be smoothed is determined based on the first projected line and the second projected line.
[0138] Optionally, the geometry calculation module A20 is also used for:
[0139] Determine the projection intersection point between the first projection line and the second projection line;
[0140] Based on the projection intersection point and the preset third distance error accuracy value, determine the projection smooth arc that corresponds to both the first projection line and the second projection line;
[0141] Based on the first projected straight line, the second projected straight line, and the projected smoothed circular arc, determine the third-order Bézier curve corresponding to the trajectory to be smoothed.
[0142] Optionally, the geometry calculation module A20 is also used for:
[0143] Determine the first tangent point and the second tangent point between the first projected line and the second projected line and the projected smooth arc, respectively, and determine the tangent line formed by the first tangent point and the second tangent point;
[0144] Determine the vertex of the projected smooth arc, and determine a parallel line that is parallel to the line of tangency based on the vertex;
[0145] Determine the third and fourth tangent points where the parallel line intersects the first projected line and the second projected line, respectively;
[0146] Based on the first tangent point, the second tangent point, the third tangent point, and the fourth tangent point, determine the four tangent points corresponding to the first straight line and the second straight line respectively;
[0147] The four tangent points are used as control points for the third-order Bézier curve to determine the third-order Bézier curve corresponding to the trajectory to be smoothed.
[0148] Optionally, the geometry calculation module A20 is also used for:
[0149] The second distance error accuracy value is taken as the shortest distance from the coplanar intersection point to the smooth arc of the trajectory.
[0150] Obtain the angle between the first straight line and the second straight line, and determine the origin and radius of the trajectory smoothing arc corresponding to the trajectory to be smoothed by using the angle and the second distance error accuracy value, which is the shortest distance.
[0151] Optionally, the geometry recognition module A10 is also used for:
[0152] Determine if the trajectory to be smoothed contains a curve;
[0153] If the trajectory to be smoothed contains a curve, then the tangent line corresponding to the first endpoint of the curve is determined as the first straight line of the trajectory to be smoothed, and the tangent line corresponding to the second endpoint of the curve is determined as the second straight line of the trajectory to be smoothed.
[0154] The specific implementation of the trajectory smoothing device of the present invention is basically the same as the various embodiments of the trajectory smoothing method described above, and will not be repeated here.
[0155] Furthermore, the present invention also provides a computer-readable storage medium. The computer-readable storage medium of the present invention stores a trajectory smoothing program, wherein, when executed by a processor, the trajectory smoothing program implements the steps of the trajectory smoothing method as described above.
[0156] The method implemented when the trajectory smoothing procedure is executed can be referred to in various embodiments of the trajectory smoothing method of the present invention, and will not be repeated here.
[0157] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0158] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0159] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0160] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0161] It should be noted that any reference signs placed between parentheses in the claims should not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0162] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0163] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. All equivalent structural transformations made by using the contents of the present invention description and drawings under the inventive concept of the present invention, or direct / indirect application in other related technical fields are included in the patent protection scope of the present invention.
Claims
1. A trajectory smoothing method, characterized in that, The trajectory smoothing method includes the following steps: Determine the first and second straight lines of the trajectory to be smoothed, and determine whether the first and second straight lines are located in the same plane; If the first straight line and the second straight line are not located on the same plane, then obtain the common perpendicular line segment between the first straight line and the second straight line, and determine whether the common perpendicular line segment is less than or equal to the preset first distance error accuracy value; If the common perpendicular segment is less than or equal to the preset first distance error accuracy value, then the midpoint of the common perpendicular segment is taken as the coplanar intersection point between the first straight line and the second straight line. Based on the coplanar intersection points and the preset second distance error accuracy value, determine the trajectory smoothing arc corresponding to the trajectory to be smoothed, and perform trajectory smoothing based on the trajectory smoothing arc.
2. The trajectory smoothing method as described in claim 1, characterized in that, After the step of determining whether the first straight line and the second straight line are located in the same plane, the method further includes: If the first line and the second line are located in the same plane, then obtain the coplanar intersection point between the first line and the second line in the plane; Perform the step of determining the trajectory smoothing arc corresponding to the trajectory to be smoothed based on the coplanar intersection points and the preset second distance error accuracy value.
3. The trajectory smoothing method as described in claim 1, characterized in that, After the step of determining whether the common perpendicular segment is less than or equal to a preset first distance error accuracy value, the method further includes: If the common perpendicular segment is greater than the first distance error accuracy value, then the third-order Bézier curve corresponding to the trajectory to be smoothed is determined, and the third-order Bézier curve is used to smooth the trajectory to be smoothed.
4. The trajectory smoothing method as described in claim 3, characterized in that, The step of determining the third-order Bézier curve corresponding to the trajectory to be smoothed includes: An auxiliary plane parallel to the first line and the second line is determined based on the midpoint of the common perpendicular segment; The first straight line is projected onto the auxiliary plane to obtain a first projected straight line, and the second straight line is projected onto the auxiliary plane to obtain a second projected straight line; The third-order Bézier curve corresponding to the trajectory to be smoothed is determined based on the first projected line and the second projected line.
5. The trajectory smoothing method as described in claim 4, characterized in that, The step of determining the third-order Bézier curve corresponding to the trajectory to be smoothed based on the first projected line and the second projected line includes: Determine the projection intersection point between the first projection line and the second projection line; Based on the projection intersection point and the preset third distance error accuracy value, determine the projection smooth arc that corresponds to both the first projection line and the second projection line; Based on the first projected straight line, the second projected straight line, and the projected smoothed circular arc, determine the third-order Bézier curve corresponding to the trajectory to be smoothed.
6. The trajectory smoothing method as described in claim 5, characterized in that, The step of determining the third-order Bézier curve corresponding to the trajectory to be smoothed based on the first projected straight line, the second projected straight line, and the projected smoothed circular arc includes: Determine the first tangent point and the second tangent point between the first projected line and the second projected line and the projected smooth arc, respectively, and determine the tangent line formed by the first tangent point and the second tangent point; Determine the vertex of the projected smooth arc, and determine a parallel line that is parallel to the line of tangency based on the vertex; Determine the third and fourth tangent points where the parallel line intersects the first projected line and the second projected line, respectively; Based on the first tangent point, the second tangent point, the third tangent point, and the fourth tangent point, determine the four tangent points corresponding to the first straight line and the second straight line respectively; The four tangent points are used as control points for the third-order Bézier curve to determine the third-order Bézier curve corresponding to the trajectory to be smoothed.
7. The trajectory smoothing method as described in claim 1, characterized in that, The step of determining the trajectory smoothing arc corresponding to the trajectory to be smoothed based on the coplanar intersection points and a preset second distance error accuracy value includes: The second distance error accuracy value is taken as the shortest distance from the coplanar intersection point to the smooth arc of the trajectory. Obtain the angle between the first straight line and the second straight line, and determine the origin and radius of the trajectory smoothing arc corresponding to the trajectory to be smoothed by using the angle and the second distance error accuracy value, which is the shortest distance.
8. The trajectory smoothing method as described in claim 1, characterized in that, The step of determining the first and second straight lines of the trajectory to be smoothed includes: Determine if the trajectory to be smoothed contains a curve; If the trajectory to be smoothed contains a curve, then the tangent line corresponding to the first endpoint of the curve is determined as the first straight line of the trajectory to be smoothed, and the tangent line corresponding to the second endpoint of the curve is determined as the second straight line of the trajectory to be smoothed.
9. A CNC machine tool, characterized in that, The CNC machine tool includes a processor, a memory, and a trajectory smoothing program stored in the memory that can be executed by the processor, wherein when the trajectory smoothing program is executed by the processor, it implements the steps of the trajectory smoothing method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a trajectory smoothing program, wherein when the trajectory smoothing program is executed by a processor, it implements the steps of the trajectory smoothing method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
CNC processing smooth transition method and device
CN106227152A
Welding robot path planning method
CN106557844A