Time-optimal feedrate scheduling with actuator constraints for 5-axis machining

Cycle time minimization is one of the major goals to achieve in manufacturing. Maximizing feedrate is the direct solution; however, physical motions need to be under the specified motion limits to avoid high-frequency vibration, causing machining error. In this paper, a time-optimal feedrate scheduling approach with corner smoothing for 5-axis G1 toolpaths is presented for 5-axis machining. One key feature of the proposed method is to describe the orientation toolpath in the spherical coordinate system (SCS), instead of the commonly used unit sphere. With this, the position and orientation of the 5-axis toolpath are integrated to become a hyper-curve in a 5-dimensional (5-D) space. The feedrate scheduling and corner smoothing are designed for this 5-D hyper-curve. Thus, no synchronization of position and orientation feedrate scheduling is needed, making the feedrate scheduling easier. A quintic B-spline corner smoothing method is utilized to smoothen sharp corners in the toolpath. Then, the S-shape feedrate profile of each block is optimized under the actuator motion constraints, with the objective of minimizing the cycle time. Particle swarm optimization (PSO) is used to provide the optimized solution. Experiments are conducted to validate the proposed approach, and the results are compared with two other existing approaches. It is found that the proposed method can achieve shorter cycle time and less contour errors, showing the effectiveness of the proposed approach.


