# Adaptive Super-Twisting Control for Mobile Wheeled Inverted Pendulum Systems
## 3 Design of the Adaptive Super Twisting Controller
\begin{array}{l}u_{A}=\frac{1}{\delta_{2}+\lambda_{2}\delta_{1}}[-f_{2}- \lambda_{2}f_{1}-\lambda_{1}\dot{q}_{2}\\ -K_{1}|\sigma_{1}|^{\frac{1}{2}}\text{sgn}(\sigma_{1})+v_{1}]\\ =\frac{1}{\delta_{2}+\lambda_{2}\delta_{1}}[-f_{2}-\lambda_{2}f_{1}-\lambda_{1 }\dot{q}_{2}-K_{1}|\sigma_{1}|^{\frac{1}{2}}\text{sgn}(\sigma_{1})\\ -\Gamma_{1}\int_{0}^{t}\text{sgn}(\sigma_{1}(\tau))d\tau]\\ u_{B}=\frac{1}{\delta_{3}}[-f_{3}-\lambda_{3}\dot{q}_{3}-K_{3}|\sigma_{2}|^{ \frac{1}{2}}\text{sgn}(\sigma_{2})+v_{2}]\\ =\frac{1}{\delta_{3}}[-f_{3}-\lambda_{3}\dot{q}_{3}-K_{3}|\sigma_{2}|^{\frac{ 1}{2}}\text{sgn}(\sigma_{2})\\ -\Gamma_{2}\int_{0}^{t}\text{sgn}(\sigma_{2}(\tau))d\tau]\end{array} \right., \tag{12}\]  
_where \(f_{i}(i=1,2,3)\) and \(g_{i}(i=1,2,3)\) are the parts of the dynamic model, which are depicted in Section 2._  
_In Assumption 1, the lumped disturbances are assumed to be bounded; then the following inequality holds:_  
\[\left\{ \begin{array}{l}||\tau_{d2}+\lambda_{2}\tau_{d1}||\leq\hat{\Gamma}_{ 1}\\ ||\tau_{d3}||\leq\hat{\Gamma}_{2}\end{array} \right.. \tag{13}\]  
**Remark 1**. : \(\hat{\Gamma}_{1},\hat{\Gamma}_{2}\) _are used to represent the actual bounds of the two kinds of disturbances in (13), respectively. It is worth noting that we are just assuming the disturbance is bounded, while we don't require the knowledge of the upper bound. This unknown upper bound has not been exploited in the design of the controller. It is adaptively learned by (11). We define \(\hat{\Gamma}=\Gamma-\hat{\Gamma}\). It represents the error between the bound obtained by the adaptive law and the actual bound. We will prove below that \(\Gamma\) will converge to \(\hat{\Gamma}\) by the rendered adaptive law._  
Proof. : Consider the Lyapunov function  
\[V=\frac{1}{2}\left(\sigma_{1}^{2}+\sigma_{2}^{2}\right)+\frac{1}{2}(\partial _{1}\hat{\Gamma}_{1}^{2}+\partial_{2}\hat{\Gamma}_{2}^{2}). \tag{14}\]  
Obviously, it is positive definite. Taking the first time derivative of the defined Lyapunov function yields  
\[\dot{V}=\sigma_{1}\dot{\sigma}_{1}+\sigma_{2}\dot{\sigma}_{2}+\partial_{1}( \Gamma_{1}-\hat{\Gamma}_{1})\dot{\Gamma}_{1}+\partial_{2}(\Gamma_{2}-\hat{ \Gamma}_{2})\dot{\Gamma}_{2}. \tag{15}\]  
From (5), (11), and (12), it follows that  
\[ \begin{array}{l}\dot{\sigma}_{1}=\dot{q}_{2}+\lambda_{1}\dot{q}_{2}+\lambda_ {2}\dot{q}_{1}\\ =(f_{2}+g_{2}u_{A})+\tau_{d2}+\lambda_{1}\dot{q}_{2}+\lambda_{2}(f_{1}+g_{1}u_{ A}+\tau_{d1})\\ =f_{2}+\lambda_{2}f_{1}+\lambda_{1}\dot{q}_{2}+(g_{2}+\lambda_{2}g_{1})u_{A}+ \tau_{d2}+\lambda_{2}\tau_{d1},\end{array}  \tag{16}\]  
\[ \begin{array}{l}\dot{\sigma}_{2}=\ddot{q}_{3}+\lambda_{3}\dot{q}_{3}\\ =f_{3}+g_{3}u_{B}+\tau_{d3}+\lambda_{3}\dot{q}_{3},\end{array}  \tag{17}\]  
\[\partial_{1}\hat{\Gamma}_{1}=\partial_{1}(\dot{\Gamma}_{1}-\dot{\Gamma}_{1})= \partial_{1}\frac{1}{\partial_{1}}|\sigma_{1}|=\sigma_{1}\text{sgn}(\sigma_{ 1}), \tag{18}\]  
\[\partial_{2}\hat{\Gamma}_{2}=\partial_{2}(\dot{\Gamma}_{2}-\dot{\Gamma}_{2})= \partial_{2}\frac{1}{\partial_{2}}|\sigma_{2}|=\sigma_{2}\text{sgn}(\sigma_{ 2}). \tag{19}\]  
Then the derivative of the Lyapunov function can be written as  
\[ \begin{array}{l}\dot{V}=\sigma_{1}\dot{\sigma}_{1}+\sigma_{2}\dot{\sigma}_{2 }+\partial_{1}\hat{\Gamma}_{1}\hat{\Gamma}_{1}+\partial_{2}\hat{\Gamma}_{2} \hat{\Gamma}_{2}\\ =\sigma_{1}(f_{2}+\lambda_{2}f_{1}+\lambda_{1}q_{2}+(g_{2}+\lambda_{2}g_{1})u_{ A}+\tau_{d2}+\lambda_{2}\tau_{d1})\\ +\sigma_{2}(f_{3}+g_{3}u_{B}+\lambda_{3}q_{3}+\tau_{d3})+(\Gamma_{1}-\hat{ \Gamma}_{1})\sigma_{1}\text{sgn}(\sigma_{1})+(\Gamma_{2}-\hat{\Gamma}_{2}) \sigma_{2}\text{sgn}(\sigma_{2}).\end{array}  \tag{20}\]Substituting the control laws proposed in (12) into (20), we can obtain  
\[