1 Introduction

Electrically driven robots are efficiently used in various applications. Because their motors provide low torque at high speed, the robotic systems are equipped with power transmission systems to provide high torque at low speed for performing the tasks. However, deformation of the transmission system produces flexibility in the joints. This phenomenon is the main source of vibration in industrial robot manipulators. Compared with rigid robots, the number of degrees of freedom becomes twice as the number of control actions due to flexibility in the joints, and the matching property between nonlinearities and inputs is lost[1]. Performing high-precision tasks by a flexible-joint robot seems to be difficult since the link position cannot follow the actuator position directly. As a result, flexibility in joints should be compensated to improve the performance and avoid unwanted oscillations. However, controlling such systems still faces numerous challenges such as the severe non-linearities, weak coupling, joint flexibility, varying operating conditions, and wide range of uncertainties[2].

Over the years, researchers attempted various control methods for flexible-joint manipulators including singular perturbation theory[3], feedback linearization[4], adaptive control[5], sliding mode control[6], robust control[7], fuzzy control[8] and neural control[9]. The presented methods belong to the class of the commonly used control strategy, which is called torque control strategy. The torque control strategy pays attention to dynamics of robot manipulator. However, model of the flexible robot is so complicated, highly nonlinear, heavily coupled, computationally extensive and uncertain. Thus, torque control approaches, particularly the model-based techniques, face the challenging problems associated with manipulator dynamics[10]. It is found that the voltage control strategy[11] is superior to the torque-control strategy for the robust control of the rigid manipulators[12] in terms of simplicity in the controller design and performance of the control system. Since flexibility in the joints provides complex dynamics, the voltage control strategy is more efficient than the torque-control strategy. Recently, robust control[10] and adaptive control[13] of flexible-joint robots have been developed using the voltage control strategy. In [14], a neural-network-based adaptive controller has been proposed for the tracking problem of manipulators with uncertain kinematics, dynamics and actuator model, using voltage control strategy.

On another aspect, tools of computational intelligence, such as artificial neural networks and fuzzy logic controllers, have been credited in various applications as powerful tools. They can provide robust controllers for mathematically ill-defined systems subjected to structured and unstructured uncertainties[15]. Fuzzy control, as a model-free approach, is simply designed for complicated systems that may be difficult to model analytically[16, 17]. Type-1 fuzzy logic control systems (T1FLC) are known for their ability to compensate for structured and unstructured uncertainties to a certain degree. Compared to T1FLC, type-2 fuzzy logic control systems (T2FLC) have been credited to be more powerful in compensating for even higher degrees of uncertainties[18]. The concept of type-2 fuzzy set was introduced by Zadeh in 1975 as an extension of the type-1 fuzzy set[19]. Type-2 fuzzy sets are able to model such uncertainties because their membership functions (MFs) are fuzzy. MFs of type-1 fuzzy sets are two-dimensional, whereas membership functions of type-2 fuzzy sets are three-dimensional. The third dimension of type-2 fuzzy sets provides an additional degree to model the uncertainties directly[18]. In contrast, the performance of a T1FLC may be improved by partitioning the input domains with a larger number of fuzzy sets. Then, a trade-off between accuracy, performance and interpretability is required[20]. A larger number of MFs result in a bigger rule base that would be harder for a human to interpret because of the curse of dimensionality[21]. The IT2FLC is particularly suitable for time-variant systems with unknown time-varying dynamics[22]. Though fuzzy control is the most widely used application of fuzzy set theory, T2FLC have been used in very few control applications, such as nonlinear control and mobile robot navigation[22], decision making[23], and quality control of sound speakers[24].

In order to obtain optimal performance of control systems, optimization algorithms, such as genetic algorithm (GA) and particle swarm optimization (PSO), have been frequently used[25]. The PSO was first introduced by Kennedy and Eberhart in 1995[26]. Through the simulation of a simplified social system, the behavior of PSO can be treated as an optimization process. As compared with other optimization algorithms like GA, the PSO requires less computational time. Therefore, it has successfully been applied to solve many optimization problems[25, 27].

This paper develops an interval T2FLC (IT2FLC) approach using voltage control strategy to control electrically driven flexible-joint robot manipulators. The IT2FLC is computationally cheaper and more efficient than T2FLC[18].

The novelty is the design of IT2FLC using the voltage control strategy and employing PSO to optimize control design parameters. As a result, the control performance is improved. Stability analysis is presented and the superiority of the IT2FLC to T1FLC is shown in the presence of uncertainties. This paper is organized as follows. Section 2 presents modeling of flexible-joint robots. Interval type-2 fuzzy logic is briefly introduced in Section 3. Section 4 outlines the particle swarm optimization. The design of the proposed controller is detailed in Section 5. Stability analysis is presented in Section 6. Section 7 presents the simulation results. Section 8 concludes the paper.

2 Electrically driven flexible-joint robot dynamics

In a simplified model of the flexible-joint robot[7], the manipulator links are assumed rigid and motors are elastically coupled to the links. The motor torques are assumed as inputs of the robotic system. In this paper, the simplified model is applied on an electrically driven robot with some modifications to obtain the motor voltages as the inputs. In this study, we consider a two-link manipulator[28] as shown in Fig. 1 with revolute joints driven by geared permanent magnet direct current motors. If the joint flexibility is modeled by a linear torsional spring, the dynamic equation of motion can be expressed as

Fig. 1
figure 1

An articulated two-link manipulator

