1 Introduction

Parametric interpolation for the non-uniform rational B-spline (NURBS) curve has become an important part of the control of robot path planning [1, 2]. An effective NURBS interpolator can not only obtain accurate contour trajectories but also have smooth dynamic performance. The discontinuities in feed motion can evoke the natural modes of the mechanical structure and the servo control system, which will degrade the contouring accuracy [3]. To achieve a shock-free and smooth machining process, researchers have considered jerks when designing interpolators.

With the inequality constraints of physical limits including joint velocity, acceleration, and jerk, an iterative optimization strategy that takes the motion time as the optimization goal was proposed in [4, 5]. In [6], Hashemian et al. proposed to utilize the reparameterization technique which expresses the relationship between the motion path parameter of the flank machining toolpath and the system time variable by an optimal transfer function to minimize the total jerk of the tool’s motion. Compared with these optimization strategies, the S-shaped feedrate profile does not require iterative optimization while satisfying the physical limits, so it is widely used in the field of robotics. An S-shaped feedrate scheduling approach was proposed for the NURBS interpolator to ensure the continuity of acceleration and control the range of jerk in [7, 8]. Ni et al. [9] also developed a bidirectional adaptive feedrate scheduling method based on the S-shaped ACC/DEC algorithm for high-speed twp-axis machining. Though the S-shaped method is widely used in smooth feedrate scheduling because of its simplicity and smoothness, the conventional S-shaped feedrate profile usually cannot deal with all the conditions, e.g., the target displacement is too short. In this case, the robot cannot reach the ending velocity from the starting velocity even by accelerating or decelerating with the max acceleration and jerk. To address this issue, this paper proposes a bidirectional velocity scanning scheme to overcome this drawback of the S-shaped feedrate profile.

Another big challenge is the calculation error that consists of two parts: the error caused by the inaccurate estimation of the arc length, and the truncation error caused by Taylor expansion [10, 11]. With these errors, it is difficult to achieve highly precise and integral parametric planning. Many studies have been carried out in this field. A high-order polynomial spline was utilized to fit the relationship of arc length and the curve parameter in [12]. A quartic equation-based interpolation method was proposed in [13], which works well in reducing feedrate fluctuation. Lo proposed a feedback parametric interpolation method, which approximates the desired point iteratively [14]. A real-time predictor–corrector interpolator was proposed by Tsai and Chen which can guarantee that the feedrate command error is within a specified tolerance [15]. Besides, a feedback interpolator with arc-length compensation and feedback correction was developed by Zhao et al. in [16, 17], which achieves good efficiency and accuracy. In this paper, an interpolation method is proposed based on the S-shaped profile with arc length prediction and feedback correction.

The process of the proposed method is as follows. Firstly, the NURBS curve is partitioned into several continuous blocks, and the speed at the junctions is generated based on the limitation of the maximum tangential acceleration, the maximum velocity, the chord error tolerance, etc. Then, a bidirectional velocity scanning is employed to calculate the ultimate feedrate at the junctions between the blocks. Afterward, the Simpson rule and the adaptive-corrected method proposed in this study are utilized to estimate the arc length of each NURBS sub-curve. Finally, the NURBS parameter \(u\) is calculated through Taylor’s expansion.

The main contributions of this paper are summarized as follows:

  • A bidirectional velocity scanning scheme is proposed to deal with the case of too short target displacement of S-shaped feedrate profile.

  • An interpolation feedrate interpolator based on S-shaped profile with arc length prediction and feedback correction is proposed to ensure precise and integral NURBS curve planning.

The rest of this paper is organized as follows. In Sect. 2, the background including the definition of the NURBS curve, the derivatives of the NURBS curve, the curvature of the NURBS curve, and the method to calculate its arc length are briefly introduced. Then, a complete feedrate scheduling scheme for the NURBS curve is introduced in Sect. 3. In Sect. 4, experiments are conducted on a 6-DOF industrial robot system, and the conclusions are presented in Sect. 5.

