Method and system for machine tool trajectory optimization based on event-triggered sampling and model predictive control
Patent Information
- Application Number
- CN202610979626.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-02
- Publication Date
- 2026-10-16
AI Technical Summary
[0003]然而,该方法存在一个根本性的技术缺陷:其判定和修正逻辑完全脱离了加工轨迹本身的局部几何特征与动态运动状态
[0014] Compared with existing technologies, the machine tool trajectory optimization method and system based on event-triggered sampling and model predictive control provided in this application abandons the globally unified static error judgment rule and instead designs a dynamic event-triggered sampling mechanism based on multi-axis collaborative state: a global optimization calculation is activated only when there is a significant mismatch between the actual operating data of the local axis and the associated axis (such as speed synchronization deviation exceeding the theoretical allowable range), thus avoiding invalid calculations. After triggering optimization, the system does not simply correct based on the absolute error of a single axis, but deeply integrates the local geometric features of the current trajectory point (path curvature radius, command feed rate) and multi-dimensional dynamic information (first and second real-time contour following errors, acceleration change rate of each axis, maximum value of the speed ratio adjustment of the associated axis) to construct a high-dimensional feature vector. This feature vector serves as input to drive a pre-trained lightweight neural network model (i.e., trajectory optimization prediction model), outputting feed rate correction coefficients and/or contour error compensation coefficients. Ultimately, the system performs precise corrections to the initial planned trajectory in two modes: first, it dynamically adjusts the local feed rate along the trajectory direction to match the current dynamic constraints; second, it applies spatial offset compensation based on the comprehensive contour error estimate in the normal direction. This ensures that the optimization action is sufficiently sensitive in critical high-curvature regions while remaining efficient in flat regions.
Smart Images