$$D(\theta )\ddot \theta + C(\theta ,\dot \theta )\dot \theta + g(\theta ) + {\tau _f}(\dot \theta ) = K(r{\theta _m} - \theta )$$
(1)
$$J{\ddot \theta _m} + B{\dot \theta _M} + rK(r{\theta _m} - \theta ) = \tau $$
(2)

where θR 2 is a vector of joint angles, and θ m R 2 is a vector of rotor angles. Thus, this system possesses 4 coordinates as [θ θ m ]. The matrix D(θ) is a 2 × 2 matrix of manipulator inertia, \(C(\theta ,\dot \theta )\dot \theta \in {\operatorname{R} ^2}\) is the vector of centrifugal and Coriolis forces, g(θ) R 2 is a vector of gravitational forces, τ ∈ R 2 is a torque vector of motors, and τ f (\(\dot \theta \)) is the frictional torques. The diagonal matrices J, B and r represent coefficients of the motor inertia, motor damping, and reduction gear, respectively. The diagonal matrix K represents the lumped flexibility provided by the joint and reduction gear. To simplify the model, both the joint stiffness and gear coefficients are assumed constant. The vector of gravitational forces g(θ) is assumed the function of only the joint positions as used in the simplified model[7]. Note that the vector and matrix are represented in bold form for clarity.

The details are given in [28].

$$\begin{array}{*{20}{l}} {D(\theta ) = \left[ {\begin{array}{*{20}{c}} {{d_1}}&{{d_2}} \\ {{d_2}}&{{d_3}} \end{array}} \right]} \\ {C(\theta ,\dot \theta ) = \left[ {\begin{array}{*{20}{c}} { - {m_2}{l_1}{l_{c2}}{{\dot \theta }_2}\sin ({\theta _2})}&{ - {m_2}{l_1}{l_{c2}}({{\dot \theta }_1} + {{\dot \theta }_2})\sin ({\theta _2})} \\ {{m_2}{l_1}{l_{c2}}{{\dot \theta }_1}\sin ({\theta _2})}&0 \end{array}} \right]} \\ {G(\theta ) = \left[ {\begin{array}{*{20}{c}} {({m_1}{l_{c1}} + {m_2}{l_1})gcos({\theta _1}) + {m_2}{l_{c2}}g\cos ({\theta _1} + {\theta _2})} \\ {{m_2}{l_{c2}}g\cos ({\theta _1} + {\theta _2})} \end{array}} \right]} \\ {{\tau _f}(\dot \theta ) = \left[ {\begin{array}{*{20}{c}} {{b_1}{{\dot \theta }_1} + {c_1}{\text{sign(}}{{\dot \theta }_1})} \\ {{b_2}{{\dot \theta }_1} + {c_2}{\text{sign}}({{\dot \theta }_1})} \end{array}} \right]} \end{array}$$
(3)

where

$${d_1} = {m_1}{l_{{c_1}}} + {m_2}(l_1^2 + l_{{c_1}}^2 + 2{l_1}{l_{{c_1}}}\cos ({\theta _2})) + {l_1} + {l_2}$$
(4)
$${d_2} = {m_2}(l_{{c_1}}^2 + {l_1}{l_{{c_1}}}\cos ({\theta _2})) + {l_2}$$
(5)
$${d_3} = {m_2}l_{{c_2}}^2 + {l_2}$$
(6)

θ i (i = 1,2) denotes the joint angle, l i is the link length, mi is the link mass, I i is the link's moment of inertia given with respect to center of mass, l ci is the distance between the center of mass of link, and the i-th joint b i (i = 1, 2) and c i (i = 1,2) are constants.

System (1)-(2) is highly nonlinear, extensively computational and heavily coupled. Complexity of the model has been a serious challenge in robot modeling and control in literature. It is expected to face a higher complexity if the proposed model includes the actuator dynamics. In order to obtain the motor voltages as inputs, we consider electrical equation of the geared permanent magnet direct current motors in the matrix form

$$u = R{I_A} + L{\dot I_a} + {K_b}{\dot \theta _m}$$
(7)

where u ∈ R 2 is a vector of motor voltages, I a R 2 is a vector of motor currents, and \({\dot \theta _m}\) is a vector of rotor velocities. The diagonal matrices R, L and K b represent the coefficients of armature resistance, armature inductance and back-emf constant, respectively. The motor torques τ, as input of dynamic equation (2), is produced by the motor currents as

$${K_m}{I_a} = \tau $$
(8)

where K m is a diagonal matrix of the torque constants. Equalities (1), (2), (7) and (8) form the robotic system such that the voltage vector u is the input vector and the joint angle vector θ is the output vector.

3 Interval type-2 fuzzy logic systems

A fuzzy logic system that uses at least one type-2 fuzzy set is called a type-2 fuzzy logic system. It is very useful in circumstances, where the determination of an exact membership grade for a fuzzy set is difficult[18]. As illustrated in Fig. 2, a type-2 fuzzy MF can be obtained by starting with a type-1 MF and blurring it. The extra mathematical dimension provided by the blurred area represents the uncertainties in the shape and position of the type-1 fuzzy set and is referred to as the footprint of uncertainty (FOU). The FOU is bounded by upper and lower MFs, and points within the “blurred area” have membership grades given by type-1 MFs. The most frequently used type-2 fuzzy sets are interval fuzzy sets, where each point in the FOU has unity secondary membership grade[22].

Fig. 2
figure 2

Type-2 fuzzy logic membership function

An interval type-2 fuzzy set \(\tilde A\) in X is defined as[19]