2 Background

2.1 Definition of a NURBS curve

A NURBS curve \(C(u)\) can be defined as follows:

$$C(u) = \frac{{\sum\limits_{i = 0}^{n} {N_{i,p} (u)w_{i} P_{i} } }}{{\sum\limits_{i = 0}^{n} {N_{i,p} (u)w_{i} } }}$$
(1)

where \(\{{P}_{i}\}\) indicates the control points; \(\{{w}_{i}\}\) indicates the corresponding weights of \(\{{P}_{i}\}\); \((n+1)\) is the number of control points; \(p\) is the degree of a NURBS curve; \(\{{N}_{i,p}(u)\}\) indicates the B-spline basis functions of the \(p\)-th degree defined on the non-uniform knot vector \(U = \{ u_{0} ,u_{1} , \ldots ,u_{m} \} = \{ \underbrace {a, \ldots a}_{p + 1},u_{p + 1} , \ldots ,u_{m - p - 1} ,\underbrace {b, \ldots b}_{p + 1}\}\); \((m+1)\) is the number of knots. Generally, it is assumed that \(a=0\), \(b=1,\) and \({w}_{i}>0\) for all \(i\). The degree \(p\), the number of control points \(\left(n+1\right),\) and the number of knots \((m+1)\) satisfy \(m=n+p+1\).

The B-spline basis functions \(\{{N}_{i,p}(u)\}\) of the \(p\)-th degree are recursively defined as follows:

