1 Introduction

The industrial evidence shows that a classical PID controller is the most popular controller for robot manipulators because of its simplicity of operation and its trusted performance, particularly in situations that do not require to know the parameters of the robot dynamics for the control law [1]. However, when trying to have outstanding performance or facing up constraints of real manipulators for example, actuator capabilities, it is essential to have variable gains for these regulators [2] and [3]. There are several control techniques to select the proper gains for the robot control; for instance: adaptive control, fuzzy control and gain scheduling [4,5,6,7]. Notice that the stability analysis in closed loop for the PID control for robot manipulators is generally carried out for controllers PID with fixed gains. In the cases where to maintain an outstanding performance and hold global asymptotic stability for the control system is mandatory, the attribute of fixed gains is unsuitable for those working conditions. It is worth noting that in the field of research and development of manipulator robot control there are still many unsolved cases to be explored. A well known unsolved case is the absence of global asymptotic stability proof for the regulator type PID (with fixed gains) [8]. There are works that only prove local asymptotic stability [7,8,9], or in the best of the cases, semiglobal asymptotic stability [8, 10], for control of robot manipulators with fixed PID gains. The principal works of PID regulators which motivated this paper have been presented in [11,12,13,14]. For the appropriate choice of the derivative and proportional gains in proposed nonlinear PID regulators, we have used a scheme of tuning based in fuzzy logic systems.

In order to remark the current importance of the PID controllers, additional recent PID related works are described in the following. Loucif, F. et al. [15], in 2020, published a work about optimization of a nonlinear PID control for a manipulator robot inspired in whales. Such a work compared with others two bio-inspired optimization algorithms: particle swarm and grey wolf algorithms. Yildiz, H., in 2020 [16], published a comparative study between a robust non-chattering sliding mode control for a line following robot and the conventional PID, also applied at the same robot. Hernández-Guzmán, V. M. et al., in 2018 [17], presented a global asymptotic stability proof applied to a PID position regulator for robot manipulators actuated by permanent magnet synchronous motors. Izadbakhsh, A., in 2019 [18], presented a single-loop PID controller design for electrical flexible-joint robots; based on the Lyapunov’s stability concepts, they proved the link position-tracking errors are asymptotically stable, and experimental implementations supported the proposed theoretical results. In 2018, Mishra, S. K. et al. [19], published a work about PID controllers with feed forward estimation used for fault tolerant control of a hydraulic system.

At the same way, in order to remark the current importance concerning fuzzy control for robotic system, we can mention the following recent works: In 2020, Jokar, H. et al. [20], published a paper about an adaptive fuzzy global fast terminal sliding mode control of an over-actuated flying robot, some simulations were carried out to validate its performance. Taran, B. et al., in 2020 [21], published a paper called “Designing an optimal fuzzy sliding mode control for a two-link robot"; in that work, a fuzzy sliding mode control based on multi-objective genetic algorithm for the path control of a two-link robot was proposed. Some basic fuzzy self-tuning controllers for robot manipulators were presented in Llama, M. et al. 2001 [22], Meza, J- L. et al. 2009 [23]. A seminal book in fuzzy systems and control is that of Wang, L. 1997 [24].

The main contribution in this work is the proposal of a novel global asymptotic stable PID regulator with PD variable gains, selftuned via fuzzy techniques, for robot manipulators. The closed-loop system, in this way, is globally asymptotically stable. With the goal of comparing the performance of the proposed regulator, two different tuning techniques for the PD variable gains, in addition to the fuzzy self-tuning technique, have been introduced. Experimental comparisons among them confirm better performance than the fixed gains scheme. The additional PD tuning techniques are based on piecewise linear functions and exponential functions dependent of the position errors.

The next sections are distributed as follow: In Sect. 2, the dynamics of the robot and its important properties are shown. Sect. 3 presents the nonlinear PID control law with variable gains. Sects. 4 and 5 present global asymptotic stability analysis of the PID control with variable PD gains. In Sect. 6, the reader will find the real-time experimental testing results. Last but not the least, in Sect. 7 the final conclusion will be explained.

2 Robot dynamics model

In order to be ready for stability analysis, we recall the general equation that describes the dynamics of an n-degrees of freedom rigid robot manipulator [25] and [26].

$$ M({\varvec{q}}){\ddot{{\varvec{q}}}} + C({\varvec{q}},\dot{\varvec{q}})\dot{\varvec{q}} + {\varvec{g}}({\varvec{q}}) = {\varvec{\tau}} $$
(1)

In this paper, \({\varvec{\tau}}\) is the applied torques vector of dimension \(n\), \({\varvec{q}}\) is the joint displacements vector of dimension \(n\), the joint velocities \(\dot{\varvec{q}}\) is a vector of dimension \(n\), \({\ddot{{\varvec{q}}}}\) is the vector of dimension \(n\) of joint accelerations, \(M({\varvec{q}})\) is the symmetric positive definite manipulator inertia matrix of dimension \(n{\text{ x }}n\), \(C({\varvec{q}},\dot{\varvec{q}})\) is the matrix of dimension \(n{\text{ x }}n\) of centripetal and Coriolis torques, \({\varvec{g}}({\varvec{q}})\) is the gravitational torques vector of dimension \(n\) obtained as the gradient of the robot potential energy \(U\left( {\varvec{q}} \right)\). It has been assumed that all the links are joined together by revolute joints. Significant properties, definitions, lemmas, theorems and assumptions about the robot dynamics are given next:

Property 1

Kelly et al. [26] The matrix \(C({\varvec{q}},\dot{\varvec{q}})\) and the time derivative \(M({\varvec{q}})\) of the inertia matrix satisfy:

$$ \dot{\varvec{q}}^{T} \left\lfloor {\frac{1}{2}\dot{M}({\varvec{q}}) - C({\varvec{q}},\dot{\varvec{q}})} \right\rfloor \dot{\varvec{q}} = 0\;\forall \;{\varvec{q}},\dot{\varvec{q}} \in {\mathbf{\mathbb{R}}}^{n} \quad {\text{and}}\quad \dot{M}({\varvec{q}}) = C({\varvec{q}},\dot{\varvec{q}}) + C({\varvec{q}},\dot{\varvec{q}})^{T}. $$

Property 2

Kelly et al. [26] For robots having only revolute joints, the vector \({\varvec{g}}\left( {\varvec{q}} \right)\) is Lipschitz; that is, there exists a constant \(k_{g} > 0\) such that \(\left\| {{\varvec{g}}\left( {\varvec{x}} \right) - {\varvec{g}}\left( {\varvec{y}} \right)} \right\| \le k_{g} \left\| {{\varvec{x}} - {\varvec{y}}} \right\|,\) a particular boundedness [27] is:

$$ k_{gi} \ge \sum\nolimits_{j = 1}^{n} \,max\left| {\partial g_{i} \left( q \right)/\partial \left( {q_{j} } \right)} \right|\;{\text{with}} \;i = 1, \ldots , N. $$

Property 3

Kelly et al. [26] There exists a positive constant \(k_{c}\) such that for all \({\varvec{x}},{\varvec{y}},{\varvec{z}} \in {\mathbf{\mathbb{R}}}^{n}\) satisfies:

$$ \left\| {C\left( {{\varvec{x}}\varvec{,}{\varvec{y}}} \right){\varvec{z}}} \right\| \le k_{c} \left\| {\varvec{y}} \right\|\left\| {\varvec{z}} \right\|. $$

Theorem 1

Kelly et al. [26], Khalil [28] (Theorem of mean value). Suppose the continuous vectorial function \({\varvec{f}}:\mathop {\mathbf{\mathbb{R}}}\nolimits^{n} \to \mathop {\mathbf{\mathbb{R}}}\nolimits^{m}\). If \(f_{i} (z_{1} ,z_{2} , \ldots ,z_{n} )\) has continuous partial derivatives for \(i = 1,...,m\), then for each pair of vectors \({\varvec{x}},{\varvec{y}} \in \mathop {\mathbf{\mathbb{R}}}\nolimits^{n}\) and each \( {\varvec{w}} \in \, {\mathbf{\mathbb{R}}}^{n}\) there exists \({\varvec{\xi}} \in {\mathbf{\mathbb{R}}}^{n}\) such that \([f({\varvec{x}}) - f({\varvec{y}})]^{T} {\varvec{w}} = \mathop {\varvec{w}}\nolimits^{T} \mathop {\left. {\frac{{\partial f({\varvec{z}})}}{{\partial {\varvec{z}}}}} \right|}\nolimits_{{{\varvec{z}} = {\varvec{\xi}}}} ({\varvec{x}} - {\varvec{y}})\), where \({\varvec{\xi}}\) is a vector on the line segment that joins the vectors \({\varvec{x}}\) and \({\varvec{y}}\).

Theorem 2

Kelly et al. [26] Let \(f:{\mathbf{\mathbb{R}}}^{n} \to {\mathbf{\mathbb{R}}}\) be a continuous differentiable function with continuous partial derivatives up to at least second order. Assume that: \(f(0) = 0 \in {\mathbf{\mathbb{R}}}\) and \(\frac{\partial f}{{\partial {\varvec{x}}}}({\mathbf{0}}) = {\mathbf{0}} \in \mathop {\mathbf{\mathbb{R}}}\nolimits^{n}\). If the Hessian matrix \((\partial /\partial x)[\partial f(x)/\partial x]\) is positive definite for all \({\varvec{x}} \in \mathop {\mathbf{\mathbb{R}}}\nolimits^{n}\), then \(f({\varvec{x}})\) is a globally positive definite function.

Lemma 1

Llama et al. [22] Let matrix \(K_{x} \left( {\varvec{x}} \right):\mathop {\mathbf{\mathbb{R}}}\nolimits^{n} \to \mathop {\mathbf{\mathbb{R}}}\nolimits^{n \times n}\) be a diagonal matrix with entries \(k_{i} (x_{i} )\) having the following structure: \(K_{x} \left( {\varvec{x}} \right) = {\text{diag}}\left[ {\begin{array}{*{20}c} {k_{x1} \left( {x_{1} } \right)} & {k_{x2} \left( {x_{2} } \right)} & \cdots & {k_{xn} \left( {x_{n} } \right)} \\ \end{array} } \right]\), and assume that there exist constant entries \(k_{li}\) and \(k_{ui}\) where \(k_{ui} > k_{li} > 0\) such that \(k_{ui} \ge k_{xi} \left( {x_{i} } \right) \ge k_{li}\) for all \(k_{{x_{i} }} \left( {x_{i} } \right)\) with \(x_{i} \in {\mathbf{\mathbb{R}}}\) and \(i = 1,...,n\), then \(\frac{1}{2}k_{ui} \mathop {\left| {x_{i} } \right|}\nolimits^{2} \ge \int_{0}^{x} \,\xi_{i} k_{{x_{i} }} \left( {\xi_{i} } \right)d\xi_{i} \ge \frac{1}{2}k_{li} \mathop {\left| {x_{i} } \right|}\nolimits^{2} .\)

Definition 1