$$\tilde A = \int\limits_{x \in X} {\left[ {\int\limits_{x \in X} {1/u} } \right]} /x,\;\;\;{J_x} \subseteq [0\;1]$$
(9)

where x is the primary variable with domain X, u is the secondary variable which has domain J x, J x is called the primary membership of x. Uncertainty about A is conveyed by the union of all the primary memberships called the footprint of uncertainty (FOU) of \(\tilde A\)[16], i.e.,

$${\text{FOU(}}\tilde A) = {J_x},\;\;\;x \in X.$$
(10)

The structure of a typical type-2 fuzzy logic system is shown in Fig. 3. It is similar to its type-1 counterpart. The major difference is that at least one of the fuzzy sets is type-2 and a type-reducer is needed to convert the type-2 fuzzy output sets into type-1 sets so that they can be processed by the defuzzifire to give a crisp output[18]. General type-2 fuzzy logic systems (FLSs) are computationally intensive because type-reduction is very intensive[18, 29]. Therefore, we will use in this work the interval type-2 fuzzy logic systems for their simplicity and efficiency. We design the fuzzy controller by the use of two inputs namely tracking error and its derivative (derror), respectively. If we select three fuzzy sets for each input, the whole control space will be covered by 9 fuzzy rules. The fuzzy rules are of the form of

Fig. 3
figure 3

Scheme of a type-2 fuzzy logic system

$$\begin{array}{*{20}{c}} {{R^i}:\;{\text{if}}\;{x_1}\;{\text{is}}\;\bar X_1^i\;{\text{and}}\;{x_2}\;{\text{is}}\;\bar X_2^i,} \\ {{\text{then}}\;{y^i} = {a_{i1}}{x_1} + {a_{i2}}{x_2} + {a_{i0}},\;\;\;i = 1,2, \cdots ,m} \end{array}$$
(11)

where \(\tilde X_j^i\) (j = 1,2) is an interval type-2 fuzzy set and the inputs of rule R i is x = (x 1,x2) ∈ U ∈ R 2, U is the universe of discourse. M is the number of rules, and in the i-th rule (R i), a i1 and a i 2 are the gains in consequent part for i = 1,2, y i is the crisp output. The proposed interval type-2 fuzzy controller is for the case when antecedents are interval type-2 fuzzy sets (A2) and consequents are crisp numbers (C0)[30]. The inference engine combines all the firing rules and gives a nonlinear mapping from the input interval type-2 fuzzy sets to the output interval type-2 fuzzy sets.

The firing strength set of the i-th rule is[29]

$${F^i}(x) = [{\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} ^i}(x),\;{\bar f^i}(x)] = [{\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} ^i},\;{\bar f^i}]$$
(12)

where

$${\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} ^i}(x) = {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{\mu } _{\bar X_1^i({x_1})}} \times {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{\mu } _{\bar X_2^i({x_2})}}$$
(13)
$${\bar f^i}(x) = {\bar \mu _{\tilde X_1^i({x_1})}} \times {\bar \mu _{\tilde X_2^i({x_2}).}}$$
(14)

The terms \({\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{\mu } _{\tilde X_j^i}}\)(j = 1, 2) and \({\bar \mu _{\tilde X_j^i}}\)(j = 1, 2) are the lower and upper membership grades of \({\mu _{\tilde X_j^i}}\), respectively.

The type-2 fuzzy inference engine produces an aggregated output type-2 fuzzy set. The type reduction block operates on this set to generate a centroid type-1 fuzzy set known as the “type-reduced set” of the aggregate type-2 fuzzy set. Several type-reduction methods have been suggested in the literature, such as the center-of-sums, the height, the modified height and the center-of-sets[18, 29]. The most commonly used one is the center-of-sets type-reducer due to its computational efficiency. That may be expressed as[18, 29]

$${Y_{\cos }}(x) = [{y_l},{y_r}] = \mathop \cup \limits_{{f^i} \in \;{F^i}(x)} \frac{{\sum\limits_{i = 1}^M {{f^i}{y^i}} }}{{\sum\limits_{i = 1}^M {{f^i}} }}$$
(15)

where Y cos is the interval set determined by two end points yi and y r, and firing strengths f = \(\left[ {{{\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} }^i},{{\bar f}^i}} \right]\) ∈ Fi (x). y i and y r can be expressed as

$${y_l} = \frac{{\sum\limits_{i = 1}^L {{{\bar f}^i}{y^i}} + \sum\limits_{i = L + 1}^M {{{\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} }^i}{y^i}} }}{{\sum\limits_{i = 1}^L {{{\bar f}^i}} + \sum\limits_{i = L + 1}^M {{{\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} }^i}} }}$$
(16)
$${y_r} = \frac{{\sum\limits_{i = 1}^R {{{\bar f}^i}{y^i}} + \sum\limits_{i = R + 1}^M {{{\bar f}^i}{y^i}} }}{{\sum\limits_{i = 1}^R {{{\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} }^i}} + \sum\limits_{i = R + 1}^M {{{\bar f}^i}} }}.$$
(17)

Two end points y t and y r can be computed efficiently using the Karnik-Mendel (KM) algorithms[29]. Since the type-reduced set is an interval type-1 set, the defuzzifire output is[18]

$$y(x) = 0.5({y_l} + {y_r}).$$
(18)

4 Particle swarm optimization (PSO)

