## 4 Controller Design  
### Conventional Method  
The control aim is to make the wheelchair move at a desired velocity and keep stable (the pitch angle is around zero). There are two controlled variables (velocity and pitch angle), but there is only one control input (\(\tau_{\mathrm{w}}\)). This problem can be resolved through a HSMC controller. To design the controller, the following two sliding mode surfaces are defined,  
\[\sigma_{1}=c_{1}e_{1}+e_{2},\hskip 28.452756 pt\sigma_{2}=c_{2}e_{3}+e_{4}, \tag{5}\]  
where \(\sigma_{1}\) and \(\sigma_{2}\) are the sliding surfaces for pitch angle and wheel rotational angle respectively. \(c_{1}\) and \(c_{2}\) are positive constants. \(e_{1}\), \(e_{2}\), \(e_{3}\) and \(e_{4}\) are the tracking errors defined according to  
\[e_{1}=\theta_{b}-\theta_{b_{d}},\hskip 28.452756 pte_{2}=\dot{\theta}_{b}-\dot{ \theta}_{b_{d}},\hskip 28.452756 pte_{3}=\theta_{\mathrm{w}}-\theta_{ \mathrm{w}_{d}},\hskip 28.452756 pte_{4}=\dot{\theta}_{\mathrm{w}}-\dot{ \theta}_{\mathrm{w}_{d}},\]  
where \(\theta_{b_{d}}\), \(\dot{\theta}_{b_{d}}\), \(\theta_{\mathrm{w}_{d}}\) and \(\dot{\theta}_{\mathrm{w}_{d}}\) are the desired values of pitch angle, pitch angular velocity, wheel angle and wheel angular velocity respectively. Differentiating Equation (5) with respect to time leads to  
\[\dot{\sigma}_{1}=c_{1}e_{2}+\ddot{\theta}_{b}-\ddot{\theta}_{b_{d}},\hskip 28.452756 pt \dot{\sigma}_{2}=c_{2}e_{4}+\ddot{\theta}_{\mathrm{w}}-\ddot{\theta}_{\mathrm{ w}_{d}}. \tag{6}\]  
From Equation (2), we have  
\[\ddot{\mathbf{q}}=\mathbf{M}^{-1}(\mathbf{q})(-\mathbf{H}(\mathbf{q},\dot{ \mathbf{q}})-\mathbf{G}(\mathbf{q})+\mathbf{Q}). \tag{7}\]  
Then, we have  
\[ \begin{cases}\ddot{\theta}_{b}=-M_{11}^{-1}(H_{1}+G_{1})-M_{12}^{-1}(H_{2}+G_{ 2}-\tau_{\mathrm{w}})\\ \ddot{\theta}_{\mathrm{w}}=-M_{21}^{-1}(H_{1}+G_{1})-M_{22}^{-1}(H_{2}+G_{2}- \tau_{\mathrm{w}}).\end{cases}  \tag{8}\]  
From Equations (6) and (8), we have  
\[ \begin{cases}\dot{\sigma}_{1}=c_{1}e_{2}-M_{11}^{-1}(H_{1}+G_{1})-M_{12}^{-1}( H_{2}+G_{2}-\tau_{\mathrm{w}})-\ddot{\theta}_{b_{d}},\\ \dot{\sigma}_{2}=c_{2}e_{4}-M_{21}^{-1}(H_{1}+G_{1})-M_{22}^{-1}(H_{2}+G_{2}- \tau_{\mathrm{w}})-\ddot{\theta}_{\mathrm{w}_{d}}.\end{cases}  \tag{9}\]Let \(\dot{\
u}_{1}=0\) and \(\dot{\
u}_{2}=0\), the equivalent control input for each sliding surface can be obtained as  
\[ \begin{cases}\tau_{\text{w}_{1}}=[-c_{1}e_{2}+M_{11}^{-1}(H_{1}+G_{1})+M_{12}^{- 1}(H_{2}+G_{2})+\ddot{\theta}_{b_{d}}]/M_{12}^{-1},\\ \tau_{\text{w}_{2}}=[-c_{2}e_{4}+M_{21}^{-1}(H_{1}+G_{1})+M_{22}^{-1}(H_{2}+G_{ 2})+\ddot{\theta}_{\text{w}_{d}}]/M_{22}^{-1}.\end{cases}  \tag{10}\]  
To make sure that all tracking errors converge to zero, the control input can be set as [25]  
\[\tau_{\text{w}}=\tau_{\text{w}_{1}}+\tau_{\text{w}_{2}}+\tau_{\text{w}_{s}}, \tag{11}\]  
where \(\tau_{\text{w}_{s}}\) is the switching control input in the reaching phase. To obtain \(\tau_{\text{w}_{s}}\), a sliding surface is designed as  
\[\sigma_{\text{s}}=\alpha\sigma_{1}+\beta\sigma_{2}, \tag{12}\]  
where \(\alpha\) and \(\beta\) are constants. The \(\tau_{\text{w}_{s}}\) can be obtained based on Lyapunov stability theorem. Choose a Lyapunov function candidate as  
\[V_{1}=\frac{1}{2}\sigma_{\text{s}}^{2}. \tag{13}\]  
Differentiating \(V_{1}\) with respect to time, we have  
\[\dot{V}_{1}=\sigma_{\text{s}}\dot{\sigma}_{\text{s}}=\sigma_{\text{s}}(\dot{ \alpha}\dot{\
u}_{1}+\beta\dot{\
u}_{2}). \tag{14}\]  
From Equations (9) and (14), we have  
\[