---
# System prepended metadata

title: Nonlinear Control  System
tags: [nonlinear conrtrol]

---

Nonlinear Control  System
===
###### tags: `nonlinear conrtrol`
## Contents
[TOC]

## Video Resource
* [OCW-Teng Hu Cheng](https://ocw.nctu.edu.tw/course_detail-v.php?bgid=2&gid=0&nid=571)
* [NCRL Resource](https://sites.google.com/a/g2.nctu.edu.tw/nonlinear-control-systems---2020-fall/)
* [DR_CAN](https://space.bilibili.com/230105574/channel/detail?cid=35996&fbclid=IwAR33RXsX27eO66-LDOiMe-yMYc_H4HTlXb7BDPQM49kmJsdzCRIPZLJwqXs)

## Definition
#### stable, unstable, asymptotically stable
* stable: $if\ \exists\delta>0, \begin{Vmatrix}x(0)-x_{e}\end{Vmatrix}<\delta,\begin{Vmatrix}x(t)-x_{e}\end{Vmatrix}<\varepsilon,\forall t$
* unstable: not stable
* asymptotically stable: start from the point $\begin{Vmatrix}x(0)-x_{e}\end{Vmatrix}<\delta$, states eventually reach the equilibrium point $x_{e}$

#### scalar function, vector function
* scalar function: $V(x_{1}, x_{2})=x_{1}^Tx_{1}+x_{2}^Tx_{2}\in R, where \ x_{1}\in R^2\ and\ x_{2}\in R^2$
* vector function: $V(x_{1}, x_{2})=x_{1}+x_{2}\in R^2$

#### PD, PSD, ND and NSD
* positive definite: $a \ function \ V \ is \ PD, if \ V(0)=0 \ and \ V(x)>0 \ \forall x \ne 0$.
* positive semidefinite: $a \ function \ V \ is \ PSD, if \ V(0)=0 \ and \ V(x) \ge 0 \ \forall x \ne 0$.
* negative definite: $a \ function \ V \ is \ ND, if \ V(0)=0 \ and \ V(x)<0 \ \forall x \ne 0$.
* positive semidefinite: $a \ function \ V \ is \ NSD, if \ V(0)=0 \ and \ V(x) \le 0 \ \forall x \ne 0$.

#### globally stable, semiglobally stable, and locally stable
* Globally stable: For all initial condition $x \in D, \ D \subset \Re^n$, the system is stable.
* Semiglobally stable: For all initial condition (provided that gains are selected appropriately) $x \in D, \ D \subset \Re^n$, the system is stable.
* Locally sable: For some initial condition $x \in D, \ D \subset \{a \  restricted \ area\}$.

#### Globally Exponentially Stable
$If\ V = {1 \over 2}x^2\ and\ \dot V = -x^2,\ we\ get\ \dot V = -2V\ and\ the\ solution\ is\ V = V(t_0)e^{-2t}.$
As we can see V decays exponentially fast.

#### invariant set 
* A set is said to be an invariant set with respect to $\dot{x}=f(x), \ if \ x(0) \in M, \ x(t) \in M, \ \forall t$.

#### Uniformly Stable and Converge
an eq. pt. $x_e$ of a nonautonomous system $\dot{x}=f(x,\color{red}t)$ is said to be
* Uniformly stable:if for any given $\epsilon > 0, \ \exists \delta(\epsilon) > 0 \ s.t. \begin{Vmatrix} x(t_0) \end{Vmatrix} < \delta(\epsilon) \Rightarrow \begin{Vmatrix} x(t) \end{Vmatrix} < \epsilon, \forall t>0$.
* Uniformly converge: if $\exists \delta_1 > 0\ s.t.\begin{Vmatrix} x(t_0) \end{Vmatrix} < \delta_1 \Rightarrow \begin{Vmatrix} x(t) \end{Vmatrix} \rightarrow 0\ as\ t \rightarrow \infty$

#### Uniformly Asymptotically Stable and Globally Uniformly Asymptotically Stable
as eq.pt.x_e of a nonautonomous system $\dot{x}=f(x,t)$ is said to be 
* Uniformly Asymptotic Stable if it is both uniformly stable and uniformly convergent
* Globally Uniformly Asymptotic Stable if it is UAS for any initial conditions.
<div style="width:400px;height:50px;border: 1px solid">
uniformly: not depend on time (especially initial time)<br>
globally: not depend on initial conditions
</div>

#### Decrescent Function
Let a function $W:D \times R^+ \rightarrow R^n$ defined as W(x,t) is continuously differentialble w.r.t. all its arguements. W(x,t) is said to be decreasent in D if $V(0,t) = 0\ and \begin{vmatrix}W(x,t)\end{vmatrix} \le V(x)\ \forall x \in D, \forall t \in R^+$.
where $V:D \to R^n$ is an $\color{red}{autonomous(time-invariant)\ P.D\ function}$
If a funtion is decrescent function, it must be P.D. and the part contain t(time) can be upper bounded by a constant.

#### Class K, Class ($K_\infty$), and Class KL
For function $\alpha:[0,a) \to [0,\infty)$
* class $K$ function: strictly increasign and $\alpha$(0)=0
* class $K_\infty$ function: if $a=\infty$, and $\alpha(r) \to  \infty\ as\ r \to \infty$

For function $\beta:[0,a) \times [0, \infty) \to [0,\infty)$
* class $KL$ function:
    * for each fixed s, the mapping $\beta(r,s)$ belongs to class K w.t.r. r and,
    * for each fixed r, the mapping $\beta(r,s)$ is decreasing w.t.r. s and $\beta(r,s) \to 0\ as\ s \to \infty$
    * 函數有兩個變數，隨著其中一個遞增，另一個遞減
    ![](https://i.imgur.com/KBVMo8o.png)
    對兩個變數偏微，一正一負
    Ex. $\beta(r,s)=\dfrac{r}{kst+1}$


#### L2 Norm 
* $\begin{Vmatrix}f\end{Vmatrix}_p \overset{\Delta}{=} (\int_0^t\begin{vmatrix}f(\tau)\end{vmatrix}^p\mathrm{d}\tau)^{{1 \over p}}$
* $\begin{Vmatrix}f\end{Vmatrix}_2 \overset{\Delta}{=} \sqrt{\int_0^tf^2(\tau)\mathrm{d}\tau}$
    * if $\begin{Vmatrix}f\end{Vmatrix}_2 \in L_\infty \Rightarrow f \in L_2$
* $\begin{Vmatrix}f\end{Vmatrix}_\infty \overset{\Delta}{=} sup_t(f(t))$

#### Lie Bracket
$[f,g] = \nabla g * f - \nabla f * g = {\partial g \over \partial x}f - {\partial f \over \partial x}g \overset{\Delta}{=} ad_fg$

Note: the derivative of g along the flow generated by f

$ad_f^0g(x) = g(x)\\ 
ad_fg(x) = [f,g](x)\\ 
ad_f^kg(x) = [f,ad_f^{k-1}g](x)$

[李導數與李括號](https://zhuanlan.zhihu.com/p/33381200)
[SLAM學習之路#五 李群李代數](https://medium.com/@ckwang19/slam%E5%AD%B8%E7%BF%92%E4%B9%8B%E8%B7%AF-%E4%BA%94-%E6%9D%8E%E7%BE%A4%E6%9D%8E%E4%BB%A3%E6%95%B8-d8706c78fbd9)

#### Lipschitz Condition
A function $f:\ X \rightarrow Y$ is called Lipschitz continuous if there exists a real constant $L \ge 0$ such that $\forall\ x_1,\ x_2 \in X$,
\begin{equation}
{\begin{Vmatrix}f(x_1) - f(x_2)\end{Vmatrix} \over \begin{Vmatrix}x_1 -x_2\end{Vmatrix}} \le L
\end{equation}

Note: Lipschitz implies bounded variation
Note: Lipschitz continuous does not imply differentiable. (ex: f(x)=|x|)

#### Existence 
* consider the first ODE $x' = F(x),\ x(t_0) = x_0$
Suppose F(x) is a continuous function defined in some region $R \overset{\Delta}{=} \{x:x_0 - \delta < x < x_0 + \delta\}$, containing the point $x_0$. Then there exists a solution number $\delta_1 < \delta$ so that a solution x=f(x) is defined in $x_0 - \delta_1 < x < x_0 + \delta_1$

#### Unique
* consider the first ODE $x' = F(x),\ x(t_0) = x_0$
Suppose F(x) and ${\partial F(x) \over \partial x}$ are continuous function (i.e. F(x) is Lipschitz) defined on R. Then there exists a number $\delta_2 < \delta_1$, so that the solution x=f(x) exists and is unique in for $x_0 - \delta_2 < x < x_0 + \delta_2$

#### Class ($C^k$) Function
* A function f is said to be of class $C^k$ if the derivatives $f',\ f'',\ f^(k)\ exists\ and\ are\ continuous.$
* The class $C^\infty$, or smooth, if it has derivatives of all orders

#### Reachable Set
Given a nonlinear system $\dot x = F(x,u)$.
Let U be an open subset of $R^m$, $\overline x_0 \in R^n$. The reachable set $R^U(\overline x_0,T)$ for a given T > 0 is defined as the set of all x(T) where $x:[0,T] \rightarrow R^n,\ u:[0,T] \rightarrow R^m$ are bounded solution of $\dot x = F(x,u)$ such that $x(0) = \overline x_0\ and\ u(t) \in U$ for all $t \in [0,T]$

## Stability of Equilibrium Point
$f = \dot x$
* ${\partial f \over \partial x} \mid_{eq.pts} < 0,\ stable$
* ${\partial f \over \partial x} \mid_{eq.pts} = 0,\ need\ higher\ order\ to\ determine\ the\ solution$
* ${\partial f \over \partial x} \mid_{eq.pts} > 0,\ unstable$

note: ${\partial f \over \partial x} \mid_{eq.pts} < 0$, which means as x increases, f is decreasing, which is equivalent that $\dot x$ is negative.
Therefore, when x is increased, $\dot x(< 0)$ force x decreasing.

## Controllability
* Linear system
    System: $\dot x = Ax + Bu$
    Controllable: $if\ C \overset{\Delta}{=} [B\ AB\ A^2B\ ...]\ is\ full\ rank$
* Nonlinear system
    System: $\dot x = f(x) + g(x)u$
    Controllable: taking care of the brackets involve f, $C \overset{\Delta}{=} [g,\ ad_fg(x),\ ...,ad_f^{k-1}g(x)]$, until you find it's full rank.

## Observability 
* Linear system
    System: $\dot x = Ax + Bu$
    Controllable: $if\ C \overset{\Delta}{=} \begin{bmatrix}C\\ CA\\ CA^2\\ ...\end{bmatrix}\ is\ full\ rank$

## Lyapunov Theorem
Let x=0 be an eq. pt. for an autonomous system $\dot{x} = f(x), and \ D \subset \Re^n$ be domain containing x=0. Let $V: \ D \to \Re$ be a continuously differentiable function such that 
\begin{gather}
V(0)=0, \ V(x) > 0 \ in \ D - \{0\}
\end{gather}
and 
\begin{gather} 
\dot{V}(x) \le 0 \ in \ D - \{0\}
\end{gather}
Then
\begin{gather} 
x=0 \ is \ \color{red}{stable}.
\end{gather}
Moreover, if 
\begin{gather} 
\dot{V}(x) < 0 \ in \ D - \{0\}
\end{gather}
Then
\begin{gather} 
x=0 \ is \ \color{red}{asymptotically \ stable}.
\end{gather}

Example:
* ![](https://i.imgur.com/ouhQYM6.png)
* ![](https://i.imgur.com/zUdp3lk.png)

#### Remark
Assume V is P.D
* The reason why V has to be P.D is that we hope V has only one minimun value (state) to converge to. Otherwise, if V has more than one minimum, we can't control which state the system eventually reach.
 
* for autonomous system:
    * $\dot V(x) \le 0 \rightarrow stable$
    * $\dot V(x) < 0 \rightarrow asymptotically\ stable$
    * If system is stable by this way, we can use LaSalle's Theorem to further judge if it is asymptotucally stable.
     
* for nonutonomous system:
    * $\dot V(t,x) \le 0 \rightarrow stable$
    * $\dot V(t,x) < 0 \rightarrow we\ can't\ conclude\ asymptotically\ stable$
    * If V(t,x) is decreasent function and $\dot V(t,x) < 0 \rightarrow asymptotically\ stable$
    * If system is stable by this way, we can use Barbalat's Lemma to further judge if it is asymptotucally stable.

[Lyapunov函數與Autonomous System的穩定性判別](https://zhuanlan.zhihu.com/p/30106590)
[Lyapunov函數與Non-Autonomous System的穩定性判別](https://zhuanlan.zhihu.com/p/32313616)

## Directional Derivative
how does function $f$ change as the input shifts in the direction of the vector $\vec{V}$

## Lasalle's Theorem (Only suitable for Autonomous System)
Let $\Omega \subset D$ be a compact set which is positively invariant with respect to $\dot{x}=f(x)$.
Let $V:D \to \Re$ be a continuously differentiable function such that $\dot{V}(x) \le 0$. Let M be the $\color{red}{largest \ invariant \ set}$ in E (the set of $\dot V = 0$). Then every solution starting in $\Omega$ approaches M as $t \to \infty$.
[suggested reference](https://zhuanlan.zhihu.com/p/31925435)

## Corollary 4.1 (from Khalil's Book)
* Let x=0 be an eq. pt. for $\dot{x}=f(x)$. Let $V:D \to \Re$ be a continuously differentiable positive definite function on a domain D. Let $S=\{x \in D \mid \dot{V}(x)=0 \}$ and suppose that no solution can stay identically in S, other than the trivial solution $x \equiv 0$. Then, the origin is $\color{red}{asymptotically\ stable}$.

## Radially Unbounded Functions
* Let $V:D \to \Re$ be a continuously differentiable function. V(x) is said to be radially unbounded if $V(x) \to \infty \ as \begin{Vmatrix} x \end{Vmatrix} \to \infty$.
* note: if $x = \{x_1, x_2\},\ x_1 = \infty\ and\ x_2 = 0\ are\ equivalent\ to \begin{Vmatrix} x \end{Vmatrix} \to \infty.$

## Theorem 4.8 and Theorem 4.9(from Khalil's Book)
* Let x=0 be an eq. pt. for $\dot{x}=f(x,t)$ and $D \subset R^n$ be a domain containing x=0. 
  Let $V[0,\infty) \times D \to R$ be a continuously differentiable function such that 
  \begin{gather}
  W_1(x) \le V(t,x) \le W_2(x) \Rightarrow \color{red}{P.D\ and\ Decreasent}\\ 
  {\partial V \over \partial t} + {\partial V \over \partial x}f(t,x) \le \color{red}0\ or \color{blue}{-W_3(x)} \Rightarrow \dot{V}(x,t)
  \end{gather}
  $\forall t \ge 0\ and\ \forall x \in D$, where $W_1(x),\ W_2(x)\  and\ W_3(x)$ are continuous positive definite function on D. Then, x=0 is $\color{red}{uniformly\ stable}\ or\ \color{blue}{uniformly\ asymptotically stable}$.
* $\color{red}{why\ we\ need\ upper\ bound?}$
* proof:
    1. $\alpha_1(x) \le V(t,x) \le \alpha_2(x)$
    2. $\dot{V}(t,x)={\partial V\over \partial t} + {\partial V \over \partial x}f(t,x) \le -\alpha_3(x)$
    3. $V(t,x) \le \alpha_2(x),\ \alpha_2\ is\ a\ class\ K\ function.$
    4. Base on 2. and 3., $\dot{V}(t,x) \le -\alpha_3(\alpha_2^{-1}(V)) \overset{\Delta}{=} -\alpha(V),\ \alpha(\bullet) \overset{\Delta}{=}\alpha_3 \circ \alpha_2^{-1}(\bullet)$
    5. Let y(t) satisfy the autonomous $1^{st}\ ODE\ \dot y = -\alpha(y),\ y(t_0)=V(t_0,x(t_0)) > 0$.
    6. Using lemma 4.3, lemma 4.4, 4, and 5 yields $V(t,x(t)) \le \sigma(V(t_0,x(t_0)),\ t-t_0),\ \forall V(t_0,x(t_0)) \in \begin{vmatrix}0,c\end{vmatrix},\ where\ \sigma(r,s)\ is \ a\ class\ KL\ function\ defined\ on\ [0,r] \times [0,\infty).$
    7. $\begin{Vmatrix}x\end{Vmatrix} \le \alpha_1^{-1}(V(t,x(t))) \le \alpha_1^{-1} \sigma(V(t_0,x_0(t_0),t-t_0) \le \beta(\begin{Vmatrix}x(t_0)\end{Vmatrix}),\ where \beta\ is\ a\ class\ K\ function$
    
[reference](https://zhuanlan.zhihu.com/p/32313616)

## Summary of Stability for Nonautonomous System
1. $V(t,x)\ is\ P.D$
2. $V(t,x)\ is\ Decreasent$
3. $\dot V(t,x)\ is\ N.S.D$
4. $V(t,x)\ is\ R.U$
5. ${\partial V\over \partial t} + {\partial V\over \partial x}f(t,x) \le -W_3(x)$

stable: 1, 3
uniformly stable: 1, 2, 3
globally uniformly stable: 1,2,3,4
globally uniformly asymptotically stable: 1, 2, 4, 5
globally asymptotically stable: 1, 4, 5
## Lemmas (from Khalil's Book)
* lemma 4.3:
  $\alpha_1(x) \le V(x) \le \alpha_2(x)$
  $\Rightarrow$ V(x) is $\color{red}{radially\ unbounded}$ if $\alpha_1\ and\ \alpha_2\ are\ K_\infty$
* lemma 4.5:
  the eq. pt.x=0 of $\dot{x}=f(t,x)$ is $\color{red}{U.A.S}$ iff there exist a $\color{red}{class\ KL}$ function $\beta$ and a positive constant c, independent of $t_0$, such that $\begin{Vmatrix}x(t)\end{Vmatrix} \le \beta(\begin{Vmatrix}x(t_0)\end{Vmatrix}), \forall t \ge t_0 \ge 0, \forall \begin{Vmatrix}x(t_0)\end{Vmatrix} < c$
  
## UUB (Uniformly Ultimately Bounded)
* $\dot x=-x + \delta \sin t$
    * solution:
      $x(t) = a e^{-(t-t_0)} + \delta \int_{t_0}^{t} e^{-(t-\tau)}\mathrm{d}\tau\\ 
      \begin{vmatrix}x(t)\end{vmatrix} \le a e^{-(t-t_0)} + \delta(1-e^{-(t-t_0)})\\ 
      \begin{vmatrix}x(t)\end{vmatrix} \le a + \delta$
     ![](https://i.imgur.com/7pAXVcV.png)
     $\begin{vmatrix}x(t)\end{vmatrix}$ will approach $\delta$ (not zero) as $t \to \infty$

* for a lighly nonlinear system, consider a dynamic system 
  $\dot x = -x + \delta\sin t$. Let $V(x) = {1 \over 2}x^2$, then
  $\dot{V}(x) = x(-x + \delta\sin t)\\ 
  \dot{V}(x) \le -x^2 + \delta\begin{vmatrix}x\end{vmatrix} = \begin{vmatrix}x\end{vmatrix} \color{red}{(\delta - \begin{vmatrix}x\end{vmatrix})}$
* consider the worst cases:
    * Case 1: $I.C\ \begin{vmatrix}x(t_0)\end{vmatrix} > \delta,\ \dot V(x(t_0)) < 0,\ then\ \dot V(x) < 0\ until\ \begin{vmatrix}x\end{vmatrix} = \delta$ 
    * Case 2: $I.C\ \begin{vmatrix}x(t_0)\end{vmatrix} = \delta,\ \dot V(x(t_0)) = 0 \Rightarrow \begin{vmatrix}x\end{vmatrix} = \delta\ as\ t \to \infty$
    * Case 3: $I.C\ \begin{vmatrix}x(t_0)\end{vmatrix} < \delta,\ \dot V(x(t_0)) > 0,\ then\ \dot V(x) > 0\ until\ \begin{vmatrix}x\end{vmatrix} = \delta$ 
    
  Therefore, the value of |x| is upper bounded by $\delta$ and lower bounded by 0.
* Uniformly Bounded:
  if exists a positive constant c, independent of $t_0 \ge 0$ and $\forall a \in (0,c)$, $\exists \beta$ s.t. $\beta(a) > 0$ independent of $t_0$, then $\begin{Vmatrix}x(t_0)\end{Vmatrix} \le a \Rightarrow \begin{Vmatrix}x(t)\end{Vmatrix} \le \beta$
* Uniformly Ultimately Bounded:
  if exists a positive constant c, independent of $t_0 \ge 0$ and $\forall a \in (0,c)$, $\exists b$ s.t. b(a) > 0 independent of $t_0$, and $\exists T \overset{\Delta}{=} T(a,b) > 0$ independent of $t_0$,then $\begin{Vmatrix}x(t_0)\end{Vmatrix} \le a \Rightarrow \begin{Vmatrix}x(t)\end{Vmatrix} \le b,\forall t > t_0 + T$

## Preliminary of Barbalat's Lemma
* suitable for non-autonomous system (compared with Lasalle's Theorem)
#### Common Misconception
* $\dot f \to 0\ as\ t \to \infty\nRightarrow f\ converge\ or\ has\ a\ limit$
    * Ex: $\dot f = {\cos(\log(t)) \over t} \Rightarrow f(t) = \sin(\log(t))\ \color{red}{does\ not\ have\ a\ limit}$ 
    * Ex: $\dot f = {1 \over 2 \sqrt{t}}\sin(\log(t)) + {\sqrt{t} \over t}\cos(\log(t)) \Rightarrow f(t) = \sqrt{t}\sin(\log(t))\ \color{red}{unbounded}$ 
    * 一階導數收斂於0，但是函數本身一直在非常緩慢地正弦波動。
* $f\ converge \nRightarrow \dot f \to 0\ as\ t \to \infty$
    * 函數收斂，一階導數卻趨於無窮，函數在收斂的值上下快速波動。
    * Barbalat's Lemma means that $(f\ converges) + (\dot f\ is\ U.C.) \Rightarrow \lim_{t \to \infty} \dot f=0$
#### When to use Barbalat's Lemma
* Note that Lasalle's Theorem is only designed for $\color{red}{autonomous}$ system
* For nonautonomous system, one should apply $\color{red}{Barbalat's\ Lemma}$
#### Barbalat's Lemma
* Integral form:
  If f(t) is uniformly continuous (U.C.) and if $\lim_{t \to \infty}\int_0^tf(\tau)\mathrm{d}\tau$ exists and is finite (equivalent the area under f(t) is finite) then $\lim_{t \to \infty}f(t) = 0$.
    * Finite Difference Theorem:
      If $\dot f$ exists and is bounded, $f$ is uniformly continuous.
* Non-Integral form:
  If $\dot f$ is U.C. and $\lim_{t \to \infty}f(t)$ exists and is finite, then $\lim_{t \to \infty}\dot f(t) = 0$
#### Ex:
Considera closed-loop system with dynamics described by $\dot x(t,x) = \tilde\theta\sin^2(t) - kx,\ where\ \tilde\theta \overset{\Delta}{=} \theta - \hat \theta$.
The Lyapunov function is designed as $V(t,x) = {1 \over 2}x^2 + {1 \over 2}\tilde\theta^2$, and substituting the dynamics into V(t,x) yields $\dot V(t,x) = -kx^2. \Rightarrow N.S.D$
* step 1: V is P.D, $\dot V$ is N.S.D $\Rightarrow V\ is\ bounded,\color{red}{\ x,\ \theta \in L_\infty (meaning\ x\ and\ \theta\ are\ bounded)}$
* step 2: According to the dynamics and 1. $\Rightarrow \dot x \in L_\infty\ (because\ x\ and\ \theta\ are\ bounded,\dot x\ is\ bounded) \Rightarrow x\ is\ uniformly\ continuous.$
* step 3: According to $\dot V(t,x) = -kx^2 \Rightarrow x \in L_2$
    * $\int_0^t\dot V(t,x) \mathrm{d}\tau = \int_0^t-kx^2 \mathrm{d}\tau = V(t) - V(0)\\ 
      \Rightarrow \int_0^t x^2 \mathrm{d}\tau \in L_\infty \Rightarrow x \in L_2$
      
By Barbalat's Lemma, x is U.C. and x is 2-norm (the norm of x is bounded); therefore, we can conclude that $\lim_{t \to \infty}x(t) = 0$ (x is $\color{red}{asymptotically\ stable}$)

[基於Barbalat's Lemma的Non-Autonomous系统分析](https://zhuanlan.zhihu.com/p/32834208)

==宗老師曰：==
==$L_\infty$ 為向量所有值相加Bounded==
==$L_2$ 為向量所有值平方相加Bounded(因無法正負相消故較為嚴格)==

## Feedback Linearization
#### System Structure (uncertainty system)
* system structure: $\dot x = Ax + B\gamma(x)[u-\alpha(x)]$
* controller: $u = \alpha(x) + \gamma(x)^{-1}\color{red}v$
* closed-loop systems: $\dot x = Ax + Bv$
* v can be designed using linear approaches (e.g. pole placement)

#### High Gain Controller
* consider a dynamical system described by $\dot x = \theta\sin^2(t) + u$. 
* where $\theta$ satisfies $\begin{vmatrix}\theta\end{vmatrix} < c$, where c is the upper bound of uncertainty.
* robust controller: $u = -kx + \color{red}{v_R}$, where $v_R$ is robust term.
* $v_R = k_2x$
  
* procedure:
  $\begin{align}
  V(x) &= {1 \over 2}x^2\\ 
  \dot V(x) &= x(\theta\sin^2(t) + u)\\ 
  &= x(\color{red}{\theta\sin^2(t)} - kx + \color{red}{v_R})\\ 
  &= x(\color{red}{\theta\sin^2(t)} - kx + \color{red}{k_2x})\\ 
  &\le -kx^2 \color{red}{- k_2x^2 + \begin{vmatrix}\theta\sin^2(t)x\end{vmatrix}}\\ 
  &\le -kx^2 \color{red}{- k_2x^2 + c\begin{vmatrix}x\end{vmatrix}}\\ 
  &\le -kx^2 - \color{red}{(k_2\begin{vmatrix}x\end{vmatrix} - c)}\begin{vmatrix}x\end{vmatrix}\\ 
  \dot V(x) &\le -kx^2,\ if\ \color{red}{(k_2\begin{vmatrix}x\end{vmatrix} - c)} >0
  \end{align}\\ 
  \Rightarrow \color{blue}{GUUB}\ (globally\ uniformly\ ultimately\ bounded)$
  
* takeaways
    * Larger the uncertainty on the parameter, the larger UUB error
    * The UUB error can be decreased by increasing control gains
      $\dot V(x) \le -kx^2,\ if\ (k_2\begin{vmatrix}x\end{vmatrix} - c) > 0,\ where\ \begin{vmatrix}x\end{vmatrix} > {c \over k_2}$ 
* how to find the ultimate bounded?
  $\begin{align}
  \dot V(x) &= x(\theta\sin^2(t) - kx - k_2x)\\ 
  &= -kx^2 - k_2x^2 + \theta\sin^2(t)x\\ 
  &= -kx^2 - k_2(x - {\theta\sin^2(t) \over 2k_2})^2 + {\theta^2\sin^4(t) \over 4k_2}\\ 
  &\le -kx^2 + {\theta^2\sin^4(t) \over 4k_2} \le -kx^2 + {c^2 \over 4k_2}
  \end{align}\\ 
  For\ \dot V(x) = 0,\ -kx^2 + {c^2 \over 4k_2} = 0\ \Rightarrow \begin{vmatrix}x\end{vmatrix} = {\color{red}c \over 2}\sqrt{{1 \over \color{red}{k k_2}}}$
    * As we can see if we increasing $k$ or $k_2$, $\begin{vmatrix}x\end{vmatrix}$ will decrease, which means we can converge more close to the origin or the error can be decreased by increasing the gain.
  
#### High Frequency Controller
* consider a dynamical system described by $\dot x = \theta\sin^2(t) + u$. 
* where $\theta$ is $\color{red}{unknown}$ and satisfies $\begin{vmatrix}\theta\end{vmatrix} < c$, where c is the upper bound of uncertainty.
* high frequency controller: $u = -kx + \color{red}{v_R}$, where $v_R$ is high frequency term.
* $v_R = -k_2sgn(x)$    （因為sgn函數在0附近變動非常快速-1~1所以稱之為high frequency）
* procedure:
  $\begin{align}
  V(x) &= {1 \over 2}x^2\\ 
  \dot V(x) &= x(\theta\sin^2(t) + u)\\ 
  &= x(\color{red}{\theta\sin^2(t)} - kx + \color{red}{v_R})\\ 
  &= \color{blue}{x}(\theta\sin^2(t) - kx + \color{red}{-k_2}\color{blue}{sgn(x)})\\ 
  &\le -kx^2 - k_2\color{blue}{\begin{vmatrix}x\end{vmatrix}} + \begin{vmatrix}\theta\sin^2(t)x\end{vmatrix}\\ 
  &\le -kx^2 - k_2\begin{vmatrix}x\end{vmatrix} + \begin{vmatrix}\theta\end{vmatrix}\begin{vmatrix}\sin^2(t)\end{vmatrix}\begin{vmatrix}x\end{vmatrix}\\  
  &\le -kx^2 - k_2\begin{vmatrix}x\end{vmatrix} +  c\begin{vmatrix}x\end{vmatrix}\\ 
  &\le -kx^2 - (k_2 - c)\begin{vmatrix}x\end{vmatrix}\\ 
  \dot V(x) &\le -kx^2,\ if\ (k_2 - c) >0
  \end{align}\\ 
  As\ long\ as\ (k_2 - c) > 0,\ \dot V(x)\ is\ N.D \Rightarrow \color{blue}{Asymptotically\ Stable}$

* takeaways
    * High frequency controller ensures GAS (or GES) as long as gain is larger than the uncertainty.

#### Conclusion
* High gain controller -> GUUB
* High frequency controller -> GES (globally exponentially stable)

#### Adaptive Controller
[Nonlinear Adaptive Controller](https://www.bilibili.com/video/BV1yW411u7qv)
#### Linearly Parameterized:
consider a dynamical system described by $\dot x = \theta\sin^2(t) + u$, 
where $\theta$ is an unkown constant and linearly parameterized.
1. if $\theta$ is known, what controller would you design?
   A1: Feedback linearization: $u = -\theta\sin^2(t) - kx,\ then\ \dot x = -kx$
2. $if\ \theta\ is\ \color{red}{unknown},\ and\ asymptotically\ stability\ is\ described\ without\ using\ high\ frequency\ controller?$
   A2: Adaptive controller: $u = -\hat\theta\sin^2(t) - kx,\ then\ \dot x = (\theta - \hat\theta)\sin^2(t) - kx,\ where\ \hat\theta\ is\ the\ estimation\ of\ system$ 

#### Selection of Lyapunov Function
Using the adaptive controller yields the closed-loop dynamics 
\begin{gather}
\dot x = \tilde\theta\sin ^2(t) - kx,\ \tilde\theta = \theta - \hat\theta
\end{gather}
how to design the Lyapunov function?
option1. $V(x) = {1 \over 2}x^2$
option2. $V(\theta,x) = {1 \over 2}x^2 + {1 \over 2}\theta^2$ 
which one? Ans: option2
$\begin{align}
For\ V(t,x) &= {1 \over 2}x^2 + {1 \over 2}\theta^2\\ 
\dot V(t,x) &= x(\tilde\theta\sin^2(t) - kx) + \tilde\theta \dot{\tilde\theta}\\ 
&= -kx^2 + x\tilde\theta\sin^2(t) - \tilde\theta \dot{\hat\theta}\ (let\ \dot{\hat\theta} = x\sin^2(t))\\  
&= -kx^2 \Rightarrow \color{red}{N.S.D\ (Globally\ Stable)}
\end{align}$ 
note: $\dot{\tilde\theta} = \dot\theta - \dot{\hat\theta} = -\dot{\hat\theta}$
design adaptive law: $\dot{\hat\theta} = x\sin^2(t)$

Let's try GAS using Barbalat's lemma (can not apply Lasalle's theorem for nonautonomous system)
1. $From\ \dot V(t,x) = -kx^2 \le 0,\ we\ know\ V(t,x) \in L_\infty,\ where\ implies\ x,\tilde\theta,\hat\theta \in L_\infty\ as\ well\ as\ u \in L_\infty$
2. According to the closed-loop dynamics, $\dot x \in L_\infty$, which also implies x is U.C.
3. Integrating on both sides of $\dot V(t,x) = -kx^2$ yields $V(t,x) - V(0,x) = \int -kx^2 \mathrm{d}t$, which implies $x \in L_2$
4. Invoking Barbalat's lemma with $x \in L_2$ and x is U.C., we can conclude $x \to 0\ as\ t \to \infty$

#### Conclusion
* All signals including states, control input, and estimate errors are bounded.
* Control input signals are continuous.
* Control effort can be reduced (we know the model $\hat\theta$).m

#### EMK (Exact Model Knowledge)
* Can feedback linearize the system
* Reduce control efforts
* Not practical
* Improve stability/convergence

#### Robust Controller
* Very high gain or high frequency
* Very hard on actuators
* Application to a very broad class of system
* Stability: UUB(high gain), GES(high frequency)

#### Adaptive Controller
* Need some structure to the uncertainty (Linearly Parameterized)
* Can achieve asymptotical tracking with continuous control
* Less control energy than typical robust methods
* Ueses dynamics to achieve best results

| | Robust | Stability | Control uncertainty |
| --------- | -------- | -------- | ------- |
| EMK | no | GES | great |
| Adoptive | yes | GAS | great |
| High gain | yes | UUB | good |
| High frequency(SMC) | yes | GES | poor |

## Euler Lagrange System (System with Known Parameters)
Consider an euler-lagrange system 
$m\ddot q + mgl\sin (q) = \tau$
where $g \in R$ is the gravity, $m \in R$ is the mass of the system, $l \in R$ is a constant, $q, \dot q \in R$ are states that are measurable, amd $\tau \in R$ is the control input.

we can conduct that is equivalent: $\ddot q = -gl\sin (q) - {\tau \over m}$ 

#### Stability Analysis Procedures
![](https://i.imgur.com/sRulXAv.png)

#### Objective-Tracking Control
$e = q_d(t) - q(t)$
Assumption: $q_d, \dot q_d, \ddot q_d \in L_\infty$
Objective: $e \rightarrow 0\ as\ t \rightarrow \infty$
Preliminaries:
* step1: Check dynamics of e: $\dot e = \dot q_d(t) - \dot q(t) \Rightarrow Control\ input\ does\ not\ appear$
* step2: Check dynamics of $\dot e$: $\ddot e = \ddot q_d(t) - \ddot q(t) \Rightarrow Control\ input\ in\ \ddot q(t)$

#### Choose Lyapunov Functions
Option1: $V(e) = {1 \over 2}me^2$, and seeking $\dot V(x) = -kme^2$
Option2: $V(e, \dot e) = {1 \over 2}me^2 + {1 \over 2}m\dot e^2, and seeking \dot V(x) = -ke^2 - k\dot e^2$
Option3: $V(r) = {1 \over 2}mr^2, r = \dot e + \alpha e, where seeking \dot V(x) = -kr^2$

###### Try Option1
* $V(e) = {1 \over 2}me^2$
* $\dot V(e) = em\dot e$
* The substituting the dynamics of $\dot e$
* $\dot V(x) = em\dot e = em(\dot q_d(t) - \color{red}{\dot q(t)}) \Rightarrow No\ control\ input$
* Game over!

###### Try Option2
* $V(e, \dot e) = {1 \over 2}me^2 + {1 \over 2}m\dot e^2$
* $\dot V(e) = em\dot e + \dot em\ddot e$
* substituting the dynamics of $\dot e\ and\ \ddot e$
* $\dot V(x) = em(\dot q_d(t) - \dot q(t)) + \color{red}{\dot e(\ddot q_d(t) - \ddot q(t))}$, where $\ddot q = -gl\sin (q) - {\color{red}{\tau} \over m}$ 
* seeking $\dot V(x) = -ke^2 - k\dot e^2$ (N.D.)
* some problem with thos error dynamics structure since the second term is independent of the first term

##### Introduction - Filter Tracking Error
$r = \dot e + \alpha e$, where $\alpha$ is a positive constant (can be considered as a control gain)
Lemma: if $r \in L_\infty$ and $r \rightarrow 0\ as\ t \rightarrow \infty$, then $e, \dot e \rightarrow 0$
Proof:
$r \in L_\infty$ implies $\begin{vmatrix}r\end{vmatrix} < \epsilon$
substituting into $r = \dot e + \alpha e$ yields $\begin{vmatrix}\dot e + \alpha e\end{vmatrix} < \epsilon$
which can further bounded as $\begin{vmatrix}\dot e\end{vmatrix} + \alpha\begin{vmatrix}e\end{vmatrix} < \epsilon$, or $\begin{vmatrix}\dot e\end{vmatrix} <  -\alpha\begin{vmatrix}e\end{vmatrix} + \epsilon$
solve for the inequality obtains $\begin{vmatrix}e(t)\end{vmatrix} < c\begin{vmatrix}e(0)\end{vmatrix}e^{-\alpha t} + {\epsilon \over \alpha}(1 + e^{-\alpha t})$
$\begin{vmatrix}e(t)\end{vmatrix} < 0\ as\ \epsilon \rightarrow 0\ and\ as\ t \rightarrow \infty$
Q.E.D. (quod erat demonstrandum)

###### Try 3
* $V(r) = {1 \over 2}mr^2$
* $\dot V(r) = rm\dot r = rm(\ddot e + \alpha \dot e)$
* $\dot V(r) = rm((\ddot q_d + glsin(q) - {\color{red}\tau \over m}) + \alpha \dot e)$
* $\dot V(r) = -kr^2$ (N.D.)
* $r \rightarrow 0\ as\ t \rightarrow \infty\ (implies\ e, \dot e \rightarrow 0\ as\ t\rightarrow \infty)$

design 
$\begin{align}
\tau 
&= m(\color{blue}{\ddot q_d + glsin(q) + \alpha \dot e} + \color{green}{kr})\\ 
&= \color{blue}{nonlinear\ term} + \color{green}{feedback\ term}
\end{align}$

## Euler Lagrange System (System with Unknown Parameters)
Consider an euler-lagrange system 
$m\ddot q + mgl\sin (q) = \tau$
where $g \in R$ is the gravity, $m, l \in R$ are $\color{red}{unknown}$ constants, $q, \dot q \in R$ are states that are measurable, amd $\tau \in R$ is the control input.

#### Objective-Tracking Control
$e = q_d(t) - q(t)$
Assumption: $q_d, \dot q_d, \ddot q_d \in L_\infty$
Objective: $e \rightarrow 0\ as\ t \rightarrow \infty$
Preliminaries:
* step1: Check dynamics of e: $\dot e = \dot q_d(t) - \dot q(t) \Rightarrow Control\ input\ does\ not\ appear$
* step2: Check dynamics of $\dot e$: $\ddot e = \ddot q_d(t) - \ddot q(t) \Rightarrow Control\ input\ in\ \ddot q(t)$

#### Robust Control - High Gain
* define tracking error: $e = q_d - q$
* filter tracking error: $r = \dot e + \alpha e$, $\alpha$ is a positive constant
* design controller: $\tau = kr + V_R$
* $\color{yellow}{m\dot r} = m\ddot q_d + mglsin(q) + \alpha m\dot e - \tau$
* $V(e, r) = {1 \over 2}mr^2 + {1 \over 2}\alpha^2 me^2$
* $\begin{align}
   \dot V(e, r) 
   &= rm\color{yellow}{\dot r} + \alpha^2 me\color{red}{\dot e}\\ 
   &= r[\color{yellow}{closed-loop dynamics}] + \alpha^2me[\color{red}{filtered\ tracking\ error}]\\ 
   &=r[m\ddot q_d + mglsin(q) + \alpha m\color{purple}{\dot e} - \tau] + \alpha^2me\color{red}{\dot e}\\ 
   &=r[m\ddot q_d + mglsin(q) + \alpha m\color{purple}{(r - \alpha e)} - \tau] + \alpha^2me\color{red}{(r - \alpha e)}\\ 
   &=r(m\ddot q_d + mglsin(q)) + \alpha mr^2 - r(kr + V_R) - \alpha^3me^2\\ 
   &and\ we\ know (m\ddot q_d + mglsin(q))\ is\ bounded (\le c_1)\\ 
   &\le c_1\begin{vmatrix}r\end{vmatrix} - (k - \alpha m)r^2 - r(V_R) - \alpha^3me^2\\ 
   &let\ k_2 = (k - \alpha m),\ and\ design\ V_R = k_3c_1^2r\\ 
   &\le - k_2r^2 - \alpha^3me^2 + c_1\begin{vmatrix}r\end{vmatrix} - k_3c_1^2r^2\\ 
   &\le - k_2r^2 - \alpha^3me^2 + {1 \over 4k_3} \Rightarrow UUB\\ 
   &\le - min(k_2, \alpha^3m)\begin{Vmatrix}Z\end{Vmatrix}^2 + {1 \over 4k_3}, \ where\ Z = \begin{bmatrix} e\\r \end{bmatrix} \Rightarrow UUB
   \end{align}$ 
   
#### Robust Control - High Freq
* define tracking error: $e = q_d - q$
* filter tracking error: $r = \dot e + \alpha e$, $\alpha$ is a positive constant
* design controller: $\tau = kr + V_R$
* $\color{green}{m\dot r} = m\ddot q_d + mglsin(q) + \alpha m\dot e - \tau$
* $V(e, r) = {1 \over 2}mr^2 + {1 \over 2}\alpha^2 me^2$
* $\begin{align}
   \dot V(e, r) 
   &= rm\color{green}{\dot r} + \alpha^2 me\color{red}{\dot e}\\ 
   &= r[\color{green}{closed-loop dynamics}] + \alpha^2me[\color{red}{filtered\ tracking\ error}]\\ 
   &=r[m\ddot q_d + mglsin(q) + \alpha m\color{purple}{\dot e} - \tau] + \alpha^2me\color{red}{\dot e}\\ 
   &=r[m\ddot q_d + mglsin(q) + \alpha m\color{purple}{(r - \alpha e)} - \tau] + \alpha^2me\color{red}{(r - \alpha e)}\\ 
   &=r(m\ddot q_d + mglsin(q)) + \alpha mr^2 - r(kr + V_R) - \alpha^3me^2\\ 
   &and\ we\ know (m\ddot q_d + mglsin(q))\ is\ bounded (\le c_1)\\ 
   &\le c_1\begin{vmatrix}r\end{vmatrix} - (k - \alpha m)r^2 - r(V_R) - \alpha^3me^2\\ 
   &let\ k_2 = (k - \alpha m),\ and\ design\ V_R = k_3sgn(r)\\ 
   &\le - k_2r^2 - \alpha^3me^2 - (k_3 - c_1)\begin{vmatrix}r\end{vmatrix}\\ 
   &\le - k_2r^2 - \alpha^3me^2 \Rightarrow GAS
   \end{align}$
   
#### Adaptive Control
* define tracking error: $e = q_d - q$
* filter tracking error: $r = \dot e + \alpha e$, $\alpha$ is a positive constant
* $m\dot r = m\ddot q_d + mglsin(q) + \alpha m\dot e - \tau$
* $V(r) = {1 \over 2}mr^2 + \color{red}{{1 \over 2}\tilde\theta^T \Gamma^{-1} \tilde\theta}$
  where $\theta\ is\ \begin{bmatrix}m\\ml\end{bmatrix},\ \tilde\theta = \theta - \hat\theta,\ and\ \Gamma\ is\ a\ positive\ diagonal\ matrix\ with\ constant\ known\ entries$
* $\dot V(r) = r(m\ddot q_d + mglsin(q) + \alpha m\dot e - \tau) +  \color{red}{\tilde\theta^T \Gamma^{-1} \dot{\tilde\theta}}$
  let 
  $\begin{align}
  Y^T\theta 
  &= m\ddot q_d + mglsin(q) + \alpha m\dot e\\ 
  &= \begin{bmatrix}\ddot q_d + \alpha\dot e & glsin(q)\end{bmatrix}\begin{bmatrix}m\\ml\end{bmatrix}
  \end{align}$
* $\dot V(r) = r(Y^T\theta - \tau) -  \color{red}{\tilde\theta^T \Gamma^{-1} \dot{\hat\theta}}$
* design $\tau = Y^T\hat\theta + kr$ and $\dot{\hat\theta} = \Gamma Yr$
* $\begin{align}
  \dot V(r) 
  &= Y^T\tilde\theta r - kr^2 +  \color{red}{\tilde\theta^T Yr}\\ 
  &= -kr^2 \Rightarrow N.S.D
  \end{align}$
* sigal chasing to show stats, $\tilde\theta$, and control input are bounded
* apply Barbalet's lemma to show $r \rightarrow 0\ as\ t \rightarrow \infty$
###### signal chasing
* V is P.D. and $\dot V$ is N.S.D. $\rightarrow V \in L_\infty \rightarrow r, \tilde\theta \in L_\infty$ 
* $r \in L_\infty \rightarrow e, \dot e \in L_\infty \rightarrow q \in L_\infty$
* $\tilde\theta \in L_\infty$ and $\theta$ is constant $\rightarrow \hat\theta \in L_\infty$
* check $Y(q, \dot e, \ddot q_d) \in L_\infty \rightarrow \tau(Y, \hat\theta, r) \in L_\infty \Rightarrow$ the control input is bounded.
* from $m\dot r = Y^T\tilde\theta - kr \rightarrow \dot r \in L_\infty \rightarrow$ r is uniformly continuous
* $V(t) - V(0) = -\int_0^t kr^2 \in L_\infty \Rightarrow r \in L_2$
From above two results, we can conclude that $r \rightarrow 0\ as\ t \rightarrow \infty$.

#### Summary
* Robust Control: $\tau = kr + V_R$, $V(e, r) = {1 \over 2}mr^2 + {1 \over 2}\alpha^2me^2$
* Adaptive Control: $\tau = Y^T\hat\theta + kr$, $V(r, \tilde\theta) = {1 \over 2}mr^2 + {1 \over 2}\tilde\theta^T\Gamma^{-1}\tilde\theta$

|           |      controller      | stability | note                                      |
| --------- |:--------------------:|:---------:| ----------------------------------------- |
| High Gain |   $kr + k_3c_1^2r$   |    UUB    | increasing k_3 can decrease the UUB error |
| High Freq |   $kr + k_3sgn(r)$   |    GAS    |                                           |
| Adaptive  | $Y^T\hat\theta + kr$ |    GAS    |                                           |

## BackSteping
#### General form
$\dot {\color{red}x} = f(x) + g(x)y_1 \\ 
\dot y_1 = f(x, y_1) + g(x, y_1)y_2 \\ 
\dot y_2 = f(x, y_1, y_2) + g(x, y_1, y_2)y_3 \\ 
... \\ 
\dot y_k = f(x, y_1, ..., y_k) + g(x, y_1, ...,y_k)\color{red}u$

#### Example
$\dot x = f(x) + g(x)y,\ g(x) > 0 \\ 
\dot y = u$
where $x, y \in R$ are the states, $u \in R$ is the control input, and $f, g$ are assumed to be known.
![](https://i.imgur.com/u827dFS.png)
Objective: $x \rightarrow 0\ as\ t \rightarrow \infty$

###### controller
1. $\dot x = f(x) + g(x)y \Rightarrow Expect\ y_d = {1 \over g(x)}(f(x) - kx)\ such\ that\ \dot x = -kx$
2. $\dot y = u \Rightarrow Design\ u\ s.t\ y \rightarrow y_d$
---
1. $\dot x = f(x) + g(x)y \color{red}{- g(x)y_d + g(x)y_d}$
2. design $y_d = {1 \over g(x)}(-f(x) - kx)$
3. closed-loop system 1: $\dot x = -k_1x + g(x)\eta$, where $\eta = y - y_d$
4. $\dot\eta = \dot y - \dot y_d\ and\ u = \dot y_d - k_2\eta \color{red}{- g(x)x}$
5. closed-loop system 2: $\dot\eta = -k_2\eta \color{red}{- g(x)x}$
6. $V = {1 \over 2}x^2 + {1 \over 2}\eta^2$
7. $\dot V = -k_1x^2 + k_2\eta^2$ (GES)
---
note: 
$u = \dot y_d - k_2\eta - g(x)x \\ 
\left\{
\begin{align}
\dot y_d\ is\ feedforward\ term\ about\ desired\ trojectory \\ 
k_2\eta\ is\ feedback\ term \\ 
g(x)x\ is\ cross\ term\ to\ cancle\ g(x)\eta\ in\ closed-loop\ 1 
\end{align}
\right.$ 

#### Example
Dynamics:
Consider the following dynamics for a robot manipulator 
$m(q)\ddot q + V_m(q, \dot q)\dot q + f(\dot q) + G(q) = \tau$
where $m: R \rightarrow R,\ V_m(q, \dot q): R \times R \rightarrow R$ are the mass and coriolis/centrifugal constant, $f: R \rightarrow R$ denotes friction, $G \in R$ denotes gravity, $q, \dot q \in R$ are states that are measurable, and $\tau \in R$ is the control input.

Kinematics:
$\dot x = J(q)\dot q$
where J(q) is Jacobian Matrix

![](https://i.imgur.com/HSnlWyH.png)

Objective 1: $x \rightarrow 0$ where x is the trajectory in task space
$\begin{align}
\dot x 
&= \dot x \color{red}{- \dot x_d + \dot x_d} \\ 
&= J\dot q \color{red}{- J\dot q_d + J\dot q_d} \\ 
&= J\eta + J\dot q_d
\end{align}$
where $\eta = \dot q - \dot q_d$
virtual control input: $\dot q \rightarrow \dot q_d,\ \dot q_d = -J^{-1}(q)kx$
closed-loop dynamics: $\dot x = J\eta - kx$

Objective 2: $\dot q \rightarrow \dot q_d$
$m\dot\eta = m\ddot q - m\ddot q_d$
where
$m\ddot q = \tau - V_m\dot q - f - G$ from open-loop dynamics
$m\ddot q_d = m{d \over dt}(J^{-1}(kx))$ from definition of $\dot q_d$ in the previous page

Design controller: $\tau = V_m\dot q_d + G(q) + f(\dot q) + m{d \over dt}(J^{-1}(kx)) - Jx - k\eta$ 
Closed-loop dynamics: $m\dot\eta = -V_m\dot q + V_m\dot q_d - Jx - k\eta$

Stability Analysis:
$V = {1 \over 2}x^2 + {1 \over 2}m\eta^2 \\ 
\begin{align}
\dot V 
&= x\dot x + {1 \over 2}\color{red}{\dot m}\eta^2 + \eta m\dot\eta \\ 
&= x(J\eta - kx) + {1 \over 2}\dot m\eta^2 + \eta(-V_m\dot q + V_m\dot q_d - Jx - k\eta) \\ 
&where\ \dot q = \eta + \dot q_d\ and\ \eta^T({1 \over 2}\dot m - V_m)\eta = 0\ from\ skew-symmetric\ property \\ 
&= x(J\eta - kx) + \eta(-Jx - k\eta) \\ 
&= -kx^2 - k\eta^2 \\  
&\rightarrow N.D.
\end{align}$

#### Example: Mechatronoc Systems
Mechanical systems: $m\ddot q + mglsin(q) = \color{red}\tau$, $\tau = k_\tau I$
Electrical systems: $L\dot I + RI + k_v\dot q = \color{red}v$

Assumptions: EMK, and $q, \dot q$ are measurable.

---
###### system 1: 
Objective: $\eta \rightarrow 0$

because tracking error:
$e = q_d - q$
$r = \dot e + \alpha e$

$w = m\ddot q_d + mglsin(q)$
$\eta = I_d - I$

$\begin{align}
m\dot r 
&= m(\ddot e + \alpha\dot e)\\ 
&= (m\ddot q_d + mglsin(q) - \tau + \alpha m\dot e) \color{green}{-\tau_d + \tau_d} \\ 
&= w + k_\tau\eta + \alpha m\dot e - \tau_d
\end{align}$

virtual control: $I_d = {1 \over k_\tau}(w + kr)$
closed-loop system: $m\dot r = k_\tau\eta + \alpha m(r - \alpha e) - kr$

###### system 2:
Objective: $\eta \rightarrow 0$

$\begin{align}
L\dot\eta 
&= L\dot I_d - L\dot I \\ 
&= L\dot I_d - (v - RI - k_v\dot q)
\end{align}$

physical control: $v = L\dot I_d + RI + k_v\dot q + k\eta + r^Tk_\tau$
closed-loop system: $L\dot\eta = -k\tau - r^Tk_\tau$

###### stability analysis:
$\begin{align}
V
&= {1 \over 2}r^Tmr + {1 \over 2}L\eta^2 + {1 \over 2}e^T\alpha^2me \\ 
&= r^T[k_\tau\eta + \alpha m(r - \alpha e) - kr] + \eta(-k\eta - r^Tk_\tau) + e^T\alpha^2m(r - \alpha e) \\ 
&= -r^T(k - \alpha m)r - k\eta^2 - \alpha^3me^Te \\ 
&\rightarrow N.D\ (provided\ that\ k > \alpha m)
&\Rightarrow GES
\end{align}$

#### Example with disturbance
$\begin{align}
\dot x_1 = d_1 + x_2 \\ 
\dot x_2 = d_2 + x_3 \\ 
\dot x_3 = d_3 + u
\end{align}$
where $x_1,x_2,x_3 \in R$ are measurable, $\theta_1, \theta_2, \theta_3 \in R$ are unkown parameters, $u \in R$ is the control input.

---
bounds of the disturbances
$\begin{Vmatrix}d_1\end{Vmatrix} \le d_{1a} + d_{1a}\begin{Vmatrix}x_1\end{Vmatrix} \\ 
\begin{Vmatrix}d_2\end{Vmatrix} \le d_{2a} + d_{2a}\begin{Vmatrix}x_2\end{Vmatrix} \\ 
\begin{Vmatrix}d_3\end{Vmatrix} \le D_3$

---
Objective: Design u using robust control such that $x \rightarrow 0,\ as\ t \rightarrow \infty$

###### system 1
Objective: design $x_{2d}$ such that $x_1$ is bounded

$\dot x_1 = d_1 + x_2 \color{red}{-x_{2d} + x_{2d}} \Rightarrow \dot x_1 = d_1 + \eta_1 + x_{2d},\ \eta_1 = x_2 - x_{2d}$

virtual control input: 
$\begin{align}
x_{2d} 
&= -kx_1 - k_{n1}d_{1a}^2x_1 + k_{n2}d_{1b}x_1 \rightarrow good\\ 
&= -kx_1 - k_{n1}sgn(x_1)+ k_{n2}d_{1b}x_1 \rightarrow bad
\end{align}$

closed-loop dynamics: $\dot x_1 = d_1 + \eta_1 - kx_1 - k_{n1}d_{1a}^2x_1 + k_{n2}d_{1b}x_1$

stability analysis:
$\begin{align}
V_1 
&= {1 \over 2}x_1^2 \\ 
\dot V_1 
&= x_1(d_1 + \eta_1 + x_{2d}) \\ 
&\le \color{green}{\begin{vmatrix}d_1x_1\end{vmatrix}} + x_1\eta_1 + x_1x_{2d}
\end{align}$