The PSO algorithm is performed as follows. The unknown parameters are called the particles that form the population size denoted by n. Starting with a randomly initialization, the particles will move in a searching space to minimize an objective function. The parameters are estimated through minimizing the objective function. The fitness of each particle is evaluated according to the objective function for updating the best position of particle and the best position among all particles as two goals in each step of computing. Each particle is directed to its previous best position and the previous best position among particles. Consequently, the particles tend to fly towards the better searching areas over the searching space. The velocity of i-th particle v i will be calculated as[26, 27]

$${v_i}(k + 1) = \chi ({v_i}(k) + {c_1}{r_1}(pbes{t_i}(k) - {x_i}(k)) + {c_2}{r_2}(gbest - {x_i}(k)))$$
(19)

where for the i-th particle in the k-th iteration, χ i is the position, pbest i is the previous best position, gbest is the previous global best position of particles, c 1 and c 2 are the acceleration coefficients namely the cognitive and social scaling parameters, r 1 and r 2 are two random numbers in the range of [0 1], φ = c1+c 2, φ > 4, and χ is constriction coefficient given by

$$\chi = \frac{2}{{\left| {a - \varphi - \sqrt {{\varphi ^2} - 4\varphi } } \right|}}.$$
(20)

Constriction coefficient is controlled by the convergence of the particle. As a result, it prevents explosion and ensuring convergence[26].

A new position of the i-th particle is then calculated as

$${x_i}(k + 1) = {x_i}(k) + {v_i}(k + 1).$$
(21)

The PSO algorithm performs repeatedly until the goal is achieved. The number of iterations denoted by k max can be set to a specific value as a goal of optimization. The most crucial step in applying PSO is to choose the best cost functions which are used to evaluate the fitness of each particle. During tuning process with PSO, the mean of root of squared error (MRSE) is used.

The cost functions for the i-th particle are computed as

$${\text{MRSE}} = E(k) = \frac{1}{N}\sum\limits_{i = 1}^N {\sqrt {e_1^2(i) + e_2^2(i)} } $$
(22)

where e 1(i) is the trajectory error of the i-th sample for the first joint, e 2(i) is the trajectory error of the i-th sample for the second joint, N is the number of samples, and k is the iteration number.

PSO algorithm initializes randomly. However, the speed of convergence is sensitive to the initialization. On the other hand, by using constriction coefficient, the PSO algorithm should find the optimum solution whatever the initial values of the particles are[26]. In addition, the PSO runs off-line, thus computing time is not as important as in real time control. Since the control design uses the optimal solution provided by PSO, the PSO-based control strategy is not dependent on the initial values.

5 Control strategy

We adopt two-input-one-output FLC to introduce the design procedures of IT2FLC, i.e., we consider the error x 1 and error rate x 2 as inputs. Let x = θ − θ d, where θ is a vector of joint angles and θ d is a vector of the desired joint angles. The IT2FLC takes these two inputs and provides a control action u ∈ R 2.

The membership functions of an FLC can be assumed as triangular functions, trapezoidal functions, Gaussian functions, etc[21]. In this study, Gaussian functions are used. Gaussian membership function has less parameters than the triangular one[21], which is preferred for optimization. The membership functions adopted by both types of control systems are shown in Figs.4 and 5, respectively. Note that “N” stands for negative, “E” stands for 0, and “P” stands for positive. The rules of the fuzzy controllers are given in Section 6.

Fig. 4
figure 4

Membership function of type-1 FLC for joint 1 (a,b) and joint 2 (c,d)

Fig. 5
figure 5

Membership function of type-2 FLC for joint 1 (a,b) and joint 2 (c,d)

To assess the performance of both types of controllers, the proposed fuzzy controller is implemented in two different ways: the first is based on a type-1 fuzzy control scheme, while the second is based on a type-2 fuzzy control scheme. In the case of the implementation of the IT2FLC, we have the same characteristics as in T1FLC, but we used type-2 fuzzy sets as membership functions for the inputs as shown in Fig. 5.

All the universes of discourses are normalized and arranged in [−1 1]. Moreover, scaling factors external to the FLC used to give appropriate values to the variables. The role of input scaling factors becomes more important for using the Gaussian MFs for inputs. The input scaling factors are employed to take the input into the operating range covered by MFs, otherwise the controller will not respond to the input.

Input variables and output variable have scaling factors k 1,k 2, k o and \({k'_1},{k'_2}\) and \({k'_o}\) for joint 1 and joint 2, respectively. Simulink model of the proposed method is shown in Fig. 6.

Fig. 6
figure 6

Simulink model of proposed method

A Gaussian MF with certain mean (m) and uncertain variance (δ) can be completely defined by 3 parameters: m and (δ 12)[29]. Since a different IT2FLC is applied to each link and each IT2FLC has 6 input type-2 MFs and 3 different scaling factors, IT2FLC has a total of 2 × (6 × 3+3) = 42 parameters to be optimized. As the PSO will only tune the membership functions of both T1FLC and IT2FLC, the rules are fixed.

In the similar manner, since a different T1FLC is applied to each link, two parameters are sufficient to determine a Gaussian type-1 MF, and 3 different scaling factors, the PSO has to optimize a total of 2 × (6 × 2 + 3) = 30 parameters. As T1FLC and IT2FLC have the same number of MFs and rules, comparing their performance may provide insights into the contributions made by the FOU.

Using the output scaling factor k 0, the fuzzy controller is formed as

$$u = {k_0}y(x).$$
(23)

Each joint is controlled separately using fuzzy controller (23). Thus,

$$u = {[{u_1}\;\;{u_2}]^T}$$
(24)

where u 1 and u 2 are the fuzzy controllers for joint 1 and 2, respectively as expressed in (23).

6 Stability analysis of the control system

In other words, y l in (16) can be rewritten as

$${y_l} = \sum\limits_{i = 1}^L {\bar q_l^i} ({a_{i1}}{x_1} + {a_{i2}}{x_2} + {a_{i0}}) + \sum\limits_{i = L + 1}^M {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _l^i} ({a_{i1}}{x_1} + {a_{i2}}{x_2} + {a_{i0}})$$
(25)

where \(\bar q_l^i = \frac{{{{\bar f}^i}}}{{{D_l}}}\) and \(\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _l^i = \frac{{{{\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} }^i}}}{{{D_l}}}\). In the meantime, we have \({D_l} = \sum {_{i = 1}^L} {\bar f^i} + \sum {_{i = L + 1}^M} {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} ^i}\).

