# Adaptive Super-Twisting Control for Mobile Wheeled Inverted Pendulum Systems
## 3 Design of the Adaptive Super Twisting Controller  
In this section, we present the controller design based on the adaptive super-twisting algorithm. The first procedure of the adaptive super-twisting controller design is to define the sliding surface, which is similar to the SMC. Obviously, the MWIP system is an underactuated system. According to the first two equations of the dynamics (5), \(q_{1}\) and \(q_{2}\) are coupled. Therefore, we need to define the first sliding manifold that contains both \(q_{1}\) and \(q_{2}\) to obtain a relative degree one for \(u_{A}\). Then, the second sliding manifold contains \(q_{3}\). The design of the sliding surface is shown in (7). \[\sigma=\left[ \begin{array}{c}\sigma_{1}\\ \sigma_{2}\end{array} \right]=\left[ \begin{array}{c}\dot{e}_{2}+\lambda_{1}e_{ 2}+\lambda_{2}\dot{e}_{1}\\ \dot{e}_{3}+\lambda_{3}e_{3}\end{array} \right], \tag{7}\]  
where \(e=\left[ \begin{array}{cc}e_{1}&e_{2}&e_{3}\end{array} \right]=\left[ \begin{array} []{cc}q_{1}-q_{1d}&q_{2}-q_{2d}&q_{3}-q_{3d}\end{array} \right]\), and \(q_{d}=\left[ \begin{array}{cc}q_{1d}&q_{2d}&q_{3d}\end{array} \right]\) represents a fixed equilibrium point corresponding to a particular task. \(\lambda_{i}(i=1,2,3)\) are positive coefficients, and they are designed to satisfy the following constraints:  
\[\lambda_{1}>0,\lambda_{2}>0,\lambda_{2}z_{2}^{*}-z_{1}^{*}<0, \tag{8}\]  
where \(z_{1}^{*}=\hat{m}_{11}+\hat{m}_{12},z_{2}^{*}=\hat{m}_{22}+\hat{m}_{12}\). \(q_{2d}\), \(\hat{q}_{1d}\), and \(q_{3d}\) represent the desired inclination angle, the desired velocity, and the desired yaw angle, respectively. Equation (7) also indicates that \(\sigma_{1}\) has relative degree one with respect to \(u_{A}\) and \(\sigma_{2}\) has relative degree one with respect to \(u_{B}\). This makes it possible to achieve the second-order sliding mode \(\sigma{=}\dot{\sigma}{=}0\). The derivative of the sliding surface is described as  
\[\dot{\sigma}=\left[ \begin{array}{c}\sigma_{1}\\ \sigma_{2}\end{array} \right]=\left[ \begin{array}{c}-K_{1}|\sigma_{1}|^{ \frac{1}{2}}\text{sgn}(\sigma_{1})+v_{1}\\ -K_{2}|\sigma_{2}|^{\frac{1}{2}}\text{sgn}(\sigma_{2})+v_{2}\end{array} \right], \tag{9}\]  
where \(K_{1},K_{2}\) are arbitrary positive constants and \(v_{1},v_{2}\) are auxiliary variables. The auxiliary variables are exploited to include the integration of the sliding mode variable, which is used to reduce the chattering phenomenon caused by the fast switching of the sign function. The derivative of the auxiliary variables is defined as  
\[\dot{v}=\left[ \begin{array}{c}\dot{v}_{1}\\ \dot{v}_{2}\end{array} \right]=\left[ \begin{array}{c}-\Gamma_{1}\text{sgn}( \sigma_{1})\\ -\Gamma_{2}\text{sgn}(\sigma_{2})\end{array} \right]. \tag{10}\]  
\(\Gamma_{1},\Gamma_{2}\) are adaptive coefficients of the sliding surface. The adaptive law can be chosen as  
\[\Gamma=\left\{ \begin{array}{c}\dot{\Gamma}_{1}=\left\{\begin{array}{c} \frac{1}{\partial_{1}}|\sigma_{1}|,|\sigma_{1}|\geq\varepsilon\\ 0,|\sigma_{1}|<\varepsilon\\ \dot{\Gamma}_{2}=\left\{\begin{array}{c}\frac{1}{\partial_{2}}|\sigma_{2}|, |\sigma_{2}|\geq\varepsilon\\ 0,|\sigma_{2}|<\varepsilon\end{array}\right.\end{array}\right.,\end{array} \right. \tag{11}\]  
where \(\partial_{1},\partial_{2}\) are arbitrary positive constants as well. \(\varepsilon\) is a boundary layer of \(\sigma\), which is introduced for the practical implementation of the controller. The initial value of \(\Gamma\) satisfies \(0\leq\Gamma(0)<\hat{\Gamma}\). \(\hat{\Gamma}\) is a constant vector, which is clearly defined in Remark 1. \(\Gamma(0)\) will be selected to be small enough or even equal to zero. In the experimental section, \(\Gamma(0)\) is appropriately selected to increase the initial responses of the system. Based on the above analysis, we can conclude the adaptive STA controller by the following theorem. **Theorem 1**. : _The achievement of a sliding motion on the surface (7) can be guaranteed by the selection of the control law_  
\[\left\{