# Adaptive Super-Twisting Control for Mobile Wheeled Inverted Pendulum Systems
## 3 Design of the Adaptive Super Twisting Controller
\begin{array}{l}\dot{V}=\sigma_{1}\phi_{1}+\sigma_{2}\phi_{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}\hat{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})\\ +\partial_{1}(\Gamma_{1}-\hat{\Gamma}_{1})\hat{\Gamma}_{1}+\partial_{2}(\Gamma _{2}-\hat{\Gamma}_{2})\hat{\Gamma}_{2}\\ =\sigma_{1}(-K_{1}|\sigma_{1}|^{\frac{1}{2}}\text{sgn}(\sigma_{1})-\Gamma_{1} \int_{0}^{t}\text{sgn}(\sigma_{1})d\tau+\tau_{d2}+\lambda_{2}\tau_{d1})+ \sigma_{2}(-K_{2}|\sigma_{2}|^{\frac{1}{2}}\text{sgn}(\sigma_{2})\\ -\Gamma_{2}\int_{0}^{t}\text{sgn}(\sigma_{2})d\tau+\tau_{d3})+(\Gamma_{1}- \hat{\Gamma}_{1})|\sigma_{1}|+(\Gamma_{2}-\hat{\Gamma}_{2})|\sigma_{2}|\\ =-K_{1}|\sigma_{1}|^{\frac{3}{2}}-\Gamma_{1}|\sigma_{1}|+\sigma_{1}(\tau_{d2}+ \lambda_{2}\tau_{d1})-K_{2}|\sigma_{2}|^{\frac{3}{2}}-\Gamma_{2}|\sigma_{2}| \\ +\Gamma_{1}|\sigma_{1}|-\hat{\Gamma}_{1}|\sigma_{1}|+\Gamma_{2}|\sigma_{2}|- \hat{\Gamma}_{2}|\sigma_{2}|\\ =-K_{1}|\sigma_{1}|^{\frac{3}{2}}-K_{2}|\sigma_{2}|^{\frac{3}{2}}+\sigma_{1} (\tau_{d2}+\lambda_{2}\tau_{d1})-\hat{\Gamma}_{1}|\sigma_{1}|+\sigma_{2}\tau_{ d3}-\hat{\Gamma}_{2}|\sigma_{2}|\\ \leq-K_{1}|\sigma_{1}|^{\frac{3}{2}}-K_{2}|\sigma_{2}|^{\frac{3}{2}}.\end{array}  \tag{21}\]  
It is clear that \(\dot{V}\) is negative definite. Therefore, the trajectory of the system reaches the manifold \(S=0\) by using the control law, and the variable \(q_{3}\) can converge to \(q_{3d}\). After reaching the sliding surface, the second phase of the sliding mode control, i.e., the sliding phase, needs to be guaranteed. The trajectory is expected to move towards the equilibrium point while sliding on the sliding surface. From (3) and (7), the motion of the system on the sliding surface can be obtained:  
\[z_{1}\ddot{q}_{1}+z_{2}\ddot{q}_{2}=\dot{m}_{12}\sin\left(q_{2}\right)\ddot{q} _{2}^{2}+\dot{G}_{b}\sin\left(q_{2}\right)+\tau_{d1}^{*}+\tau_{d2}^{*}, \tag{22}\]  
\[\dot{q}_{2}+\lambda_{1}\left(q_{2}-q_{2d}\right)+\lambda_{2}\left(\dot{q}_{1}- \dot{q}_{1d}\right)=0. \tag{23}\]  
From (23), \(\dot{q}_{1}\) and \(\ddot{q}_{1}\) can be described as (24) and (25), respectively. \[\dot{q}_{1}=\frac{-\dot{q}_{2}-\lambda_{1}(q_{2}-q_{2d})+\lambda_{2}\dot{q}_{1d }}{\lambda_{2}} \tag{24}\]  
\[\ddot{q}_{1}=\frac{-\ddot{q}_{2}-\lambda_{1}\dot{q}_{2}}{\lambda_{2}} \tag{25}\]  
Substituting (25) into (22) and introducing a new state vector \(\mathrm{x}=[x_{1},\!x_{2}]=[q_{2},\!\dot{q}_{2}]\), a new system is derived, which is equivalent to (22) and (23) in the view of stability:  
\[\dot{\mathrm{x}}=\Phi(\mathrm{x}), \tag{26}\]  
where  
\[\[PERSON](\mathrm{x})=\left[ \begin{array}{c}\[PERSON]_{1}(\mathrm{x})\\ \[PERSON]_{2}(\mathrm{x})\end{array} \right],\Phi_{1}(\mathrm{x})=x_{2},\]  
\[\Phi_{2}(\mathrm{x})=\frac{1}{\lambda_{2}z_{2}-z_{1}}(\lambda_{2}(\dot{m}_{12 }\sin\left(x_{1}\right)x_{2}^{2}+\dot{G}_{b}\sin\left(x_{1}\right)+\tau_{d1}^{* }+\tau_{d2}^{*})+z_{1}\lambda_{1}x_{2}).\]  
The equilibrium of (26) is denoted by \(\mathrm{x}^{*}\)= \([x_{1}^{*},\!x_{2}^{*}]=[0,0]\). We linearize (26) at the equilibrium \(\mathrm{x}^{*}\) to establish the linear stability criteria that guarantees local exponential stability of the nonlinear system. The linearized system is described by  
\[\dot{\mathrm{x}}=\mathbf{A}\cdot\left(\mathrm{x}-\mathrm{x}^{*}\right), \tag{27}\]  
where  
\[\mathbf{A}=\left.\frac{\partial\Phi}{\partial\mathrm{x}}\right|_{\mathrm{x}^{*} }=\left[ \begin{array}{cc}0&1\\ \Delta_{1}&\Delta_{2}\end{array}