In the similar manner, y r in (17) can be rewritten as

$${y_r} = \sum\limits_{i = 1}^R {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i} ({a_{i1}}{x_1} + {a_{i2}}{x_2} + {a_{i0}}) + \sum\limits_{i = R + 1}^M {\bar q_r^i} ({a_{i1}}{x_1} + {a_{i2}}{x_2} + {a_{i0}})$$
(26)

where \(\bar q_r^i = \frac{{{{\bar f}^i}}}{{{D_l}}}\) and \(\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i = \frac{{{{\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} }^i}}}{{{D_i}}}\) In the meantime, we have \({D_r} = \sum {_{i = 1}^R} {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} ^i} + \sum {_{i = R + 1}^M} {\bar f^i}\).

From (18), after some manipulation, one can obtain

$$y(x) = {C_1}(x){x_1} + {C_2}(x){x_2} + {C_0}(x)$$
(27)

where

$${C_1}(x) = 0.5 \times (\sum\limits_{i = 1}^L {\bar q_l^i{a_{il}}} + \sum\limits_{i = L + 1}^L {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _l^i{a_{il}}} + \sum\limits_{i = 1}^R {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i{a_{il}}} + \sum\limits_{i = R + 1}^M {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i{a_{il}}} )$$
(28)
$${C_2}(x) = 0.5 \times (\sum\limits_{i = 1}^L {\bar q_l^i{a_{i2}}} + \sum\limits_{i = L + 1}^L {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _l^i{a_{i2}}} + \sum\limits_{i = 1}^R {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i{a_{i2}}} + \sum\limits_{i = R + 1}^M {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i{a_{i2}}} )$$
(29)
$${C_0}(x) = 0.5 \times (\sum\limits_{i = 1}^L {\bar q_l^i{a_{i0}}} + \sum\limits_{i = L + 1}^M {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _l^i{a_{i0}}} + \sum\limits_{i = 1}^R {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i{a_{i2}}} + \sum\limits_{i = R + 1}^M {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i{a_{i0}}} ).$$
(30)

The obtained analytical structure of the fuzzy controller improves our study to develop the analysis and design. To normalize the controller, we use the input scaling factors k 1 > 0 and k 2 > 0, and the output scaling factor k 0 > 0. The input vector is formed as

$$x = {[{k_1}{z_1}\;\;{k_2}{z_2}]^T}$$
(31)

where for the i-th joint, z 1 and z 2 are defined as

$${z_1} = {\theta _{di}} - {\theta _i}$$
(32)
$${z_2} = {\dot \theta _{di}} - {\dot \theta _i}$$
(33)

where θ di and θ i are the desired and actual joint position, respectively. From (32) and (33), we have \({\dot z_1}\) = z 2. Using x 1 = k 1 z 1 and x 2 =k 2 z 2, we obtain

$${\dot x_1} = \alpha {x_2}$$
(34)

where α =\(\frac{{{k_1}}}{{{k_2}}}\)> 0.

Fuzzy controller by the use of scaling factors is formed as

$$u(x) = {k_0}({C_1}(x){x_1} + {C_2}(x){x_2} + {C_0}(x)).$$
(35)

This general structure shows a nonlinear variable gain controller that finds many applications in control. The nonlinear gain C i (x) covers the nonlinearity of the controller by parameters in hand. The control purposes are simply described by linguistic rules in fuzzy controller transformed to a nonlinear function as stated by (35).

Substituting (35) into (7) forms the closed loop system as

$$({C_1}(x){x_1} + {C_2}(x){x_2} + {C_0}(x)){k_0} = R{I_a} + L{\dot I_a} + {K_b}{\dot \theta _m}.$$
(36)

Assume that the motor voltage u expressed by (7) is limited such that

$$|R{I_a} + L{I_a} + {K_b}{\dot \theta _m}|\; \leqslant \;{u_{\max }}$$
(37)

where u max > 0 is a maximum permitted voltage for the motor. This assumption is a technical regard to protect the motor against over-voltages. The complexity of design and analysis has been changed to simplicity by using the model of motor in place of model of manipulator. Here, we should know only the upper limits of the motor voltages (u max) as inputs of robotic system. Because electrical motors drive the electrical manipulator, the motor voltages are the system inputs. The desired trajectory should be planned considering the maximum permitted voltages for motors. This means that each motor is so strong that it can track the desired trajectory under the permitted voltage. Moreover, the desired trajectory should be smooth that its derivatives up to the required order are available and limited. To find a control law for the convergence of error, a positive definite function is proposed as

$$V = \int_0^{{x_1}} {{C_2}} (x){x_1}d{x_1}$$
(38)

where V is a positive definite function of x 1 if C 2(x) is positive. To satisfy C 2(x) > 0, it is sufficient that a i 2 ⩾ 0.