Kelly [29] Let \({\text{F}}\left( {m,\varepsilon ,{\varvec{x}}} \right)\) with \(1 \ge m \ge 0\), \(\varepsilon > 0\) and \({\varvec{x}} \in \mathop {\mathbf{\mathbb{R}}}\nolimits^{n}\) denote the set of all continuously differentiable increasing functions: \({\mathbf{sat}}\left( {\varvec{x}} \right) = \left[ {\begin{array}{*{20}c} {{\text{sat}}\left( {x_{1} } \right)} & {{\text{sat}}\left( {x_{2} } \right)} & \ldots & {{\text{sat}}\left( {x_{n} } \right)} \\ \end{array} } \right]^{T}\), such that: \(\left| x \right| \ge {\text{sat}}\left( x \right) > m\left| x \right|\;\forall \;x \in {\mathbf{\mathbb{R}}}:\left| {\varvec{x}} \right| < \varepsilon\), \(\varepsilon \ge \left| {{\text{sat}}\left( {\text{x}} \right)} \right| > m\varepsilon \;\forall \;x \in {\mathbf{\mathbb{R}}}:\left| x \right| \ge \varepsilon\), \(1 \ge d\left( {{\text{sat}}\left( x \right)} \right)/dx > 0\;\forall \;x \in {\mathbf{\mathbb{R}}}\). A particular case of this class of saturating functions is \({\text{sat}}\left( x \right) = {\text{tanh}}(x).\)

Definition 2

Hernandez et al. [27] Let \(A\) be a \(n \times n\) matrix with \(a_{i,j}\) representing its elements at row \(i\) and column \(j\). The matrix \(A\) is said to be strictly diagonally dominant if:

$$ \left| {a_{i,j} } \right| > \sum\limits_{i = 1,j \ne i}^{n} \,\left| {a_{i,j} } \right|,\quad i = 1,2, \ldots ,n. $$

Definition 3

Hernandez et al. [27] If \(A\) is a \(n \times n\) symmetric and strictly diagonally dominant matrix and if \(a_{i,i} >\) 0 for all \(i = 1,2, \ldots ,n\), then \(A\) is positive definite.

Lemma 2

Orrante et al. [13] If \(A \in \mathop {\mathbf{\mathbb{R}}}\nolimits^{n \, x \, n}\) fulfills Definitions 2 and 3, and \({\mathbf{sat}}\left( x \right)\) fulfills Definition 1, then:

$$ {\mathbf{sat}}\mathop {\left( {\varvec{x}} \right)}\nolimits^{T} A{\varvec{x}}\quad > \quad 0\quad \forall \;{\varvec{x}} \in \mathop {\mathbf{\mathbb{R}}}\nolimits^{n} \,{\text{with}}\;{\varvec{x}} \ne 0\quad \in \mathop {\mathbf{\mathbb{R}}}\nolimits^{n}. $$

Assumption 1

There exist positive constant matrices \(K_{u}\), \(K_{l}\) such that Lemma 1 can be applied. That is:

$$ \frac{1}{2}\mathop {\tilde{\varvec{q}}}\nolimits^{T} K_{u} \tilde{\varvec{q}} \ge \int_{0}^{{\tilde{\varvec{q}}}} \,\mathop {\varvec{\xi}}\nolimits^{T} K\left( {\mathop {\varvec{\xi}}\nolimits_{k} } \right)d\mathop {\varvec{\xi}}\nolimits_{k} : = \sum\limits_{i = 1}^{n} \,\int_{0}^{{\tilde{q}_{i} }} \,\xi_{i} k_{i} \left( {\xi_{i} } \right)d\xi_{i} \ge \frac{1}{2}\mathop {\tilde{\varvec{q}}}\nolimits^{T} K_{l} \tilde{\varvec{q}} \ge {\mathbf{sat}}(\tilde{\varvec{q}})^{T} \left( {\frac{{K_{l} }}{2}} \right){\mathbf{sat}}(\tilde{\varvec{q}}) $$
(2)
$$ {\text{and}}\quad \frac{1}{2}{\mathbf{sat}}(\tilde{\varvec{q}})^{T} K_{u} {\mathbf{sat}}(\tilde{\varvec{q}}) \ge \int_{0}^{{\tilde{\varvec{q}}}} \,{\mathbf{sat}}({\varvec{\xi}})^{T} K\left( {\varvec{\xi}} \right)d{\varvec{\xi}}: = \sum\limits_{i = 1}^{n} \,\int_{0}^{{\tilde{q}_{i} }} \,\xi_{i} k_{i} \left( {\xi_{i} } \right)d\xi_{i} \ge \frac{1}{2}{\mathbf{sat}}(\tilde{\varvec{q}})^{T} K_{l} {\mathbf{sat}}(\tilde{\varvec{q}}) $$
(3)

where \(K_{u}\), \(K_{l}\) are \(n \times n\) constant positive definite diagonal matrices whose entries are \(k_{{u_{i} }}\), \(k_{{l_{i} }}\), respectively, with \(i = 1,2, \cdots ,n\).\

3 The proposed control law

The PID regulator is a famous set point control strategy for manipulators that makes sure asymptotic stability for fixed symmetric positive definite gain matrices. To improve the performance of the closed-loop system, it may be advisable to have variable gains [11]. In this paper, a novel PID type controller is presented whose major attribute is that stability is held notwithstanding the gain parameters depend on the positions of the robot. In [13, 29 and 30], a class of nonlinear PID global regulators with fixed gains was introduced and studied. In the current work, we have extended, the previous regulator with the end of suitably varying the proportional and derivative gains in function of the positions. This leads to the following proposed control law:

$$ {\varvec{\tau}} = K_{p} \left( {\tilde{\varvec{q}}} \right)\tilde{\varvec{q}} - K_{v} \left( {\tilde{\varvec{q}}} \right)\dot{\varvec{q}} + K_{i} \int_{0}^{t} \,\left[ {\alpha {\mathbf{sat}}\left( {\tilde{\varvec{q}}(\sigma )} \right) - \dot{\varvec{q}}} \right]d\sigma $$
(4)

