**3. Sliding mode control design**

A continuous-time dynamical equation of an *n*-link robot manipulator is defined as follows:

$$\mathbf{M}(\mathbf{q})\ddot{\mathbf{q}} + \mathbf{C}(\mathbf{q}, \dot{\mathbf{q}})\dot{\mathbf{q}} + \mathbf{F}(\dot{\mathbf{q}}) + \mathbf{G}(\mathbf{q}) = \mathbf{r},\tag{8}$$

where *q*∈*Rnx*<sup>1</sup> denotes the joint configuation variables (translational or rotational) representing the generalized position coordinates (alias the joint positions) of the robot links. Similarly, *q*\_, *q*€ ∈*Rnx*<sup>1</sup> represent the joint velocity and acceleration of the robot links, respectively. *M q* ∈*Rnxn* is the symmetric, bounded, positive definite inertia mass matrix. *C q*, *q*\_ ∈*Rnxn* is the matrix of Coriolis and centripetal forces and *F q*\_ ∈*Rnx*<sup>1</sup> is the vector of viscous friction. Furthermore, the vector of *G q* ∈*Rnx*<sup>1</sup> represents the gravity terms, and finally, *τ* ∈*Rnx*<sup>1</sup> is called the control torque vector, or the vector of applied joint torques.

Sliding surface defined below is considered in the design of SMC controller:

$$
\mathfrak{s} = \dot{\mathfrak{e}} + \lambda \mathfrak{e}, \tag{9}
$$

where *e* ¼ �*q*~ ¼ *q* � *q<sup>d</sup>* represents the error vector and *λ* is assumed to be a symmetric positive definite matrix such that *s* ¼ **0** would evolve into a stable surface. The reference velocity vector *q*\_*<sup>r</sup>* is the same as the definition in [1]:

$$
\dot{\mathbf{q}}\_r = \dot{\mathbf{q}}\_d - \lambda \mathbf{e}.\tag{10}
$$

Hence, one can define the sliding surface as follows:

$$
\mathbf{s} = \dot{\mathbf{q}} - \dot{\mathbf{q}}\_r.\tag{11}
$$

Now, the following lemma refers to the sliding mode controller design.

**Lemma 1**. *Let us consider the system consisting of (8) through (10). If the following control rule is selected:*

$$
\boldsymbol{\pi} = \hat{\boldsymbol{\pi}} - \mathbf{K}\_{\text{sg}} \text{sgn}\left(\mathbf{s}\right) \tag{12}
$$

such that

$$
\hat{\mathbf{r}} = \mathbf{M}\ddot{\mathbf{q}}\_r + \hat{\mathbf{C}}\ddot{\mathbf{q}}\_r + \mathbf{G} \tag{13}
$$

and

$$K\_{\otimes\_i} \ge \left\| \Delta \mathbf{C} \dot{\mathbf{q}}\_r \right\| + \Gamma\_i,\tag{14}$$

*then the following sliding condition* [1]*,*

$$\frac{1}{2}\frac{d}{dt}\left[\mathbf{s}^T\mathbf{M}\mathbf{s}\right] < -\left.\eta\left(\mathbf{s}^T\mathbf{s}\right)^{1/2}\right|, \eta > 0\tag{15}$$

*is satisfied.* In (14), *Ksg <sup>i</sup>* stands for the element of sliding gain vector *Ksg* and *Γ* is a design parameter vector that must be chosen to ensure the inequality *Γ<sup>i</sup>* ≥ *Fup* þ *ηi*.

**Proof.** Let Lyapunov function candidate be given as follows:

$$V = \frac{1}{2} \mathbf{s}^T \mathbf{M} \mathbf{s}.\tag{16}$$

Since *M* is positive definite and *s* is different from zero (*s* 6¼ **0**), *V* is always greater than zero (*V* >0) and by taking time derivative of (16) and taking into account the symmetric property of *M*, it takes the following form:

$$\dot{V} = \frac{1}{2}\dot{s}^T \mathbf{M} \mathbf{s} + \frac{1}{2}s^T \left(\dot{\mathbf{M}}\mathbf{s} + \mathbf{M}\dot{\mathbf{s}}\right) = \frac{1}{2}\dot{s}^T \mathbf{M}\mathbf{s} + \frac{1}{2}s^T \dot{\mathbf{M}}\mathbf{s} + \frac{1}{2}s^T \dot{\mathbf{M}}\mathbf{s} = \mathbf{s}^T \mathbf{M}\dot{\mathbf{s}} + \frac{1}{2}s^T \dot{\mathbf{M}}\mathbf{s} \tag{17}$$

Using (11), we get:

$$\dot{V} = \mathbf{s}^T \mathbf{M} (\ddot{\mathbf{q}} - \ddot{\mathbf{q}}\_r) + \frac{1}{2} \mathbf{s}^T \dot{\mathbf{M}} \mathbf{s} = \mathbf{s}^T \left( \mathbf{M} \ddot{\mathbf{q}} - \mathbf{M} \ddot{\mathbf{q}}\_r \right) + \frac{1}{2} \mathbf{s}^T \dot{\mathbf{M}} \mathbf{s} \tag{18}$$