$$N_{i,0} (u) = \left\{ {\begin{array}{ll} {1} & \, u_{i} \le u < u_{i + 1} \\ {0} & {otherwise}\end{array} } \right.$$
(2)
$$\begin{array}{l} N_{i,0} (u) = \frac{{u - u_{i} }}{{u_{i + p} - u_{i} }}N_{i,p - 1} (u) + \frac{{u_{i + p + 1} - u}}{{u_{i + p + 1} - u_{i + 1} }}N_{i + 1,p - 1} (u) \\ i = 0,1, \cdots ,n \end{array}$$
(3)

In this paper, the knot vector is derived following the Rosenfeld method [18]:

$$U = \left\{ {\underbrace {0, \cdots ,0}_{p + 1},\frac{{l_{1} + l_{2} }}{L},\frac{{l_{1} + l_{2} + l_{3} }}{L}, \cdots ,\frac{{\sum\limits_{i = 1}^{n - 2} {l_{i} } }}{L},\underbrace {1, \cdots ,1}_{p + 1}} \right\}$$
(4)

where \({l}_{i}\) is the straight-line distance between the \((i-1)\)-th control point and \(i\)-th control point, and \(L\) is the sum of \({l}_{1},{l}_{2},\dots ,{l}_{n}\). Moreover, when \(\left\{{w}_{i}{P}_{i}\right\}\) and \(\{{w}_{i}Q\}\) are represented as the control points, two B-spline curves A(u), B(u) can be defined as:

$$A(u) = \sum\limits_{i = 0}^{n} {N_{i,p} (u)w_{i} P_{i} }$$
(5)
$$B(u) = \sum\limits_{i = 0}^{n} {N_{i,p} (u)w_{i} } Q$$
(6)

where \(Q\) is a constructed vector. It has the same dimension as the \({P}_{i}\), and all elements of \(Q\) are 1. Then, the NURBS curve Eq. (1) can be rewritten as:

$$C(u) = \frac{A(u)}{{B_{st} (u)}}$$
(7)

where \({B}_{st}(u)\) represents the first term of vector \(B(u)\).

2.2 Curvature of a NURBS curve

For a NURBS curve of the \(p\)-th degree, it has derivatives of the \(d\)-th order where \(d\le p\). According to Eq. (7), the first- and second-order derivatives of a NURBS curve, i.e., \({C}^{^{\prime}}(u)\) and \({C}^{"}(u)\), can be evaluated as follows:

$$C^{^{\prime}} (u) = \frac{{A^{^{\prime}} (u) - C(u)B_{st}^{^{\prime}} (u)}}{{B_{st} (u)}}$$
(8)
$$C^{^{\prime\prime}} (u) = \frac{{A^{^{\prime\prime}} (u) - 2C^{^{\prime}} (u)B_{st}^{^{\prime}} (u) - C(u)B_{st}^{^{\prime\prime}} (u)}}{{B_{st} (u)}}$$
(9)

As shown in Eqs. (5) and (6), \(A\left(u\right)\) and \(B\left(u\right)\) can be treated as two different B-spline curves. Assuming that \({{H}_{i}=w}_{i}{P}_{i}\), the k-order derivatives of B-spline curve \(A\left(u\right)\) can be written as:

$$A^{ < k > } (u) = \sum\limits_{i = 0}^{n - k} {N_{i,p - k} (u)H_{i}^{ < k > } }$$
(10)
$$H_{i}^{ < k > } = \left\{ {\begin{array}{ll} {H_{i}} , & {k = 0} \\ {\frac{p - k + 1}{{u_{i + p + 1} - u_{i + k} }}(H_{i + 1}^{ < k - 1 > } - H_{i}^{ < k - 1 > } )},&{k > 0} \end{array} } \right.$$
(11)

where \(k\) is the order of derivatives, and \(U^{ < k > } = \{ \underbrace {0, \ldots 0}_{p - k + 1},u_{p + 1} , \ldots ,u_{m - p - 1} ,\underbrace {1, \ldots ,1}_{p - k + 1}\}\).

Similarly, \({B}^{<k>}(u)\) can be obtained. Therefore, \({C}^{^{\prime}}(u)\) and \(C^{\prime\prime}(u)\) can be calculated based on \({A}^{<k>}(u)\) and \({B}_{st}^{<k>}(u)\). Then, the curvature of a NURBS curve is calculated, as shown in Eq. (12).

$$\rho = \frac{{\left\| {C^{\prime}(u) \times C^{\prime\prime}(u)} \right\|}}{{\left\| {C^{\prime}(u)} \right\|^{3} }}$$
(12)

2.3 Arc length of a NURBS curve

The arc length \(s\left(u\right)\) of a NURBS curve \(C(u)\) over parameter interval \([{u}_{i},{u}_{i+1}]\) is defined as:

$$s(u) = \int_{{u_{i} }}^{{u_{i + 1} }} {\left\| {C^{^{\prime}} (u)} \right\|} du$$
(13)

where \(\Vert {C}^{^{\prime}}(u)\Vert\) is the norm of the first-order derivative \({C}^{^{\prime}}(u)\).

In this study, a numerical integration method, i.e., the Simpson rule, is adopted to approximately estimate the arc length of a NURBS curve. \(S({u}_{i},{u}_{i+1})\) represents the approximate arc length of the NURBS curve \(C(u)\) on the interval \([{u}_{i},{u}_{i+1}]\), and it can be calculated by:

$$s(u_{i} ,u_{i + 1} ) = \frac{{(u_{i + 1} - u_{i} )}}{6}\left[ {s^{^{\prime}} (u_{i} ) + 4s^{^{\prime}} (\frac{{u_{i + 1} + u_{i} }}{2}) + s^{^{\prime}} (u_{i + 1} )} \right]$$
(14)

However, the direct calculation of the Simpson rule will cause approximation error in the numerical result. The issue can be addressed by bisecting the parameter interval \([{u}_{i},{u}_{i+1}]\) into two equal sub-intervals, which is called the composite Simpson rule. Then, Eq. (14) is repeatedly applied over each subinterval:

$$s(u_{i} ,\frac{{u_{i} + u_{i + 1} }}{2},u_{i + 1} ) = s(u_{i} ,\frac{{u_{i} + u_{i + 1} }}{2}) + s(\frac{{u_{i} + u_{i + 1} }}{2},u_{i + 1} )$$
(15)

Assuming that \(\delta\) is the tolerance for the parameter interval, we have:

$${{\left[ {s(u_{i} ,\frac{{u_{i} + u_{i + 1} }}{2},u_{i + 1} ) - s(u_{i} ,u_{i + 1} )} \right]} \mathord{\left/ {\vphantom {{\left[ {s(u_{i} ,\frac{{u_{i} + u_{i + 1} }}{2},u_{i + 1} ) - s(u_{i} ,u_{i + 1} )} \right]} {10}}} \right. \kern-\nulldelimiterspace} {10}} < \delta$$
(16)

If the condition in Eq. (16) cannot be satisfied, the two subintervals in Eq. (15) will be divided into two subintervals again. The loop repeats until Eq. (16) holds for each subinterval. Finally, the sum of the arc lengths of all subintervals is the real length of the arc. In this study, \({f}_{s}(a,b)\) is defined as the iteratively calculated arc length between \(a\) and \(b\).

2.4 NURBS parameter and curve interpolation

The second-order Taylor’s expansion is widely used to establish the relationship between the NURBS parameter and the arc length. It is shown as follows:

$$u_{i + 1} = u_{i} + \left. {\frac{du}{{dt}}} \right|_{{t = t_{i} }} \cdot T_{s} + \left. {\frac{{d^{2} u}}{{dt^{2} }}} \right|_{{t = t_{i} }} \cdot \frac{{T_{s}^{2} }}{2}$$
(17)

where \({u}_{i}\) is the curve parameter when \(t={t}_{i}\), and \({T}_{s}\) is the sampling period. After derivation, it can be rewritten as follows:

$$\begin{aligned} u_{i + 1} & = u_{i} + \frac{{V(t_{i} )}}{{\left| {C^{^{\prime}} (u_{i} )} \right|}} \cdot T_{s} + \frac{1}{{\left| {C^{^{\prime}} (u_{i} )} \right|}} \\ & \left( {A(t_{i} ) - \frac{{C^{^{\prime}} (u_{i} ) \cdot C^{^{\prime\prime}} (u_{i} )}}{{\left| {C^{^{\prime}} (u_{i} )} \right|^{3} }}V^{2} (t_{i} )} \right) \cdot \frac{{T_{s}^{2} }}{2} \\ \end{aligned}$$
(18)

where \(V\left(t\right)\) and \(A(t)\) are the desired velocity and acceleration of the NURBS curve, respectively.

3 S-shaped feedrate scheduling based NURBS interpolator

In this section, the division of the curve into several blocks by using the curvatures is introduced in Sec 3.1. Then, the S-shaped feedrate profile is introduced briefly in Sect. 3.2. In Sect. 3.3, the precise calculation of the arc length of blocks and NURBS parameter is described.

3.1 Critical points and curve segmentation

In NURBS curves, the sharp corners with large curvature can undermine the dynamic performance of high-speed machining. Thus, it is critical to segment each block at the key points that are commonly referred to as sharp corners. The feedrate velocity over the candidate points can be calculated based on the two constraints of chord error and centripetal acceleration [19].

Constrained by the chord error, the feedrate should satisfy Eq. (19):

$$v_{i} \le \frac{2}{{T_{s} }}\sqrt {\frac{1}{{\rho_{i}^{2} }} - (\frac{1}{{\rho_{i} }} - \delta_{\max } )^{2} }$$
(19)

where \({\rho }_{i}\) is the curvature at the \(i\)-th interpolation point; \({\delta }_{\mathrm{max}}\) is the maximum chord error, and \({T}_{s}\) is the sampling period.

Constrained by the centripetal acceleration, the feedrate should also satisfy Eq. (20):

$$v_{i} \le \sqrt {\frac{{A_{c\max } }}{{\rho_{i} }}}$$
(20)

where \({A}_{c \mathrm{max}}\) is the maximum centripetal acceleration, so the restricted feedrate \({v}_{i}^{R}\) can be expressed as follows:

$$v_{i}^{R} = \min \{ \frac{2}{{T_{s} }}\sqrt {\frac{1}{{\rho_{i}^{2} }} - (\frac{1}{{\rho_{i} }} - \delta_{\max } )^{2} },\;\sqrt {\frac{{A_{c\max } }}{{\rho_{i} }}} ,\,V_{\max } \}$$
(21)

where \({V}_{\mathrm{max}}\) is the allowable max feedrate of the actuator.

Ultimately, the critical points are found from the candidate points, where \({v}_{i}^{R}\) is less than the feedrate command. Based on these critical points, the NURBS curve can be split into several continuous blocks.

3.2 S-shape velocity profile and bidirectional scanning

3.2.1 S-shaped feedrate profile

The S-shaped feedrate profile consisting of seven phases is shown in Fig. 1. The expressions of S-shaped velocity, acceleration, and jerk in seven phases are summarized in Table 1. The symbols \({t}_{i}(i=\mathrm{1,2},\dots ,7)\) represent the time parameters.where \({v}_{s}\) and \({v}_{e}\) are the starting and ending velocities, respectively; \({A}_{m}\) is the allowable maximum acceleration, and \({J}_{m}\) is the maximum jerk of the actuator.

Fig. 1
figure 1

The S-shaped feedrate profile with seven sections

Table 1 Expressions for the S-shaped feedrate profile

As the change of target displacement, initial velocity, end velocity, maximum acceleration, and jerk, there are 17 types of the S-shape feedrate profile. It is critical to formulate an S-shape feedrate profile basic function that can deal with all 17 cases. The velocity and acceleration profiles of the 17 cases are provided in the Appendix. A more detailed formula expression of the 17 types S-shape feedrate profile is given by Sencer et al. in [4].

3.2.2 Bidirectional velocity scanning

If the target displacement is too short but the velocity calculated by Eq. (21) is big, the system cannot reach the ending velocity from the starting velocity even by accelerating or decelerating with the max acceleration and jerk. Besides an S-shape feedrate profile basic function that can deal with all 17 cases, a bidirectional velocity scanning scheme (forward velocity and backward velocity scanning) is also needed to correct the starting or ending velocity in these cases.

Forward velocity scanning

In this case, \({v}_{s}<{v}_{e}\), where \({v}_{s}\) and \({v}_{e}\) are the starting and ending velocities, respectively. According to the 7-segment S-shape velocity profile, the minimum acceleration time \({t}_{a}\) and displacement \({s}_{a}\) required for the velocity from \({v}_{s}\) to \({v}_{e}\) in the pure acceleration stage can be expressed as:

$$\left\{ {\begin{array}{*{20}l} {t_{a} = \sqrt {\frac{{v_{e} - v_{s} }}{J}} } \\ {s_{a} = t_{a} (v_{e} + v_{s} )} \\ \end{array} } \right.$$
(22)

Assume that \(s\) is the target displacement. If \(s<{s}_{a}\), then the velocity cannot reach \({v}_{e}\) within this displacement, and the ending velocity needs to be revised. As shown in Eq. (23), \({v}_{\mathrm{max}}^{\mathrm{^{\prime}}}\) is the maximum velocity that can be reached within the displacement \(s\).

$$(v_{\max }^{^{\prime}} + v_{s} ) \cdot \sqrt {\frac{{v_{\max }^{^{\prime}} - v_{s} }}{J}} - s = 0$$
(23)

Backward velocity scanning

In this case, \({v}_{s}>{v}_{e}\). Similarly, the minimum deceleration time \({t}_{d}\) and displacement \({s}_{d}\) required for the velocity from \({v}_{s}\) to \({v}_{e}\) in the pure deceleration stage can be expressed as:

$$\left\{ {\begin{array}{*{20}l} {t_{d} = \sqrt {\frac{{v_{s} - v_{e} }}{J}} } \\ {s_{d} = t_{d} (v_{e} + v_{s} )} \\ \end{array} } \right.$$
(24)

If \(s<{s}_{d}\), the velocity cannot reach \({v}_{e}\) within this displacement, and the starting velocity needs to be revised. As shown in Eq. (25), \({v}_{\mathrm{max}}^{^{\prime}}\) is the maximum velocity that can be decelerated to \({v}_{e}\) within the displacement \(s\).

$$(v_{\max }^{^{\prime}} + v_{e} ) \cdot \sqrt {\frac{{v_{\max }^{^{\prime}} - v_{e} }}{J}} - s = 0$$
(25)

Figure 2 illustrates the examples of forward and backward velocity scanning, where the red curves and blue curves indicate the original planning trajectory and the updated after velocity scanning, respectively.

Fig. 2
figure 2

Bidirectional velocity scanning. a Forward scanning. b Backward scanning

3.3 The high-precision NURBS interpolator

The Simpson bisection iterative algorithm can obtain the accurate arc length of each block after multiple iterations. Unfortunately, due to the truncation error of the Taylor expansion, the calculated parameter \(u\) usually cannot be accurately planned to 1. Therefore, the actuator cannot completely track the NURBS curve. To handle this problem, this paper proposes an iteration algorithm to calculate the block displacement with NURBS parameter \(u\) as the optimization target. The algorithm is as follows:

Assume that the number of breakpoints is \(n\). Then, the number of blocks is \((n+1)\), and the arc length of blocks is \({s}_{0},{s}_{1},\cdots ,{s}_{n}\). Denote the total arc length of the NURBS curve as \(S\). \({S}_{H}\) and \({S}_{L}\) satisfy the inequality \({S}_{H}>S>{S}_{L}\), and \(\Delta S={S}_{H}-{S}_{L}\).

Firstly, the Simpson bisection iterative algorithm is used to calculate the arc length of each block. The velocities and accelerations of blocks can be calculated using the S-shape feedrate profile. Then, with these velocities and accelerations, the NURBS parameter \(u\) can be calculated by Eq. (18). Usually, the NURBS parameter \(u\) cannot meet the precision requirement due to the truncation error. Thus, \({S}_{H}\) and \({S}_{L}\) are modified by a dichotomy searching, and the arc length of each block is modified according to Eq. (26). The loop will not break until the NURBS parameter \(u\) satisfies the precision requirement.

$$s_{i} = s_{i} + \Delta S \cdot {{f_{s} (u_{i - 1} ,u_{i} )} \mathord{\left/ {\vphantom {{f_{s} (u_{i - 1} ,u_{i} )} {S_{L} }}} \right. \kern-\nulldelimiterspace} {S_{L} }}$$
(26)

The whole algorithm is described in Algorithm 1:where \(\Delta l\) is a small offset, and \(eps\) is the accuracy tolerance. They are set to \(5\mathrm{mm}\) and 0.000005 in this paper, respectively.

figure a

4 Simulation and experimental results

4.1 Simulation results and analysis

In this study, the butterfly-shaped curve is taken as our NURBS test curve. The degree, control points, knot vectors, and weight vectors of the NURBS curve are given as follows:

The degree: \(p=3\).

The control points (mm): \(P\)= [(533.2, 52.0), (534.3, 52.0), (534.8, 49.4), (535.5, 44.8), (548.3, 51.2), (556.5, 58.4), (569.3, 66.9),( 584.7, 63.6), (579.2, 47.1), (573.3, 39.7), (571.1, 30.3), (562.2, 33.6), (570.6, 28.3), (568.2, 20.2), (562.0, 15.3), (566.4, 4.6), ( 559.7, 9.1), (558.6, 14.3), (554.8, 8.3), (548.9, 12.4), (542.9, 16.7), (538.7, 21.9), (534.4, 36.2), (535.7, 24.8), (538.5, 19.6), (533.2, 14.8), (528.0, 19.6), (530.8, 24.8), (532.1, 36.2), (527.7, 21.9), (523.6, 16.7), (517.6, 12.4), (511.7, 8.3), (507.9, 14.3), (506.8, 9.12), (500.1, 4.69), (504.5, 15.3), (498.3, 20.2), (495.8, 28.3), (504.3, 33.6), (495.4, 30.3), (493.0, 39.6), (487.4, 47.2), (481.8, 63.6),( 497.2, 66.9), (509.9, 58.4), (518.2, 51.2), (531.0, 44.8), (531.7, 49.4), (532.2, 52.0),(533.2, 52.0)].

The knot vector: \(U\)= [0, 0, 0, 0, 0.008161, 0.018293, 0.049457, 0.073221, 0.106681, 0.140978, 0.178852, 0.199462, 0.220485, 0.241155, 0.262784, 0.281181, 0.298390, 0.323584, 0.341160, 0.352734, 0.368200, 0.383845, 0.399920, 0.414476, 0.446994, 0.471980, 0.484841, 0.500412, 0.515823, 0.528684, 0.553670, 0.586251, 0.600671, 0.616746, 0.632392, 0.647858, 0.659389, 0.676880, 0.701893, 0.719102, 0.737562, 0.759375, 0.780046, 0.800961, 0.821519, 0.859257, 0.893554, 0.926833, 0.950760, 0.981924, 0.992057, 1.0, 1.0, 1.0, 1.0].

The weight vector: \(W=\)[1.0000, 1.0000, 1.0000, 1.2000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 2.0000, 1.0000, 1.0000, 5.0000, 3.0000, 1.0000, 1.1000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.1000, 1.0000, 3.0000, 5.0000, 1.0000, 1.0000, 2.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.2000, 1.0000, 1.0000, 1.0000].

To describe the test curve as accurately as possible, the curve including 100,001 sampling points with a sampling spacing \(\Delta u=0.00001\) is shown in Fig. 3a. The curvature curve corresponding to the sampling points is shown in Fig. 3b. As shown in Fig. 3b, the curvature threshold \(\varepsilon\) is set as to 0.25, and 19 curvature extreme points can be selected. According to the constraints of chord error and centripetal acceleration, the critical points are found from the sampling points, and they are also shown in Fig. 3a as black dots. The maximum velocity at each critical point can be determined by Eq. (21).

Fig. 3
figure 3

The butterfly-shaped curve, critical points, and curvature. a Butterfly-shaped NURBS curve. b Curvature of the test NURBS curve

The interpolator parameters used for the butterfly-shaped test curve are listed in Table 2.

Table 2 Test parameters of the interpolations

The Simpson iterative algorithm and the method proposed in this paper are used to calculate the arc length of each block. The calculation results obtained by the Simpson iterative algorithm are as follows: \({s}_{0}=0.585141\), \({s}_{1}=5.348356\)\({s}_{2}= 89.180639\), \({s}_{3}=21.120720\), \({s}_{4}=8.898868\), \({s}_{5}=8.896570\), \({s}_{6}=4.699582\), \({s}_{7}=29.888507\)\({s}_{8}=11.498431\)\({s}_{9}=5.799827\), \({s}_{10}=5.699825\), \({s}_{11}=11.487612\), \({s}_{12}=29.917852\), \({s}_{13}=4.698810\), \({s}_{14}=8.897285\)\({s}_{15}=8.798869\)\({s}_{16}=21.084886\)\({s}_{17}=89.210446\)\({s}_{18}=5.431492\)\({s}_{19}=0.467329\). The total arc length of the NURBS curve is \(S=371.611046\). The calculation results obtained by the method proposed in this paper are as follows: \({s}_{0}=0.585740\), \({s}_{1}=5.353978\)\({s}_{2}=89.243448\), \({s}_{3}=21.142144\), \({s}_{4}=8.908179\), \({s}_{5}=8.907302\), \({s}_{6}= 4.704525\), \({s}_{7}=29.912613\), \({s}_{8}=11.511162\), \({s}_{9}=5.805811\), \({s}_{10}=5.705704\), \({s}_{11}=11.500059\), \({s}_{12}=29.942049\), \({s}_{13}=4.703753\), \({s}_{14}=8.908096\)\({s}_{15}=8.808009\)\({s}_{16}=21.106301\)\({s}_{17}=89.273012\)\({s}_{18}=5.437201\)\({s}_{19}=0.467807\). The total arc length is \(S=371.991906\).

It can be found that for compensating the truncation error, the arc length of each block calculated by the proposed method in this paper increases little compared with that calculated by the Simpson iterative algorithm. The arc length of the first and last block is all too short for the S-shaped feedrate profile, so this study corrects the velocity of these junctions through the bidirectional velocity scanning scheme. Figure 4 shows the velocity, acceleration, and jerk curves of the S-shaped feedrate profile calculated by our method. The ending velocities obtained by the Simpson iteration method and our method are 0.0043165 \(\mathrm{mm}/\mathrm{s}\) and 0.00042 \(\mathrm{mm}/\mathrm{s}\), respectively. Obviously, our proposed method achieves better accuracy. The NURBS parameter \(u\) of the two methods can be calculated by Eq. (18). As shown in Fig. 5a, the parameter \(u\) obtained by the two methods is basically the same, i.e., 0.998752 and 0.999993.

Fig. 4
figure 4

NURBS parameter \(u\) and the arc length

Fig. 5
figure 5

The scheduled curves of the method proposed in this paper. a Velocity curve. b Acceleration curve. c Jerk curve

As shown in Fig. 6, the method based on the Simpson iteration algorithm leaves a small blank space at the end of the NURBS curve that cannot be executed. By contrast, the method proposed in this study obtains the NURBS curve precisely. Figure 5b shows the iterative process of calculating the total arc length of the NURBS curve using the method proposed in this paper. It is found that the ideal situation is reached immediately after 10 iterations, and the whole process takes less than 2.5 s. It indicates that the proposed algorithm improves the NURBS interpolation precision for offline trajectory planning.

Fig. 6
figure 6

Comparison of NURBS curves. a Simpson iteration method. b The method of this paper

4.2 Experimental results

Corresponding to the simulation tests, the butterfly-shaped curve is drawn by a real industrial robot. As shown in Fig. 7, the experiment was implemented on a 6-DOF ROKAE (XB7) light-weight industrial robot, and a carbon pen was installed on the wrist of the robot. Meanwhile, the existing commercial motor drive of the ROKAE was utilized to control the joint position. The task-level and intermediate-layer computation was run on a 64-Bit Linux-based real-time controller equipped with an Intel Core-i7 CPU with 8 GB memory. The controller communicates with the motor drive via the EtherCAT protocol at a sampling rate of 1 kHz.

Fig. 7
figure 7

The Experiment platform

The butterfly-shaped NURBS curve drawn by the 6-DOF industrial robot is shown in Fig. 8. As shown in the video of the attachment, the robot runs smoothly and stably throughout the execution process.

Fig. 8
figure 8

Experimental result of butterfly-shaped curve

5 Conclusion

This paper proposes a high-precision S-shaped feedrate scheduling scheme for the NURBS interpolator. It consists of curve segmentation, bidirectional velocity scanning, and NURBS curve interpolation. Meanwhile, an interpolation method is proposed based on Taylor’s expansion with arc length prediction and feedback correction. This method effectively improves the accuracy of NURBS curve planning.