Certified space curve fitting and trajectory planning for CNC machining with cubic B-splines
Introduction
In CNC machining, the G01 code is widely used to represent a tool path in the form of polylines. But the G01 codes generally introduce large amounts of data and extreme changes in traveling directions. Hence data compressing and curve smoothing are expected to increase the machining efficiency. Fitting the polyline tool path with parametric curves is a traditional step in data compression and path refinement of CNC machining. After we derive the smooth tool path, the next step is interpolation, that is, velocity (feedrate) planning along the fitted curve in order to make the machining time as short as possible with error and dynamic constraints.
The curve fitting problem is also a classical problem in Computer Graphics and Computer Aided Design (see [[1], [2], [3], [4], [5]]). Different distance approximation methods have been proposed, for instance, quadratic approximation is used to simplify the optimization problems in curve fitting [[1], [2], [3]]. Flöry [4] implements this method to fit the points with B-spline curves by avoiding the given obstacles. Shen et al. [5] present an algorithm to compute a certified approximation to a given parametric space curve with cubic B-spline curves. When focusing on the G01 codes interpolation in CNC, we need to emphasize two requirements related to CNC machining: eliminating extreme changes at the joints and controlling confined error. During the stage of eliminating extreme changes, the corner transition technique is usually used to improve smoothness [[6], [7], [8]]. This approach generates the tool path mixed with line segments and transition curves. However, corner transition cannot compress the data effectively. Yau et al. [9] and Wang et al. [10] divide the G01 codes into groups with a continuous short-blocks criterion, and then built the spline to interpolate all points in each group. Fan et al. [11] interpolate G01 points for the whole tool path. This method may introduce lots of short curves when the points generated by G01 codes are very close to each other. Fitting the G01 codes with parametric curves has attracted the attention of many researchers (see [[9], [10], [11]]), but none of these methods can guarantee the confined error since the Hausdorff distance between a space G01 polyline and a rational parametric curve is difficult to compute. Recently, Yang et al. [12] propose an accurate expression of Hausdorff distance between a planar G01 polyline and a rational parametric curve.
There are different methods to deal with the Hausdorff distance between parametric curves. Alt et al. [13] present an algebraic algorithm to compute the Hausdorff distance between two sets of planar curves. Elber et al. [14] propose a method to compute the precise Hausdorff distance between regular freeform shapes in and . This method bases on solving polynomial systems using subdivision multi-variate solvers from [15], which is a numerical refinement method. Chen et al. [16] present a geometric pruning method for computing the Hausdorff distance between two B-spline curves, however, this method mainly provides a lower bound and an upper bound of the Hausdorff distance instead of the exact Hausdorff distance. Hanniel et al. [17] design a GPU algorithm to compute the directed Hausdorff distance between two NURBS surfaces. This method could effectively compute the Hausdorff distance in space by numerical iteration. We can find that the exact computation of Hausdorff distance between two B-spine curves/surfaces is not a trivial task.
In this paper, we give the exact Hausdorff distance between a space curve segment and a line segment by deriving an explicit expression. Based on this explicit formula, we build the optimal model for G01 curve fitting and trajectory planning such that the Hausdorff distances between the line segments and their corresponding curve segments are bounded by given error. Note that the error control between a segment and its corresponding curve segment is an appropriate issue in CNC.
The quality of a fitted curve depends heavily on the number of control points. Redundant control points will increase the computational complexity and enlarge the unnecessary curvature variations. In our fitting process, we find that the redundant control points are generally located on the part of curve whose curvature is small. The fitting precision can be preserved when some of these control points are removed. Hence, we detect and remove certain redundant control points. However, the fitted curve will fail to satisfy the expected precision if the control points are inadequate. If the control points are inadequate, we automatically add knots by using the method in [18]. Using these adaptive regulations of control points, we construct the fitting curve under confined error with few iterations.
After tool path smoothing based on curve fitting, we need to plan the velocity along the tool path which is another important task in CNC machining. There are many papers in this area in accordance with different constraints. Erkorkmaz and Altintas [19], Liu et al. [20], Fan et al. [21] and Annoni et al. [22] provide time-optimal feedrate scheduling algorithms under jerk constraint for each axis. Yuan et al. [23] propose two new interpolation algorithms for CNC machining along curved tool paths: a time-optimal interpolation algorithm under chord error, feedrate, and tangential acceleration bounds, and a greedy interpolation algorithm under chord error and tangential jerk bounds. Dong et al. [24], Beudaert et al. [25] and Zhang et al. [26] present different velocity planning methods with acceleration and jerk constraints for each axis in a greedy way. Nam et al. [27], Lai et al. [28] and Lin et al. [29] investigate look-ahead facility to do velocity planning including jerk constraints.
As introduced above, the two-stage model is commonly used in the past decades: first, smoothing short line segments by parametric curves such as B-splines fitting; second, velocity planning. Unlike other methods, Yang et al. [12] combine these two stages to time parameter B-spline curve fitting for the planar G01 interpolation problem by adding velocity and acceleration constraints. This method generates smooth tool path with confined error and minimal machining time. Experimental results encourage us to generalize this two-in-one model to space G01 polylines, since the space case is much more popular in practical applications.
The paper is arranged as follows. Section 2 provides some necessary preliminaries about general B-splines curve fitting. Section 3 proposes a new algorithm to fit space curves using cubic B-splines curve with confined error. The velocity planning method via time-parameterized B-spline curve is designed in Section 4. Our experimental results are shown in Section 5. Finally, we conclude our paper with a summary of our work in Section 6. The detailed proofs of lemmas are proposed in Appendix A Proof of, Appendix B Proof of.
Section snippets
Preliminaries
In this section, we introduce some notations which will be used throughout this paper. Let be a set of line segments in space. describes a discrete polyline toolpath in CNC.
A parametric space curve is defined as , where are polynomials with respect to the parameter . The unit tangent vector , the unit bi-normal vector , the unit principal normal vector and the curvature of are
General fitting process
We briefly introduce the classical fitting process for the original G01 toolpath by using the cubic B-spline curves .
Let be the distance between and for every . The fitting problem can be rewritten as an optimization problem aiming to minimize the sum of squared distances, i.e., to find the optimal control points for the following objective function. where is a smooth function with a weight . There are
Trajectory planning with confined error
Recall the traditional velocity planning process, we will consider the optimal problem with dynamic constraints along the path curve obtained in Section 3. The object of velocity planning is to find an interpolation with minimal machining time under the machine capability such as velocity bound , acceleration bound and jerk bound . We now derive these dynamic constraints explicitly for a cubic B-spline path.
Formula (6) indicates that the axis velocity is quadratic at every
Experimental results
We applied our algorithm in some typical space curves to see the performance. We implement four objects having different typical characteristics. Variations in curvature of the Butterfly Curve make fitting and trajectory planning more challenging. The blade machining is actually one of the most important and popular applications in CNC. The Helix Curve has special geometry property and is important in many fields including CNC. The Star Curve has the loop structure which is one of the typical
Conclusions
This paper proposes a certified curve fitting algorithm for space G01 polylines by using cubic B-spline curves. The algorithm is based on an explicit Hausdorff distance formula between the line segments and the B-spline curve segments. Introducing the time-parameterized B-spline curve, we propose a two-in-one trajectory planning model by considering error constraints and dynamic constraints simultaneously. More importantly, based on the “Bang–Bang-Singular” property, we give an effective and
Acknowledgments
This work is partially supported by National Natural Science Foundation of China under Grants 61872332, 11731013 and National Center for Mathematics and Interdisciplinary Sciences, CAS , China.
References (35)
Fitting curves and surfaces to point clouds in the presence of obstacles
Comput Aided Geom Design
(2009)- et al.
Certified approximation of parametric space curves with cubic b-spline curves
Comput Aided Geom Design
(2012) - et al.
A real-time look-ahead interpolation methodology with curvature-continuous b-spline transition scheme for cnc machining of short line segments
Int J Mach Tools Manuf
(2013) - et al.
Fast bezier interpolator with real-time lookahead function for high-accuracy machining
Int J Mach Tools Manuf
(2007) - et al.
A realtime curvature-smooth interpolation scheme and motion planning for cnc machining of short line segments
Int J Mach Tools Manuf
(2015) - et al.
Curve fitting and optimal interpolation for cnc machining under confined error using quadratic b-splines
Comput Aided Des
(2015) - et al.
Subdivision termination criteria in subdivision multivariate solvers using dual hyperplanes representations
Comput Aided Des
(2007) - et al.
Computing the hausdorff distance between two b-spline curves
Comput Aided Des
(2010) - et al.
Computing the hausdorff distance between nurbs surfaces using numerical iteration on the gpu
Graph Models
(2012) - et al.
The insertion algorithm
Comput Aided Des
(1985)