# Adaptive Super-Twisting Control for Mobile Wheeled Inverted Pendulum Systems
## 2 Modeling of MWIP System  
The profile of the MWIP system is shown in Figure 1, in which the specific parameters are indicated in the corresponding positions. \(\psi_{l}\) and \(\psi_{r}\) are the rotation angles of the left and right wheels, respectively, and \(\alpha\) is the yaw angle of the MWIP system. \(\theta\) is the inclination angle of the body. \(m_{b},m_{w}\) are the masses of the body and a wheel, \(I_{by}\), \(I_{bz}\) are the moments of inertia of the body about the Y axis and Z axis. \(I_{wa},I_{wd}\) are the moments of inertia of a wheel about its axis and a diameter, \(l\) is the length between the wheel axle and the center of gravity of the body. \(r\) is the radius of the wheel, and \(2b\) is the distance between two wheels. \(D_{b}\) is used to denote the viscous resistance in the driving system, and \(D_{w}\) is the viscous resistance of the ground. \(u_{r},u_{l}\) are the rotation torques generated by the right and left motors coaxial with the wheels. \(\tau_{ext}\) is used to denote the external disturbance. The dynamic model of the MWIP system derived from Lagrange functions is given by [23]:  
\[\left\{ \begin{array}{c}m_{11}\ddot{\psi}+m_{12}\cos\left(\theta\right)\ddot{ \theta}\\ =m_{12}\sin\left(\theta\right)\left(\dot{\theta}^{2}+\dot{\alpha}^{2}\right)-2 D_{w}\dot{\psi}\\ \quad+2D_{b}\left(\dot{\theta}-\dot{\psi}\right)+u_{r}+u_{l}+\tau_{ext1}\\ m_{12}\cos\left(\theta\right)\ddot{\psi}+m_{22}\ddot{\theta}\\ =I_{bl}\sin\left(\theta\right)\cos\left(\theta\right)\dot{\alpha}^{2}+G_{b} \sin\left(\theta\right)\\ \quad-2D_{b}\left(\dot{\theta}-\dot{\psi}\right)-u_{r}-u_{l}+\tau_{ext2}\\ \left(I_{bl}\sin^{2}\left(\theta\right)+m_{33}\right)\ddot{\alpha}\\ =-2I_{bl}\sin\left(\theta\right)\cos\left(\theta\right)\dot{\alpha}\dot{\theta }-m_{12}\sin\left(\theta\right)\dot{\alpha}\dot{\psi}\\ \quad-\frac{2b^{2}}{r^{2}}\left(D_{b}+D_{w}\right)\dot{\alpha}+\frac{b}{r} \left(u_{r}-u_{l}\right)+\tau_{ext3}\end{array} \right., \tag{1}\]  
Figure 1: The mobile wheeled inverted pendulum (MWIP) system. where  
\[\left\{ \begin{array}{l}\psi=\dfrac{1}{2}\left(\psi_{r}+\psi_{l}\right)\\ m_{11}=\left(m_{b}+2m_{w}\right)r^{2}+2l_{wa}\\ m_{12}=m_{b}lr\\ m_{22}=m_{b}l^{2}+l_{by}\\ I_{bl}=l_{bz}+m_{b}l^{2}\\ G_{b}=m_{b}gl\\ m_{33}=2l_{wd}+\dfrac{2b^{2}}{r^{2}}\left(l_{wa}+m_{w}r^{2}\right)\end{array} \right..\]  
To simplify the denotation, we rewrite (1) in vector form:  
\[M\left(q\right)\ddot{q}+N\left(q,\dot{q}\right)+O\left(\dot{q}\right)=\tau+ \tau_{ext}, \tag{2}\]  
where  
\[q=\left[q_{1}\quad q_{2}\quad q_{3}\right]^{T}=\left[\psi\quad\theta\quad \alpha\right]^{T},\]  
\[M\left(q\right)=\left[ \begin{array}{ccc}m_{11}&m_{12}\cos\left(q_{2}\right) &0\\ m_{12}\cos\left(q_{2}\right)&m_{22}&0\\ 0&0&l_{bl}\sin^{2}\left(q_{2}\right)+m_{33}\end{array} \right],\]  
\[N\left(q,\dot{q}\right)=\left[ \begin{array}{ccc}-m_{12}\sin\left(q_{2} \right)\left(\dot{q}_{2}^{2}+\dot{q}_{3}^{2}\right)\\ -l_{bl}\sin\left(q_{2}\right)\cos\left(q_{2}\right)\dot{q}_{3}^{2}-G_{b}\sin \left(q_{2}\right)\\ 2l_{bl}\sin\left(q_{2}\right)\cos\left(q_{2}\right)\dot{q}_{2}q_{3}+m_{12} \sin\left(q_{2}\right)\dot{q}_{1}q_{3}\end{array} \right],\]  
\[O\left(\dot{q}\right)=\left[ \begin{array}{ccc}2D_{w}\dot{q}_{1}-2D_{b}\left( q_{2}-q_{1}\right)\\ 2D_{b}\left(\dot{q}_{2}-\dot{q}_{1}\right)\\ \dfrac{2b^{2}}{r^{2}}\left(D_{b}+D_{w}\right)\dot{q}_{3}\end{array} \right],\]  
\[\tau=\left[ \begin{array}{c}u_{r}+u_{l}\\ -u_{r}-u_{l}\\ \dfrac{b}{r}\left(u_{r}-u_{l}\right)\end{array} \right],\tau_{ext}=\left[ \begin{array}{c}\tau_{ext1}\\ \tau_{ext2}\\ \tau_{ext3}\end{array} \right].\]  
Since the model process is always subject to noises and measurement errors, the disturbances could not be avoided. It is impossible to get a completely accurate dynamic model. Therefore, we rewrite (2) based on the nominal model of the MWIP system, as shown in Equation (3), where \(\hat{M}\left(q\right)\), \(\hat{N}\left(q,\dot{q}\right)\), and \(\hat{O}\left(\dot{q}\right)\) are used to represent the nominal values in the dynamic model.