Introduction
In manufacturing, the cycle time is considered as one of the most important factors that every manufacturer desire to minimize. However, reducing the cycle time without degrading the machining accuracy is challenging. Smooth motion planning that plays a key role in accomplishing the objective is composed of two fundamental elements: (1) smoothness (continuity) in toolpath and (2) smooth feedrate scheduling. Given a toolpath, infinite possible feedrate profiles can be designed along the same toolpath. Different feedrate profiles will lead to different machining results. In particular, nonsmooth feedrate profile will result in motion discontinuities which degrade the machining accuracy. Besides, maximizing the feedrate implies the cycle time reduction. Hence, the time-optimal smooth feedrate scheduling is one of the essential components to achieve the next-generation high-speed machining.
In machining, toolpaths generated from computer-aided manufacturing (CAM) software are mostly defined by a set of G1 command points. In other words, they are approximately represented using a series of short line segments. Sharp corners between every two line segments are the major cause of toolpath and motion discontinuities that excite high-frequency vibration to machining systems, degrading the machining quality [1]. Thus, to remedy the problem, corner smoothing should be considered to achieve the smoothness in the toolpath prior to planning a smooth feedrate profile.
To smoothen the sharp corners and control the trajectory geometry, many corner smoothing algorithms have been introduced thus far. The most commonly used corner smoothing method is the circular arc method [2]. Although a lot of commercial computer numerical control (CNC) controllers have integrated this user-friendly method in their products as a machining strategy, only the tangential continuity is guaranteed. Then, numerous spline corner smoothing methods with different degrees and types, e.g., quartic/ quintic Bezier splines [3,4], cubic/quintic B-spline [5,6], Pythagorean-hodograph (PH) spline [7], and clothoid splines [8], were presented. However, none of them considers 5-axis toolpath, in which the corner smoothing should handle the sharp corners in the orientation toolpath as well as those in the position toolpath, since the discontinuities in the orientation toolpath also lead to the vibration and machining error. In addition, synchronizing the position and orientation toolpaths is another difficulty.
For the 5-axis corner smoothing, Tulsyan and Altintas proposed a novel cornering method inserting quintic and septic B-splines for smoothing corners in the position and orientation toolpaths, respectively [9]. Nonetheless, in their proposed method, calculation of the control points to synchronize the two toolpaths is too complicated. Thus, the Newton-Raphson optimization algorithm is deployed to numerically determine the control points. To avoid using the numerical analysis tool, Yang et al. presented to smoothen the position and orientation toolpaths in the workpiece coordinate system (WCS) and the machine coordinate system (MCS), respectively [10,11]. As a result, the synchronization can be achieved analytically without considering the constraint of the unit orientation vector. However, the above methods can only be implemented with the conventional 5-axis machine tools which simply embody 3 translational and 2 rotational drives. Meanwhile, there has recently been an increasing trend of using alternative machining technologies such as robotic machining systems in industry due to the satisfactory cost efficiency, high flexibility, and multifunctionality of industrial robots [12]. The above corner smoothing approaches [9][10][11] cannot directly work with such robotic machining systems because of nonlinear coupling kinematics of the robots.
Once the sufficient smoothness of the toolpath is ensured, the time-optimal smooth feedrate scheduling is addressed to attain the smooth motion planning. Table 1 shows some related works on feedrate scheduling. One of the key factors to deliver the smooth feedrate profile is to confine jerk under a specific limit. Thus, many jerk-limited feedrate designs, such as B-spline [13], geometry-based [14,15], sine-shape [16], and S-shape [17][18][19], were introduced. Among others, the S-shape feedrate design is commonly adopted due to its simplicity and smoothness. Du et al. investigated a complete S-shape feedrate scheduling approach (CSFA) [17], while analytical feedrate scheduling methods with various modified S-shape designs were presented in [19]. Nonetheless, the aforementioned works were dedicated to only bi-or triaxis translational machining.
For 5-axis machining, it is necessary to plan the feedrate profile for the orientation toolpath as well as for the position toolpath, and furthermore, time synchronization is also required to merge both feedrate profiles. Hence, Beudaert et al. developed an iterative algorithm to plan the feedrate profile based on the toolpath geometry for 5-axis machine tool and robot arm [15]. However, the issue of 5-axis corner smoothing was not studied. Moreover, the geometrybased velocity profile is much more complicated and nonuser-friendly than the S-shape one. Lu and Chen proposed a genetic algorithm based optimal S-shape feedrate profile for 5-axis systems [20]. Although the actuator constraints were included, only one block was considered, and hence, no cornering issue was discussed. Huang et al. proposed a simultaneous linear and angular trajectory planning (SLATP) method to plan the time-synchronized S-shape feedrate profile with linear and angular motion constraints [21]. However, due to the lack of actuator motion constraints and the use of low-order corner smoothing, the reduction of machining time and peak errors are limited.
In most of the above feedrate scheduling methods in Table 1, the feedrate profiles are planned separately for each block so that velocity at the junction may be discontinuous. Even though bi-directional scanning is used to make them continuous, it is required to analyze and establish the feedrate profile for the entire toolpath in one shot [17,19,21]. Due to memory limit of the CNC controller, the methods incorporating with the bi-directional scanning technique are able to work with only a limited number of blocks. Moreover, most of the studies on the G1 toolpaths implement only the circular arc cornering method to smoothen the toolpath prior to scheduling the feedrate profile. Consequently, the acceleration and jerk may not be smooth since the curvature at the junction of line and corner segments is not continuous.
The objective of this paper is to propose a time-optimal S-shape feedrate scheduling approach for 5-degree-of-freedom (DOF) machining. The proposed method not only can be applied to the conventional 5-axis CNC machine tools,  [13] 2/3-axis B-spline Actuator [14] 2/3-axis Geometry-based Tangential [15] 5-axis Geometry-based Actuator [16] 2/3-axis Sine Tangential [17] 2/3-axis S-shape Tangential [18] 2/3-axis S-shape Actuator [19] 2/3-axis Modified S-shape Tangential [20] 5-axis S-shape Actuator [21] 5-axis S-shape Tangential but also can be applied to other 5-axis machining systems, such as robotic machining systems. It is assumed that the given command path is composed of G1 line segments with prescribed orientation. The position tool path with orientation will be regarded as a path in 5-dimensional (5-D) space. The 5-D space consists of the 3-D task space for position tool path and 2-D spherical coordinate system (SCS) for tool orientation. In other words, the command path can be considered as a piecewise linear 5-D curve. The feedrate scheduling and corner smoothing will be conducted on this 5-D path. In this way, the feedrate scheduling for both position and orientation toolpaths is integrated in one platform, and no synchronization is needed.
The PSO method proposed in [18] is utilized to obtain optimal parameters for the time-optimal S-shape feedrate and for the smooth corner under various motion constraints. To achieve jerk-limited feedrate, a quintic B-spline corner smoothing method, instead of circular arc cornering used in [18], is employed here. The proposed method can smoothen the corners of the 5-D G1 toolpath according to user-defined error tolerances. Then, concerning each block, the feedrate profile is planned by PSO with respect to the actuator motion constraints separately and in succession. Finally, compared with two existing methods [17,21], experiments will be carried out to highlight benefits of the high-order corner smoothing and effectiveness of the feedrate scheduling with considering the actuator motion constraints, instead of the tangential (linear and angular) motion constraints.
To show feasibility of the proposed approach for more general 5-axis machining systems, the target system of this study is a 5-DOF dual-arm robotic machining system presented in [22]. In the system, two 5-DOF serial robot manipulators are used to hold a workpiece and work with a cutting tool fixed on a stationary base, forming 5-DOF machining configuration. Its structural kinematics is much more nonlinear and coupling than the conventional 5-axis CNC machine tool. The kinematics complexity leads to complicated relationship between the tangential motion and the actuator motion. As a consequence, the corner smoothing and the feedrate scheduling with actuator constraints for the 5-axis robotic machining are much more challenging than the conventional one. Moreover, the approaches of corner smoothing and feedrate scheduling presented in this paper can equally be applied to the conventional 5-axis CNC machine tool and other 5-axis robotic machining systems [12].
The contributions of the paper include the following: • The feedrate scheduling and corner smoothing for both position and orientation toolpaths are integrated in a 5-D space, and no synchronization is needed, which make the feedrate scheduling easier.
• The orientation toolpath is described in the SCS, instead of the commonly used unit sphere. • The high-order corner smoothing, i.e., quintic B-spline corner smoothing, is proposed to achieve better corner smoothing, which leads to smaller contour errors. • In feedrate scheduling, the actuator motion constraints are considered for a robotic machining system which can significantly reduce the cycle time.
The rest of the paper is structured as follows. In Sect. II, the quintic B-spline is introduced to establish the corner smoothing for 5-D G1 toolpath, while Sect. III presents a time-optimal S-shape feedrate scheduling method based on PSO. Simulation and experimental results on the 5-DOF dual-arm robotic platform are shown in Sect. IV, and conclusion remarks are provided in Sect. V.