where \(K_{p} \left( {\tilde{\varvec{q}}} \right)\), \(K_{v} \left( {\tilde{\varvec{q}}} \right)\) and \(K_{i}\) are positive definite diagonal \(n \times n\) matrices, whose entries are denoted by \(k_{{p_{i} }} \left( {\mathop {\tilde{q}}\nolimits_{i} } \right)\), \(k_{{v_{i} }} \left( {\mathop {\tilde{q}}\nolimits_{i} } \right)\) and \(k_{{i_{i} }}\), respectively, \(\alpha > 0\) and \(\tilde{\varvec{q}} = \mathop {\varvec{q}}\nolimits_{d} - {\varvec{q}}\) denotes the position error vector with \(\mathop {\varvec{q}}\nolimits_{d}\) being the instant desired position.

The closed-loop system is obtained by substituting the control law (4) into the robot dynamics (1), see Fig. 1. The closed-loop equation can be written as

$$ \frac{d}{dt}\left[ {\begin{array}{*{20}c} {\tilde{\varvec{q}}} \\ {\dot{\varvec{q}}} \\ {\varvec{w}} \\ \end{array} } \right] = \left[ {\begin{array}{*{20}c} { - {\varvec{q}}} \\ {M({\varvec{q}})^{ - 1} [ - C({\varvec{q}},\dot{\varvec{q}})\dot{\varvec{q}} - g({\varvec{q}}) + {\varvec{g}}(\mathop {\varvec{q}}\nolimits_{d} ) + K_{p} \left( {\tilde{\varvec{q}}} \right)\tilde{\varvec{q}} - K_{v} \left( {\tilde{\varvec{q}}} \right)\dot{\varvec{q}} + K_{i} {\varvec{w}}]} \\ {\alpha {\mathbf{sat}}\left( {\tilde{\varvec{q}}} \right) - \dot{\varvec{q}}} \\ \end{array} } \right] $$
(5)
Fig. 1
figure 1

Block diagram of the closed-loop system

where \({\varvec{w}}\) is defined as:

$$ {\varvec{w}} = \int_{0}^{t} \,\left[ {\alpha {\mathbf{sat}}\left( {\tilde{\varvec{q}}(\sigma )} \right) - \dot{\varvec{q}}} \right]d\sigma - K_{i}^{ - 1} {\varvec{g}}\left( {\mathop {\varvec{q}}\nolimits_{d} } \right) $$

and we have that (5) becomes an autonomous nonlinear differential equation whose origin \(\mathop {\left[ {\begin{array}{*{20}c} {\mathop {\tilde{\varvec{q}}}\nolimits^{T} } & {\mathop {\dot{\varvec{q}}}\nolimits^{T} } & {\mathop {\varvec{w}}\nolimits^{T} } \\ \end{array} } \right]}\nolimits^{T} = 0 \in \mathop {\mathbf{\mathbb{R}}}\nolimits^{3n}\) is the unique equilibrium point.

4 Analysis of global asymptotic stability

In this segment, it is proven that the proposed control law (4) leads to a globally asymptotically stable closed-loop system, with proportional and derivative variable gain matrices. This stability analysis has been motivated by the works of [11, 13, 23, 29] and [30].

4.1 Lyapunov function candidate

In order to study the stability of the equilibrium point (5), the following Lyapunov function candidate is proposed:

$$ \begin{aligned} V\left( {\tilde{\varvec{q}},\dot{\varvec{q}},{\varvec{w}}} \right) & = \int_{0}^{{\tilde{\varvec{q}}}} \,\mathop {\varvec{\xi}}\nolimits^{T} K_{p} \left( {\varvec{\xi}} \right)d{\varvec{\xi}} + \alpha \int_{0}^{{\tilde{\varvec{q}}}} \,\mathop {{\mathbf{sat}}\left( {\varvec{\xi}} \right)}\nolimits^{T} K_{v} \left( {\varvec{\xi}} \right)d{\varvec{\xi}} + U\left( {\varvec{q}} \right) - U\left( {\mathop {\varvec{q}}\nolimits_{d} } \right) \\ & \quad + {\varvec{g}}\mathop {\left( {\mathop {\varvec{q}}\nolimits_{d} } \right)}\nolimits^{T} \tilde{\varvec{q}} + \frac{1}{2}\mathop {\dot{\varvec{q}}}\nolimits^{T} M\left( {\varvec{q}} \right)\dot{\varvec{q}} - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} M\left( {\varvec{q}} \right)\dot{\varvec{q}} + \mathop {\varvec{w}}\nolimits^{T} K_{i} {\varvec{w}} .\\ \end{aligned} $$
(6)

Note that under Assumption 1, the function in (6) can be lower bounded as:

$$ \begin{aligned} V(\tilde{\varvec{q}},\dot{\varvec{q}},{\varvec{w}}) \ge V_{L} (\tilde{\varvec{q}},\dot{\varvec{q}},{\varvec{w}}):= & \frac{1}{2}\mathop {\tilde{\varvec{q}}}\nolimits^{T} K_{pl} \tilde{\varvec{q}} + \frac{\alpha }{2}{\mathbf{sat}}(\tilde{\varvec{q}})^{T} K_{vl} {\mathbf{sat}}(\tilde{\varvec{q}}) + U\left( {\varvec{q}} \right) - U\left( {\mathop {\varvec{q}}\nolimits_{d} } \right) + {\varvec{g}}\mathop {\left( {\mathop {\varvec{q}}\nolimits_{d} } \right)}\nolimits^{T} \tilde{\varvec{q}} \\ & \quad + \frac{1}{2}\mathop {\dot{\varvec{q}}}\nolimits^{T} M\left( {\varvec{q}} \right)\dot{\varvec{q}} - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} M\left( {\varvec{q}} \right)\dot{\varvec{q}} + \mathop {\varvec{w}}\nolimits^{T} K_{i} {\varvec{w}} . \\ \end{aligned} $$
(7)

