Elsevier

Computer-Aided Design

Volume 106, January 2019, Pages 13-29
Computer-Aided Design

Certified space curve fitting and trajectory planning for CNC machining with cubic B-splines

https://doi.org/10.1016/j.cad.2018.08.001Get rights and content

Highlights

  • An explicit Hausdorff distance is given for a line segment and a curve segment.

  • A space curve fitting algorithm with confined error for space G01 polylines is given.

  • A two-to-one trajectory planning model is proposed for space G01 polylines.

  • An effective and efficient algorithm is designed to solve the two-to-one model.

Abstract

In CNC machining, the tool path following G01 codes generally introduces large computations and inherent discontinuities. A common way to avoid these shortcomings is fitting the G01 polyline with a parametric curve and then scheduling the feedrate along the fitted curve. However, curve fitting with confined error in three dimensional space is nontrivial since the Hausdorff distance between a space G01 segment and a rational parametric curve segment is difficult to formulate. In this paper, we derive the explicit expression for the Hausdorff distance between a line segment and a curve segment, and then propose a curve fitting algorithm for G01 polylines. Instead of the traditional two-stage model, we present a combined trajectory planning model with error constraints as well as dynamic constraints. Moreover, an effective and efficient algorithm is designed to solve this model. Experimental results are provided to illustrate and clarify our methods.

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 C1 freeform shapes in R2 and R3. 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 P={pkpk+1R3|k=1,2,,m1} be a set of line segments in space. P describes a discrete polyline toolpath in CNC.

A parametric space curve is defined as f(s)=(x(s),y(s),z(s))T, where x(s),y(s),z(s)Q[s] are polynomials with respect to the parameter s. The unit tangent vector t(s), the unit bi-normal vector b(s), the unit principal normal vector n(s) and the curvature κ(s) of f(s) are t(s)=f(s)f(s),b(s)=f(

General fitting process

We briefly introduce the classical fitting process for the original G01 toolpath P by using the cubic B-spline curves f(s).

Let Dis(pk,f(s)) be the distance between pk and f(s) for every pk,k=1,,m. 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 ci,i=1,2,,n for the following objective function. minc12k=1mDis(pk,f(s))2+λη(s)where η(s) is a smooth function with a weight λ>0. 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 Vmax, acceleration bound ±Amax and jerk bound ±Jmax. 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)

Cited by (0)

View full text