Corner smoothing for 5-axis G1 toolpath
In 5-axis machining, a toolpath is in general composed of the tool position P = [P x P y P z ] T and the tool orientation which must be a unit vector. These two components are represented in the WCS (also called task coordinate system in the field of robotics). On the other hand, displacements of revolute joints denoted as q ∈ ℜ 5 that are driven by actuators are defined in the MCS. Kinematic chains, i.e., forward kinematics and inverse kinematics, are used to transfer the coordinates between these two coordinate systems. A G1 toolpath generated from CAM software can be represented as a series of line segments, in which end points are defined by G1 command points. For 5-axis G1 toolpath, each command point usually contains cutting position P and tool orientation O, as demonstrated in Fig. 1a. Between every two line segments, there exists a corner that lacks continuity of the tangent vector. The discontinuity excites highfrequency vibration to machining systems, degrading the machining accuracy [1]. Hence, in this section, the corners in the toolpath are smoothened satisfying the C 3 continuity under user-defined corner tolerances ε pw and ε ow , as depicted in Fig. 1a, prior to scheduling feedrate profile.
The orientation toolpath is usually considered on a unit sphere surface representing the collection of tool orientation unit vectors. Although spline-based corner segments can be inserted into the toolpath, analysis of the control point location is difficult due to the constraint that magnitude of the tool orientation vector must be unity [9]. Hence, the orientation toolpath can be represented in the SCS as In other words, the 5-axis G1 toolpath can be represented in the 5-D coordinates = P x P y P z T , The 5-D toolpath can still be treated as a piecewise linear toolpath, in which the corners need to be smoothened. Thus, the B-spline segments are inserted into the toolpath as illustrated in Fig. 1b. For the sake of the C 3 continuity, location of the B-spline control points has to be determined properly. On the other hand, to control the toolpath geometry satisfying the user-defined corner tolerances ε pw and ε ow , analysis of the control points is considered separately as discussed below.