Proof. Assume that 0 < C 2 < C 2(x), where C 2 is a positive constant. Thus,

$${C_2}\int_0^{{x_1}} {{x_1}d{x_1}} < \int_0^{{x_1}} {{C_2}} (x){x_1}d{x_1}.$$
(39)

We have \(\int_0^{{x_1}} {{C_2}{x_1}\operatorname{d} {x_1}} = 0.5{C_2}x_1^2\). Hence, \(0.5{C_2}X_1^2 < \int_0^{{x_1}} {{C_2}{x_1}\operatorname{d} {x_1}} \). Thus, (39) implies that V > 0 for x 1 ≠ 0. Since \(\int_0^{{x_1}} {{C_2}{x_1}\operatorname{d} {x_1}} = 0\) and C 2(x)x 1 is limited, V = 0 if x 1 = 0. Thus, V is a positive definite function of x 1.

The time derivative of V is calculated as

$$\dot V = {C_2}(x){x_1}{\dot x_1} = \alpha {C_2}(x){x_1}{x_2}.$$
(40)

From (36), we can write

$${C_2}(x){x_2} = - {C_2}(x){x_1} - {C_0}(x) + \frac{{R{I_a} + L{{\dot I}_a} + {K_b}{{\dot \theta }_m}}}{{{k_0}}}.$$
(41)

Substituting (41) into (40) yields

$$\dot V = - \alpha {C_1}(x)x_1^2 - \alpha {C_0}(x){x_1} + \alpha {x_1} \times \frac{{(R{I_a} + L{{\dot I}_a} + {K_b}{{\dot \theta }_m})}}{{{k_0}}}$$
(42)

Since \( - \alpha {C_1}(x)x_1^2 \leqslant 0\) for C 1(x) ⩾ 0, to satisfy \(\dot V \leqslant 0\) for stability, it is required that

$${x_1}(R{I_a} + L{\dot I_a} + {K_b}{\dot \theta _m}) \leqslant {k_0}{C_0}(x){x_1}$$
(43)

As we known,

$${x_1}(R{I_a} + L{\dot I_a} + {K_b}{\dot \theta _m}) \leqslant \;|{x_1}||R{I_a} + L{\dot I_a} + {K_b}{\dot \theta _m}|\; \leqslant \;|{x_1}|{u_{\max }}.$$
(44)

To satisfy (43), it is sufficient that

$$|{x_1}|{u_{\max }} \leqslant {k_0}{C_0}(x){x_1}.$$
(45)

Since k 0 > 0, to guarantee the stability, x 1 C 0(x) must be positive. This means that C 0(x) must be designed with the same sign as x 1. This condition is simply satisfied if a i 0 is selected with the same sign as x 1.

From (45) and x 1 C 0(x) > 0, we obtain

$$\frac{{{u_{\max }}}}{{|{C_0}(x)|}} \leqslant {k_0}.$$
(46)

From (30), we can obtain

$${c_{0,\min }} \leqslant {C_0}(x) \leqslant {c_{0,\max }}$$
(47)

where c 0,min and c 0,max are two constants. To select a constant value, we should select a value for k 0 that satisfies (46) in all the cases. The maximum permitted value for k 0 is then selected as

$$\frac{{{u_{\max }}}}{{{c_{0,\max }}}} = {k_0}.$$
(48)

Therefore, stability is guaranteed under assumptions C 1(x) > 0,C 2(x) > 0,x 1 C 0(x) > 0 and \(\frac{{{u_{\max }}}}{{{c_{0,\max }}}} = {k_0}\). In the i-th rule, a i 0 is selected with the same sign as x 1 to satisfy x 1 C 0(x) > 0. We can select a i 1 > 0 and a i 2 > 0 in all rules but to satisfy C 2(x) > 0 and x 1 C0( x ) > 0. There is at least one rule that a i 1 > 0 and a i 2 > 0.

Fuzzy rules for i = 1, ⋯ , 9 are designed where the following cases occur:

Case 1. Assume that x 1x2 < 0 result in asymptotic stability by \(\dot V < 0\) < 0 in (40). Thus, u should be small.

Case 2. Assume that x 1 = 0 or x 2 = 0 result in Lyapunov stability by \(\dot V = 0\) = 0 in (40). Thus, u should be medium.

Case 3. Assume that x 1x2 > 0 result in instability by \(\dot V 0\) > 0 in (40). Thus, u should be very high.

The fuzzy rules for the first and second controllers are given as follows:

Rule 1: If x 1 is P and x 2 is P, then y = 1.

Rule 2: If x 1 is P and x 2 is Z, then y = 0.75.

Rule 3: If x 1 is P and x 2 is N, then y = 0.25.

Rule 4: If x 1 is Z and x 2 is P, then y = 0.5.

Rule 5: If x 1 is Z and x 2 is Z, then y = 150x 1 + 10x 2.

Rule 6: If x 1 is Z and x 2 is N, then y = −0.5.

Rule 7: If x 1 is N and x 2 is P, then y = −0.25.

Rule 8: If x 1 is N and x 2 is Z, then y = −0.75.

Rule 9: If x 1 is N and x 2 is N, then y = −1.

Therefore, using the above analysis, x 1 and x 2 are bounded. Then, one can imply the boundedness of u because of boundedness of x 1 and x 2.

Proof. From (28) to (30), C 1(x), C 2(x) and C 0(x) are bounded as