Figure CN122923968A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine tool trajectory optimization technology, and in particular to a machine tool trajectory optimization method and system based on event-triggered sampling and model predictive control. Background Technology
[0002] In the field of precision CNC machining, especially for high-speed and high-precision machining of complex curved surfaces, ensuring a high degree of consistency between the actual tool movement trajectory and the theoretically planned path is crucial to guaranteeing the final workpiece quality. In existing technologies, a common trajectory optimization strategy is to employ a feedback compensation method based on a fixed threshold. This method monitors the deviation (i.e., following error) between the actual position and the commanded position of each motion axis in real time. When this deviation exceeds a preset, globally unified static threshold, the system triggers a speed reduction or a simple error compensation mechanism.
[0003] However, this method suffers from a fundamental technical flaw: its judgment and correction logic is completely detached from the local geometric features and dynamic motion state of the machining trajectory itself. Specifically, this method treats the error tolerance of all machining areas as equal, ignoring the decisive influence of the path curvature radius and the current feed rate on the formation of contour errors. In high-curvature regions of the machining path (such as sharp corners and small-radius arc transition sections), even if the absolute value of the single-axis following error is small, the small positional deviation will be significantly amplified due to the rapid change in the direction of motion, transforming into a huge normal contour error, which can easily lead to serious machining defects such as overcutting or undercutting. At this time, the fixed error threshold is too lenient to trigger effective compensation in a timely manner, resulting in insufficient response of the correction strategy in critical areas. Conversely, in flat or low-curvature regions, the system has a relatively high tolerance for following errors, but the fixed threshold will still frequently trigger unnecessary deceleration or compensation due to small, harmless fluctuations, leading to an overly conservative machining process and severely sacrificing overall machining efficiency.
[0004] This deficiency directly leads to the non-adaptive and inefficient nature of the trajectory optimization process. Because the optimization decision lacks precise judgment on when and to what extent optimization is needed, the system either fails to guarantee accuracy where it is critical or hesitates to improve efficiency where it can, thus failing to achieve a dynamic optimal balance between machining accuracy and efficiency. Summary of the Invention
[0005] This application aims to at least partially address one of the technical problems in the related art.
[0006] To achieve the above objectives, embodiments of this application propose a machine tool trajectory optimization method based on event-triggered sampling and model predictive control, comprising the following steps: Step 1: Obtain the initial planned trajectory of the current machining task of the CNC machine tool and construct a trajectory optimization prediction model; wherein, the initial planned trajectory is a smooth continuous trajectory, including a sequence of trajectory points sorted by time, each trajectory point corresponds one-to-one with a timestamp, and each trajectory point contains spatial coordinates, the corresponding instruction feed rate and the path curvature radius; Step 2: Continuously acquire the actual running data of each motion axis, and compare the actual running data of each motion axis at the current moment with the actual running data at the previous sampling moment; if at least one motion axis meets the preset judgment condition, a global sampling event is triggered, and the current motion axis is defined as the local axis, and the remaining motion axes are defined as related axes; otherwise, the current initial planned trajectory is maintained and the actual running data of each motion axis is continuously acquired. Step 3: Determine the real-time contour following error of each motion axis based on the actual operating data of this axis and related axes, and the local geometric features of the trajectory points corresponding to the initial planned trajectory at the current moment; calculate the adjustment amount of the actual cooperative state relative to the theoretical allowable error range; generate the acceleration change rate based on the acceleration sequence of each motion axis. Step 4: Construct a feature vector based on the initial planned trajectory, real-time contour following error, and acceleration change rate, and input it as input data into the trajectory optimization prediction model. Output dynamic adjustment parameters, and correct the initial planned trajectory based on the dynamic adjustment parameters to obtain the optimized trajectory.
[0007] Based on the actual operating data of this axis and associated axes, and the local geometric features of the trajectory points corresponding to the initial planned trajectory at the current moment, the real-time contour following error of each motion axis is determined, and the adjustment amount of the actual coordinated state relative to the theoretical allowable error range is calculated, including: Step 31: Based on the spatial coordinates of the current trajectory point of the initial planned trajectory and the corresponding timestamp, obtain the theoretical velocity components of each motion axis, and determine the theoretical velocity components of this axis and the theoretical velocity components of the associated axis based on the theoretical velocity components of each motion axis. Step 32: Based on the current system time and the spatial coordinates of each trajectory point, obtain the command position corresponding to the current moment, and obtain the command coordinate components corresponding to the current axis and the associated axis based on the command position; obtain the actual feedback position of each motion axis based on the current system time, and obtain the actual coordinate components corresponding to the current axis and the associated axis based on the actual feedback position. Step 33: Calculate the absolute value of the difference between the command coordinate component and the actual coordinate component corresponding to the local axis and the associated axis respectively, and obtain the first real-time contour following error and the second real-time contour following error. Step 34: Preset the theoretical allowable error range, and obtain the dynamic attenuation factor based on the first real-time contour following error and the second real-time contour following error; obtain the corrected allowable deviation based on the theoretical allowable error range and the dynamic attenuation factor; Step 35: Obtain a reference speed ratio based on the ratio of the theoretical speed component of the associated axis to the theoretical speed component of the local axis; construct a speed ratio allowable range based on the reference speed ratio and the correction allowable deviation. Step 36: Obtain the real-time speed of this axis and the real-time speed of each associated axis at the current moment, and obtain the actual speed ratio based on the ratio of the real-time speed of the associated axes to the real-time speed of this axis; Step 37: Determine the speed ratio adjustment amount for each associated axis based on the relationship between the actual speed ratio and the allowable speed ratio range: If the actual speed ratio is within the allowable speed ratio range, set the current speed ratio adjustment amount for the associated axis to 0; otherwise, determine the current speed ratio adjustment amount for the associated axis based on the actual speed ratio, the reference speed ratio, and the correction allowable deviation; obtain the maximum speed ratio adjustment amount for all associated axes.
[0008] Obtain the actual velocity sequences of the local axis and the associated axis at the current time and the previous n sampling times; perform a numerical differentiation on the actual velocity sequences to obtain the acceleration sequences; perform a numerical differentiation on the acceleration sequences to obtain the acceleration rate of change sequences; define the acceleration rate of change value corresponding to the current time in the acceleration rate of change sequences as the acceleration rate of change of the local axis and the acceleration rate of change of the associated axis.
[0009] The feature vector is generated by concatenating the maximum value of the velocity ratio adjustment of the associated axis at the current moment, the first real-time contour following error, the second real-time contour following error, the rate of change of the local axis acceleration, the rate of change of the associated axis acceleration, and the command feed velocity and path curvature radius of the current trajectory point.
[0010] The trajectory optimization prediction model is a pre-trained lightweight neural network model.
[0011] The output of the trajectory optimization prediction model is the feed rate correction coefficient and / or the contour error compensation coefficient.
[0012] Starting from the current trajectory point, a local trajectory segment is extracted forward from the initial planned trajectory. The product of the feed rate and the feed rate correction coefficient of each trajectory point in the local trajectory segment is calculated to obtain the local velocity sequence. An optimized trajectory is generated based on the local velocity sequence.
[0013] The comprehensive contour error estimate is obtained by weighted summation of the first real-time contour following error and the second real-time contour following error. The normal compensation amount is obtained based on the comprehensive contour error estimate. The unit normal vector is obtained based on the current trajectory point. The current trajectory point and the adjacent m subsequent trajectory points are spatially offset along the unit normal vector. The spatial offset amount is the normal compensation amount, resulting in a set of compensated trajectory points. An optimized trajectory is generated based on the set of compensated trajectory points.
[0014] Compared with existing technologies, the machine tool trajectory optimization method and system based on event-triggered sampling and model predictive control provided in this application abandons the globally unified static error judgment rule and instead designs a dynamic event-triggered sampling mechanism based on multi-axis collaborative state: a global optimization calculation is activated only when there is a significant mismatch between the actual operating data of the local axis and the associated axis (such as speed synchronization deviation exceeding the theoretical allowable range), thus avoiding invalid calculations. After triggering optimization, the system does not simply correct based on the absolute error of a single axis, but deeply integrates the local geometric features of the current trajectory point (path curvature radius, command feed rate) and multi-dimensional dynamic information (first and second real-time contour following errors, acceleration change rate of each axis, maximum value of the speed ratio adjustment of the associated axis) to construct a high-dimensional feature vector. This feature vector serves as input to drive a pre-trained lightweight neural network model (i.e., trajectory optimization prediction model), outputting feed rate correction coefficients and / or contour error compensation coefficients. Ultimately, the system performs precise corrections to the initial planned trajectory in two modes: first, it dynamically adjusts the local feed rate along the trajectory direction to match the current dynamic constraints; second, it applies spatial offset compensation based on the comprehensive contour error estimate in the normal direction. This ensures that the optimization action is sufficiently sensitive in critical high-curvature regions while remaining efficient in flat regions.
[0015] In summary, this invention effectively overcomes the shortcomings of traditional methods, which suffer from insufficient correction or overly conservative approaches due to neglecting local geometry and motion states of the trajectory. By initiating optimization on demand through an event-triggered mechanism, computational overhead is significantly reduced. Furthermore, by deeply integrating multi-axis cooperative deviations with contextual information such as curvature and velocity, and utilizing a lightweight model for intelligent decision-making, precise and adaptive trajectory correction is achieved. This method significantly improves machining efficiency and system resource utilization while ensuring high precision in machining complex curved surfaces, making it particularly suitable for high-speed, high-precision machining scenarios on embedded CNC platforms. Attached Figure Description
[0016] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 A flowchart of a machine tool trajectory optimization method based on event-triggered sampling and model predictive control provided in an embodiment of this application; Figure 2 This is a block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0017] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0018] The following describes, with reference to the accompanying drawings, a machine tool trajectory optimization method and system based on event-triggered sampling and model predictive control, according to embodiments of this application.
[0019] like Figure 1 As shown, the machine tool trajectory optimization method and system based on event-triggered sampling and model predictive control includes the following steps: Step 1: Obtain the initial planned trajectory of the current machining task of the CNC machine tool and construct a trajectory optimization prediction model; wherein, the initial planned trajectory is a smooth continuous trajectory, including a sequence of trajectory points sorted by time, each trajectory point corresponds one-to-one with a timestamp, and each trajectory point contains spatial coordinates, the corresponding instruction feed rate, and the path curvature radius.
[0020] The initial planned trajectory for the current machining task is obtained from the CNC system. This initial planned trajectory is a smooth, continuous parametric curve, existing as a time-ordered sequence of trajectory points, each corresponding to a unique timestamp. The data structure of each trajectory point contains three core elements: three-dimensional spatial coordinates (x, y, z), the corresponding command feed rate at that point, and the path curvature radius. These data are typically generated based on the workpiece geometry model and process parameters, and have undergone kinematic smoothing to ensure acceleration continuity. Subsequently, a trajectory optimization and prediction model is constructed based on historical machining datasets.
[0021] Step 2: Continuously acquire the actual running data of each motion axis, and compare the actual running data of each motion axis at the current moment with the actual running data at the previous sampling moment; if at least one motion axis meets the preset judgment condition, a global sampling event is triggered, and the current motion axis is defined as the local axis, and the remaining motion axes are defined as related axes; otherwise, the current initial planned trajectory is maintained and the actual running data of each motion axis is continuously acquired.
[0022] This embodiment uses the encoders and servo drivers of each motion axis of a CNC machine tool as interfaces to continuously acquire the actual operating data of each motion axis at the current moment with a fixed high-frequency sampling period (e.g., 1 millisecond). Each motion axis specifically includes three linear feed axes: X-axis, Y-axis, and Z-axis, and one or more rotary axes selected from A-axis (rotation around the X-axis), B-axis (rotation around the Y-axis), or C-axis (rotation around the Z-axis) depending on the machine tool configuration. The actual operating data includes the real-time position, real-time speed, and real-time acceleration of each motion axis.
[0023] The actual operating data of each motion axis at the current moment is compared item by item with the actual operating data at the previous sampling moment. Among them, the key parameter used to determine whether a global sampling event is triggered is the speed synchronization deviation, which is the absolute value of the difference between the real-time speed measured by this axis and any associated axis at the same sampling moment.
[0024] The preset judgment condition is: when the speed synchronization deviation exceeds a pre-calibrated speed threshold, the trigger condition is considered met. This speed threshold is calibrated based on statistical analysis of a large amount of historical machining data. Under typical five-axis linkage milling conditions, this threshold can be set to 8 mm / s for linear axes (X / Y / Z) and 5° / s for rotary axes (A / B / C). These values have been verified in trial cutting experiments on various typical parts (such as impellers, mold surfaces, etc.), and can avoid false triggering while ensuring machining accuracy.
[0025] If at least one motion axis meets the above criteria, a global sampling event is immediately triggered. In this event, the motion axis that meets the criteria is defined as the current axis, and all other motion axes are defined as associated axes. The complete actual running data of the current axis and each associated axis at the current moment is recorded for subsequent feature extraction. If none of the motion axes meet the criteria, the current initial planned trajectory remains unchanged, and the actual running data of each motion axis continues to be acquired cyclically at a fixed sampling period until the next criteria are met or the processing task ends.
[0026] Step 3: Determine the real-time contour following error of each motion axis based on the actual running data of this axis and associated axes, and the local geometric features of the trajectory points corresponding to the initial planned trajectory at the current moment, and calculate the adjustment amount of the actual cooperative state relative to the theoretical allowable error range; generate the acceleration change rate based on the acceleration sequence of each motion axis.
[0027] On the one hand, based on the actual operating data of this axis and related axes, and the local geometric features of the trajectory points corresponding to the initial planned trajectory at the current moment, the real-time contour following error of each motion axis is determined, and the adjustment amount of the actual cooperative state relative to the theoretical allowable error range is calculated, including: Step 31: Based on the spatial coordinates of the current trajectory point of the initial planned trajectory and the corresponding timestamp, obtain the theoretical velocity components of each motion axis, and determine the theoretical velocity components of the current axis and the related axes based on the theoretical velocity components of each motion axis.
[0028] This embodiment extracts the spatial coordinates (e.g., (x, y, z) values in a three-dimensional Cartesian coordinate system) of the current trajectory point and the corresponding timestamp t based on the initial planned trajectory. Combining the spatial displacement and time interval between adjacent trajectory points, the ideal motion vector of the tool center point at that moment is calculated using a trajectory interpolation algorithm, including its direction and resultant velocity magnitude. Based on the kinematic model of the machine tool (forward or inverse kinematic mapping relationship), this ideal motion vector is decomposed onto each physical motion axis, thereby obtaining the theoretical velocity components of each motion axis at the current trajectory point. For example, in a typical vertical five-axis machining center, the X, Y, and Z axes are linear feed axes, the A axis is a swivel axis rotating around the X axis, and the C axis is a table axis rotating around the Z axis. When the tool moves along a complex curved path, based on the current attitude angle (e.g., angle A and angle C) and the path tangential vector, the resultant velocity of the tool center point is accurately allocated to the five axes X, Y, Z, A, and C using the Jacobian matrix or analytical inverse kinematics method, obtaining their corresponding theoretical velocity values. Based on this, if a certain axis (such as the X-axis) is subsequently determined to be the current axis, then its corresponding theoretical velocity component is the theoretical velocity of the X-axis at the current trajectory point; the other axes (such as the Y, Z, A, and C axes) are defined as associated axes, and their respective theoretical velocity components are also determined simultaneously.
[0029] Step 32: Based on the current system time and the spatial coordinates of each trajectory point, obtain the command position corresponding to the current moment, and obtain the command coordinate components corresponding to the current axis and the associated axis based on the command position; obtain the actual feedback position of each motion axis based on the current system time, and obtain the actual coordinate components corresponding to the current axis and the associated axis based on the actual feedback position.
[0030] In actual operation, the current system time is first obtained, for example, 16:14:23.456 milliseconds on June 8, 2026, and this time is matched with the initial planned trajectory pre-generated by the CNC program. This initial planned trajectory is a series of ordered trajectory points formed by discretizing the machining path. Each trajectory point not only contains the spatial position of the tool center point in the workpiece coordinate system (such as the coordinate values of the X-axis, Y-axis, and Z-axis) and the attitude angle (such as the A-axis angle of rotation around the X-axis and the C-axis angle of rotation around the Z-axis), but also includes a precise timestamp, indicating that the tool should ideally reach that position at that moment.
[0031] Since the current system time is usually not exactly equal to the timestamp recorded at a single trajectory point, but rather falls between two adjacent trajectory points, the system needs to calculate the precise command position the tool should be in at the current moment using interpolation. Specifically, the system first searches the trajectory sequence for the time interval in which the current time falls, i.e., finding the previous trajectory point (denoted as the "previous point") and the next trajectory point (denoted as the "next point"). Assuming the timestamp of the previous point is 16:14:23:000, the timestamp of the next point is 16:14:24:000, and the current system time is 16:14:23:456, then the time difference between the current time and the previous point is 456 milliseconds, and the time interval between the two trajectory points is 1000 milliseconds. At this point, a scaling factor is calculated, its value being equal to the difference between the current time and the previous point divided by the time interval between the two points, i.e., 456 ÷ 1000 = 0.456.
[0032] This scaling factor is used to determine the weight distribution between two trajectory points in the interpolation process: the weight of the previous point is 1 minus the scaling factor (i.e., 1 - 0.456 = 0.544), and the weight of the subsequent point is the scaling factor itself (i.e., 0.456). For the three linear coordinates of the X, Y, and Z axes, the system performs a weighted average of the corresponding coordinate values of the two points. For example, if the X coordinate of the previous point is 120.0 mm and the X coordinate of the subsequent point is 121.0 mm, then the commanded X coordinate at the current moment is: 120.0 × 0.544 + 121.0 × 0.456 = 120.456 mm. The calculation method for the Y and Z axes is exactly the same.
[0033] For rotation angles (such as the A-axis and C-axis), due to the periodicity and directionality of the angles (e.g., from 359° to 1°, the shortest path is a 2° clockwise rotation), a linear weighted average cannot be directly applied. Therefore, the shortest rotation direction and angle difference between the two points are calculated. For example, if the previous point's A-axis angle is 15.0° and the subsequent point's is 16.0°, the angle difference is +1.0°; if the previous point is 359.0° and the subsequent point's is 1.0°, the angle difference should be considered +2.0°. After determining the correct angle difference, this angle difference is multiplied by a scaling factor and added to the previous point's angle to obtain the current angle command value. For example, if the previous point's A-axis angle is 15.0°, the angle difference is +1.0°, and the scaling factor is 0.456, then the current A-axis command angle is 15.0° + 1.0° × 0.456 = 15.456°. The C-axis is handled in the same way.
[0034] Through the above steps, a complete and precise command position is finally obtained, which includes three linear coordinates (X, Y, Z) and two rotation angles (A, C). This position represents the target pose that the tool should achieve at the current moment under ideal, undisturbed conditions.
[0035] The target pose is input into the machine tool's specific inverse kinematics model. Based on the machine tool's actual structure (e.g., a double-swivel head structure, a swivel head plus rotary table structure, or other five-axis configuration), this model converts the target pose of the tool into the commanded coordinate components that should be achieved on each physical motion axis (including the X-axis, Y-axis, Z-axis, A-axis, and C-axis). For example, at a certain moment, the system might calculate the commanded position as 120.5 mm for the X-axis, -45.2 mm for the Y-axis, 80.0 mm for the Z-axis, 15.3° for the A-axis, and 92.7° for the C-axis.
[0036] Meanwhile, the high-precision encoders built into each motion axis servo drive acquire the current actual feedback position of each axis in real time at the microsecond level. This feedback data is transmitted back to the CNC core via a high-speed industrial communication bus (such as EtherCAT or PROFINET) to form the actual coordinate components of each axis. For example, at this time, the actual position of the X-axis is 120.48 mm, the Y-axis is -45.22 mm, the Z-axis is 80.03 mm, the A-axis is 15.28°, and the C-axis is 92.71°.
[0037] If the X-axis is determined to be the primary axis, its corresponding command coordinate component is 120.5 mm, and its actual coordinate component is 120.48 mm. The remaining Y-axis, Z-axis, A-axis, and C-axis are defined as "associated axes," each with its corresponding command coordinate components (-45.2 mm, 80.0 mm, 15.3°, and 92.7°, respectively) and actual coordinate components (-45.22 mm, 80.03 mm, 15.28°, and 92.71°, respectively).
[0038] Step 33: Calculate the absolute value of the difference between the command coordinate component and the actual coordinate component corresponding to the local axis and the associated axis, respectively, to obtain the first real-time contour following error and the second real-time contour following error.
[0039] In the real-time interpolation and error monitoring process of the CNC system, the command coordinate components of each motion axis at the current moment are obtained according to the aforementioned interpolation method, and the corresponding actual coordinate components are obtained through encoder feedback. Assuming that in the current machining task, the X-axis is designated as the local axis, and the remaining Y-axis, Z-axis, A-axis, and C-axis are designated as associated axes, the absolute value of the deviation between the command value and the actual value of the local axis and all associated axes is calculated. For example, if the command coordinate component of the X-axis (local axis) is 120.500 mm and the actual feedback coordinate is 120.480 mm, the absolute value of the difference is |120.500 - 120.480| = 0.020 mm. This value is the first real-time contour following error, used to characterize the trajectory tracking accuracy of the local axis itself.
[0040] For each associated axis, the absolute value of the deviation between the command and the actual coordinates is calculated for each axis: the Y-axis command is -45.200 mm, the actual value is -45.220 mm, and the absolute value of the deviation is |-45.200 - (-45.220)| = 0.020 mm; the Z-axis command is 80.000 mm, the actual value is 80.030 mm, and the absolute value of the deviation is |80.000 - 80.030| = 0.030 mm; the A-axis command is 15.300°, the actual value is 15.280°, and the absolute value of the deviation is |15.300 - 15.280| = 0.020°; the C-axis command is 92.700°, the actual value is 92.710°, and the absolute value of the deviation is |92.700 - 92.710| = 0.010°. Then, these absolute values of deviation for each associated axis are combined. A unified quantitative index is typically generated using methods such as weighted Euclidean norm or simple summation. For example, if linear coordinates and angles are normalized separately and then weighted and summed, the angle error can be converted into an equivalent arc length (e.g., estimated with a tool rotation radius of 100 mm, 0.020° ≈ 0.035 mm), and then combined with the linear axis error. However, if only the overall deviation of multi-axis coordination is considered without distinguishing physical units, the absolute values of the deviations of each axis can be directly added or the maximum value can be taken. In this embodiment, for simplicity, the system directly adds the absolute values of the deviations of the four associated axes: 0.020 + 0.030 + 0.020 + 0.010 = 0.080 (units are mixed; in actual engineering, normalization is often performed). This comprehensive result is defined as the second real-time contour following error, used to reflect the overall following performance of the motion axes other than the current axis in coordinated motion.
[0041] Step 34: Preset the theoretical allowable error range, and obtain the dynamic attenuation factor based on the first real-time contour following error and the second real-time contour following error; obtain the corrected allowable deviation based on the theoretical allowable error range and the dynamic attenuation factor.
[0042] In high-precision five-axis CNC machining, to achieve adaptive control of contour errors, a theoretical allowable error range is first set as a reference threshold. For example, considering the accuracy requirements of the current machining task, the theoretical allowable error range for linear axes is set to ±0.050 mm, and for rotary axes, it is ±0.050 degrees. The normalization process for millimeter-level linear errors is as follows: A reference length scale is pre-defined, typically taken as the maximum travel range of the toolpath or a typical feature dimension in the current machining task. For example, if the maximum machining range of the workpiece in the X direction is 200 mm, the theoretical allowable linear error (e.g., ±0.050 mm) can be divided by this reference length to obtain the normalized linear error benchmark: 0.050 ÷ 200 = 0.00025. Similarly, the actual linear following error (e.g., X-axis deviation of 0.020 mm) is also normalized using the same reference length: 0.020 ÷ 200 = 0.00010.
[0043] The normalization process for angular error requires converting it into an equivalent linear displacement before dimensionless transformation. A common method is to introduce the effective radius of rotation, i.e., the distance from the tool tip to the center of the rotation axis. Assuming that the effective radius of rotation at the tool tip is 100 mm under the combined action of the A and C axes in the current machining process (this value can be calculated in real-time by the kinematic model or preset to a typical value), then a 1-degree rotation will result in an arc-length displacement of approximately 1.745 mm at the tool tip. Therefore, the theoretically permissible angular error of ±0.050 degrees corresponds to the equivalent linear error of: 0.050 × 1.745 ≈ 0.0873 mm. Dividing this value by the same reference length (e.g., 200 mm) yields the normalized angular error baseline: 0.0873 ÷ 200 ≈ 0.000436. Similarly, if the actual angular deviation of axis A is 0.020 degrees, then its equivalent linear error is 0.020 × 1.745 ≈ 0.0349 mm, which, after normalization, is 0.0349 ÷ 200 ≈ 0.000175.
[0044] The first real-time contour following error (i.e., the error of this axis) and the second real-time contour following error (i.e., the comprehensive error of the associated axis) use the data from the previous embodiment: the first real-time contour following error is 0.020, and the second real-time contour following error, after normalization, is 0.080. Based on the relative relationship between these two error values and the theoretical allowable error range, a dynamic attenuation factor is dynamically generated. This factor reflects the degree to which the current motion state deviates from the ideal trajectory. First, the larger value between the first and second real-time contour following errors is taken as the current overall error level, i.e., 0.080; then it is compared with the theoretical allowable error range of 0.050. Since 0.080 is greater than 0.050, it indicates that the current error has exceeded the allowable range and enters the over-error adjustment state. At this time, the dynamic attenuation factor is calculated according to the following rules: First, calculate the proportion of the current error exceeding the allowable range, that is, (current overall error minus theoretical allowable error range) divided by the theoretical allowable error range to obtain the overshoot ratio; then subtract this overshoot ratio from 1 and multiply it by a sensitivity coefficient (set to 1.5 here) to obtain the initial attenuation value; however, in order to avoid excessive attenuation leading to system instability, a lower limit protection value (such as 0.3) is set, and the final dynamic attenuation factor is the larger of the initial attenuation value and the lower limit protection value.
[0045] Substituting the values, the overshoot ratio is (0.080 minus 0.050) divided by 0.050, which equals 0.6; The initial attenuation value is 1 minus 1.5 multiplied by 0.6, which equals 1 minus 0.9, or 0.1. Since 0.1 is less than the set lower limit protection value of 0.3, the final dynamic attenuation factor is 0.3.
[0046] Subsequently, the original theoretical allowable error range is adjusted using this dynamic attenuation factor to generate a corrected allowable deviation. The calculation method is as follows: multiply the theoretical allowable error range by the dynamic attenuation factor.
[0047] That is: 0.050 multiplied by 0.3 equals 0.015.
[0048] This correction allows for a deviation that means that, under the current motion conditions, since the actual contour error has significantly exceeded expectations, the tolerance boundary will be tightened, allowing subsequent trajectory deviations to not exceed 0.015 units.
[0049] Step 35: Obtain a reference speed ratio based on the ratio of the theoretical speed component of the associated axis to the theoretical speed component of the local axis; construct a speed ratio allowable range based on the reference speed ratio and the correction allowable deviation. In high-precision five-axis CNC machining, to achieve dynamic coordination of multi-axis motion and adaptive control of contour errors, this embodiment constructs a reference speed ratio that reflects the speed coupling relationship between each associated axis and the current axis. This ratio is scientifically weighted using a speed amplitude normalization weighting method based on the magnitude of each associated axis's influence on the current tool path. The complete embodiment is as follows: Assume that in the current machining path, the X-axis is designated as the primary axis, with a theoretical linear velocity of 300 mm / min. Associated axes include the Y-axis (theoretical velocity 200 mm / min), Z-axis (100 mm / min), A-axis (15 degrees / min), and C-axis (45 degrees / min). Since the units of the rotation axes are degrees, they must first be converted to the equivalent linear velocity at the tool tip. Let the effective radius of rotation from the current tool tip to the center of rotation be 100 mm, then: The equivalent linear velocity corresponding to 15 degrees per minute on axis A is approximately: ; The equivalent linear velocity corresponding to 45 degrees per minute on the C-axis is approximately: .
[0050] Next, calculate the original velocity ratio of each associated axis to the local axis (X-axis): Y-axis velocity ratio = 200 ÷ 300 ≈ 0.6667; Z-axis velocity ratio = 100 ÷ 300 ≈ 0.3333; The speed ratio of axis A = 26.18 ÷ 300 ≈ 0.0873; C-axis speed ratio = 78.54 ÷ 300 ≈ 0.2618; Extract the absolute values of the equivalent linear velocities for each associated axis: Y-axis 200, Z-axis 100, A-axis 26.18, C-axis 78.54 (unit: mm / min). Calculate the sum of the velocities of all associated axes: Total velocity = 200 + 100 + 26.18 + 78.54 = 404.72 mm / min. Calculate the weight of each axis (i.e., the proportion of its velocity to the total velocity). Y-axis weight = 200 ÷ 404.72 ≈ 0.4942; Z-axis weight = 100 ÷ 404.72 ≈ 0.2471; A-axis weight = 26.18 ÷ 404.72 ≈ 0.0647; C-axis weight = 78.54 ÷ 404.72 ≈ 0.1940; Multiply each axis weight by its corresponding velocity ratio and sum them to obtain the reference velocity ratio: Y-axis contribution = 0.4942 × 0.6667 ≈ 0.3295; Z-axis contribution = 0.2471 × 0.3333 ≈ 0.0824; A-axis contribution = 0.0647 × 0.0873 ≈ 0.0056; C-axis contribution = 0.1940 × 0.2618 ≈ 0.0508; Adding the four items together: 0.3295 + 0.0824 + 0.0056 + 0.0508 ≈ 0.4683; Therefore, the final reference speed ratio is 0.468.
[0051] Next, the permissible range for the speed ratio is constructed using a correction for the allowable deviation. For this purpose, a speed sensitivity coefficient, with a value of 2000, is introduced. This coefficient is used to map small position tolerances to a reasonable speed coordination tolerance range. The specific calculation is as follows: Adjustment range = Correction allowable deviation × Speed sensitivity coefficient = 0.00015 × 2000 = 0.3 (i.e. ±30%).
[0052] The upper and lower limits of the allowable range for the speed ratio are as follows: Upper limit = Reference speed ratio × (1 + Adjustment range) = 0.4683 × (1 + 0.3) ≈ 0.6088; Lower limit = Reference speed ratio × (1 - Adjustment range) = 0.4683 × (1 - 0.3) ≈0.3278; The final determined allowable range for the speed ratio is [0.328, 0.609].
[0053] Step 36: Obtain the real-time speed of this axis and the real-time speed of each associated axis at the current moment, and obtain the actual speed ratio based on the ratio of the real-time speed of the associated axes to the real-time speed of this axis; Assuming the X-axis is set as the current machining axis in the current machining section, during a certain control cycle, the CNC system obtains the instantaneous speed of each axis in real time through servo driver feedback or the internal status register of the motion controller, as follows: X-axis (this axis) real-time speed: 295 mm / min Y-axis real-time speed: 198 mm / min Z-axis real-time speed: 97 mm / min Real-time angular velocity of axis A: 14.8 degrees / minute C-axis real-time angular velocity: 44.2 degrees / minute; Since the A-axis and C-axis are rotational axes, their units are angles. They need to be converted to equivalent linear velocities at the tool tip to ensure consistent dimensions with the linear axes. Calculate the ratio of the actual velocity of each associated axis to the actual velocity of the local axis, i.e., divide the real-time equivalent linear velocity of each associated axis by the real-time linear velocity of the local axis (295 mm / min). The actual speed ratio along the Y-axis = 198 ÷ 295 ≈ 0.6712. The actual speed ratio along the Z-axis = 97 ÷ 295 ≈ 0.3288. The actual speed ratio of axis A = 25.82 ÷ 295 ≈ 0.0875. The actual speed ratio of the C-axis = 77.15 ÷ 295 ≈ 0.2615; These actual speed ratios reflect the speed at which each associated axis moves relative to its own axis at the current moment.
[0054] Step 37: Determine the speed ratio adjustment amount for each associated axis based on the relationship between the actual speed ratio and the allowable speed ratio range: If the actual speed ratio is within the allowable speed ratio range, set the current speed ratio adjustment amount for the associated axis to 0; otherwise, determine the current speed ratio adjustment amount for the associated axis based on the actual speed ratio, the reference speed ratio, and the correction allowable deviation; obtain the maximum speed ratio adjustment amount for all associated axes.
[0055] Determine whether the actual speed ratio falls within the allowable range for each axis, and determine the speed ratio adjustment amount for each associated axis accordingly: Y-axis judgment: The actual ratio 0.6712 is greater than the upper limit 0.609, which is outside the allowable range (too fast); at this time, the adjustment amount is calculated according to the following formula: Speed ratio adjustment amount = (actual speed ratio - reference speed ratio) ÷ (correction allowable deviation × speed sensitivity coefficient).
[0056] For example, substituting the values, we get: (0.6712 - 0.468) ÷ (0.00015 × 2000) = 0.2032 ÷ 0.3 ≈ 0.677. This positive value indicates that the Y-axis is relatively too fast and its speed needs to be suppressed. The adjustment amount is +0.677 (which can be used for proportional deceleration or feedforward reverse compensation later).
[0057] Z-axis judgment: The actual ratio 0.3288 ∈ [0.328, 0.609] is within the allowable range. Therefore, the speed ratio adjustment of the Z-axis is set to 0, and no intervention is required.
[0058] A-axis judgment: The actual ratio is 0.0875 < the lower limit of 0.328, which exceeds the allowable range (too slow); use the same formula as above: (0.0875 - 0.468) ÷ 0.3 = (-0.3805) ÷ 0.3 ≈ -1.268; A negative value indicates that the A-axis is severely lagging and needs to be accelerated to compensate. The adjustment amount is -1.268 (the larger the absolute value, the more severe the lag).
[0059] C-axis judgment: The actual ratio 0.2615 < 0.328, which exceeds the lower limit. The calculation is: (0.2615 - 0.468) ÷ 0.3 = (-0.2065) ÷ 0.3 ≈ -0.688, which means that the C-axis also has lag, but the degree is less than that of the A-axis.
[0060] At this point, the speed ratio adjustments for each associated axis are as follows: Y-axis: +0.677, Z-axis: 0, A-axis: -1.268, C-axis: -0.688.
[0061] Then, the maximum absolute value of the speed ratio adjustment for all associated axes was obtained to identify the most severely mismatched axis, serving as the primary basis for global control. The absolute values of each adjustment were: 0.677, 0, 1.268, and 0.688, with a maximum value of 1.268 (from axis A).
[0062] On the other hand, the actual velocity sequences of the local axis and the associated axis at the current time and the previous n sampling times are obtained; the actual velocity sequences are numerically differentiated once to obtain the acceleration sequence; the acceleration sequence is numerically differentiated once to obtain the acceleration rate of change sequence; the acceleration rate of change value corresponding to the current time in the acceleration rate of change sequence is defined as the acceleration rate of change of the local axis and the acceleration rate of change of the associated axis.
[0063] First, within the current control cycle, the actual velocity values of the current axis and all associated axes are synchronously acquired at the current moment and at the previous n (≥2) consecutive sampling moments, forming a time series of length n+1. This series accurately reflects the velocity evolution trend of each axis over the recent period. Then, a numerical differentiation operation is performed on the velocity series of each axis, typically using central difference, forward difference, or a higher-precision finite difference scheme, to obtain the corresponding acceleration series. This series describes the instantaneous acceleration state of each axis at each sampling moment. A second numerical differentiation is performed on the obtained acceleration series, i.e., another difference processing is applied, generating an acceleration rate of change series. This series characterizes the rate of change of acceleration over time and is an important indicator for measuring motion smoothness and mechanical shock levels. Finally, the latest values corresponding to the current moment in this acceleration rate of change series are extracted and defined as the acceleration rate of change of the current axis and the acceleration rate of change of each associated axis.
[0064] Step 4: Construct a feature vector based on the initial planned trajectory, real-time contour following error, and acceleration change rate, and input it as input data into the trajectory optimization prediction model. Output dynamic adjustment parameters, and correct the initial planned trajectory based on the dynamic adjustment parameters to obtain the optimized trajectory.
[0065] The feature vector is generated by concatenating the maximum value of the velocity ratio adjustment of the associated axis at the current moment, the first real-time contour following error, the second real-time contour following error, the rate of change of the local axis acceleration, the rate of change of the associated axis acceleration, and the command feed velocity and path curvature radius of the current trajectory point.
[0066] In this embodiment, multiple high-dimensional dynamic parameters are spliced together in a fixed order to construct a unified feature vector. The feature vector consists of the following seven key elements: (1) the maximum value of the speed ratio adjustment of all associated axes at the current moment, which reflects the most serious speed mismatch between axes and reflects the deterioration level of multi-axis synchronization; (2) the first real-time contour following error, which usually refers to the position deviation along the main normal direction, directly characterizing the degree of tool deviation from the ideal trajectory; (3) the second real-time contour following error, which usually refers to the error of the sub-normal or tangential component, used to capture the directional characteristics of contour deviation in three-dimensional space; (4) the rate of change of acceleration of the local axis (i.e., jerkiness), which measures the smoothness of the local axis motion. An excessively high value indicates the risk of mechanical shock or servo oscillation; (5) the rate of change of acceleration of associated axes, which can be taken as the maximum value, average value or vector form, used to evaluate the dynamic response consistency of the cooperating axes; (6) the command feed speed of the current trajectory point, which represents the machining efficiency setting and affects the dynamic response bandwidth and error tolerance of the system; (7) the path curvature radius, which describes the geometric complexity of the current tool path. Small curvature radius areas have higher requirements for speed coordination and contour accuracy. These parameters are horizontally concatenated in a preset order to form a fixed-dimensional real-number vector (e.g., 7-dimensional). This concatenation method preserves the complete original information, facilitating machine learning models to automatically uncover inherent correlations. This feature vector organically integrates kinematic states (velocity, rate of change of acceleration), geometric constraints (curvature, feed rate), and control performance indicators (profile error, coordination deviation), forming a multi-perspective snapshot of the current machining transient. This supports high-order controllers in making real-time decisions that balance accuracy, efficiency, and stability. The trajectory optimization prediction model is a pre-trained lightweight neural network model. The output of the trajectory optimization prediction model is a feed rate correction coefficient and / or a contour error compensation coefficient.
[0067] A pre-trained lightweight neural network model balances computational efficiency and prediction accuracy. The main body of the model consists of three fully connected layers: the input layer has the same dimensions as the aforementioned feature vectors (e.g., 7-dimensional), including the maximum adjustment value of the associated axis velocity ratio, real-time contour following errors in two directions, the rate of change of acceleration on the local and associated axes, the current command feed velocity, and the path curvature radius; the hidden layer uses 16 neurons, and the activation function is the computationally inexpensive and gradient-stable Swish (or ReLU) to enhance nonlinear expressiveness; the output layer can be configured as a single output (feed velocity correction coefficient only), dual outputs (feed velocity correction coefficient and contour error compensation coefficient), or a combined output of both through multi-task learning, depending on control requirements. The total number of network parameters is controlled below 500, ensuring that inference can be completed on an embedded motion controller with microsecond-level latency.
[0068] During the training set construction phase, a large number of trajectory programs covering typical machining scenarios (such as high-speed linear cutting, small curvature corners, helical interpolation, start-stop transitions, etc.) are first run in a simulation environment or on actual machine tools. Raw data for each control cycle is collected synchronously, including real-time speed of each axis, position feedback, command trajectory points, path curvature, and feed commands. Based on the aforementioned method, the feature vector seven-tuple corresponding to each moment is calculated offline, and combined with expert rules or high-fidelity simulation results, corresponding labels are generated, namely the ideal feed rate correction coefficient and / or contour error compensation coefficient. Finally, hundreds of thousands to millions of feature-label sample pairs are formed, constituting the supervised training set.
[0069] The training process employs a standard supervised learning paradigm: mean squared error (MSE) is used as the loss function to measure the deviation between the predicted correction coefficients and the true labels; the optimizer is Adam, with an initial learning rate set to 0.001, and early stopping and learning rate decay strategies are used to prevent overfitting; training is completed under GPU acceleration, and the model with the minimum weights and the lowest validation set error after convergence is saved. After lightweight processing such as pruning and quantization (e.g., FP32 to INT8), a pre-trained lightweight neural network model is obtained, which can be deployed in the kernel of a CNC system.
[0070] During the online prediction phase, each time a new interpolation cycle begins, the underlying servo data is first acquired in real time. Following the aforementioned process, a 7-dimensional feature vector for the current moment is generated and input into the deployed lightweight neural network model. The model rapidly propagates forward, outputting one or two continuous values: a feed rate correction coefficient and / or a contour error compensation coefficient. The entire prediction-execution process is completed within milliseconds, requiring no external intervention. This significantly improves machining accuracy and robustness under complex trajectories while maintaining extremely low computational resource consumption, fully demonstrating the practical value of lightweight intelligent models in high-end manufacturing equipment.
[0071] Starting from the current trajectory point, a local trajectory segment is extracted forward from the initial planned trajectory. The product of the feed rate and the feed rate correction coefficient of each trajectory point in the local trajectory segment is calculated to obtain the local velocity sequence. An optimized trajectory is generated based on the local velocity sequence.
[0072] Starting from the current trajectory point corresponding to the current interpolation cycle, a local trajectory segment of finite length is extracted from the pre-planned initial trajectory. This local trajectory segment typically includes several subsequent trajectory points (e.g., 10 to 30 points) starting from the current point, covering the motion path from tens to hundreds of milliseconds in the future. Its length is determined comprehensively based on the system sampling period, maximum feed rate, and the controller's look-ahead capability. Subsequently, for each trajectory point in this local trajectory segment, the system obtains its originally planned feed rate, i.e., the ideal motion rate specified by the CNC program or trajectory generator for that point. Simultaneously, using the aforementioned lightweight neural network model or other real-time decision-making mechanism, a feed rate correction coefficient is calculated for each corresponding point. This coefficient reflects the safety and rationality assessment of the original speed under the current working conditions (such as contour error, inter-axis coordination, path curvature, etc.), and is typically between 0.1 and 1.0.
[0073] Next, the original feed rate of each trajectory point in the local trajectory segment is multiplied point by point with its corresponding feed rate correction coefficient to generate a new local velocity sequence. For example, if the original feed rate of a trajectory point is 2000 mm / min and the correction coefficient output by the model is 0.75, then the actual target velocity of that point in the local velocity sequence is 1500 mm / min. This process achieves dynamic scaling of the original velocity command, ensuring automatic speed reduction in high curvature regions, large error states, or regions with sudden acceleration changes, while maintaining efficient feed in flat, low-error segments.
[0074] Finally, the local velocity sequence and the corresponding local trajectory point coordinates are input into a higher-order interpolator (such as a spline interpolator or a time-optimal trajectory planning module) to regenerate an optimized trajectory that satisfies the new velocity constraints. This optimized trajectory not only preserves the geometry of the original path but also makes the motion of each axis smoother through fine-tuning of the local velocities, effectively suppressing contour errors and mechanical vibrations caused by velocity overshoot or coordination mismatch. The entire process is executed in a rolling manner within each control cycle, ensuring both machining accuracy and machine tool safety while maximizing machining efficiency. It is particularly suitable for applications with stringent dynamic performance requirements, such as high-speed, high-precision milling and five-axis simultaneous machining.
[0075] The comprehensive contour error estimate is obtained by weighted summation of the first real-time contour following error and the second real-time contour following error. The normal compensation amount is obtained based on the comprehensive contour error estimate. The unit normal vector is obtained based on the current trajectory point. The current trajectory point and the adjacent m subsequent trajectory points are spatially offset along the unit normal vector. The spatial offset amount is the normal compensation amount, resulting in a set of compensated trajectory points. An optimized trajectory is generated based on the set of compensated trajectory points.
[0076] First, two key error quantities in the current interpolation cycle are obtained: the first real-time profile following error and the second real-time profile following error. The first real-time profile following error typically represents the tool's positional deviation in the principal normal direction (i.e., the direction perpendicular to the tangent of the motion trajectory and having the greatest impact on profile accuracy); the second real-time profile following error represents the positional deviation in the secondary normal or tangential direction, used to more comprehensively describe the tool's deviation from the ideal trajectory in three-dimensional space. Then, based on preset process requirements and path characteristics, these two error quantities are weighted and summed to obtain a comprehensive profile error estimate. This comprehensive error estimate is calculated by multiplying the first real-time profile following error by a large weighting coefficient (e.g., 0.8) and the second real-time profile following error by a small weighting coefficient (e.g., 0.2), and then adding them together. This weighting method reflects the dominant role of the principal normal error in the overall profile quality. Next, this comprehensive error estimate undergoes amplitude limiting and low-pass filtering to avoid noise interference and overcompensation, and is converted into the final normal compensation amount through a proportional gain coefficient. The normal compensation amount represents the distance the tool needs to move in the opposite direction of the normal to offset the current accumulated profile deviation.
[0077] Next, the unit normal vector is extracted from the geometric information of the current trajectory point. This unit normal vector is perpendicular to the current direction of tool movement and points in the correction direction that most effectively reduces the contour error. Based on this, not only is the current trajectory point adjusted, but the same spatial offset operation is also performed simultaneously on several subsequent trajectory points (e.g., 5): each selected trajectory point is translated a distance along the direction of the aforementioned unit normal vector, and this distance is the normal compensation amount calculated above. This forms a set of uniformly corrected new trajectory points, called the compensated trajectory point set. This method of simultaneously offsetting multiple points within a local trajectory window ensures the continuity and smoothness of the corrected trajectory, avoiding acceleration jumps or mechanical shocks caused by abrupt changes at a single point.
[0078] Finally, this set of compensated trajectory points is fed into the interpolator to replace the corresponding path segment in the original command trajectory, thereby generating an optimized real-time machining trajectory. This optimized trajectory, without altering the overall path direction and feed timing, actively incorporates geometric compensation for the current contour error, enabling the tool to more closely conform to the theoretical contour during actual operation. Especially in high-speed machining of small-curvature corners, complex free-form surfaces, or highly dynamic start-stop conditions, this method can significantly reduce steady-state and transient contour errors, improving the surface quality and dimensional accuracy of the workpiece. Furthermore, since this strategy only involves the spatial offset of trajectory points, it does not require replanning the speed curve or modifying time parameters, thus allowing seamless integration into the motion control framework of existing CNC systems, exhibiting excellent engineering applicability and real-time performance.
[0079] To implement the above embodiments, this application also proposes an electronic device. Please see [link to relevant documentation]. Figure 2 , Figure 2 This is a schematic diagram of the structure of the electronic device provided in an embodiment of this application. For example... Figure 2 As shown, the electronic device 500 includes: a processor 501 and a memory 502 communicatively connected to the processor 501; the memory 502 stores computer-executable instructions; the processor 501 executes the computer-executable instructions stored in the memory to implement the method provided in the foregoing embodiments.
[0080] To implement the above embodiments, this application also proposes a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided in the foregoing embodiments.
[0081] To implement the above embodiments, this application also proposes a computer program product, including a computer program that, when executed by a processor, implements the methods provided in the foregoing embodiments.
[0082] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.
Claims
1. A machine tool trajectory optimization method based on event-triggered sampling and model predictive control, characterized in that, Includes the following steps: Step 1: Obtain the initial planned trajectory of the current machining task of the CNC machine tool and construct a trajectory optimization prediction model; wherein, the initial planned trajectory is a smooth continuous trajectory, including a sequence of trajectory points sorted by time, each trajectory point corresponds one-to-one with a timestamp, and each trajectory point contains spatial coordinates, the corresponding instruction feed rate and the path curvature radius; Step 2: Continuously acquire the actual running data of each motion axis, and compare the actual running data of each motion axis at the current moment with the actual running data at the previous sampling moment; if at least one motion axis meets the preset judgment condition, a global sampling event is triggered, and the current motion axis is defined as the local axis, and the remaining motion axes are defined as related axes; otherwise, the current initial planned trajectory is maintained and the actual running data of each motion axis is continuously acquired. Step 3: Determine the real-time contour following error of each motion axis based on the actual operating data of this axis and related axes, and the local geometric features of the trajectory points corresponding to the initial planned trajectory at the current moment; calculate the adjustment amount of the actual cooperative state relative to the theoretical allowable error range; generate the acceleration change rate based on the acceleration sequence of each motion axis. Step 4: Construct a feature vector based on the initial planned trajectory, real-time contour following error, and acceleration change rate, and input it as input data into the trajectory optimization prediction model. Output dynamic adjustment parameters, and correct the initial planned trajectory based on the dynamic adjustment parameters to obtain the optimized trajectory.
2. The machine tool trajectory optimization method based on event-triggered sampling and model predictive control according to claim 1, characterized in that, Based on the actual operating data of this axis and associated axes, and the local geometric features of the trajectory points corresponding to the initial planned trajectory at the current moment, the real-time contour following error of each motion axis is determined, and the adjustment amount of the actual coordinated state relative to the theoretical allowable error range is calculated, including: Step 31: Based on the spatial coordinates of the current trajectory point of the initial planned trajectory and the corresponding timestamp, obtain the theoretical velocity components of each motion axis, and determine the theoretical velocity components of this axis and the theoretical velocity components of the associated axis based on the theoretical velocity components of each motion axis. Step 32: Based on the current system time and the spatial coordinates of each trajectory point, obtain the command position corresponding to the current moment, and obtain the command coordinate components corresponding to the current axis and the associated axis based on the command position; obtain the actual feedback position of each motion axis based on the current system time, and obtain the actual coordinate components corresponding to the current axis and the associated axis based on the actual feedback position. Step 33: Calculate the absolute value of the difference between the command coordinate component and the actual coordinate component corresponding to the local axis and the associated axis respectively, and obtain the first real-time contour following error and the second real-time contour following error. Step 34: Preset the theoretical allowable error range, and obtain the dynamic attenuation factor based on the first real-time contour following error and the second real-time contour following error; obtain the corrected allowable deviation based on the theoretical allowable error range and the dynamic attenuation factor; Step 35: Obtain a reference speed ratio based on the ratio of the theoretical speed component of the associated axis to the theoretical speed component of the local axis; construct a speed ratio allowable range based on the reference speed ratio and the correction allowable deviation. Step 36: Obtain the real-time speed of this axis and the real-time speed of each associated axis at the current moment, and obtain the actual speed ratio based on the ratio of the real-time speed of the associated axes to the real-time speed of this axis; Step 37: Determine the speed ratio adjustment amount for each associated axis based on the relationship between the actual speed ratio and the allowable speed ratio range: If the actual speed ratio is within the allowable speed ratio range, set the current speed ratio adjustment amount for the associated axis to 0; otherwise, determine the current speed ratio adjustment amount for the associated axis based on the actual speed ratio, the reference speed ratio, and the correction allowable deviation; obtain the maximum speed ratio adjustment amount for all associated axes.
3. The machine tool trajectory optimization method based on event-triggered sampling and model predictive control according to claim 2, characterized in that, Obtain the actual velocity sequences of the local axis and the associated axis at the current time and the previous n sampling times; perform a numerical differentiation on the actual velocity sequences to obtain the acceleration sequences; perform a numerical differentiation on the acceleration sequences to obtain the acceleration rate of change sequences; define the acceleration rate of change value corresponding to the current time in the acceleration rate of change sequences as the acceleration rate of change of the local axis and the acceleration rate of change of the associated axis.
4. The machine tool trajectory optimization method based on event-triggered sampling and model predictive control according to claim 3, characterized in that, The feature vector is generated by concatenating the maximum value of the velocity ratio adjustment of the associated axis at the current moment, the first real-time contour following error, the second real-time contour following error, the rate of change of the local axis acceleration, the rate of change of the associated axis acceleration, and the command feed velocity and path curvature radius of the current trajectory point.
5. The machine tool trajectory optimization method based on event-triggered sampling and model predictive control according to claim 1, characterized in that, The trajectory optimization prediction model is a pre-trained lightweight neural network model.
6. The machine tool trajectory optimization method based on event-triggered sampling and model predictive control according to claim 5, characterized in that, The output of the trajectory optimization prediction model is the feed rate correction coefficient and / or the contour error compensation coefficient.
7. The machine tool trajectory optimization method based on event-triggered sampling and model predictive control according to claim 6, characterized in that, Starting from the current trajectory point, a local trajectory segment is extracted forward from the initial planned trajectory. The product of the feed rate and the feed rate correction coefficient of each trajectory point in the local trajectory segment is calculated to obtain the local velocity sequence. An optimized trajectory is generated based on the local velocity sequence.
8. The machine tool trajectory optimization method based on event-triggered sampling and model predictive control according to claim 6, characterized in that, The comprehensive contour error estimate is obtained by weighted summation of the first real-time contour following error and the second real-time contour following error. The normal compensation amount is obtained based on the comprehensive contour error estimate. The unit normal vector is obtained based on the current trajectory point. The current trajectory point and the adjacent m subsequent trajectory points are spatially offset along the unit normal vector. The spatial offset amount is the normal compensation amount, resulting in a set of compensated trajectory points. An optimized trajectory is generated based on the set of compensated trajectory points.