Corner smoothing of position toolpath
Endpoints of the position toolpath are denoted as P i , i = 0, 1, ⋯, N, where N is the number of line segments. In order to avoid the discontinuity at the corner, a B-spline corner with (n + 1) control points will be adopted and is defined as control points and B i, k (u) is the kth-degree B-spline basis function of the spline parameter u defined on the nonperiodic knot vector U as introduced in [23].
To achieve the C 3 continuity, the degree and number of control points are chosen as 5 and 7, respectively. For the sake of symmetry across the angular bisector of the corner angle, the knot vector is designed as The C 3 continuity along the B-spline corner is guaranteed by the choice of degree. However, it is also required the C 3 continuity at the junctions between the line segments and the B-spline corner, which can be achieved by properly locating the control points. Considering the control points of the B-spline corner between two line segments �������� ⃗ 0 1 and �������� ⃗ 1 2 , firstly, p 0 and p 6 must be the starting (u = 0) and ending (u = 1) points of the corner, respectively, as illustrated in Fig. 2. For C 3 continuity, the tangent vectors of the B-spline curve at two end points of the corner (u = 0, 1) must be parallel to the line segments. Thus, it is required that the control points be such that To satisfy the tangency continuity condition (4), let us locate p 0 , p 1 , and p 2 on the line segment �������� ⃗ 0 1 and p 4 , p 5 , and p 6 on the line segment �������� ⃗ 1 2 , respectively. For symmetry of the corner, the p 3 is placed at the corner point P 1 , as shown in Fig. 2. Then, to smoothen the corner under the user-defined corner error ε pw and satisfy the C 3 continuity (4) and (5), following [9], the location of the control points can be obtained as  Fig. 1 Representation of position and orientation toolpath in a workpiece coordinate system and b 5-D coordinate system α is the corner angle. The derivation can be found in Appendix 1. Here, l p is a tuning parameter to determine the control points p 2 and p 4 . They will be closer to the corner point P 1 (i.e., p 3 ) for smaller l p and farther for larger l p . The first term in the minimum function in (7) is for the requirement of corner error. The second and third terms are to avoid the situation that the inserted corner occupies over half length of the original line segment.

Corner smoothing of orientation toolpath
Similar to the position toolpath, endpoints of the orientation toolpath are denoted as Z i , i = 0, 1, ⋯, N. Following the same line in the position toolpath corner smoothing, the corner is inserted by the quintic B-spline corner expressed as points. The knot vector (3) is also implemented here. The spline parameter u is shared with the position spline function in order to synchronize the orientation toolpath with the position toolpath. As a result, it is no need to schedule the feedrate profiles for the two toolpaths, separately. Only the feedrate scheduling for only the position toolpath is required. Similar to the position corner smoothing, the C 3 continuity along the toolpath can be achieved simply by the proper choice of the degree of the B-spline basis function.
On the other hand, to achieve the C 3 continuity at the junctions between the corner and line segments, the control points need to be chosen properly. They also need to be chosen to meet the corner tolerance for orientation ε ow . As a result, the design of control points for the orientation toolpath is more involved than that for the position toolpath.
This is because that ε ow depends not only on the corner error in SCS (‖ΔZ‖ in Fig. 3), but also on the position toolpath. Let us consider a corner formed by two line segments �������� ⃗ 0 1 and �������� ⃗ 1 2 as depicted in Fig. 3. Similar to (4) and (5), the C 3 continuity of the toolpath requires the control point to satisfy Through the derivation process provided in Appendix 2, the control points to achieve the condition (10) can be obtained as , while the tuning parameters l oa and l ob are to be determined to meet the condition (9) and the corner tolerance ε ow . Firstly, by the chain rule, (9) can be written as where (du/ds)| u = 0, 1 = 1/‖dQ/du‖ u = 0, 1 = 1/5l p . Secondly, from (9) and (12), we can obtain d du Note that the vector ������� ⃗ 0 0 and ������� ⃗ 6 2 are the same direction with ������ ⃗ 0 1 and ������ ⃗ 5 6 , respectively. From (11) to (13), we get Hence, to ensure the condition (9), the parameters l oa and l ob are proportional to the tuning parameter l p for the corner smoothing of the position toolpath. The proportional ratio is related to the lengths of line segments: Thus, once l p is given, the control points of the orientation corner segment can be determined by (11) and (16).
Next, the conditions on l p will be studied to limit the maximum orientation corner error under the user-defined orientation corner error ε ow . Let us define ‖ΔO‖ as the maximum deviation of the tool orientation vectors that meet the tolerance ε ow . Mathematically, it can be written as Then, ‖ΔO‖ can be approximated by corner error in SCS as (14) where the Jacobian function J should be evaluated at θ and ϕ of the corner point Z 1 . The corner error in the SCS, i.e., ΔZ, can be obtained as From (17) to (19), we can obtain Finally, combining with the conditions imposed for the corner smoothing of the position toolpath (7), l p should be updated as Here, the sharp corners in the 5-axis G1 toolpath are inserted by the B-spline corner segments under the userdefined corner errors ε pw and ε ow . As a result, the smoothened 5-axis G1 toolpath possesses the C 3 continuity. Since the position and orientation toolpaths can be regarded as being smoothened in a 5-D coordinate system with the same Thus, only feedrate scheduling for the position toolpath is required. Moreover, it can be seen that no structural kinematics is involved in the corner smoothing approach. Hence, this approach is applicable to any machining system.