Now, we will give sufficient conditions to make \(V_{L} \left( {\tilde{\varvec{q}},\dot{\varvec{q}},{\varvec{w}}} \right)\) be a positive definite function. The sum of \(\mathop {\frac{1}{2}\tilde{\varvec{q}}}\nolimits^{T} K_{pl} \tilde{\varvec{q}} + U\left( {\varvec{q}} \right) - U\left( {\mathop {\varvec{q}}\nolimits_{d} } \right) + {\varvec{g}}\mathop {\left( {\mathop {\varvec{q}}\nolimits_{d} } \right)}\nolimits^{T} \tilde{\varvec{q}}\) is positive definite if \(k_{pli} > k_{gi}\), according to Theorem 2 and Definition 2 and 3, [14]. Due to \(K_{i} > 0\), we have \(\frac{1}{2}{\varvec{w}}^{T} K_{i} {\varvec{w}}\) is positive definite. By reordering the terms \(\frac{1}{2}\mathop {\dot{\varvec{q}}}\nolimits^{T} M\left( {\varvec{q}} \right)\dot{\varvec{q}} - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} M\left( {\varvec{q}} \right){\dot{{\varvec{q}}} = }\frac{1}{2}\mathop {\left[ {\dot{\varvec{q}} - \alpha {\mathbf{sat}}\left( {\tilde{\varvec{q}}} \right)} \right]}\nolimits^{T} M\left( {\varvec{q}} \right) = \left[ {\dot{\varvec{q}} - \alpha {\mathbf{sat}}\left( {\tilde{\varvec{q}}} \right)} \right] - \frac{{\alpha^{2} }}{2}{\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} M\left( {\varvec{q}} \right){\mathbf{sat}}\left( {\tilde{\varvec{q}}} \right)\), and taking into account the term \(\frac{\alpha }{2}{\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} K_{vl} \:{\mathbf{sat}}\left( {\tilde{\varvec{q}}} \right)\), it is possible to rewrite:

$$ \begin{aligned} & \frac{1}{2}\mathop {\dot{\varvec{q}}}\nolimits^{T} M\left( {\varvec{q}} \right)\dot{\varvec{q}} - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} M\left( {\varvec{q}} \right)\dot{\varvec{q}} + \frac{\alpha }{2}{\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} K_{vl} \:{\mathbf{sat}}\left( {\tilde{\varvec{q}}} \right) \\ & \ge \frac{1}{2}\mathop {\left[ {\dot{\varvec{q}} - \alpha {\mathbf{sat}}\left( {\tilde{\varvec{q}}} \right)} \right]}\nolimits^{T} M\left( {\varvec{q}} \right)\left[ {\dot{\varvec{q}} - \alpha {\mathbf{sat}}\left( {\tilde{\varvec{q}}} \right)} \right] + \frac{\alpha }{2}[\lambda_{m} \left\{ {K_{vl} } \right\} - \alpha \lambda_{M} \left\{ {M\left( {\varvec{q}} \right)} \right\}]\mathop {\left\| {{\mathbf{sat}}\left( {\tilde{\varvec{q}}} \right)} \right\|}\nolimits^{2} , \\ \end{aligned} $$

those last terms are positive definite if \(\lambda_{m} \left\{ {K_{vl} } \right\} - \alpha \lambda_{M} \left\{ {M\left( {\varvec{q}} \right)} \right\} > 0\). Then, the positiveness conditions are:

$$ k_{pli} > k_{gi} \quad {\text{and}}\quad \frac{{\lambda_{m} \left\{ {K_{vl} } \right\}}}{{\lambda_{M} \left\{ {M\left( {\varvec{q}} \right)} \right\}}} \ge \alpha $$
(8)

In sum, the Lyapunov function candidate (10) is a globally positive definite function \(V\left( {\tilde{\varvec{q}},\dot{\varvec{q}},{\varvec{w}}} \right) > 0\;\forall \left[ {\begin{array}{*{20}c} {\tilde{\varvec{q}}} & {\dot{\varvec{q}}} & {\varvec{w}} \\ \end{array} } \right]^{T} \ne 0 \in {\mathbf{\mathbb{R}}}^{n}\), under the conditions (8).

4.2 Time derivative of the Lyapunov function candidate

The time derivative of the Lyapunov function candidate (6) along the trajectories of the closed-loop Eq. (5) leads to

$$ \begin{aligned} \dot{V}\left( {\tilde{\varvec{q}},\dot{\varvec{q}},{\varvec{w}}} \right) &= \mathop {\tilde{\varvec{q}}}\nolimits^{T} K_{p} \left( {\tilde{\varvec{q}}} \right){\dot{\tilde{{\varvec{q}}}}} + {\varvec{g}}\mathop {\left( {\varvec{q}} \right)}\nolimits^{T} \dot{\varvec{q}} + {\varvec{g}}\mathop {\left( {\mathop {\varvec{q}}\nolimits_{d} } \right)}\nolimits^{T} {\dot{{\varvec{\tilde{q}}}}} + \frac{1}{2}\mathop {\dot{\varvec{q}}}\nolimits^{T} \dot{M}\left( {\varvec{q}} \right)\dot{\varvec{q}} - \alpha {\mathbf{s}}{\dot{\bf a}}{\bf t}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} M\left( {\varvec{q}} \right)\dot{\varvec{q}} + \dot{\varvec{q}}M\left( {\varvec{q}} \right)\ddot{\varvec{{q}}} \\ & \quad - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} \dot{M}\left( {\varvec{q}} \right){\varvec{q}} - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} M\left( {\varvec{q}} \right){\ddot{{\varvec{q}}}} + \mathop {\varvec{w}}\nolimits^{T} K_{i} \dot{\varvec{w}} + \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} K_{v} \left( {\tilde{\varvec{q}}} \right){\dot{\tilde{{\varvec{q}}}},} \\ \end{aligned} $$
(9)

where we have used the Leibnitz’s rule for differentiation of integrals and Property 1. By substituting the closed-loop value of \({\ddot{{\varvec{q}}}}\) (5) in (9), we have the following simplified expression:

