An Efficient NURBS Path Generator for a Oen Source CNC ERNESTO LO VALVO, STEFANO DRAGO Diartimento di Ingegneria Chimica, Gestionale, Informatica e Meccanica Università degli Studi di Palermo Viale delle Scienze, 9128 Palermo ITALY ernesto.lovalvo@unia.it Abstract: - In this aer a NURBS ath generator (on the lane XY) is roosed to be develoed for those CNC machine tools and robot which are Oen Source or Oening Architecture. The goal is to use simle and efficient techniques to manufacture geometries which are very comlex, whose main feature is the resence of free-form surfaces and contours. To reach this goal, the NURBS ath generator has been otimized in order to enable the user to select among three different otions to generate the tool ath, using a secific arameter. The three otions are resectively called NURBS interolation with constant increments of u arameter (NICU), NURBS interolation with constant dislacement increments by linear motion (NICL), NURBS interolation with constant dislacement increments by circular motion (NICC). The NURBS ath generator has been imlemented for an Oen Source Numerical Control (LinuxCNC) in order to evaluate its efficiency, by simulations and exerimental tests, in terms of comutational comlexity, comarison between the trajectory covered and the ath rogrammed, caability to follow seed and ath trends. Key-Words: - NURBS, Path Generator, CNC, Oen Source, LinuxCNC, Interolation 1 Introduction In modern manufacturing, machining is mainly focused either on the roduction of mold for mechanical and aerosace comonents or on that one of biomedical devices; however, at the same time, it can be emloyed for finishing oeration at the end of a roduction rocess of any mechanical element: these are the reasons why the develoment of systems which make it ossible high-seed and recise manufacturing has become one of the main interests of researching activities. For many years commercial and Oen Source Comuter Aided Design systems have been offering the ossibility of creating bidimensional and tridimensional surfaces or curves (both analytical ones and free-form ones). Among techniques which are emloyed for the drawing and the design of surfaces and curves, the NURBS (Non-Uniform Rational B-Sline) arametric formulation is widely used: in fact the flexibility, the recision and the simlicity of this kind of drafting enables one to work comlex geometries and to modify their shae locally. In the recent years Comuter Aided Manufacturing systems and some high erformance Comuter Numerical Control ones have been emloying NURBS arametric formulation to describe and to create tool aths, offering the ossibility of using NURBS interolation. However in many conventional CNC machine tools there are only linear and circular ath interolators (i.e. linear and circular interolation functions): therefore this can be considered an evident limit. In fact, when it is necessary to manufacture a comlex model, such as, for examle, the mold of a car door or the sirals of a scroll comressor, since these rofiles are irregular (they are, without a doubt, reform surfaces and rofiles) the CAM system is obliged to aroximate the real curve with a tool ath comosed by a series of many segments and arcs. However this method doesn t always enable one to create a manufactured surface exactly coinciding with that one of the CAD; in addition to this, it can cause a oor quality surface finishing as a consequence of frequent variations of tool feed rate, so it could be different from that one rogrammed before. However, if the CNC, which is resent in the machine tool, have an oen architecture (as Oen Source), it enables anyone has adequate knowledge to study and modify the source code in order to imlement a tool ath generator which satisfies the desired requirements. In this aer, it is shown a NURBS ath generator (on the lane XY) for manufacturing of comlex curves which can be considered suitable for this kind of alication. In articular, the develoed ISBN: 978-96-474-42-2 173
NURBS ath generator has been imlemented for the LinuxCNC, an Oen Source Numerical Control. This has enabled one to evaluate its efficiency in terms of comutational comlexity, recision of the covered trajectory comared with the ath rogrammed, caability to follow the feed rate trend. The algorithms, on which the NURBS ath generator is based, have been develoed considering the interolation methods of NURBS ath shown in literature [1-5]. In articular, it has been considered De-Boor s algorithm for the arametric NURBS reresentation [6-9]. 2 LinuxCNC LinuxCNC [3,1] is a software which enables one to transform a common Personal Comuter into numerical control for machine tools such as milling machines and lathes, taking advantage of Real Time extensions of Linux oerating system. The main feature of LinuxCNC software is to be Oen Source and Oen Architecture. This enables one to download free (on the website htt://www.linuxcnc.org), to study and to modify the source code: therefore, it is ossible to imlement new functions or to imrove available ones adding new codes. When it is necessary to manufacture a mechanical comonent, the current LinuxCNC version enables one to choose only one of the following working otions: linear interolation, circular interolation, NURBS interolation, standard working cycles for holes and ockets. If the mechanical comonent is characterized by free-form surfaces and rofiles, using the NURBS interolation can be certainly considered the right choice. However the current NURBS interolation method doesn t always follow these conditions: the corresondence between manufactured surface and that one drawn by CAD software; the caability of working with a rogrammed feed rate; the resence of elaboration time (required for the creation of tool ath) which can be considered adequate for comlex NURBS curves. Therefore, these oerating conditions don t enable one to manufacture easily and efficiently very comlex geometries characterized by free-form surfaces and rofiles. 3 NURBS Path Generation 3.1 Mathematical NURBS formulation The NURBS (Not Uniform Rational B-Sline) formulation is a arametric reresentation of curves and surfaces, both analytical ones and free-form ones [5-6]. A NURBS curve is defined when it is ossible to establish: A set of n+1 control oints; A weight for each control oint which isn t negative; The degree of the curve. By means of the following exression and the revious arameters, it can be defined a vector, called U and formed by m+1 elements: U = u,..., u, u,..., u,..., u, u,..., u ] [ + 1 j m 1 m m ui = ui = i + 1 ui = n + 2 i < + 1 + 1 i n i > n i =,..., n + + 1 The elements of knot vector are a growing series of real numbers which can be not recursive or not uniform, i.e.: u =... = u < u + 1... u j u j+ 1... um 1 < um =... = um The knot vector is defined not uniform because there are knots which reeat themselves inside it. The aim of the reeated knots is to make NURBS curve ass through the first and last control oint; moreover they make the extremities of the curve be tangent to control olygon and, at the same time, they define a curve segment. The arametric equation of a degree NURBS curve on the lane x y is: n N ( ) i i, u wp n = i i C( u) = = ( ) ( ) ( ) [, ] n R i i, u Pi = x u i+ y u j u u u = m N ( u) w i= i, i where u is the curve arameter defined in the range u, u ] (the first element and the last one of knot [ m vector), R i, (u) is the -degree rational function, while N i, (u) is the -degree B-Sline function calculated by the use of a recursive exression of lower degree functions. u u u 1 u i i+ + Ni, ( u) = Ni, 1( u) + Ni + 1. 1( u) (2) u u u u i+ i i+ + 1 i+ 1 The B-Sline zero degree basic function N i, (u) is a ste function which has the following mathematical exression: (1) ISBN: 978-96-474-42-2 174
1 u 1 i u < u i + N i, ( u ) = (3 ) otherwise The u i values are elements of U knot vector. Changing the u value from u to u m in the equation (1), it is ossible to calculate the coordinates of all the oints belonging to the curve. The main advantages of NURBS arametric formulation can be summarized in the ossibility of modifying locally the shae of the curve by changing the osition of the control oints P i, the degree, the w i weights, the U knot vector. 3.2 Oerating rincile of NURBS ath generator The NURBS ath generator has to transform instructions which describe the tool ath in NURBS format and are reorted in the art-rogram, into osition commands for the Servo Control Loo System (loo control of the servo drive of the axis): this device, in its turn, at regular time intervals, transforms these commands into dislacement ones for each servo-motor controlling motion of axes; dislacement commands are electrical imulses whose cumulative number causes both the dislacement and the rate by which tool moves forward along that axis at those time intervals. The goal is to set the motions of the controlled axes in order to move the tool along the ath which, ste by ste, corresonds to the NURBS rogrammed one. Therefore, NURBS interolation is carried out following a temoral method which is, at the same time, incremental: the consequence is that the NURBS ath is created as a series of dislacements. Considering C(u k ) as the command osition at the time (T k ), during the temoral increment, the tool is moving forward in order to reach, at the time T k+1, the following command osition C(u k+1 ). Fig. 1- NURBS interolation To set the coordinates of the oints to interolate, it can take advantage of the arametric exression of the curve which has to be created: this is ossible by changing the value attributed to u arameter from u to u m (resectively the first element and the last one of the knot vector) 3.3 The NURBS ath generator develoed The roosed NURBS ath generator has been develoed considering the following basic rinciles: A art rogram is given to the CNC: it contains the tool ath described in the NURBS format of FANUC numerical control. The goal is to take advantage of a CAM software which is able to generate a art rogram containing the commands which describe the tool ath in NURBS format used by numerical control mentioned before [11-12]. It is ossible to generate the tool ath using the NURBS arametric formulation (it is emloyed the De Boor s algorithm to calculate the coordinates of the next ositions which have to be imlemented) [13-17]. To generate the next command ositions for the Servo Loo Control System (i.e. the next dislacement commands) it takes advantage of linear interolation function or the circular one (there are both linear interolation functions and circular ones in any CNC). The indirect consequence is that the tool ath will be aroximated either by a series of linear segments or by a series of bi-arcs [3-4, 18-]. To reduce rocessing time which is necessary to create the tool ath, after the acquiring of the command ack in which is rogrammed the NURBS curve, it haens automatically the subdivision of this one in segments characterized by a number of control oints (<3*grade) of the NURBS (the subdivision is recursively carried out using the De Boor s subdivision algorithm). Then each segment of the curve of NURBS curve is singularly elaborated to generate the tool ath. All calculations needed to define the tool ath are carried out in re-elaboration hase (offline). The goal is to reduce the time comutational comlexity during the real time work hase which will take lace in real time [26-31]. Moreover the NURBS ath generator has been develoed in order to enable the user to select among three different otions to generate the tool ath, using a arameter. The first otion aroximates the ath rogrammed with a tool ath comosed by a series of bi-arcs; so, the coordinates of the oints interolated by such bi-arcs are calculated setting constant increments of u arameter. The second one aroximates the ath rogrammed with a tool ath comosed by a series of bi-arcs, but the coordinates of the ISBN: 978-96-474-42-2 175
oints interolated by such bi-arcs are calculated setting constant increments of dislacement. The third one aroximates the ath rogrammed with a tool ath comosed by a series of linear segments but, as in the revious case, the coordinates of the oints interolated by such linear segments are calculated setting constant increments of dislacement. The three otions of NURBS interolation are resectively called: a) NURBS interolation by constant increments of u arameter - (NICU), b) NURBS interolation by constant dislacement increments and linear motion - (NICL), c) NURBS interolation by constant dislacement increments and circular motion - (NICC). When the NURBS interolation is carried out setting constant increments of u arameter, the issue is that the otimal dimension of u increment is unknown; moreover along the curve, u increments don t corresond to dislacement increments ( s ). Adoting this method, it is ossible to find the following anomalies: If u is too small, the elaboration time will be inadequate; If u is too large, there will be an inadequate recision of the generated ath in comarison with the rogrammed ath; If s isn t an integer multile of V* T, the feed rate of the tool will be different from that one rogrammed. In fact, because of T is constant, if the length of the bi-arc isn t an integer multile of the factor V* T, the last segment of the bi-arc (whose length is s' s ) will be interolated with a different rate in comarison with that one s' s rogrammed ( V ' = = V ). T T On the contrary, if the NURBS interolation is carried out setting constant dislacement increments, the dimension of u increment is set so that the dislacement increment s is integer multile of the roduct V* T. Therefore the arameter uk +1 = uk + u is calculated by inverse ratio of length function. Adoting this strategy, you get the following advantages: The feedrate V by which the tool moves from the osition to in the time T will coincide to that one rogrammed; Comared with the ath rogrammed, the recision of that one generated will deend on the value of s. Given that s=v* T, it is ossible to get the standard of recision wanted adoting a suitable value of V. Regarding the inverse ratio of the length function, its analytic exression is unknown and, for this reason, in the range characterized by each element of knot vector, its trend is aroximated by a third degree olynomial. 2 2 u l) a + b( l l ) + c( l l ) + d( l l ) ( l l ) (4) ( = j j j j+ 1 4 Simulation and Tests The urose of simulations and tests has been that one to confirm the ideas which are at the base of NURBS interolation techniques roosed, to underline ossible errors of the algorithm imlemented, to make a comarison in order to evaluate the efficiency in terms of comutational comlexity (elaboration time), recision of the ath covered comared with that one rogrammed and caability of following the feed rate rogrammed [32-33]. To comlete the check, some milling manufacturing was erformed by a machine tool, RM-MiniMill. Fig. 2 - Curve Butterfly machining Milling manufacturing is characterized by incisions, whose shae could be both analytic and arbitrary. NURBS Order Control Points Current LinuxCNC Table 1 - Processing times [s] NICU NICC NICL 4 13.31 <.1.12.1 5 32 1.94.1.3.29 5 5 7.72.4.65.54 4 119 112.2.5.65.63 4 231 884.9.11 1.19 1.12 6 589.38 15.8 14. ISBN: 978-96-474-42-2 176
V=2 mm/min V=3 mm/min V=4 mm/min 5 5 5 NICU - - - -5 1 5 2-5 1 2 5-5 5 1 2 NICC - - - -5 1 5 2-5 1 2 5-5 5 5 1 15 2 NICL - - - -5 1 2-5 1 2-5 1 2 Table 2 - Feedrate error (in %) for Trident curve V=2 mm/min V=3 mm/min V=4 mm/min 5 5 5 NICU - - - -5 5 1 5-5 5 1 5-5 5 5 1 NICC - - - -5 5 1 5-5 5 1 5-5 5 5 1 NICL - - - -5 5 1-5 5 1-5 5 1 Table 3 - Feedrate error (in %) for Butterfly curve ISBN: 978-96-474-42-2 177
In Tab. 1 the rocessing times needed to generate the tool ath are shown,, using a Personal Comuter with a Mobile AMD Semron Processor 34+ and 2 GB RAM. The NURBS interolator has been evaluated with 2 test curves widely adoted in literature, called Trident [31] and Butterfly [26], with art rogram reorted in Fig. 3 and Fig.4 resectively. Fig. 3 - Part rogram for Trident curve The Tab. 2 and 3 reort the trends of rate errors as Vcom V ercent value Err% = V with the com increasing in feedrate commanded and with the change in the ath rogrammed. The result of the comarison underlines that whereas the NURBS interolation method of the current LinuxCNC software version gets into crisis with curves having more than 1 control oints, on the contrary all three NURBS interolation methods roosed take elaboration times which are more than accetable, even with NURBS curves having more than 5 control oints. In articular the NURBS interolation method with constant increments of the u arameter is the choice considered more accetable in all that alications when reducing elaboration times is the main need. Moreover, if the NURBS interolation is carried out setting constant dislacement increments, the average error of feedrate is ractically negligible both with the increasing in the feedrate commanded and with the change in the tool ath rogrammed. Fig. 4 - Part rogram for Butterfly curve On the contrary, if the interolation is carried out setting constant increments of u arameter, the average error of feedrate can become not negligible ISBN: 978-96-474-42-2 178
for high values of feedrate and, above all, if the tool ath rogrammed is characterized by continuous and raid changes of direction. This means an inadequate finishing of manufacturing surface. 5 Conclusion By tests erformed, you can underline advantages and disadvantages of the three NURBS interolation methods roosed. The final result is that it doesn t exist a NURBS interolation method which is better than other ones, but the choice about which one has to be adoted will deend by the following asects: standard of recision by which you want to create the tool ath; feedrate by which you want to erform the manufacturing; comuting caacity of the PC. On the basis of the results achieved, you can conclude that if the comuting caabilities of the PC emloyed are limited, it is convenient to adot a NURBS interolation method with constant increments of u arameter; on the contrary, if you want to have high recision of the ath covered in comarison with that one rogrammed and you want to manufacture using middle feedrate which is near to the value rogrammed, it will be convenient to adot one of the two methods which carries out the interolation setting constant increments of dislacement. In articular, using feedrates uer than 3 mm/min, the NURBS interolation with constant increments by circular motion seems to be more efficacious (above all if you want to avoid the segmentation of the tool ath); instead, using feedrate lower than 3 mm/min, it is convenient the NURBS interolation with constant increments of dislacement by linear motion. For this reasons, the choice about which NURBS interolation method has to be emloyed to generate the tool ath deends by the user who will choose that one which will satisfy his needs. References: [1] Lei, W.T., Sung, M.P., Lin, L.Y., Huang, J.J., Fast Real-Time NURBS Path Interolation for CNC Machine Tools, International Journal of Machine Tools and Manufacture, Vol. 47, Iss. 1, 27,. 153-1541. [2] Lei, W.T., Wang, S.B., Robust Real-Time NURBS Path Interolators, International Journal of Machine Tools and Manufacture, Vol. 49, Iss. 7-8, 29, 6-633. [3] Leto, M., Licari, R., Lo Valvo E., Piacentini M., CAD/CAM Integration for NURBS ath interolation on PC based real.time numerical control, Proceedings of AMST 28 Conference, 28,. 223-233. [4] Piegl, L., Tiller, W., Biarc Aroximation of NURBS Curves, Comuter-Aided Design, Vol. 34, Iss. 11, 22,. 87-814. [5] Hong-Tzong, Y., Jun-Bin, W., Chien-Yu, H., Chih-Hua, Y., PC-based Controller with Realtime Look-ahead NURBS Interolator, V, Comuter-Aided Design, Vol. 4/1-4, (27),. 331-34. [6] Piegl, L., Tiller, W., The NURBS Book, Sringer Verlag, 1997. [7] Bahr, B., Xiao, X., Krishnan, K., A Real-time Scheme of Cubic Parametric Curve Interolations for CNC Systems, Comuters in Industry, Vol. 45, Iss. 3, 21,. 39-317. [8] Cheng. M.-Y., Tsai, M.C., Kuo, J.C., Real-time NURBS Command Generators for CNC Servo Controllers, Journal of Machine Tools and Manufacture, Vol. 42, Iss. 7, 22,. 81-813. [9] Liu, Q.J., Yue, J.H., Wang, Y.F., Dong, J.C., Wang, T.Y., A Parametric Curve Interolation Algorithm for High Seed Machining, Key Engineering Materials, Vol. 458, Iss. 35, 21,. 35-41. [1] LinuxCNC, www.linuxcnc.org [11] Jung, Y. H., Lee, D.W., Kim, J. S., Mok, H. S., NC Post-Processor for 5-axis Milling Machine of Table-rotation/tilting tye, Journal of Materials Processing Technology, Vol. 13-131, 22,. 641-646. [12] Koren, Y., Lin, R.S., Five-Axis Surface Interolators, Annals of CIRP, Vol. 44, No. 1, 1995,. 379-382. [13] Liu, X., Ahmad, F., Yamazaki, K., Mori, M., Adative Interolation Scheme for NURBS Curves With the Integration of Machining Dynamics, International Journal of Machine Tools and Manufacture, Vol. 45, Iss. 4-5, 24,. 433-444. [14] Wang, F.C., Yang, D.C.H., Nearly Arc-Length Parameterized Quintic-Sline Interolation for Precision Machine, Comuter-Aided Design, Vol., No. 5, 1993,. 281-288. [15] Erkorkmaz, K., Altintas, Y., Quintic Sline Interolation with Minimal Feed Fluctuations, Journal of Manufacturing Science and Engineering, Vol. 127, No. 2,,. 339-349. [16] Ho, M.C., Hwang, Y.R., Hu, C.H., Five-Axis Tool Orientation Smoothing Using Quaternion Interolation Algorithm, International Journal of Machine Tools and Manufacture, Vol. 43, Iss. 12, 23,. 19-1267. ISBN: 978-96-474-42-2 179
[17] Yeh, S.S., Hsu, P.L., The Seed-Controlled Interolator for Machining Parametric Curves, Comuter-Aided Design, Vol. 31, Iss. 5, 1999,. 349-357. [18] Koren, Y., Lo, C.C., Shitalni, M., CNC interolators: Algorithms and Analysis, ASME Production Engineering Division, Proceedings of the 1993 ASME Winter Annual Meeting, Vol. 64, 1993,. 83-92. [19] Koren, Y. Lin, R. S., Real-Time Five Axis Interolator for Machining Ruled Surfaces, Proceedings of the 1994 International Mechanical Engineering Congress and Exosition, Vol. 55, 1994,. 951-959. [2] Lai, Y.L., Tool-Path Generation of Planar NURBS Curve, Robotics and Comuter- Integrated Manufacturing, Vol. 26, Iss. 5, 21,. 471-482. [21] Yeh, S.S., Hsu, P.L., Adative-Feedrate Interolation for Parametric Curves with a Confined Chord Error, Comuter-Aided Design, Vol. 34, No. 3, 21,. 229-237. [22] Zhang, Q.G., Greenway, R.B., Develoment and Imlementation of a NURBS Curve Motion Interolation, Robotics and Comuter- Integrated Manufacturing, Vol. 14, No. 1, 1998,. 27-36. [23] Lin, H., Wang, G., Dong, C., Constructing Iterative Non-Uniform B-Sline Curve and Surface to Fit Data Points, Science in China Series F: Information Sciences, Vol. 47, No. 3, 23,. 315-331. [24] Heng, M., Erkorkmaz, K., Design of a NURBS Interolator with Minimal Feed Fluctuations and Continuous Feed Modulation Caability, International Journal of Machine Tools and Manufacture, Vol. 5, Iss. 3, 21,. 281-293. [] Lo, C.C., A New Aroach to CNC Tool Path Generation, Comuter-Aided Design, Vol. 3, Iss. 8, 1998,. 649-655. [26] Lei, W.T., Sung, M.P., Lin, L.Y., Huang, J.J., Fast real-time NURBS ath interolation for CNC machine tools, International Journal of Machine Tools and Manufacture, Vol. 47/1, 27,. 2246-2262. [27] Park, J., Nam, S., Yang, M., Develoment of a Real-Time Trajectory Generator for NURBS Interolation Based On The Two-Stage Interolation Method, Int J Adv Manuf Technol.,Vol. 26, No. 4,,. 359-365. [28] Zhiming, X., Jincheng, C., Zhengjin, F., Performance Evaluation of a Real-Time Interolation Algorithm for NURBS Curves, International Journal of Advanced Manufacturing Technology, Vol. 2, No. 4, 22,. 27-276. [29] Tsai, M.C., Cheng, C.W., A Real-Time Predictor-Corrector Interolator for CNC Machining, Journal of Manufacturing Science and Engineering, Vol. 1, Iss. 3, 23,. 449-46. [3] Cheng, C.W., Tsai, M.C., Real-Time Variable Feedrate NURBS Curve Interolator for CNC Machining, Journal of Advanced Manufacturing Technology, Vol. 23, No. 11-12, 24,. 865-873. [31] Lin, M.T., Tsai, M.S., Yau, H.T., Develoment of a dynamic-based NURBS Interolator with Real-Time Look-Ahead Algorithm, International Journal of Machine Tools and Manufacture, Vol. 47, Iss. 15, 27,. 2246-2262. [32] Erkorkmaz, K., Heng, M., A Heuristic Feedrate Otimization Strategy for NURBS Toolaths, CIRP Annuals - Manufacturing Technology, Vol. 57, Iss. 1, 28,. 47-41. [33] Tsai, Y.F., Farouki, R.T., Feldman, B., Performance Analysis of CNC Interolators for Time-Deendent Feedrates along PH Curves, Comuter Aided Geometric Design, Vol. 18, No. 3, 21,. 245-265. ISBN: 978-96-474-42-2 18