Time-optimal S-shape feedrate scheduling for the smoothened toolpath
In this section, the time-optimal feedrate profile is proposed and scheduled after the 5-axis G1 toolpath was smoothened with the B-spline corner presented in Sect. II. The S-shape feedrate profile as shown in Fig. 4 is adopted for each line segment. Since the orientation toolpath is synchronized with the position toolpath using the same spline parameter, the feedrate scheduling is designed based on the position toolpath. It is to establish the time-optimal feedrate scheduling under various motion constraints. In this study, the actuator (joint) motion constraints are taken into account instead of the tangential motion constraints considered in most previous studies. For the robotic machining system in this study, satisfaction of the joint motion constraints is crucial to the smooth motion due to the nonlinear kinematics and constraints. It is clear that the feedrate scheduling can be formulated as a nonlinear constrained optimization problem, in which parameters of the feedrate profile are optimized to minimize the cycle time. PSO, one of the most popular evolutionary algorithms, is utilized to solve the optimization problem with respect to the joint motion constraints.

Fundamental principle of s-shape feedrate profile
The S-shape feedrate profile is mainly composed of 3 zones: acceleration (ACC), constant velocity (CON), and deceleration (DEC), in which they can be divided into 5 time segments, i.e., T i , i = 1, 2, ⋯, 5, as illustrated in Fig. 4. In the figure, the feedrate profile is scheduled according to one toolpath segment with the length L and given parameters, i.e., starting velocity v s , and ending velocity v e . In the acceleration profile, a A and a D are the maximum acceleration and deceleration in the ACC zone and DEC zone, respectively. Meanwhile, in the jerk profile, J 1 , J 2 , J 4 , and J 5 are the jerk during T 1 , T 2 , T 4 , and T 5 , respectively. Given the toolpath length L, the starting velocity v s , the ending velocity v e , and the time segments T i , i = 1, 2, ⋯, 5, the S-shape feedrate profile can be generated through formulas listed in Table 2, in which τ i , i = 1, 2, ⋯, 5 denote the relative time variables. The acceleration/deceleration and jerks can be calculated using the following formulas [18]: In general, the toolpath length L and the starting velocity v s are given as initial conditions, while the ending velocity v e and the time segments T i , i = 1, 2, ⋯, 5 are taken to be the design parameters. However, it can be seen in (22) and (23) that arbitrary choice of the design parameters may yield negative a A and a D , resulting in the false feedrate profile. Hence, it is required to include two additional constraints as well as the joint motion constraints, i.e., joint velocity limits ̇ max , acceleration limits ̈ max , and jerk limits ⃛ max .
The design parameters, i.e., T i , i = 1, 2, ⋯, 5 and v e , must be nonnegative. Nonetheless, there are possibilities that some of the time segments are zero, causing the feedrate profile to lose the acceleration phase or the deceleration phase. By (24), in case T 1 (or T 2 ) is zero, T 2 (or T 1 ) must be set to zero. The same rule also applies to T 4 or T 5 . When the choice of the design parameters falls to these situations, the ending velocity v e is no longer a design variable and will be determined as follows instead: (a) Without ACC zone: T 1 and T 2 equal to zero and the starting velocity v s is nonzero (T 1 = T 2 = 0 and v s ≠ 0)

