Variational Analysis, Optimization, and Fixed Point Theory 2014View this Special Issue
Minimum Time Trajectory Optimization of CNC Machining with Tracking Error Constraints
An off-line optimization approach of high precision minimum time feedrate for CNC machining is proposed. Besides the ordinary considered velocity, acceleration, and jerk constraints, dynamic performance constraint of each servo drive is also considered in this optimization problem to improve the tracking precision along the optimized feedrate trajectory. Tracking error is applied to indicate the servo dynamic performance of each axis. By using variable substitution, the tracking error constrained minimum time trajectory planning problem is formulated as a nonlinear path constrained optimal control problem. Bang-bang constraints structure of the optimal trajectory is proved in this paper; then a novel constraint handling method is proposed to realize a convex optimization based solution of the nonlinear constrained optimal control problem. A simple ellipse feedrate planning test is presented to demonstrate the effectiveness of the approach. Then the practicability and robustness of the trajectory generated by the proposed approach are demonstrated by a butterfly contour machining example.
For the purpose of maximum productivity, minimum time trajectory planning (MTTP) problems along given path have been widely studied in CNC machining applications, such as Smith et al. , Timar and Farouki , Yuan et al. , and Zhou et al. . However, the Acc/Dec structure of the common minimum time trajectory with acceleration or torque constraints has been proven to be discontinuous by Chen and Desrochers  and McCarthy and Bobrow , which means that direct execution of this discontinuous trajectory can induce tool vibrations and reduce machining accuracy.
To make the minimum time trajectory more practical in applications, trajectory smoothing methods, which can generate continuous Acc/Dec structure, have been studied by several authors. One kind of methods is to solve optimization problem with time-jerk objective as mentioned in Gourdeau and Schwartz . Or the common methods are to confine the change rate of acceleration by introducing jerk constraint into the problem. Dong et al.  obtained smooth minimum time trajectory by solving the jerk constrained problem with a bidirectional scan algorithm. Zhang et al.  proposed a greedy strategy to realize the smooth problem solution. Then another smoothing strategy was proposed by the same author in . Zhang and Li  presented a convex optimization approach to solve the jerk constrained minimum time trajectory planning problem. Then a linear programming method was shown in Fan et al.  to obtain smooth trajectory.
However, to achieve high precision machining in minimum time, only continous Acc/Dec of the trajectory is not enough. Actually, in the cases of high speed or highly varying loads machining, the servo system response will become weak [13–16]. At this moment, even smooth trajectory cannot maintain the machining precision.
For the purpose of improving machining precision, one kind of approaches is to develop new advantage controllers, such as Srinivasan and Kulkarni , Chuang and Liu , and Takahashi and Bickel . An alternative approach is to consider servo system performance in the trajectory planning process, which improves the performance of existing industrial systems without modifying the controllers.
Ardeshiri et al.  considered a simplified motor dynamics and studied a speed dependent torque constrained minimum time trajectory planning. Tarkiainen and Shiller  ignored manipulator gravity and studied a rigid manipulator dynamics and motor dynamics governed minimum time trajectory planning. But the studies of Ardeshiri et al.  and Tarkiainen and Shiller  are all based on the open loop servo dynamics.
Dong and Stori  discussed the necessity of introducing closed loop servo dynamics into the trajectory planning problem and claimed the advantage of including closed loop servo dynamics is no infeasible command, which may exceed the physical capabilities of the system, is generated for the axis drivers. Ernesto and Farouki  presented an inverse dynamics strategy to modify the trajectory according to the closed loop servo mode and then reduce the machining error. A similar work was also presented in Guo et al. . Tsai et al.  proposed a look-ahead interpolate algorithm with closed loop servo dynamics constraints. Dong and Stori  constructed the closed loop servo dynamics constrained problem as an optimization problem and a two-pass method was used to solve the problem. Guo et al.  and Zhang et al.  applied tracking error as the indicator of the closed loop servo dynamics and corrasponding optimization problems were solved in their works.
According to the model formulation of closed loop servo dynamics as in [24, 25], the introduced tracking error constraints make the minimum time trajectory planning problem become a complex nonconvex optimal control problem and no further reduction can be achieved.
In this paper, to realize high precision machining in minimum execution time, the minimum time feedrate planning problem with considering limited servo dynamics performance is studied. Tracking error acts as the constraint function of the servo dynamics. Then a minimum time trajectory planning problem with confined velocity, acceleration, jerk, and tracking error constraints is constructed. Different from the works of Guo et al.  and Zhang et al. , in this paper we present a newly active set strategy to realize a convex optimization based solution of the complex constrained trajectory planning problem.
The rest of this paper is organized as follows. In Section 2, a closed loop system with PD controller is introduced. The minimum time trajectory planning problem with confined constraints is stated in Section 3, and the properties of the optimal trajectory are also presented in this section. In Section 4, a constraints handling strategy is present by which the nonconvex tracking error function is approximated by a linear function. In Section 5, the convex optimization based strategy is presented. The simulation tests are given in Section 6.
2. Servo Control System Model
In this paper, we consider that each axis of the CNC machine is driven by an electronic motor, which can be approximated by the following equations: where denotes the armature current, denotes the control voltage and is the angular position of rotor, is the inertial load, is the viscous friction coefficient, is the resistance of armature circuit, is the torque constant of the motor, and is the voltage constant of the motor.
In Laplace domain, the transfer function of the motor model can be of the following form: where denotes the servo gain and is known as servo time constant.
The PID controller is widely used in CNC control system. Here to simplify the presentation, PD controller is used to construct the closed loop control system for each axis, as shown in Figure 1. In fact, the following analysis of tracking error approximation is also appropriate for other types of controllers.
In Figure 1, denotes the proportional gain of the controller and is the differential gain. Define tracking error as the difference between reference command and actual axis location, . Then we can obtain the output transfer function of the closed loop control system described as
The error transfer function is written as where , , , , and .
In time domain, the equivalent differential equation of (4) with zero initial conditions is which is a second order differential equation system. Apparently, with the initial conditions, the tracking error of the CNC axis can be calculated by solving this equation.
According to the classical control theory, the tracking error of system (5) is stable only when all the roots of the following homogeneous differential equation have negative real parts:
Further, the roots are allocated as underdamping form to improve the responsiveness of the control system; then we have
3. Minimum Time Trajectory Planning with Confined Tracking Error
Three-axis -- CNC machine is studied here. In task space, we define given tool path having the following parametric formula: and we assume the path is at least . Then we have where denotes any one of the three axes.
3.1. Ordinary Considered Constraints
In trajectory planning problems, the velocity and acceleration are ordinarily considered constraint conditions. For the purpose of smoothing the trajectory, the jerk constraint of each axis is also considered. Mathematically, these constraint functions can be written as where , , and are the parameter velocity, acceleration, and jerk, respectively.
Then we define variables , , and , and they satisfy
The velocity, acceleration, and jerk constraints of each axis can be
3.2. Tracking Error Constraints
For commonly used controllers (e.g., PID controller) in industrial CNCs, the zero error response is impossible. Especially, the fast ACC/DEC commands of high speed machining can induce large tracking error. So in trajectory planning process, it is necessary to modify the generated trajectory to reduce tracking error.
In parameter domain, the tracking error estimation can be realized by executing the following steps.
According to the chain rule, we have Then the error equation (5) of each axis becomes
Defining and , we have where
Hence in parameter domain, the tracking error w.r.t the parameter commands can be estimated by solving (15) numerically. And the tracking error constraint of the axis is denoted by .
3.3. Formulated as an Optimal Control Problem
The objective of our problem is to minimize machining time along given tool path; that is, . In parameter domain, we have .
The axis velocity, acceleration, jerk constraints, and the tracking error constraints act as the constraint conditions; then the problem is stated as follows:
In problem (17), we assume the initial tracking error of each axis is zero, the initial and final velocities are specified, denoted by , , and the initial and final accelerations are zeroes.
3.4. Bang-Bang Constraint Structure of the Optimal Trajectory
In this section, we will prove that the constraint structure of the optimal trajectory is “bang-bang,” which is the key to realize our optimization approach.
In robotic manipulator applications, Chen and Desrochers  proved that the constraint structure of optimal motion is bang-bang for torque/acceleration constrained problem. The optimal constraint structure for tracking error constrained MTTP problem has not been proved yet.
In optimal control problem (17), acts as the control variable. The states of problem (17) are and , where , . So the jerk constraints act as the mixed state-control constraints in this problem; the velocity, acceleration, and tracking error limits are the 2-order, 1-order, and 3-order pure state constraints, respectively.
Here we define the mixed state-control constraints set as and the pure state constraints set as . The Hamiltonian function and the Lagrange function of problem (17) become where , , , and are the adjoint variables of the states , , , and , respectively. and are the multiplier vectors of the mixed constraints and pure state constraints, respectively.
Based on the extended maximum principle , there exits the following theorem.
Theorem 1. For optimal control problem (17), assume that a feasible control is optimal. Then there exists at least one of the process constraints (pure state constraints and mixed constraints ) which is active at almost all points of the parameter horizon .
Proof. We define symbols , . Based on the extended maximum principle , the optimal solution of problem (17) satisfies the following conditions:
where is the state based control constraint set.
For optimal control problem with state constraints, the optimal control trajectory can have the following four possible control arcs: control upper limit, control lower limit, sensitivity arc, and path constrained arc. In this proof, we discuss all the four possible control arcs. In arbitrary small interval , the optimal solution can only have the following three cases.
Case (I). In small interval , at least one of the mixed constraints is active, denoted by , with the set of active mixed constraints.
Case (II). In small interval , at least one of the pure state constraints is active, denoted by , with the set of active pure state constraints.
Case (III). In small interval , none of the mixed or pure state constraints is active, denoted by , .
Then we discuss the above possible cases one by one.
Case (I). In , the Lagrange function of the problem is rewritten as And the optimal trajectory satisfies where . According to condition (22), in this case . Then the optimal control is determined by So the optimal control is general bang-bang.
Case (II). Similar to Case (I), in the Lagrange function is rewritten as
And the optimal trajectory satisfies
According to (29), the optimal control is determined by the active state constraints and
Case (III). In this case, since none of the constraints is active, the problem can be treated as an unconstrained optimal control problem; the Lagrange function can be reduced to And we have
In , according to (32), there exists which is impossible.
Then we consider the interval shrink to a point, which means . Now we have . If , we have and with opposite signs, which means that this point is a switch point. If , the Hamiltonian function is reduced to . According to condition (21), the optimal state becomes , which is impossible.
Above all, except the switch points, at almost all points of the parameter horizon , there exists at least one of the process constraints (pure state constraints and mixed constraints ) which is active.
In this subsection, a simple example is solved to present the optimal constraint structure of the tracking error constrained minimum time trajectory planning problem.
The test path is shown in Figure 2 with its parametric equation:
In this example, the parameters of the error transfer function (4) for each axis are
Since problem formulation (17) is a complex nonconvex optimal control problem, the direct parameterization solution is inefficient. However, by using proper initial guess, the solution of problem (17) for this simple path is possible.
In this example, the axis acceleration constraints with bound 1000 mm/s2, jerk constraints with bound 10000 mm/s3, and tracking error constraints with bound 0.05 mm are considered. The optimized trajectories are shown in Figures 3(a), 3(b), 3(c), and 3(d).
4. Nonconvex Constraints Handling Strategy
In our previous paper , a constraint convexification strategy is proposed to realize a convex optimization solution of the jerk constrained minimum time trajectory planning problem which is proven to be nonconvex. In this paper, a new constraint convexification strategy called active set strategy is proposed to handle the complex nonconvex tracking error constraint.
From Theorem 1, we have known that the optimal constraint curves have the bang-bang structure, which means that if there exists a small interval of the parameter domain in which none of the velocity, acceleration, and jerk constraints is active, then at least one of the tracking error constraints is active (denoted by , ). In this case, we have
Now in if we define a pseudo tracking error function as then we have for .
Here we define a typical problem named as original P, which is described as minimum motion time along given path while the trajectory is only subjected to velocity and acceleration constraints. According to the works of Bobrow et al. , Zhang et al. , and Fan et al. , we have the fact that the optimal solution of the original P is maximum among all feasible solutions for any . So let be any feasible solution of problem (17), which is also feasible for the original P, and then we have with the optimal solution of the original P.
According to (38), four subfunctions are constructed in this paper to handle the nonconvex constraint , which are We can check that the four subfunctions are all linear w.r.t the states . More importantly, the constructed four subfunctions are the overestimate of the constraint function (37).
Remark. In our nonconvex constraints handling strategy, the pseudo function (36) is only defined in open interval , so possible constraint failure exists at the end points of the interval, , . However, since the closed loop control system is configured to underdamping stable as mentioned in (7), the tracking error governed by our constraints handling strategy is still bounded which is supported by Theorem 2.7 in Guo et al. . The solution of the examples in Section 6 can also verify this conclusion.
5. A Convex Optimization Based Problem Solution Strategy
Problem (17) is a complex nonlinear optimal control problem with mixed and pure state constraints. Direct parameterization method is inefficient to solve this problem. According to our previous works in , the velocity, acceleration, and jerk constrained minimum time trajectory planning problem can be solved by a convex optimization method. So in this paper, the nonlinear tracking error constraint function is the key issue needed to be solved.
In this paper, a novel solution strategy of problem (17) is proposed and named as active set approach which means only the active tracking error constraints are considered in the trajectory planning problem. And then linear pseudo tracking error constraint functions (39) and (40) are used to replace the real tracking error constraint functions to make the problem solution efficiently.
Let be a positive integer, and since the trajectory is fixed at the end points, written as , , the sequence of grid nodes must be clamped, written as
In problem (41) the trajectory needs to be estimated, and the three-order derivative information of trajectory should exist. Hence, let mean that 3-order -spline is suitable for our problem. Then the trajectories , , and can be approximated by the following -spline curves in parameter interval : where is the th decision variable and denotes the th basis function defined as And the derivative information of basis function can be calculated by
The vector forms of (43) are written as where
The pointwise discretization method is used to parameterize the path constraints and the convergence proof of this method can be found in Chen and Vassiliadis . Let denote the th constraint reference node and
Then we can obtain the values of each trajectory , , and at node , written as , , and , . The minimum time objective can be approximated as
So the convex optimal control problem (41) can be approximated by the following convex optimization problem: where and denote the upper and lower active constraints sets of the -axis tracking error, respectively. Consider for , and for .
The proposed optimization strategy is achieved by executing the following steps.
Step 1. The original P is solved firstly by using the convex optimization as mentioned in  with the purpose of getting the actual maximum parameter velocity trajectory with .
Step 2. Initial the upper and lower active constraints sets of tracking errors for all 3 axes, denoted by , . Initial iteration .
Step 4. The acts as reference command; the tracking error of each axis is estimated by solving equation (15). If no tracking error crosses the given bounds, algorithm stops. If the -axis tracking error exceeds the upper limit at point , then update the active set . If the -axis tracking error exceeds the lower limit at point , then update the active set ;
Step 5. If the updated active sets satisfy and for all , the final solution is obtained and algorithm stops, else , go to Step 3.
6. Illustrative Examples
In this section, we present two test examples to verify the effectiveness of the proposed approach. First, a simple ellipse path constrained minimum time trajectory planning problem mentioned in Section 3.5 is solved to present the feasibility of the pseudo tracking error constrained trajectory. Then a NURBS type butterfly pattern manufacturing problem with practical high order control system is tested to show the practicability of the proposed approach.
The numerical implement of the convex optimization problem (50) for the test paths is achieved by using the MATLAB SQP routine fmincon. All the numerical solutions are run on a laptop with windows 32 bit system, 2.5 GHz Core i3 processor, 2 GB RAM memory.
For convenience, we use MTT, SMTT, TEC-SMTT, and RTEC-SMTT to denote the minimum time trajectory, the smooth minimum time trajectory, the proposed tracking error constrained SMTT, and the original real tracking error constrained SMTT, respectively.
6.1. An Ellipse Path Test
The path equation and constraint settings are mentioned in Section 3.5. By executing the proposed strategy in Section 5, the TEC-SMTT is obtained for the ellipse path. The MTT and SMTT are also calculated for comparison.
Figure 4 shows the tracking error estimation at initial iteration of the proposed strategy. The corresponding active constraints indicator of tracking error trajectory is also shown. In the solution process, the final solution is achieved by only 2 iterations. The optimized velocity, acceleration, and jerk curves of the TEC-SMTT for all axes are shown in Figures 5(b), 6(b), and 7(b), respectively. The estimated tracking error curves corresponding to the optimized TEC-SMTT are shown in Figure 8(b). The optimized velocity, acceleration, jerk, and tracking error curves for the SMTT are shown in Figures 5(a), 6(a), 7(a), and 8(a) for comparison. From Figure 8(b), we can see that the proposed tracking error constrained trajectory optimization strategy is efficient to reduce tracking error in this example, which is consistent with our previous discussion in this paper. More details are shown in Table 1. The RTEC-SMTT has been calculated in Section 3.5, and the details are also shown in Table 1. In Table 1, the tracking error is estimated by simulating the control system in Matlab Simulink environment under the interpolation period ms.
By doing statistics of the data in Table 1, the proposed TEC-SMTT can reduce maximum tracking errors 52% and 51% compared with the MTT and SMTT for the ellipse path; the corresponding time losses 41.5% and 13.7%, respectively. For comparison, the RTEC-SMTT reduces tracking errors 49.8% and 48.8% compared with the MTT and SMTT; the corresponding time losses 36% and 9.3%, respectively. The TEC-SMTT has similar dynamics performance with the RTEC-SMTT, but the computation cost of the proposed approach is much smaller.
6.2. A Butterfly Contour Test
For the purpose of testing the practicability and robustness of the proposed tracking error constrained minimum time trajectory planning method, in this subsection a butterfly contour test configured with practical high order control system is studied. The butterfly contour is shown in Figure 9.
The 3-axis machining equipment is simulated by Matlab Simulink. Each axis is controlled by an independent PID controller from Tsai et al. . Each closed loop control system includes position control and velocity PI control loops, and a velocity feed forward path. The parameters of the control systems can be found in Tsai et al. . The closed loop transfer function for each axis has the following structure: which is four-order. For -axis of the simulated machine, the control parameters of (53) are
For -axis, the control parameters are
Here we ignore the influence of dipole and non-dominant pole to the closed loop system, and we can have the order reduced error transfer function, which has the structure of (4). For -axis, the parameters of the reduced model (4) are
For -axis, the parameters are
In this example, the axis acceleration constraints with bound 2500 mm/s2, jerk constraints with bound 100,000 mm/s3, and tracking error constraints with bound 0.15 mm are considered.
Based on the reduced control system model, the TEC-SMTT is generated by our proposed approach. Considering the influence of the reduced order model to the control system dynamics, the error bound for the reduced order model is relaxed to 0.25 mm. In this subsection, the mentioned tracking error estimation is based on the reduced control system model.
Figure 10 shows the tracking error curves which vary along with the iteration of the algorithm. The corresponding active constraints indicator of tracking error trajectory is also shown. The final TEC-SMTT solution is obtained by 2 iterations with time cost 37.64 s. For this butterfly contour, the RTEC-SMTT cannot be obtained efficiently, so no result for this trajectory is listed here. The feedrate trajectories of the optimized SMTT and TEC-SMTT are shown in Figure 11. The planning time costs are listed in Table 2.
Because of the approximate operation for the problem, the tracking error curves of the planned butterfly trajectory exceed the setting bound slightly in some intervals as shown in Figure 10. Even so, the planned trajectory is efficient for reducing the tracking error compared with the ordinary jerk constrained smooth trajectory. The data in Table 2 also confirm this.
Then the optimized MTT, SMTT, and TEC-SMTT are interpolated into control commands with interpolation period ms. The full four-order control system model for each axis is used to simulate the machining process. Figures 14(a) and 14(b) present the simulated tracking error curves for the optimized SMTT and TEC-SMTT commands, respectively. The corresponding execution velocity, acceleration and frequency curves are shown in Figures 12, 13, and 15, respectively. From these figures, we can see that the proposed TEC-SMTT can have smaller tracking error than the SMTT. More details are shown in Table 2. From Table 2, the TEC-SMTT can reduce maximum tracking errors 27.1% and 25.3% compared with the MTT and SMTT for the butterfly contour, the corresponding time losses 24.3% and 11.5%, respectively. The results indicate that the proposed TEC-SMTT is efficient for this practical high order controlled example implying that the proposed approach is practical and robust.
Since the common trajectory modification method for improving machining precision is to confine jerk, in this example the smooth minimum time trajectory planning problems with different jerk constraint settings are tested.
The confined jerks are 60,000 mm/s3 and 45,000 mm/s3 and corresponding trajectories are labeled by SMTT-T1 and SMTT-T2. The test results are listed in Table 2.
From the results in Tables 1 and 2, we can see that the jerk constrained SMTTs are efficient for reducing the mean tracking error, but the effectiveness of reducing maximum tracking error is weak compared with the proposed TEC-SMTT. Figure 16 presented the machining contours under the MTT, SMTT, and TEC-SMTT commands, respectively. From this figure, we can see that the proposed method is also efficient for reducing contour error, especially in the case of high speed machining. Since the computation time of the TEC-SMTT is acceptable for off-line applications, replace SMTT with TEC-SMTT as the high precision minimum time command is reasonable in practical applications.
In this paper, an efficient computation approach for solving tracking error constrained minimum time trajectory has been presented. The proved “bang-bang” constraint structure of the optimal trajectory induces a novel convex optimization based strategy to realize the solution of the complex tracking error constrained minimum time trajectory planning problem. Because of the convexity of the optimization strategy, the optimized value is unique and the solution process is efficient. The planning tests on the examples present the ability of the approach to generate optimized trajectory. The experiment results have also shown that the trajectory generated by the proposed approach is practical and robust.
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
This work was supported by the Foundation of UPC for the Author of National Excellent Doctoral Dissertation (120501A) and the Natural Science Foundation of Shandong Province (ZR2012FQ020).
C. M. Yuan, K. Zhang, W. Fan, and X. S. Gao, “Time-optimal interpolation for CNC machining along curved tool paths with confined chord error,” Journal of Systems Science and Complexity, vol. 26, no. 5, pp. 836–870, 2013.View at: Google Scholar
J. F. Zhou, Y. W. Sun, and D. M. Guo, “Adaptive feedrate interpolation with multi constraints for five-axis parametric tool path,” The International Journal of Advanced Manufacturing Technology, vol. 71, no. 9–12, pp. 1873–1882, 2014.View at: Google Scholar
R. Gourdeau and H. M. Schwartz, “Optimal control of a robot manipulator using a weighted time-energy cost function,” in IEEE Conference on Decision and Control, pp. 1628–1631, Tampa, Fla, USA, 1989.View at: Google Scholar
W. Fan, X. Gao, C. Lee, K. Zhang, and Q. Zhang, “Time-optimal interpolation for five-axis CNC machining along parametric tool path based on linear programming,” The International Journal of Advanced Manufacturing Technology, vol. 69, no. 5–8, pp. 1373–1388, 2013.View at: Publisher Site | Google Scholar
M. Tarkiainen and Z. Shiller, “Time optimal motions of manipulators with actuator dynamics,” in Proceedings of the IEEE International Conference on Robotics and Automation, pp. 725–730, Atlanta, Ga, USA, May 1993.View at: Google Scholar
T. Ardeshiri, M. Norrlof, J. Lofberg, and A. Hansson, “Convex optimization approach for time-optimal path tracking of robots with speed dependent constraints,” in Proceedings of the 18th IFAC World Congress, pp. 14648–14653, Milano, Italy, August-September 2011.View at: Google Scholar
H. Takahashi and R. J. Bickel, “Developing a controller to reduce contour error,” in Proceedings of the IEEE International Workshop on Advanced Motion Control, pp. 222–227, ACM, 2000.View at: Google Scholar
J. X. Guo, Q. Zhang, and X. S. Gao, “Tracking error reduction in CNC machining by reshaping the kinematic trajectory,” Journal of Systems Science and Complexity, vol. 26, no. 5, pp. 817–835, 2013.View at: Google Scholar
K. Zhang, J. X. Guo, and X. S. Gao, “Cubic spline trajectory generation with axis jerk and tracking error constraints,” International Journal of Precision Engineering and Manufacturing, vol. 14, no. 7, pp. 1141–1146, 2013.View at: Google Scholar
J. E. Bobrow, S. Dubowsky, and J. S. Gibson, “Time-optimal control of robotic manipulators along specified paths,” International Journal of Robotics Research, vol. 4, no. 3, pp. 3–17, 1985.View at: Google Scholar
Q. Zhang, S. R. Li, and X. S. Gao, “Practical smooth minimum time trajectory planning for path following robotic manipulators,” in Proceedings of the American Control Conference, Washington, DC, USA, June 2013.View at: Google Scholar