# Balance Control of a Configurable Inverted Pendulum on an Omni-Directional Wheeled Mobile Robot
## 3 Using Second-Order Sliding Mode Control to Design the Stabilizing Controllers
### Controller Design of Spherical Inverted Pendulum  
The design of the stabilizing controller for the spherical inverted pendulum system using second-order sliding mode control is presented in this subsection. Clearly, the dynamics given in (15)-(18) are highly nonlinear and dynamically coupled. The system model simplification is required because the system model is too complex to be used directly in the control design. By symmetry of the system, the spherical inverted pendulum system can be viewed as a two-dimensional extension of the traditional cart-pole inverted pendulum system [31]. The angular displacements \(\alpha\) and \(\beta\) are small for balance control, so cross-coupling is neglectable. The system can be simplified and decoupled into two independently cart-pole inverted pendulum systems as follows  
\[(m+M)\ddot{x}+(ml\cos\alpha)\ddot{x}-(ml\dot{\alpha}\sin\alpha) \dot{\alpha} = F_{x}, \tag{85}\] \[(ml\cos\alpha)\ddot{x}+(ml^{2}+I_{pyy})\dot{\alpha}-mgl\sin\alpha = 0,\] (86) \[(m+M)\dot{y}+(ml\cos\beta)\ddot{\beta}-(ml\dot{\beta}\sin\beta) \dot{\beta} = F_{y},\] (87) \[(ml\cos\beta)\dot{y}+(ml^{2}+I_{Pxx})\dot{\beta}-mgl\sin\beta = 0, \tag{88}\]  
From (85)-(88), we can see that two cart-pole inverted pendulum systems in the \(X\)-axis and \(Y\)-axes are identical. Next, only the controller design of the cart-pole inverted pendulum system in the \(X\) axis is addressed. By introducing a disturbance or uncertainty \(d_{x1}\) which may include external disturbance, parametric perturbation, and unmodeled dynamics, the dynamic Equations (85) and (86) is rewritten as follows  
\[ \begin{split}\ddot{x}&=\frac{(ml^{2}+I_{pyy})(ml \dot{\alpha}^{2}\sin\alpha)-m^{2}l^{2}g\sin\alpha\cos\alpha}{m^{2}l^{2}+Mml^{2} +(m+M)I_{Pyy}-m^{2}l^{2}\cos^{2}\alpha}\\ &\quad+\frac{ml^{2}+I_{pyy}}{m^{2}l^{2}+Mml^{2}+(m+M)I_{Pyy}-m^ {2}l^{2}\cos^{2}\alpha}(F_{x}+d_{x1}),\end{split}  \tag{89}\]  
\[ \begin{split}\ddot{\alpha}&=\frac{-m^{2}l^{2}\dot{ \alpha}^{2}\sin\alpha\cos\alpha+(m+M)mgl\sin\alpha}{m^{2}l^{2}+Mml^{2}+(m+M)I_{ Pyy}-m^{2}l^{2}\cos^{2}\alpha}\\ &\quad+\frac{-ml\cos\alpha}{m^{2}l^{2}+Mml^{2}+(m+M)I_{Pyy}-m^ {2}l^{2}\cos^{2}\alpha}(F_{x}+d_{x1}).\end{split}  \tag{90}\]  
To obtain the regular form for the system of (89) and (90), the following change of variables is used  
\[z_{x}=x-\varphi(\alpha), \tag{91}\]  
where\[\varphi(\alpha)=-\frac{ml^{2}+I_{pyy}}{ml}\ln\frac{1+\tan(\
icefrac{{\alpha}}{{2}})}{ 1-\tan(\
icefrac{{\alpha}}{{2}})}. \tag{92}\]  
Then the regular form is given by  
\[\bar{z}_{x} =H(\alpha,\ \dot{\alpha})\tan\alpha, \tag{93}\] \[\ddot{\alpha} =v_{s}(\alpha,\ \dot{\alpha},\ F_{x})+d_{x}, \tag{94}\]  
where  
\[H(\alpha,\ \dot{\alpha})= g+\frac{ml^{2}+I_{pyy}}{ml\cos\alpha}\dot{\alpha}^{2}, \tag{95}\] \[v_{s}(\alpha,\ \dot{\alpha},\ F_{x})= \frac{-m^{2}l^{2}\dot{\alpha}^{2}\sin\alpha\cos\alpha+(m+M)mgl\sin \alpha}{(m+M)(ml^{2}+I_{pyy})-m^{2}l^{2}\cos^{2}\alpha}\] (96) \[+\frac{-ml\cos\alpha}{(m+M)(ml^{2}+I_{pyy})-m^{2}l^{2}\cos^{2} \alpha}F_{x},\] \[d_{x}= \frac{-ml\cos\alpha}{(m+M)(ml^{2}+I_{pyy})-m^{2}l^{2}\cos^{2} \alpha}d_{x1}. \tag{97}\]  
The following coupled sliding variable is chosen:  
\[s_{x}=k_{x}(\dot{z}_{x}+a_{x}z_{x})+(\dot{\alpha}+b_{x}\alpha) \tag{98}\]  
where \(k_{x}\), \(a_{x}\), and \(b_{x}\) are constant parameters. By referring to the condition of (68), the appropriate \(k_{x}\), \(a_{x}\), and \(b_{x}\) can be selected to guarantee that the closed-loop system is asymptotically stable. Differentiating \(s_{x}\) yields  
\[ \begin{split}\dot{s}_{x}=k_{x}(\dot{z}_{x}+a_{x}\dot{z}_{x})+ \ddot{\alpha}+b_{x}\dot{\alpha}\\ =k_{x}[H(\dot{\alpha},\dot{\alpha})\tan\alpha+a_{x}\dot{z}_{x}]+v _{s}(\alpha,\dot{\alpha},F_{x})+b_{x}\dot{\alpha}+d_{x}.\end{split}  \tag{99}\]  
System Equations (93) and (94) whose relative degree is one relative to \(s_{x}\).