$$|{C_1}(x)|\;\;0.5{\alpha _1}|{x_1}|$$
(49)
$$|{C_2}(x)|\;\;0.5{\alpha _2}|{x_2}|$$
(50)
$$|{C_0}(x)|\; \leqslant \;0.5{\alpha _0}$$
(51)

where

$$\left| {\sum\limits_{i = 1}^L {\bar q_l^i{a_{i1}}} + \sum\limits_{i = L + 1}^M {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _l^i{a_{i1}}} + \sum\limits_{i = 1}^R {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i{a_{i1}}} + \sum\limits_{i = R + 1}^M {\bar q_r^i{a_{i1}}} } \right|\; \leqslant {\alpha _1}$$
(52)
$$\left| {\sum\limits_{i = 1}^L {\bar q_l^i{a_{i2}}} + \sum\limits_{i = L + 1}^M {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _l^i{a_{i2}}} + \sum\limits_{i = 1}^R {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i{a_{i2}}} + \sum\limits_{i = R + 1}^M {\bar q_r^i{a_{i2}}} } \right|\; \leqslant {\alpha _2}$$
(53)
$$\left| {\sum\limits_{i = 1}^L {\bar q_l^i{a_{i0}}} + \sum\limits_{i = L + 1}^M {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _l^i{a_{i0}}} + \sum\limits_{i = 1}^R {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i{a_{i0}}} + \sum\limits_{i = R + 1}^M {\bar q_r^i{a_{i0}}} } \right|\; \leqslant {\alpha _0}$$
(54)

andα 1,α 2, α 0 are constant.

Considering (13) and (14), we have

$${\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{f} ^i}(x) \leqslant 1$$
(55)
$${\bar f^i}(x) \leqslant 1.$$
(56)

Thus, one can imply that \(\bar q_l^i,\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _l^i,\bar q_r^i\) and \(\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{q} _r^i\) are bounded. The coefficient a i 1 is a constant parameter. As a result, inequality (52) is verified.

Similarly, inequality (53) and (54) are proven.

Therefore, u is bounded using (35) as

$$|u|\; \leqslant \;{k_0}({\alpha _1}|{x_1}| + \;{\alpha _2}|{x_2}| + \;{\alpha _0}).$$
(57)

According to the proof given by [31], since the input u is a bounded variable, I a is bounded.

Since the desired joint angle θ d and its time derivative \({\dot \theta _d}\) are bounded, the bounded variables x l and x 2 imply that θ = θ d −x1 and \(\dot \theta = {\dot \theta _d} - {x_2}\) are bounded.

Since I a is bounded, (4) implies that τ is a bounded. From (2), we have

$$J{\ddot \theta _m} + B{\dot \theta _m} + {r^2}K{\theta _m} = \tau + rK\theta .$$
(58)

System (58) is a second order linear system with positive gains J, B, r 2 K, and a limited input τ + rKθ. This system is stable based on the Routh-Hurwitz criterion and implies that θ m, \({\dot \theta _m}\) and \({\ddot \theta _m}\) are bounded.

Since all the states associated with each joint, i.e., θ,\({\dot \theta}\) m ,\({\dot \theta _m}\) and I a , are bounded, vectors θ,\({\dot \theta}\)m,\({\dot \theta _m}\) and I a are bounded. As a conclusion, based on the stability analysis, all the required signals are bounded.

7 Simulation results

In this section, to compare the performance of T1FLC and IT2FLC, the performance of position and tracking control of an electrical flexible-joint articulated robot manipulator are presented. Fig. 6 shows the control system used for obtaining the simulation results. The parameters of the manipulator and motors are given in Tables 1 and 2, respectively. Moreover, the voltage of motors is limited to ±40 V to protect motor from over-voltage. The desired joint trajectory for the joints is shown in Fig. 7. The desired trajectory should be sufficiently smooth such that all its derivatives up to the required order are bounded.

Table 1 The dynamical parameters of robot
Table 2 The motor parameters
Fig. 7
figure 7

Desired joint trajectory

Simulation 1. The control system is simulated for set point control, where a desired value of rad is given to the joints. Set point application is used for point-to-point motion control of robot manipulators. In industry, the set point control is also a dominant approach in the process control. Scaling factors are given in Table 3. To have satisfactory performance, the gains of input and output scaling factors are selected by trial and error method.

Table 3 Scaling factors of type-1 and type-2 FLC

The control system responses using T1FLC and IT2FLC are shown in Fig. 8. As shown in Fig. 8, the performance of the IT2FLC is better than T1FLC to some extent. However, the transient responses of both type of controllers are not good. The responses have overshoot with zero steady state error. An optimization algorithm, such as particle swarm optimization algorithm, can be applied to find optimum values for control design parameters to achieve the desired performance.

Fig. 8
figure 8

Control system responses using type-1 and type-2 FLC

Simulation 2. In this simulation, the performance of controllers in tracking a desired trajectory is compared.

The desired joint trajectory for the joints is shown in Fig. 7. Other conditions are the same as Simulation 1. The control system performs well as shown in Fig. 9, while the maximum values of errors for joints 1–2 are 0.022 rad, 0.02 rad, and 0.0224 rad, 0.022 rad, using T1FLC and IT2FLC, respectively. The motor voltages of both joints are shown in Fig. 10. All of the voltages of motors lie under the valid limited values without chattering problem. It is seen that there is no change in voltage polarity, which offers good reasons to tolerate the high oscillations. In this case, the control efforts perform well. However, the joint tracking errors are not very good.

Fig. 9
figure 9

Tracking performance of type-1 & type-2 FLC