Feedrate profile for multiple line segments
A G1 toolpath composed of multiple line segments is usually defined by G1 command points P i . In another perspective, the point P i , i = 1, 2, ⋯, N − 1, also serves as corner points. After smoothening the corners, let us define the middle point of the inserted corner segment as the new corner point, i.e., c i , i = 1, 2, ⋯, N − 1, as shown in Fig. 5. For these multiple segments, i.e., <P 0 c 1 > , < c 1 c 2 > , ⋯ , < c N − 1 P N > (each called a block), the local S-shape feedrate profile is individually generated, sequentially. In this configuration, the starting velocity of the first block and the ending velocity of the last block must equal to zero  Table 3 Pseudocode of standard PSO Table 4 Proposed time-optimal feedrate scheduling v 1 s = 0 and v N e = 0 . Note that the superscript i stands for the block i, i = 1, 2, ⋯, N. The ending velocity of the current block will be the starting velocity of the next block, i.e., v i+1 In the feedrate scheduling of each block, the 6 design parameters, i.e., T i , i = 1, 2, ⋯, 5 and v e , need to be determined under the constraint (25) and the joint motion constraints. This can be formulated as the nonlinear constrained optimization problem. Thus, PSO is adopted to optimize the design parameters in order to achieve the objective of the minimum machining time, to be presented in Sect. III-C below. Note that other global optimization tools, e.g., adaptive differential evolution [24] and coyote algorithm [25], can also be implemented to solve the constrained optimization problem.

PSO for time-optimal feedrate scheduling
PSO is one of the evolutionary optimization tools that iteratively updates the position of M optimizing particles (design parameters) X m = x 1m , x 2m , ⋯ , x Dm , m = 1, 2, ⋯ , M in a D-dimensional search space, i.e., space of design parameters, in order to approach the optimal solution while satisfying all constraints. In each iteration k, the optimizing particles are driven by the velocity vector V m = v 1m , v 2m , ⋯ , v Dm . The velocity and position of the particle m can be updated corresponding to an update mechanism [18]: where w, c 1 , and c 2 are the inertia weight, the individual learning gain, and the global learning gain, respectively; rand(⋅) stands for a uniformly random number in range of [0, 1]; Y m = y 1m , y 2m , ⋯ , y Dm and Y g = y g1 , y g2 , ⋯ , y gD represent the individual best position of the particle m and the global best position of the swarm, respectively, which are evaluated through comparisons of the user-defined cost function f (X m ). For the constrained optimization, penalty rules are necessary to deprioritize any particles that do not satisfy the constraints; as a result, the optimized designed parameters will be prevented from violating the constraints. Through iterations, the PSO will cease when the maximum number of iterations k max is met. Pseudocode of the standard PSO is presented in Table 3. For parameter tuning of the PSO, larger particle number M will cost more computational load due to more evaluations of the cost function and penalization, but can improve the reliability. Dynamics of the velocity (Eq. (30)) that is the key mechanism of the PSO embodies three components, i.e., momentum, individual, and global components. Large inertia weight w increases the potential of global searching, while local searching will be efficient when w is small. The inertia weight w is suggested to be linearly decreasing with respect to the iteration k [26]: The coefficients c 1 and c 2 represent stochastic acceleration weights with respect to the individual best and the   v  T  T  T  T  T   1  2  3  4  5 ( , , , , ,0) global best positions, respectively. Too large c 1 will result in excessive wandering in the search space, whereas too large c 2 will lead to the particles falling into local optima. To be compromised, the values of c 1 and c 2 are suggested to be the same and their sum should be greater than 4 [27].
To achieve the time-optimal feedrate scheduling in each block using PSO, the particle X is used to denote the design parameters T 1 , T 2 , T 3 , T 4 , T 5 , and v e , i.e., X = (T 1 , T 2 , T 3 , T 4 , T 5 , v e ). For time optimization in the feedrate scheduling, the cost function is defined as Besides, constraints of the optimization problem include (25) and the joint motion constraints, i.e., joint velocity, acceleration, and jerk limits: Although v e is not involved in the cost function (33), it is confined by the motion constraints (34). Recall that violating the constraints (25) can fail to schedule the feedrate profile, while the constraints (34) can be violated with low preference. Let us define (25) and (34) as the hard constraint and soft constraint, respectively. Hence, the penalty rules can be set that the cost function will be penalized to be infinity when the hard constraint is violated, and will be multiplied by a large positive constant when the soft constraint is violated, i.e., where c p ≫ 1. Note that the tangential motion constraints can also be added in the constraints of the optimization problem. However, the issue is not explored further here for simplicity.
Given a 5-axis G1 toolpath, in which corners are smoothened according to Sect. II, the time-optimal feedrate profile hard constraint violated f (X) ⋅ c p ; soft constraint violated for each block will be established using PSO with the cost function (33) and the penalty rules (35). Then, the smooth toolpath can be interpolated corresponding to the optimized feedrate profile. As a consequence of considering the joint motion constraints, the joint motion corresponding to the generated feedrate is expected to be bounded under the joint motion constraint (34). The whole procedure of the proposed feedrate scheduling is summarized in Table 4.
The proposed feedrate scheduling can generate the feedrate profile and interpolate the command toolpath for each block, separately and in succession, unlike the bi-directional scanning based feedrate scheduling methods, which need to analyze and establish the feedrate profile for the entire toolpath in one shot [17,21]. For real-time feedrate scheduling, the bi-directional scanning-based approaches are only able to work with a limit number of blocks due to the memory limit.

