Chapter 7: Robust Robot Control
Lesson 3: Sliding-Mode Control for Robots
This lesson introduces sliding-mode control (SMC) for robotic manipulators as a robust nonlinear control technique for joint-space tracking in the presence of bounded uncertainties and disturbances. We derive sliding surfaces, equivalent and switching control laws using the standard robot dynamics, prove robustness using Lyapunov methods, and then illustrate implementation in Python, C++, Java, MATLAB/Simulink, and Wolfram Mathematica.
1. Conceptual Overview of Sliding-Mode Control (SMC)
Sliding-mode control is a robust nonlinear control method for systems with matched uncertainties, i.e., disturbances entering through the same channels as the control inputs. For a robotic manipulator, the control input is the joint torque vector \( \tau \in \mathbb{R}^n \), and uncertainties such as modeling errors, friction, or external disturbances can often be lumped as an additive term to the torque.
In SMC, we design a sliding surface (or manifold) \( s(q,\dot{q},t) = 0 \) in the state space such that whenever the motion stays on this surface, the tracking error dynamics have the desired behavior (e.g., exponential decay). The controller has two conceptual parts:
- An equivalent control that would keep the state exactly on the surface \( s = 0 \) if there were no disturbances.
- A switching (discontinuous) control that drives the system state toward the surface and compensates for disturbances and uncertainties.
For an \(n\)-DOF manipulator with joint coordinates \( q \in \mathbb{R}^n \) and desired trajectory \( q_d(t) \), SMC yields a torque law of the form
\[ \tau(q,\dot{q},t) = \tau_{\mathrm{eq}}(q,\dot{q},t) + \tau_{\mathrm{sw}}(q,\dot{q},t), \]
with \( \tau_{\mathrm{sw}} \) typically using a sign or saturation function of the sliding variable \( s \) to enforce robustness.
flowchart TD
QD["Desired trajectory q_d(t)"] --> E["Error e = q - q_d"]
E --> S["Sliding variable s = e_dot + Lambda e"]
S --> CTRL["Control law tau = tau_eq + tau_sw"]
CTRL --> PLANT["Robot dynamics M(q) q_ddot + C(q,q_dot) q_dot + g(q) = tau + d(t)"]
PLANT --> Y["Measured q, q_dot"]
Y --> E
2. Robot Dynamics with Uncertainties
We recall the standard rigid robot manipulator dynamics (which you already know from kinematics and dynamics):
\[ M(q)\ddot{q} + C(q,\dot{q})\dot{q} + g(q) = \tau, \]
where \( M(q) \) is the symmetric positive definite inertia matrix, \( C(q,\dot{q})\dot{q} \) are Coriolis/centrifugal forces, and \( g(q) \) is gravity. In a robust control context we explicitly include uncertainties and disturbances:
\[ M(q)\ddot{q} + C(q,\dot{q})\dot{q} + g(q) = \tau + d(t), \]
where \( d(t) \in \mathbb{R}^n \) collects modeling errors, unmodeled friction, external forces, etc. We typically assume a component-wise bound
\[ |d_i(t)| \leq \bar{d}_i, \quad \bar{d}_i > 0,\quad i=1,\dots,n. \]
The disturbance is matched because it acts in the same input channel as \( \tau \). Sliding-mode control exploits this structure to obtain a robustness margin.
3. Sliding Surface Design for Joint-Space Tracking
Let \( q_d(t) \) be a smooth desired joint trajectory with known first and second derivatives \( \dot{q}_d(t), \ddot{q}_d(t) \). Define the tracking error and its derivative:
\[ e(t) = q(t) - q_d(t), \qquad \dot{e}(t) = \dot{q}(t) - \dot{q}_d(t). \]
A common sliding surface for joint-space tracking is
\[ s(t) = \dot{e}(t) + \Lambda e(t), \]
where \( \Lambda \in \mathbb{R}^{n\times n} \) is a constant, symmetric positive definite matrix (often diagonal with positive entries \( \lambda_i > 0 \)).
On the sliding surface \( s(t) = 0 \) for all sufficiently large \(t\), we have
\[ \dot{e}(t) = -\Lambda e(t). \]
This is a linear first-order stable system with solution
\[ e(t) = \exp(-\Lambda (t-t_0))\,e(t_0), \]
so that \( e(t) \to 0 \) exponentially as \( t \to \infty \). Thus, by designing the controller to enforce \( s(t) \to 0 \), we implicitly shape the error dynamics.
4. Derivation of Sliding-Mode Control Law for Robots
We derive a joint-space SMC law for the uncertain robot dynamics. Start from the sliding variable
\[ s = \dot{e} + \Lambda e = \dot{q} - \dot{q}_d + \Lambda(q - q_d). \]
Differentiate to obtain
\[ \dot{s} = \ddot{q} - \ddot{q}_d + \Lambda\dot{e}. \]
Using the uncertain dynamics
\[ \ddot{q} = M(q)^{-1}\big(\tau + d(t) - C(q,\dot{q})\dot{q} - g(q)\big), \]
we obtain
\[ \dot{s} = M(q)^{-1}\big(\tau + d(t) - C(q,\dot{q})\dot{q} - g(q)\big) - \ddot{q}_d + \Lambda(\dot{q} - \dot{q}_d). \]
Decompose the control torque into equivalent and switching parts
\[ \tau = \tau_{\mathrm{eq}} + \tau_{\mathrm{sw}}. \]
The equivalent torque is defined by imposing \( d(t) = 0 \) and \( \dot{s} = 0 \), i.e., motion constrained to the sliding surface:
\[ 0 = M(q)^{-1}\big(\tau_{\mathrm{eq}} - C(q,\dot{q})\dot{q} - g(q)\big) - \ddot{q}_d + \Lambda(\dot{q} - \dot{q}_d), \]
which yields
\[ \tau_{\mathrm{eq}}(q,\dot{q},t) = M(q)\big(\ddot{q}_d - \Lambda\dot{e}\big) + C(q,\dot{q})\dot{q} + g(q). \]
Substituting back, the true sliding dynamics become
\[ \dot{s} = M(q)^{-1}\big(\tau_{\mathrm{sw}} + d(t)\big). \]
A classical choice for the switching torque is
\[ \tau_{\mathrm{sw}} = -K\,\operatorname{sgn}(s), \quad K = \operatorname{diag}(k_1,\dots,k_n),\quad k_i > 0, \]
where the sign function acts element-wise:
\[ \operatorname{sgn}(s_i) = \begin{cases} 1 & \text{if } s_i > 0,\\[0.3em] 0 & \text{if } s_i = 0,\\[0.3em] -1 & \text{if } s_i < 0. \end{cases} \]
The complete SMC law is then
\[ \tau(q,\dot{q},t) = M(q)\big(\ddot{q}_d - \Lambda\dot{e}\big) + C(q,\dot{q})\dot{q} + g(q) - K\,\operatorname{sgn}(s). \]
Proper selection of the gains \( K \) guarantees that the sliding surface is attractive and the tracking error converges despite disturbances, as shown next.
5. Lyapunov Stability and Robustness Proof Sketch
We analyze robustness using a Lyapunov function based on the sliding variable:
\[ V(s) = \tfrac{1}{2}s^T s. \]
This function is positive definite in \( s \): \( V(s) > 0 \) for all \( s \neq 0 \) and \( V(0) = 0 \). Its time derivative is
\[ \dot{V} = s^T\dot{s}. \]
Using the sliding dynamics with the SMC law,
\[ \dot{s} = M(q)^{-1}\big(-K\,\operatorname{sgn}(s) + d(t)\big), \]
we obtain
\[ \dot{V} = s^T M(q)^{-1}\big(-K\,\operatorname{sgn}(s) + d(t)\big). \]
Let \( \lambda_{\max}(M(q)) \) be the largest eigenvalue of \( M(q) \); since \( M(q) \) is positive definite and smooth on a compact set of interest, there exists \( 0 < m_{\min} \leq m_{\max} \) such that \( \lambda_{\max}(M(q)) \leq m_{\max} \) and hence \( \|M(q)^{-1}\| \leq 1/m_{\min} \). Using component-wise bounds \( |d_i(t)| \leq \bar{d}_i \), we can write
\[ \dot{V} \leq -\frac{1}{m_{\max}}\sum_{i=1}^n k_i |s_i| + \frac{1}{m_{\min}}\sum_{i=1}^n \bar{d}_i |s_i|. \]
If we choose the gains such that
\[ k_i > \frac{m_{\max}}{m_{\min}}\bar{d}_i + \eta_i, \quad \eta_i > 0, \]
then there exists \( \eta > 0 \) with
\[ \dot{V} \leq -\eta \sum_{i=1}^n |s_i| = -\eta \|s\|_1. \]
This implies the reaching condition
\[ s^T\dot{s} \leq -\eta \|s\|, \]
so the sliding variable tends to zero in finite time (standard SMC result), and the surface \( s = 0 \) is attractive and invariant. On the surface, the dynamics reduce to \( \dot{e} = -\Lambda e \), yielding exponential tracking.
flowchart TD
ST["Start: choose Lambda, K"] --> BND["Assume bounds on d(t)"]
BND --> VDEF["Define V = 0.5 s^T s"]
VDEF --> DERV["Compute V_dot = s^T s_dot"]
DERV --> INEQ["Bound V_dot <= -eta ||s||"]
INEQ --> REACH["Conclude finite-time reach to s = 0"]
REACH --> SLIDE["On s = 0: e_dot = -Lambda e, e -> 0"]
6. Practical Issues — Chattering and Boundary Layers
The ideal discontinuous control uses the sign function, which causes high-frequency switching in the torque and can excite unmodeled dynamics. This is known as chattering. Two common remedies are:
- Boundary layer (saturation) method: Replace \( \operatorname{sgn}(\cdot) \) by a continuous saturation function within a small neighborhood of the surface.
- Higher-order SMC: Design controllers acting on higher derivatives of the sliding variable to obtain smoother torques (beyond our scope here).
A typical boundary-layer implementation uses
\[ \tau_{\mathrm{sw}} = -K\,\operatorname{sat}\!\left(\frac{s}{\phi}\right), \]
where \( \phi > 0 \) is a diagonal matrix or vector of layer widths and
\[ \operatorname{sat}(z_i) = \begin{cases} z_i & \text{if } |z_i| \leq 1,\\[0.3em] \operatorname{sgn}(z_i) & \text{if } |z_i| > 1. \end{cases} \]
Inside the boundary layer, \( s \) no longer converges exactly to zero, but to a small neighborhood whose size is proportional to \( \phi \). This trades exact robustness for reduced chattering and smoother torques, which is often essential in real robotic systems.
7. Python Implementation Example
We now sketch a joint-space SMC implementation for an \(n\)-DOF robot in
Python. We assume access to functions M_robot(q),
C_robot(q, dq), and g_robot(q) providing the
standard dynamic model (e.g., from
roboticstoolbox-python or your own implementation).
import numpy as np
def smc_torque(q, dq, q_d, dq_d, ddq_d, Lambda, K, phi):
"""
Sliding-mode control for joint-space tracking.
Parameters
----------
q, dq : np.ndarray, shape (n,)
Current joint position and velocity.
q_d, dq_d, ddq_d : np.ndarray, shape (n,)
Desired joint position, velocity, acceleration.
Lambda : np.ndarray, shape (n, n)
Positive definite sliding surface gain matrix.
K : np.ndarray, shape (n, n)
Positive diagonal switching gain matrix.
phi : np.ndarray, shape (n,)
Boundary-layer half-widths (positive entries).
"""
# Tracking error
e = q - q_d
e_dot = dq - dq_d
# Sliding variable s = e_dot + Lambda * e
s = e_dot + Lambda @ e
# Robot model (user-provided or from a robotics library)
M = M_robot(q) # shape (n, n)
C = C_robot(q, dq) # shape (n, n)
g = g_robot(q) # shape (n,)
# Equivalent control tau_eq
tau_eq = M @ (ddq_d - Lambda @ e_dot) + C @ dq + g
# Smooth sign using tanh, approximate sat(s/phi)
# Avoid elementwise division by zero
phi_safe = np.maximum(phi, 1e-6)
sat_arg = s / phi_safe
# Elementwise hyperbolic tangent
sat_val = np.tanh(sat_arg)
tau_sw = -K @ sat_val
tau = tau_eq + tau_sw
return tau
# Example of usage inside a control loop (pseudo-code)
def control_loop():
Lambda = np.diag([15.0, 15.0]) # example for 2 DOF
K = np.diag([5.0, 5.0])
phi = np.array([0.05, 0.05])
while True:
q, dq = get_joint_state() # from sensors
q_d, dq_d, ddq_d = desired_trajectory()
tau = smc_torque(q, dq, q_d, dq_d, ddq_d, Lambda, K, phi)
send_joint_torque(tau) # to low-level driver
In practice, you must ensure numerical stability (M_robot(q)
well-conditioned), consider torque limits, and filter noisy velocity
measurements before computing \( s \).
8. C++ Implementation Example (Eigen-Based)
In C++, a typical choice is the Eigen library for matrix
operations, possibly combined with a dynamics engine such as RBDL or
Pinocchio to compute M(q), C(q, dq), and
g(q).
#include <Eigen/Dense>
using Eigen::VectorXd;
using Eigen::MatrixXd;
struct SmcGains {
MatrixXd Lambda; // n x n
MatrixXd K; // n x n (diagonal)
VectorXd phi; // n
};
VectorXd smcTorque(
const VectorXd& q,
const VectorXd& dq,
const VectorXd& q_d,
const VectorXd& dq_d,
const VectorXd& ddq_d,
const SmcGains& gains
) {
const MatrixXd& Lambda = gains.Lambda;
const MatrixXd& K = gains.K;
const VectorXd& phi = gains.phi;
// Tracking error and sliding variable
VectorXd e = q - q_d;
VectorXd e_dot = dq - dq_d;
VectorXd s = e_dot + Lambda * e;
// Robot dynamics (user must implement or wrap a robotics library)
MatrixXd M = M_robot(q); // n x n
MatrixXd C = C_robot(q, dq); // n x n
VectorXd g = g_robot(q); // n
VectorXd tau_eq = M * (ddq_d - Lambda * e_dot) + C * dq + g;
// Smooth saturation via tanh
VectorXd phi_safe = phi.cwiseMax(1e-6);
VectorXd sat_arg = s.cwiseQuotient(phi_safe);
VectorXd sat_val = sat_arg.array().tanh();
VectorXd tau_sw = -K * sat_val;
VectorXd tau = tau_eq + tau_sw;
return tau;
}
The function smcTorque can be called at each control cycle
with the current measured state and desired trajectory, then passed to
the real-time torque interface of the robot controller.
9. Java Implementation Example
In Java, one can implement SMC using array-based linear algebra or
libraries such as
ojAlgo or Apache Commons Math. Below is a
simplified array-based version for small \(n\)-DOF robots.
public class SlidingModeController {
// Lambda and K are n x n (stored row-major)
private final double[][] Lambda;
private final double[][] K;
private final double[] phi;
public SlidingModeController(double[][] Lambda, double[][] K, double[] phi) {
this.Lambda = Lambda;
this.K = K;
this.phi = phi;
}
// Utility: matrix-vector product y = A x
private static double[] matVec(double[][] A, double[] x) {
int n = x.length;
double[] y = new double[n];
for (int i = 0; i < n; ++i) {
double sum = 0.0;
for (int j = 0; j < n; ++j) {
sum += A[i][j] * x[j];
}
y[i] = sum;
}
return y;
}
// Utility: elementwise tanh
private static double[] tanhVec(double[] x) {
int n = x.length;
double[] y = new double[n];
for (int i = 0; i < n; ++i) {
y[i] = Math.tanh(x[i]);
}
return y;
}
public double[] computeTorque(
double[] q, double[] dq,
double[] qd, double[] dqd, double[] ddqd
) {
int n = q.length;
// Errors
double[] e = new double[n];
double[] eDot = new double[n];
for (int i = 0; i < n; ++i) {
e[i] = q[i] - qd[i];
eDot[i] = dq[i] - dqd[i];
}
// s = eDot + Lambda e
double[] LambdaE = matVec(Lambda, e);
double[] s = new double[n];
for (int i = 0; i < n; ++i) {
s[i] = eDot[i] + LambdaE[i];
}
// Robot dynamics (user implementation)
double[][] M = M_robot(q);
double[][] C = C_robot(q, dq);
double[] g = g_robot(q);
// tau_eq = M (ddqd - Lambda eDot) + C dq + g
double[] LambdaEDot = matVec(Lambda, eDot);
double[] inner = new double[n];
for (int i = 0; i < n; ++i) {
inner[i] = ddqd[i] - LambdaEDot[i];
}
double[] Minner = matVec(M, inner);
double[] Cdq = matVec(C, dq);
double[] tauEq = new double[n];
for (int i = 0; i < n; ++i) {
tauEq[i] = Minner[i] + Cdq[i] + g[i];
}
// tau_sw = -K sat(s/phi) with tanh
double[] satArg = new double[n];
for (int i = 0; i < n; ++i) {
double phiSafe = Math.max(phi[i], 1e-6);
satArg[i] = s[i] / phiSafe;
}
double[] satVal = tanhVec(satArg); // approximate sat
double[] tauSw = new double[n];
for (int i = 0; i < n; ++i) {
// K is diagonal
tauSw[i] = -K[i][i] * satVal[i];
}
double[] tau = new double[n];
for (int i = 0; i < n; ++i) {
tau[i] = tauEq[i] + tauSw[i];
}
return tau;
}
}
This code can be integrated into a Java-based real-time control stack (e.g., for industrial robots exposing a Java API).
10. MATLAB / Simulink Implementation Sketch
MATLAB code can be written in an .m file and called either
from a script or from a Simulink block (e.g., via a MATLAB Function
block). Below is a basic joint-space SMC function for MATLAB.
function tau = smc_torque(q, dq, qd, dqd, ddqd, Lambda, K, phi)
% Sliding-mode control for an n-DOF manipulator.
% q, dq, qd, dqd, ddqd are column vectors (n x 1).
% Tracking error
e = q - qd;
eDot = dq - dqd;
% Sliding variable
s = eDot + Lambda * e;
% Robot model functions (user-defined, e.g., from Robotics System Toolbox)
M = M_robot(q); % n x n
C = C_robot(q, dq); % n x n
g = g_robot(q); % n x 1
% Equivalent control
tau_eq = M * (ddqd - Lambda * eDot) + C * dq + g;
% Boundary-layer saturation using tanh
phi_safe = max(phi, 1e-6);
sat_arg = s ./ phi_safe;
sat_val = tanh(sat_arg); % approximate sat(s/phi)
tau_sw = -K * sat_val;
tau = tau_eq + tau_sw;
end
In Simulink, one typical implementation is:
- Use blocks to compute \( e = q - q_d \) and \( \dot{e} = \dot{q} - \dot{q}_d \).
- Compute \( s = \dot{e} + \Lambda e \) with Gain and Sum blocks.
- Use a MATLAB Function block implementing the SMC law above to compute \( \tau \) from \( (q,\dot{q},q_d,\dot{q}_d,\ddot{q}_d,s) \).
- Feed the torque into a Simscape Multibody model or a custom dynamics block.
11. Wolfram Mathematica Implementation Sketch
Mathematica is well-suited to symbolically derive the SMC law and then simulate the resulting closed-loop dynamics numerically. Below is a sketch for a two-DOF manipulator.
(* Define symbolic variables *)
n = 2;
Lambda = DiagonalMatrix[{15., 15.}];
K = DiagonalMatrix[{5., 5.}];
phi = {0.05, 0.05};
(* Example desired trajectory q_d(t) *)
qd[t_] := {Sin[t], Cos[t]};
dqd[t_] := D[qd[t], t];
ddqd[t_] := D[qd[t], {t, 2}];
(* Sliding variable s(q, dq, t) *)
s[q_, dq_, t_] := (dq - dqd[t]) + Lambda.(q - qd[t]);
(* Robot dynamic model: user-defined M, C, g as functions of q, dq *)
Mfun[q_] := Mrobot[q]; (* 2 x 2 *)
Cfun[q_, dq_] := Crobot[q, dq]; (* 2 x 2 *)
gfun[q_] := grobot[q]; (* 2 *)
(* Equivalent control *)
tauEq[q_, dq_, t_] :=
Mfun[q].(ddqd[t] - Lambda.(dq - dqd[t])) + Cfun[q, dq].dq + gfun[q];
(* Smooth switching using Tanh (approximate saturation) *)
tauSw[q_, dq_, t_] :=
Module[{sv = s[q, dq, t], phiSafe},
phiSafe = Map[Max[#, 1.*^-6] &, phi];
-K.DiagonalMatrix[Tanh[sv/phiSafe]].ConstantArray[1., n]
];
tauSmc[q_, dq_, t_] := tauEq[q, dq, t] + tauSw[q, dq, t];
(* Closed-loop dynamics for simulation *)
closedLoopEqns =
With[{q1 = q1[t], q2 = q2[t]},
{
q1''[t] == (Mfun[{q1, q2}]^-1.(
tauSmc[{q1, q2}, {q1'[t], q2'[t]}, t]
- Cfun[{q1, q2}, {q1'[t], q2'[t]}].{q1'[t], q2'[t]}
- gfun[{q1, q2}]
))[[1]],
q2''[t] == (Mfun[{q1, q2}]^-1.(
tauSmc[{q1, q2}, {q1'[t], q2'[t]}, t]
- Cfun[{q1, q2}, {q1'[t], q2'[t]}].{q1'[t], q2'[t]}
- gfun[{q1, q2}]
))[[2]]
}
];
(* Numerically simulate with NDSolve for given initial conditions *)
sol = NDSolve[
Join[closedLoopEqns,
{q1[0] == 0., q2[0] == 0., q1'[0] == 0., q2'[0] == 0.}],
{q1, q2}, {t, 0, 10}
];
(* Plot tracking performance *)
Plot[Evaluate[{q1[t], qd[t][[1]]} /. sol], {t, 0, 10},
PlotLegends -> {"q1", "q1_d"}]
Symbolic capabilities also allow you to verify Lyapunov conditions and manipulate expressions for the sliding surface and control law analytically.
12. Problems and Solutions
Problem 1 (Single-DOF SMC Design): Consider a single-joint robot with dynamics \( J\ddot{q} + b\dot{q} + g_0\sin(q) = \tau + d(t) \), where \( J, b, g_0 > 0 \) and \( |d(t)| \leq \bar{d} \). Let the desired joint position be constant \( q_d \). Design a sliding-mode controller of the form \( \tau = \tau_{\mathrm{eq}} + \tau_{\mathrm{sw}} \) with sliding variable \( s = \dot{e} + \lambda e \), \( e = q - q_d \), \( \lambda > 0 \), and prove that if \( k > \bar{d} \) in \( \tau_{\mathrm{sw}} = -k\operatorname{sgn}(s) \), then the sliding surface is attractive.
Solution:
Since \( q_d \) is constant, \( \dot{q}_d = \ddot{q}_d = 0 \). The sliding variable is \( s = \dot{q} + \lambda(q - q_d) \). Its derivative is
\[ \dot{s} = \ddot{q} + \lambda\dot{q}. \]
From the dynamics,
\[ \ddot{q} = \frac{1}{J}\big(\tau + d(t) - b\dot{q} - g_0\sin(q)\big). \]
Choose the equivalent control by canceling known dynamics and imposing \( \dot{s} = 0 \) (with \( d(t) = 0 \)):
\[ 0 = \frac{1}{J}\big(\tau_{\mathrm{eq}} - b\dot{q} - g_0\sin(q)\big) + \lambda\dot{q}, \]
which yields
\[ \tau_{\mathrm{eq}} = b\dot{q} + g_0\sin(q) - J\lambda\dot{q}. \]
With \( \tau = \tau_{\mathrm{eq}} - k\operatorname{sgn}(s) \), we obtain
\[ \dot{s} = \frac{1}{J}\big(-k\operatorname{sgn}(s) + d(t)\big). \]
Consider the Lyapunov function \( V = \tfrac{1}{2}s^2 \). Its derivative is
\[ \dot{V} = s\dot{s} = \frac{1}{J}s\big(-k\operatorname{sgn}(s) + d(t)\big) = \frac{1}{J}\big(-k|s| + s\,d(t)\big). \]
Using \( |s\,d(t)| \leq |s|\bar{d} \), we get
\[ \dot{V} \leq \frac{1}{J}(-k + \bar{d})|s|. \]
If \( k > \bar{d} \), then \( -k + \bar{d} = -\eta \) with \( \eta > 0 \) and hence
\[ \dot{V} \leq -\frac{\eta}{J}|s| < 0 \quad \text{for } s \neq 0. \]
Therefore, the reaching condition holds and the sliding surface is attractive.
Problem 2 (Error Dynamics on the Sliding Surface): For the \(n\)-DOF SMC design with sliding variable \( s = \dot{e} + \Lambda e \), show that if the motion is constrained to the surface \( s = 0 \), then the tracking error satisfies a linear homogeneous first-order ODE and converges exponentially to zero.
Solution:
By definition, on the surface \( s = 0 \), \( \dot{e} = -\Lambda e \). This is a linear time-invariant system with solution
\[ e(t) = \exp(-\Lambda (t-t_0))\,e(t_0). \]
Since \( \Lambda \) is positive definite, all eigenvalues of \( -\Lambda \) have strictly negative real parts, so \( e(t) \to 0 \) exponentially as \( t \to \infty \).
Problem 3 (Gain Selection with Known Disturbance Bound): Consider the multi-DOF SMC controller with \( \tau_{\mathrm{sw}} = -K\,\operatorname{sgn}(s) \), where \( K = \operatorname{diag}(k_1,\dots,k_n) \). Assuming disturbance bounds \( |d_i(t)| \leq \bar{d}_i \) and inertia eigenvalue bounds \( 0 < m_{\min} \leq \lambda_{\min}(M(q)) \leq \lambda_{\max}(M(q)) \leq m_{\max} \), derive a conservative inequality that guarantees \( \dot{V} \leq 0 \) for \( V = \tfrac{1}{2}s^T s \).
Solution:
As in Section 5, we have
\[ \dot{V} = s^T M(q)^{-1}\big(-K\,\operatorname{sgn}(s) + d(t)\big) \leq -\frac{1}{m_{\max}}\sum_{i=1}^n k_i|s_i| + \frac{1}{m_{\min}}\sum_{i=1}^n \bar{d}_i|s_i|. \]
A sufficient condition for \( \dot{V} \leq 0 \) for all \( s \) is
\[ \frac{k_i}{m_{\max}} \geq \frac{\bar{d}_i}{m_{\min}} \quad \Rightarrow \quad k_i \geq \frac{m_{\max}}{m_{\min}}\bar{d}_i, \quad i=1,\dots,n. \]
In practice, one chooses \( k_i \) strictly larger than this bound to enforce strict negativity of \( \dot{V} \) away from \( s = 0 \).
Problem 4 (Boundary-Layer Steady-State Error): Consider the scalar SMC with boundary layer \( \tau_{\mathrm{sw}} = -k\,\operatorname{sat}(s/\phi) \), \( |d(t)| \leq \bar{d} \), and \( \phi > 0 \). By analyzing the inequality for \( \dot{V} = s\dot{s} \) with \( \dot{s} = J^{-1}(-k\,\operatorname{sat}(s/\phi) + d(t)) \), argue qualitatively how the steady-state bound on \( |s| \) depends on \( \phi \), \( k \), and \( \bar{d} \).
Solution (Sketch):
Inside the boundary layer \( |s| \leq \phi \), we have \( \operatorname{sat}(s/\phi) = s/\phi \), so the dynamics become approximately linear:
\[ \dot{s} = J^{-1}\big(-k\,\frac{s}{\phi} + d(t)\big). \]
At steady state, the disturbance term must be balanced by the control term, leading to an approximate bound
\[ \left|k\,\frac{s}{\phi}\right| \approx |d(t)| \leq \bar{d} \quad \Rightarrow \quad |s| \lesssim \frac{\bar{d}\,\phi}{k}. \]
Thus, the steady-state bound on \( |s| \) is proportional to \( \phi \) and inversely proportional to \( k \). Smaller \( \phi \) and larger \( k \) improve accuracy but increase chattering and control effort.
13. Summary
In this lesson, we developed sliding-mode control for robotic manipulators based on the standard dynamic model with matched bounded disturbances. We introduced the sliding surface \( s = \dot{e} + \Lambda e \), derived the equivalent torque and switching components, and used Lyapunov analysis to show robust attraction to the sliding manifold and exponential tracking on it. We discussed practical issues such as chattering and boundary layers and provided multi-language implementation sketches (Python, C++, Java, MATLAB/Simulink, and Mathematica), preparing the ground for more advanced robust and adaptive control schemes in later chapters.
14. References
- Utkin, V. I. (1977). Variable structure systems with sliding modes. IEEE Transactions on Automatic Control, 22(2), 212–222.
- Utkin, V. I. (1992). Sliding Modes in Control and Optimization. Springer-Verlag.
- Slotine, J.-J. E., & Li, W. (1987). On the adaptive control of robot manipulators. International Journal of Robotics Research, 6(3), 49–59.
- Slotine, J.-J. E. (1984). Sliding controller design for non-linear systems. International Journal of Control, 40(2), 421–434.
- Young, K. D., Utkin, V. I., & Özgüner, Ü. (1999). A control engineer's guide to sliding mode control. IEEE Transactions on Control Systems Technology, 7(3), 328–342.
- Edwards, C., & Spurgeon, S. K. (1998). Sliding Mode Control: Theory and Applications. Taylor & Francis.
- Bartolini, G., Ferrara, A., & Usai, E. (1998). Chattering avoidance by second-order sliding mode control. IEEE Transactions on Automatic Control, 43(2), 241–246.