Fig. 10
figure 10

Voltage of motors

Simulation 3. As mentioned earlier, the control design parameters were obtained by trial and error method. However, we can use the proposed PSO algorithm to obtain better performance by finding the optimal control design parameters. In this simulation, the parameters of PSO algorithm presented in Section 4 are set to c 1 = 2.05, c 2 = 2.05 and φ = 0.72. The number of particles and iterations are set as 150 and 100, respectively. As a result of applying the PSO algorithm, the scaling factors of the optimized T1FLC and IT2FLC are reported in Table 4. Moreover, the MFs of the optimized IT2FLC and T1FLC are shown in Figs. 11 and 12, respectively.

Table 4 Scalling factors of the optimized type-1 and type-2 FLC
Fig. 11
figure 11

Membership functions of the optimized type-2 FLC for joint 1 (a,b) and joint 2 (c,d)

Fig. 12
figure 12

Membership functions of the optimized type-1 FLC for joint 1 (a,b) and joint 2 (c,d)

The speed of convergence versus iteration is shown in Fig. 13. It indicates that the fitness values have converged. Another observation is that the additional mathematical dimension provided by the FOU enables IT2FLC to achieve a lower MRSE than T1FLC. Set point performance and tracking errors are shown in Figs. 14 and 15, respectively. The control system behaves well in these cases, as well. As a result of applying optimized T1FLC, the maximum value of tracking error for joint 1 and 2 in the simulations is reached to the value of 7×10−3 and 8×10−3, respectively. As a result of applying optimized IT2FLC, the maximum value of tracking error for joint 1 and 2 in the simulations is reached to the value of 6 × 10−3 and 7.98 × 10-3, respectively. It is seen that the results are much better than simulation 1. To assess the performance of control system better, another desired trajectory is considered as

Fig. 13
figure 13

The cost function of PSO

Fig. 14
figure 14

Set point performance

Fig. 15
figure 15

Tracking performance

$${\theta _d} = \sin (t),\;\;\;\;\theta (0) = 1,\;\;\;\;\;0 \leqslant t \leqslant 10.$$
(59)

The performance of control system is shown in Fig. 16, where the joint tracking error is reduced as well.

Fig. 16
figure 16

Tracking performance

Simulation 4. In this case, for the robustness evaluation of the controllers, external disturbances are added to the robot system. The disturbance is inserted to the input of each motor as a periodic pulse function with a period of 2 s, having a different value of amplitude, with time delay of 0.7 s, and pulse-width 30% of the period[32]. This form of disturbance is general. But it includes jumps to cover the complex cases. All the values of the cost functions for different amplitude of disturbance in the cases of T1FLC and IT2FLC are given in Table 5.

Table 5 Comparison between type-1 and type-2 FLC for different amplitudes of disturbance

As seen from Table 5, the performance of the T1FLC is similar to IT2FLC to some extent as long as the amplitude of disturbance is low or there is no disturbance. However, when the amplitude of disturbance in the Table 5 is increased, it is seen that the performance of T1FLC degrades significantly. Hence, the performance of the T1FLC will be unacceptable under this disturbance. Thus, the T1FLC cannot be used in such noisy environment. On the other hand, IT2FLC can handle the external disturbances to give a very good performance effectively. As a result, the IT2FLC is able to handle the uncertainty and outperform the type-1 controller.

Simulation 5. In this case, the ability of the T1FLC and IT2FLC to handle unmodelled dynamics is investigated. To this end, transport delay is deliberately introduced into the feedback loop[20]. First, a transport delay equalling to 0.2 s is artificially added to the nominal system. The step responses are shown in Fig. 17. When a the transport delay equalling to 0.3s is added to the system, the corresponding step responses are shown in Fig. 18. As shown in Figs. 17 and 18, large oscillations are obtained when T1FLC is used to control the plant. Of the two controllers, IT2FLC provided the best performance as its step responses have the smallest overshoot and are least oscillatory. The simulation results again confirm that the IT2FLC is able to handle the uncertainty and unmodelled dynamics, and outperform the T1FLC controller.

Fig. 17
figure 17

Set point performance under unmodelled dynamics with time delay 0.2 s

Fig. 18
figure 18

Set point performance under unmodelled dynamics with time delay 0.3 s

As a result, the main advantage of the IT2FLC is its ability to eliminate persistent oscillations, especially when unmodelled dynamics is introduced.

8 Conclusions

In this paper, interval type-2 fuzzy logic controller was used to control a two-joint articulated flexible-joint robot driven by permanent magnet direct current motors using voltage control strategy. Stability analysis was presented and the performance of the IT2FLC was compared with that of T1FLC. In addition, an optimal IT2FLC for flexible-joint robot was introduced using particle swarm optimization. In fact, parameters of the primary membership functions of IT2FLC were optimized to improve the performance and increase the accuracy of IT2FLC. We observed using performance criteria such as MRSE, when the amplitude of external disturbance is low, the performance of both T1FLC and IT2FLC is somehow identical. However, it is known that T1FLC can handle the nonlinearities and uncertainties up to some extent. Therefore, by increasing amplitude of external disturbance and considering unmodelled dynamics, the results demonstrate that IT2FLC can outperform T1FLC. Thus, the IT2FLC is more appealing than its type-1 counterpart with regards to accuracy and interpretability. The main advantage of the IT2FLC appears to be its ability to eliminate the persistent oscillations, especially when unmodelled dynamics is introduced. This ability to handle modeling error is particularly useful when fuzzy logic controllers are tuned off-line using PSO.