Simulation and experimental results
In order to validate and highlight the performance of the proposed feedrate scheduling approach, simulation and experimental results were carried out. Two cases, i.e., planar G1 toolpath and 5-axis G1 toolpath, are studied. Results of the planar and 5-axis cases with the proposed approach will be compared with the CSFA [17] and the SLATP [21], respectively, which are the feedrate scheduling methods using the circular arc corner smoothing and considering only the tangential motion constraints.
The simulations and experiments were conducted by a 5-DOF dual-arm robotic machining platform which consists of a host PC, dSPACE modules, and an in-house-developed dual-arm robot machining system, as illustrated in Fig. 6. The robot is comprised of two identical 5-DOF serial robot arms that are used to hold a workpiece and cooperate with a stationary cutting tool. This is equivalent to a 5-axis machining system. Each arm embodies 5 revolute joints; therefore, the motion constraints of all the 10 joints will be considered. In the corner smoothing, the user-defined corner errors were set to ε pw = 50 μm and ε ow = 50 μrad, respectively. The sampling time is T s = 1 ms. Based on the servomotors' specifications, the tangential and joint motion constraints are specified and listed in Table 5. In the table, the joint motion constraints belong to both left and right arms due to their identical design. For the PSO, the number of particles and the maximum iterations are set to M = 30, and k max = 20, respectively; both c 1 an c 2 are chosen as 2.5; w min , and w max are 0.4, and 1.0, respectively; c p is set as 10 6 .

Planar G1 toolpath
For planar case, a chevron arrow toolpath plotted on the XY-plane is studied and shown in Fig. 7. Since the tool orientation is fixed, the corner smoothing for the orientation toolpath and the angular motion constraints are not considered in this case. Fig. 7 shows the chevron toolpath before and after the corners smoothened by the circular arc method and the B-spline method introduced in Sect. II. With the feedrate scheduling by the CSFA and the proposed approach, Fig. 8 shows the feedrate profile with respect to arc length, and Fig. 9 plots the tangential motion profiles, including velocity, acceleration, and jerk, with respect to time. Through kinematics chain of the machining system found in [28], the joint velocities and jerks are obtained and presented in Fig. 10. After implementing the planned feedrate commands for machining, the resulting joint velocities and jerks and contour error are depicted in Figs. 11 and 12, respectively. Moreover, the cycle time, and root-mean-square (RMS) and peak values of the contour error are summarized in Table 6.  As observed in Fig. 8, the feedrate planned by the proposed approach is apparently superior to the CSFA, especially during the CON phases. The area difference between the two feedrate profiles can determine amount of the cycle time that the proposed approach can reduce. This is expressed in Fig. 9. It can be seen that the proposed method and the CSFA result in total motion durations of 3.284 and 4.002 s, respectively, showing that the proposed approach can achieve 17.9% shorter cycle time than the CSFA. The main reason behind this is that the feedrate scheduling with the CSFA considers the tangential motion limits, while the proposed approach deals with the joint motion limits. As a result, the maximum tangential velocity and jerk with the CSFA are bounded by the limits, whereas those of the proposed approach surpass them by approximately 50% at most.
In Fig. 7, the B-spline corner is compared to the circular arc corner which is fixed curvature. Thus, there may exist an abrupt change of curvature at the joints between the inserted corner and the line segments, resulting in motion discontinuities in the toolpath. The discontinuities are reflected as spikes in the jerk profile scheduled by the CSFA as seen in Fig. 10, even though all the joint jerks are strictly within the limits. In Fig. 11, all the actual velocities behave as planned, but the jerk spikes become so severe that some of them exceed the limits. Furthermore, the jerk spikes violating the limit lead to peaks in the contour error, as seen in Fig. 12. Besides, since there are no constraint violation and critical issue in the joint accelerations, they are omitted in Figs. 10 and 11.

