## 2 Materials and Methods
### Dynamics of the Ball-Balancing Robot  
Consider the ball-balancing robot shown in Figure 1. Assuming that there is no slip between the sphere and the floor and between the driving wheels and the sphere, the dynamic equation of the ball-balancing robot can be expressed as [12]:  
\[M(\mathbf{q})\ddot{\mathbf{q}}+C(\dot{\mathbf{q}},\mathbf{q})\dot{\mathbf{q}}+\mathbf{f}(\dot{\mathbf{q}})+g (\mathbf{q})=B(\mathbf{q})\mathbf{u}. \tag{1}\]  
Here, \(\mathbf{M}(\mathbf{q})\in\mathbb{R}^{4\times 4}\) is the symmetric inertia matrix, \(C(\dot{\mathbf{q}},\mathbf{q})\in\mathbb{R}^{4\times 4}\) represents the Coriolis and centripetal matrix, \(\mathbf{f}(\dot{\mathbf{q}})\in\mathbb{R}^{4}\) is the friction matrix, \(\mathbf{g}(\mathbf{q})\in\mathbb{R}^{4}\) is the gravity vector, \(\mathbf{B}(\mathbf{q})\in\mathbb{R}^{4\times 2}\) denotes control input matrix, and \(\mathbf{u}\in\mathbb{R}^{2}\) represents the control input vector. These terms are given by:  
\[\mathbf{M}(\mathbf{q})=\begin{bmatrix}m_{1}&m_{2}&m_{3}&m_{4}\\ m_{2}&m_{5}&m_{6}&m_{7}\\ m_{3}&m_{6}&m_{8}&0\\ m_{4}&m_{7}&0&m_{9}\end{bmatrix},\]  
\[\mathbf{C}(\dot{\mathbf{q}},\mathbf{q})=\begin{bmatrix}c_{11}&c_{12}&c_{13}&c_{14}\\ c_{21}&c_{22}&c_{23}&c_{24}\\ c_{31}&c_{32}&c_{33}&c_{34}\\ c_{41}&c_{42}&0&c_{44}\end{bmatrix},\]  
\[\mathbf{f}(\dot{\mathbf{q}})=\begin{bmatrix}\zeta_{x}\dot{x},\zeta_{y}\dot{y},\zeta_{ \theta}\dot{\theta},\zeta_{\varphi}\phi\end{bmatrix}^{\top},\]  
\[\mathbf{g}(\mathbf{q})=\begin{bmatrix}0,0,\beta_{3},g_{4}\end{bmatrix}^{\top},\ \mathbf{u}=\begin{bmatrix}u_{x},u_{y}\end{bmatrix}^{\top},\]  
\[\mathbf{B}(\mathbf{q})=\begin{bmatrix}\mathbf{B}_{s}^{\top},\mathbf{B}_{b}^{\top} \end{bmatrix}^{\top},\ \mathbf{q}=\begin{bmatrix}x,y,\theta,\varphi\end{bmatrix}^{\top},\]  
\[\mathbf{B}_{s}=\frac{1}{r_{w}}\begin{bmatrix}0&-\cos\varphi\\ \cos\theta&\sin\varphi\cos\theta\end{bmatrix}^{\top},\ \mathbf{B}_{b}=\frac{r_{s}}{r_{w}} \begin{bmatrix}0&1\\ 1&0\end{bmatrix}^{\top},\]  
where the \(X\)- and \(Y\)-axis positions of the ball are denoted by \(x\) and \(y\), respectively, pitch and roll are denoted by \(\theta\) and \(\varphi\), respectively, and \(u_{x}\) and \(u_{y}\) denote the control inputs of the virtual acting wheels by the three omnidirectional wheels, respectively. The terms in \(\zeta_{i}\) (\(i=x,y,\theta,\varphi\)) are viscous coefficients. \(r_{s}\) and \(r_{w}\) denote the ball radius and omnidirectional wheel radius, respectively. It is noted that control input matrices \(\mathbf{B}_{s}\) and \(\mathbf{B}_{b}\) are invertible with \(|\theta|\), \(|\varphi|<\pi/2\). The terms in \(\mathbf{M}(\mathbf{q})\), \(\mathbf{C}(\dot{\mathbf{q}},\mathbf{q})\), and \(\mathbf{g}(\mathbf{q})\) are given in Appendix A.  
Figure 1: Spatial model of the ball-balancing robot [10].  
The dynamic equation in (1) can be decoupled into two subsystems of the position and the angle as follows:  
\[\tilde{\mathbf{q}}_{s} =\mathbf{F}_{s}+\Delta\mathbf{F}_{s}+\mathbf{G}_{s}\mathbf{u}, \tag{2}\] \[\tilde{\mathbf{q}}_{b} =\mathbf{F}_{b}+\Delta\mathbf{F}_{b}+\mathbf{G}_{b}\mathbf{u}. \tag{3}\]  
In these expressions, \(\mathbf{q}_{s}=\left[x,y\right]^{\top}\), \(\mathbf{q}_{b}=\left[\theta,\varphi\right]^{\top}\), and the matrices \(\mathbf{F}_{j}\), \(\Delta\mathbf{F}_{j}\) and \(\mathbf{G}_{j}\) (\(j=s,b\)) are given in Appendix B. \(\Delta\mathbf{F}_{j}\) represents the model uncertainties including viscous damping coefficients \(\zeta_{i}\) (\(i=x,y,\theta,\varphi\)).  
The control objective was to design the control input \(\mathbf{u}\) satisfying that \(\lim_{t\to\infty}\|\mathbf{q}_{s}-\mathbf{q}_{sr}\|=\mu_{0}\) and \(\lim_{t\to\infty}\|\mathbf{q}_{b}-\mathbf{q}_{br}\|=\mu_{1}\), where \(\mathbf{q}_{sr}=\left[x_{r},y_{r}\right]^{\top}\) and \(\mathbf{q}_{br}=\left[0,0\right]^{\top}\) are the reference vectors for trajectory tracking and balancing, respectively, and \(\mu_{0}\) and \(\mu_{1}\) are arbitrary positive constants.