Taking *q*€ from (8) and replacing it in (18), we have:

$$\dot{V} = s^T \left( \mathbf{M} \mathbf{M}^{-1} \left( \mathbf{r} - \mathbf{C} \dot{q} - \mathbf{G} - \mathbf{F} \right) - \mathbf{M} \ddot{q}\_r \right) + \frac{1}{2} s^T \dot{\mathbf{M}} \mathbf{s}.$$

Then, taking *q*\_ from (11) and replacing it above yields:

$$\dot{V} = s^T \left( \mathbf{r} - \mathbf{C}\dot{q}\_r - \mathbf{G} - \mathbf{F} - \mathbf{M}\ddot{q}\_r \right) + \frac{s^T (\dot{\mathbf{M}} - 2\mathbf{C})s}{2}.$$

In the above equation, the second term is zero due to the *asymmetry property*; therefore, it disappears. In this new case,

$$
\dot{V} = \mathbf{s}^T \left( \mathbf{r} - \mathbf{C}\dot{\mathbf{q}}\_r - \mathbf{G} - \mathbf{F} - \mathbf{M}\ddot{\mathbf{q}}\_r \right). \tag{19}
$$

Next, applying (12) and (13) successively for *τ* and ^*τ* in Eq. (19), and proceeding step by step, the following result is reached:

$$\dot{\mathbf{V}} = \mathbf{s}^T \left( \left( \hat{\mathbf{C}} - \mathbf{C} \right) \dot{\mathbf{q}}\_r - \mathbf{K}\_\mathbf{g} \text{sgn}(\mathbf{s}) - \mathbf{F} \right) = \mathbf{s}^T \left( -\Delta \mathbf{C} \dot{\mathbf{q}}\_r - \mathbf{K}\_\mathbf{g} \text{sgn}(\mathbf{s}) - \mathbf{F} \right). \tag{20}$$

In robot modeling, the terms *M q*� � and *G q*� � can be well and accurately determined, but in most cases it is not easy to have the parameters *C q*, *q*\_ � � and *F q*\_ � � precisely. Therefore, in this work, the matrix *C* is considered

$$\mathbf{C} = \hat{\mathbf{C}} + \Delta \mathbf{C},\tag{21}$$

where *Ci*,*<sup>j</sup>* stands for the elements of the matrix *C*. Also, the vector *F* is assumed an external disturbance with the upper bound defined as,

$$||F|| \le F\_{up},\tag{22}$$

where the operator k k*:* denotes Euclidian norm [2]. Now, by rearranging (20) as shown step by step below, we get the following:

$$\dot{V} = -\mathbf{s}^T \left(\Delta \mathbf{C} \dot{\mathbf{q}}\_r + \mathbf{F}\right) - \mathbf{s}^T \mathbf{K}\_\mathbf{g} \text{sgn}\left(\mathbf{s}\right) = -\mathbf{s}^T \left(\Delta \mathbf{C} \dot{\mathbf{q}}\_r + \mathbf{F}\right) - \sum\_{i=1}^n K\_{\mathbf{g}\_i} |\mathbf{s}\_i|,\tag{23}$$

where *si* j j ¼ *si <sup>T</sup> sgn s*ð Þ*<sup>i</sup>* . *An In-Depth Analysis of Sliding Mode Control and Its Application to Robotics DOI: http://dx.doi.org/10.5772/intechopen.93027*

At this point, we can briefly verify that the terms on the right side of (14) are positive. First of all, it is easiest to say that the first term on the right, Δ*Cq*\_*<sup>r</sup>* � � � �, is positive in any case, because the Euclidian norm is used. The other term *Γ<sup>i</sup>* is also positive. Because, as we have already stated in (14) that *Γ<sup>i</sup>* ≥ *Fup* þ *ηi*, where *Fup* is an unknown upper bound defined as k k*F* ≤ *Fup* in (22), which also indicates that it is absolutely positive, and *η* is a strictly positive design constant and ensures inequality (6). Hence, *Γ<sup>i</sup>* ≥0. Now, if the inequality *Ksg <sup>i</sup>* given by (14) is substituted in Eq. (23) under the acceptance of its equality sign for a moment, we can rewrite Eq. (23) by extending it as follows:

$$\dot{V} = -\mathbf{s}^T \left(\Delta \mathbf{C} \dot{\mathbf{q}}\_r + \mathbf{F}\right) - \sum\_{i=1}^n ||\Delta \mathbf{C} \dot{\mathbf{q}}\_r|| |\mathbf{s}\_i| - \sum\_{i=1}^n F\_{up} |\mathbf{s}\_i| - \sum\_{i=1}^n \eta\_i |\mathbf{s}\_i|.$$

The first, second and third terms on the right side of the equation above are negative in varying amounts and contribute to the final term, which is P*<sup>n</sup> <sup>i</sup>*¼<sup>1</sup>*η<sup>i</sup> si* j j, more negatively. Therefore, we can easily conclude that

$$\dot{V} \le -\sum\_{i=1}^{n} \eta\_i |s\_i|. \tag{24}$$

This shows that *V* is a Lyapunov function and the satisfaction of sliding condition in (15) is proven.