$$ \begin{aligned} \dot{V}\left( {\tilde{\varvec{q}},\dot{\varvec{q}},{\varvec{w}}} \right) & = - \mathop {\dot{\varvec{q}}}\nolimits^{T} K_{v} \left( {\tilde{\varvec{q}}} \right)\dot{\varvec{q}} - \alpha {\mathbf{s\dot{a}t}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} M\left( {\varvec{q}} \right)\dot{\varvec{q}} - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} C^{T} ({\varvec{q}},\dot{\varvec{q}})\dot{\varvec{q}} \\ & \quad - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} K_{p} \left( {\tilde{\varvec{q}}} \right)\tilde{\varvec{q}} - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} {\varvec{g}}(\mathop {\varvec{q}}\nolimits_{d} ) + \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} {\varvec{g}}({\varvec{q}}). \\ \end{aligned} $$
(10)

Due to \(K_{v} > 0\) hence \(- \mathop {\dot{\varvec{q}}}\nolimits^{T} K_{v} \left( {\tilde{\varvec{q}}} \right)\dot{\varvec{q}}\) is negative definite. Next, we provide upper bounds on the following terms:

$$ \begin{aligned} & - \alpha {\mathbf{s\dot{a}t}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} M\left( {\varvec{q}} \right)\dot{\varvec{q}} \le \alpha \lambda_{M} \left\{ {M\left( {\varvec{q}} \right)} \right\}\mathop {\left\| {\dot{\varvec{q}}} \right\|}\nolimits^{2} ,\quad - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} C^{T} ({\varvec{q}},\dot{\varvec{q}})\dot{\varvec{q}} \le \alpha k_{c} \sqrt n \zeta \mathop {\left\| {\dot{\varvec{q}}} \right\|}\nolimits^{2} , \\ & - \frac{1}{2}\mathop {\dot{\varvec{q}}}\nolimits^{T} K_{v} \left( {\tilde{\varvec{q}}} \right)\dot{\varvec{q}} \le - \frac{1}{2}\lambda_{m} \left\{ {K_{v} \left( {\tilde{\varvec{q}}} \right)} \right\}\mathop {\left\| {\dot{\varvec{q}}} \right\|}\nolimits^{2} \:, \\ \end{aligned} $$

and by means of Theorem 1, we have:

$$ - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} \left[ {{\varvec{g}}(\mathop {\varvec{q}}\nolimits_{d} ) - {\varvec{g}}({\varvec{q}})} \right] = - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} \mathop {\left. {\frac{{\partial {\varvec{g}}({\varvec{z}})}}{{\partial {\varvec{z}}}}} \right|}\nolimits_{{{\varvec{z}} = {\varvec{\xi}}}} \tilde{\varvec{q}}\:. $$

Using the Definitions 2 and 3, and Lemma 1, it is possible to establish that [12]

$$ - \alpha {\mathbf{sat}}\mathop {\left( {\tilde{\varvec{q}}} \right)}\nolimits^{T} \left[ {K_{p} + \mathop {\left. {\frac{{\partial {\varvec{g}}({\varvec{z}})}}{{\partial {\varvec{z}}}}} \right|}\nolimits_{{{\varvec{z}} = {\varvec{\xi}}}} } \right]\tilde{\varvec{q}} < 0 \, \forall \tilde{\varvec{q}} \ne 0 \in {\mathbf{\mathbb{R}}}^{n} \;{\text{If}}\;k_{pli} > k_{gi} ; $$

this also allows us to establish that, if

$$ \frac{{\tfrac{1}{2}\lambda_{m} \left\{ {K_{v} \left( {\tilde{\varvec{q}}} \right)} \right\}}}{{\lambda_{M} \left\{ {M\left( {\varvec{q}} \right)} \right\} + k_{c} \sqrt n \zeta }} > \alpha \quad {\text{and}}\quad k_{pli} > k_{gi}, $$
(11)

then \(\dot{V}\left( {\tilde{\varvec{q}},\dot{\varvec{q}},{\varvec{w}}} \right)\) is a globally negative semidefinite function. By using the fact that the Lyapunov function candidate (6) is radially unbounded and globally positive definite, and its time derivative is a globally negative semidefinite function, we can conclude that the equilibrium of the closed-loop system (5) is stable. Finally, by invoking the Lasalle’s invariance principle, the conclusion is that the equilibrium of the closed-loop system is globally asymptotically stable for the regulation case.

5 PD-gains tuning.

This section is devoted to describe the most convenient way of varying the PD gains in function of the position errors, which allows us to avoid saturations in the actuator torques (when the errors are large) and to have small errors in the steady state (by increasing the proportional gains in this stage). The transitory response is also governed by the derivative gains in function of the position errors. The inclusion of the particular integral action, proposed in this work, leads to globally effects; that is, the asymptotic stability of the equilibrium (convergence of the errors toward zero) is reached globally (the initial conditions can be arbitrarily large). The integral gain does not require, in our analysis, to be variable, is enough be a fixed gain. A future study, about the effects of also adapting the integral gain in function of the position error, will be considered due to the possible effects in the performance of the position response.

For the case of variable gains by self-tuning PD matrix functions techniques, three techniques are implemented: fuzzy self-tuning, piecewise-linear self-tuning and exponential self-tuning. Fig. 2 shows the different slope shapes for the implemented functions for the programmed tuning of the PD variable gains, in a general aspect. A general description for each of the proposed techniques is shown in the following subsections.

Fig. 2
figure 2

General shapes of tuning for \(K_{p}\) and \(K_{v}\): a fuzzy functions, b piecewise-linear functions and c exponential functions

5.1 Fuzzy self-tuning PD functions technique

The Fuzzy Logic Tuner (FLT) proposed for obtaining the slope shape of the PD variable gains is based in [22]. With the intention of reducing the computation of the real-time controller and obtaining the desired mapping shape, simple strategies of design were selected; these are: Mamdani’s rule base, trapezoidal input membership functions, singleton output membership functions, singleton fuzzification, product inference and the centroid defuzzification method. Fig. 3 shows a block diagram of the FLT.