5-axis G1 toolpath
In this case, a fan-shaped toolpath with varying tool orientation, which contains 20 G1 command points (N = 19), is taken into account and illustrated in Fig. 13. Locations of the command points are listed in Table 7. Fig. 13 demonstrates the fan-shape toolpath before and after corners smoothened by the B-spline method. The position and orientation toolpaths are smoothened under the user-defined corner tolerances (ε pw and ε ow ). Owing to (21), the corner tolerance is ensured smaller than defined. Also, the toolpaths are synchronized with the same spline parameter. Then, the feedrate profiles for the position and orientation toolpath are simultaneously planned by the proposed approach with the joint motion constraints. Fig. 14 plots linear and angular velocity profiles with respect to arc length scheduled by the proposed approach and the SLATP. In addition, the linear and angular motion profiles and the joint motion profiles with respect to time are depicted in Figs. 15 and 16, respectively. As to the results of the feedrate scheduling, the actual joint motion profiles are shown in Fig. 17. To underline smoothness of the machining motion, frequency analysis of the measured linear acceleration and the contour error are plotted in Figs. 18 and 19, respectively. The resulting cycle time and contour error are summarized in Table 6.      Like the planar case, in most of the blocks, the maximum feedrate planned by the proposed approach is noticeably higher than those of the SLATP, as observed in Fig. 14. As illustrated in Fig. 15, the cycle time is 4.596 s with the proposed method, and 4.921 s with the SLATP. On the other hand, not only the linear and angular velocities but also the jerks scheduled by the proposed approach is mostly larger than the SLATP. Considering the joint motions, the joint velocity profiles of both approaches are very similar and all the joint velocities and jerks satisfy the constraints. Similar to the planar case, all the joint accelerations not shown in Figs. 16 and 17 are completely under the limits. Nonetheless, many spikes can be found in the jerk profiles planned by the SLATP, as shown in Fig. 16.
In perspectives of the experimental results, the joint velocity and acceleration of both the approaches behave the same as scheduled and they are strictly under the motion limits as plotted in Fig. 17. For the jerk profiles, although the actual jerks tend to be larger than scheduled, those of the proposed approach still satisfy the constraints. However, in case of the SLATP, the jerk spikes become much harsher so that the constraints are violated. The spikes are due to the existing jerk discontinuity in the toolpath, which the circular arc corner smoothing cannot handle. They cause the highfrequency vibration shown in Fig. 18. It can be clearly seen that the SLATP contains more high-frequency components than the proposed approach does. Consequently, the feedrate command from the proposed approach can yield better contouring results than the SLATP, as presented in Fig. 19 and summarized in Table 6.
In this experimental study, the proposed method was implemented to only the 5-axis robotic machining system. Indeed, the method is also applicable to other machining systems, such as the conventional 5-axis machine tools. Similar results of cycle time reduction can be obtained because the consideration of the actuator motion constraints may yield shorter cycle time than the tangential ones.

Conclusions
For 5-axis machining systems, a PSO-based feedrate scheduling approach has been proposed to achieve a time-optimal feedrate profile for 5-axis G1 toolpaths. The proposed method includes two stages. Firstly, the sharp corners between line segments are smoothened by quintic B-spline corner segments. Due to the corner smoothing, the C 3 continuity is guaranteed throughout the toolpath. Furthermore, the spline functions of the position and orientation toolpaths share the same spline parameter; hence, the feedrate profiles can be scheduled with respect to only the position toolpath. With the corner smoothing, the second stage of the method is to schedule the feedrate profile for the whole toolpath based on PSO with the objective of minimizing the total machining time. The S-shape feedrate profile is adopted for each block. The actuator motion constraints rather than the tangential ones are imposed during the optimization to contribute better reduction of the cycle time. The proposed method has been validated experimentally on a 5-DOF dual-arm robotic machining system. The results were compared with two existing methods, i.e., CSFA and SLATP. It is found that the proposed method can achieve shorter cycle time and less contour errors, showing the effectiveness of the proposed approach.