Fig. 3
figure 3

Block diagram for the Fuzzy Logic Tuner

The input membership functions are triangular and normalized, and the output membership functions are singleton type, see Fig. 4. The fuzzy logic rule base is:

$$ {\text{IF}}\;\tilde{q}\;{\text{is}}\;A^{l} \;{\text{THEN}}\;K\;{\text{is}}\;B^{l} $$
Fig. 4
figure 4

Input and output membership functions, respectively

The maximum defuzzifier chooses the output \(k\) as the point in V (crisp set of all possible outputs) at which achieves its maximum value [24]. Define the set \({\text{hgt}}(B^{l} ) = \left\{ {\left. {k \in K} \right|\mu_{{B^{l} }} = sup\mu_{{B^{l} }} (k)} \right\}\) that is, \({\text{hgt}}(B^{l} )\) is the set of all points in \(K\) at which \(\mu_{{B^{l} }}\) achieves its maximum value. The maximum defuzzifier defines \(k^{ * }\) as an arbitrary element in \({\text{hgt}}(B^{l} )\), that is, \(k^{ * } = {\text{any}}\;{\text{point}}\;{\text{in}}\;{\text{hgt}}(B^{l} ).\) If \({\text{hgt}}(B^{l} )\) contains a single point, then \(k^{ * }\) is uniquely defined.

The parameters for the fuzzy self-tuning are four, a pair for each joint. Tables 1 and 2 show the parameters of the fuzzy self-tuning of the PD variable gains.

Table 1 Parameters of the fuzzy tuner of the joint 1
Table 2 Parameters of the fuzzy tuner of the joint 2

5.2 Piecewise-linear PD functions technique

For this case, the gains of the nonlinear PID regulator with PD variable gains are tuned by a piecewise-linear function technique, determined by the following relation: \(k_{{p_{1} }} = 7000 - 6.73 \cdot 10^{5} \left| {\tilde{q}_{1} } \right|\), \(k_{{p_{2} }} = 700 - 1.4 \cdot 10^{4} \left| {\tilde{q}_{2} } \right|\), \(k_{{v_{1} }} = 398 - 7.87 \cdot 10^{3} \left| {\tilde{q}_{1} } \right|\), \(k_{{v_{2} }} = 40.3 - 3.8 \cdot 10^{3} \left| {\tilde{q}_{2} } \right|\). The units of the gains for \(K_{p}\) and \(K_{v}\) are [N m / rad], [N m seg / rad], respectively, and \(\tilde{q}\) is in [rad].

In order to satisfy the stability conditions given in (11) is necessary to add low boundaries to \(K_{p}\) and \(K_{v}\). The low boundaries are \(K_{p} = {\text{diag}}\left\{ {{43}.{7},{ 4}.{1}} \right\}\), \(K_{v} = {\text{diag}}\left\{ {{34},{ 4}.{3}} \right\}\).

5.3 Exponential PD functions technique

The exponential tuning scheme is based on exponential functions of position errors, as follow: \(K_{p} = {\text{diag}}\left\{ {f_{p1} (\mathop {\tilde{q}}\nolimits_{1} ),f_{p2} (\mathop {\tilde{q}}\nolimits_{2} )} \right\}\) [Nm/rad], \(K_{v} = {\text{diag}}\left\{ {f_{v1} (\mathop {\tilde{q}}\nolimits_{1} ),f_{v2} (\mathop {\tilde{q}}\nolimits_{2} )} \right\}\), where \(f_{p1} ( \, \mathop {\tilde{q}}\nolimits_{1} \, ) = 43.7 + 3000.7 \, e^{{( \, - \, 46.197 \, \left| {\mathop { \, \tilde{q}}\nolimits_{1} \, } \right| \, )}}\), \(f_{p2} (\mathop { \, \tilde{q}}\nolimits_{2} \, ) = 4.1 + 700.1 \, e^{{( \, - \, 46.332 \, \left| {\mathop { \, \tilde{q}}\nolimits_{2} \, } \right| \, )}}\), \(f_{v1} ( \, \mathop {\tilde{q}}\nolimits_{1} \, ) = 34 + 60.1 \, e^{{( \, - \, 32.37 \, \left| {\mathop { \, \tilde{q}}\nolimits_{1} \, } \right| \, )}}\), \(f_{v2} ( \, \mathop {\tilde{q}}\nolimits_{2} \, ) = 4.3 + 20.3 \, e^{{( \, - \, 57.66 \, \left| {\mathop { \, \tilde{q}}\nolimits_{2} \, } \right| \, )}}\).

6 Real-time experimental testing

The testbed manipulator arm (see Fig. 5) is a prototype built at CICESE Research Center, Mexico and located at Instituto Tecnológico de La Laguna, México [31].

Fig. 5
figure 5

Photograph and schematic diagram of the CICESE Robot

Eq. (1) with the CICESE Robot parameters results:

$$ \begin{aligned} &\overbrace {{ \left[ {\begin{array}{*{20}c} {m_{1} l_{{c1}}^{2} + m_{2} \left[ {l_{1}^{2} + l_{{c2}}^{2} + 2l_{1} l_{{c2}} \cos \left( {q_{2} } \right)} \right] + I_{1} + I_{2} } & {m_{2} \left[ {l_{{c2}}^{2} + l_{1} l_{{c2}} \cos \left( {q_{2} } \right)} \right] + I_{2} } \\ {m_{2} \left[ {l_{{c2}}^{2} + l_{1} l_{{c2}} \cos \left( {q_{2} } \right)} \right] + I_{2} } & {m_{2} l_{{c2}}^{2} + I_{2} } \\ \end{array} } \right]}}^{{M(\varvec{q})}}{\ddot{{\varvec{q}}}} \\ & + \overbrace {{\left[ {\begin{array}{*{20}c} { - m_{2} l_{1} l_{{c2}} \sin \left( {q_{2} } \right)\dot{q}_{2} } & { - m_{2} l_{1} l_{{c2}} \sin \left( {q_{2} } \right)\left[ {\dot{q}_{1} + \dot{q}_{2} } \right]} \\ {m_{2} l_{1} l_{{c2}} \sin \left( {q_{2} } \right)\dot{q}_{1} } & 0 \\ \end{array} } \right]}}^{{C(\varvec{q},{\dot{{\varvec{q}}}})}}{\dot{\varvec{q}}} + \overbrace {{\left[ {\begin{array}{*{20}c} {\left[ {m_{1} l_{{c1}} + m_{2} l_{1} } \right]g\sin \left( {q_{1} } \right) + m_{2} l_{{c2}} g\sin \left( {q_{1} + q_{2} } \right)} \\ {m_{2} l_{{c2}} g\sin \left( {q_{1} + q_{2} } \right)} \\ \end{array} } \right]}}^{{\varvec{g}(\varvec{q})}} = \varvec{\tau } \\ \end{aligned} $$

where the physical values of the parameters are shown in Table 3. The structure of the elements of the dynamics of the manipulator satisfies the important Properties 1 to 3 mentioned in Sect. 2 (see, e.g., [22, 23]).

Table 3 Physical parameters of the CICESE Robot

The control law with constant gains used in the experiments for comparison purposes is given by

$$ {\varvec{\tau}} = K_{p} \tilde{\varvec{q}} - K_{v} \dot{\varvec{q}} + K_{i} \int_{0}^{t} \,\left[ {\alpha {\mathbf{sat}}\left( {\tilde{\varvec{q}}(\sigma )} \right) - \dot{\varvec{q}}} \right]d\sigma $$
(12)

Comparison experiments among the PID regulator with constant gains (12), and the proposed PID regulators, given by (4), with PD variable gains, have been carried out.

In both cases, constant and variable PD gains, the parameters \(\alpha\) and \(k_{i}\)’s were maintained unaltered, the values assigned for \(\alpha\) is 1.5 and for \(k_{i1} = 100\) [Nm/s-rad]; \(k_{i2} = 10\) [Nm/s-rad]. For the case with constant gains, the values were assigned: \(k_{p1} = 58.7\) [Nm/rad], \(k_{p2} = 4.1\) [Nm/rad], \(k_{v1} = 34.0\) [Nm-s/rad]; \(k_{v2} = 4.3\) [Nm-s/rad], where the subscripts 1 and 2 have been used to distinguish the shoulder and the elbow joint, respectively.

The experimental results show the usefulness of the regulator proposed with three different techniques of self-tuning PD gains. The experimental results are shown in Figs. 6, 7, 8, 9, 10, 11,1213. They show the actual joint positions and applied torques for the proposed control schemes: fuzzy self-tuning PD control, the piecewise-linear self-tuning PD control, the exponential self-tuning PD control and the classical PID control with constant gains. From Figs. 6 and 7, we can observe that the position transient responses for the fuzzy PD self-tuning are faster than the others to reach the set point.

Fig. 6
figure 6

Position \(q_{1}\) of joint 1

Fig. 7
figure 7

Position \(q_{2}\) of joint 2

Fig. 8
figure 8

Applied torque \(\tau_{1}\)

Fig. 9
figure 9

Applied torque \(\tau_{2}\)

Fig. 10
figure 10

Plot of \(k_{{p_{1} }}\) proportional gain

Fig. 11
figure 11

Plot of \(k_{{p_{2} }}\) proportional gain

Fig. 12
figure 12

Plot of \(k_{{v_{1} }}\) derivative gain

Fig. 13
figure 13

Plot of \(k_{{v_{2} }}\) derivative gain

Furthermore, the position errors in steady state (after 4 s of the transient response) are smaller in the fuzzy self-tuning PD functions techniques; see Table 4 and Fig. 14. The plots of positions are in degree scales for better appreciation of the joint motions. Applied torques \(\tau_{1}\) and \(\tau_{2}\) are shown in Fig. 8 and Fig. 9; these figures show the evolution of the applied torques; they remain within the torque actuator limits \(\tau_{{1\:{\text{max}}}}\) = 150 Nm and \(\tau_{{2\:{\text{max}}}}\) = 15 Nm.

Table 4 Index of steady state errors [deg]
Fig. 14
figure 14

Plot of index of steady state errors

The improvement in the responses of the fuzzy self-tuning PD control is mainly caused by the capability of varying the variable PD gains in accordance with the position errors. Figures 10, 11, 12, 13 show the evolution of proportional and derivative gains for all proposed regulators.

The regulators with self-tuning PD gains gives high gains, into the permitted boundaries, when the position errors are small and small gains when the position errors are big, avoiding so the actuators torques reach their saturation zone.

7 Conclusions

In this paper, we have proposed a class of new nonlinear PID global regulators with variable gain matrices Kp and Kv; besides, we have proposed three schemes for tuning of the PD gains of such a class of PID regulators, via: piecewise-linear functions, exponential functions and fuzzy selftuned functions. Moreover, a global asymptotic stability proof, via Lyapunov theory, for the proposed nonlinear PID global regulator with self-tuning PD gains for robot manipulator is presented. Experiments in real time on a two-degree-of-freedom robot arm are made to point out the functionality of the proposed controller.

The experimental results showed that the regulator with fixed gains nonlinear PID is not able to achieve the desired functionality. In order to get good results, it is recommendable to have variable gains in the regulator. The experiments show that the reference is reached in a less time, when it is used, the proposed nonlinear PID controller with fuzzy self-tuning PD gains, than when it is used the fixed gains regulator and the other PD gains tuning systems. A next stage is to try with the trajectory tracking problem.