# Solving a Simple Geduldspiele Cube with a Robotic Gripper via Sim-to-Real Transfer
## 2 Approach to Solving Geduldspiele Cubes via Sim-to-Real Transfer
### Derivation of LTI Ball-Plane System Model  
By rewriting (7) and (10) as a standard form, we have  
\[\begin{split}&\ddot{p}+\frac{m_{b}g}{J_{b}/r_{b}^{2}+m_{b}}\sin \theta-\frac{m_{b}p}{J_{b}/r_{b}^{2}+m_{b}}\dot{\theta}^{2}=\frac{F_{\mu}}{J_{ b}/r_{b}^{2}+m_{b}}\\ &\ddot{\theta}+\frac{2m_{b}p\dot{p}}{m_{b}p^{2}+J_{p}}\dot{ \theta}+\left(\frac{m_{b}gp+m_{p}g\frac{J}{r_{b}}}{m_{b}p^{2}+J_{p}}\right) \cos\theta=\tau\end{split} \tag{12}\]  
We linearize (12) by analyzing at the equilibrium, say \(s_{e}=[p,\dot{p},\theta,\dot{\theta}]^{\mathrm{T}}=[0,0,0,0]^{\mathrm{T}}\), which yields a small angle approximation assumption  
\[\theta\approx 0,\quad\sin\theta\approx\theta,\quad\cos\theta\approx 1-\frac{ \theta^{2}}{2}\approx 1.\]  
Consequently, we obtain  
\[\begin{split}&\ddot{p}=-\frac{m_{b}g}{J_{b}/r_{b}^{2}+m_{b}}+\frac{ F_{\mu}}{J_{b}/r_{b}^{2}+m_{b}}\\ &\ddot{\theta}=-\frac{m_{p}gl}{2J_{p}}+\frac{1}{J_{p}}\tau\end{split} \tag{13}\]  
For clarity, we set  
\[\frac{1}{J_{p}}\tau=\frac{m_{p}gl}{2J_{p}}+\tau\]  
which involves a gravity compensation plus a pure control. Then, (13) becomes  
\[\begin{split}&\ddot{p}=-\frac{m_{b}g}{J_{b}/r_{b}^{2}+m_{b}}+ \frac{F_{\mu}}{J_{b}/r_{b}^{2}+m_{b}}\\ &\ddot{\theta}=\bar{\tau}.\end{split} \tag{14}\]  
Now, let \(s=[p,\dot{p},\theta,\dot{\theta}]^{T}\); (14) can be expressed as  
\[\begin{split}&\dot{s}=\left[\begin{array}{ccc}0&1&0&0\\ 0&0&-\frac{m_{b}g}{J_{b}/r_{b}+m_{b}}&0\\ 0&0&0&1\\ 0&0&0&0\\ \end{array}\right]s+\left[\begin{array}{c}0\\ 0\\ 0\\ 1\\ \end{array}\right]\tau+\left[\begin{array}{c}0\\ \frac{F_{\mu}}{J_{\tau}/r_{b}+m_{b}}\\ 0\\ 0\\ 0\\ \end{array}\right]\\ &=As+b\tau\end{split} \tag{15}\]By checking the controllability matrix, e.g., ctrb(A,b) in MATLAB, we can easily know that the above system is controllable. Given desired eigenvalues \(\lambda_{i}\), we can find a state feedback control \(\tau=-ks\) yielding  
\[\dot{s}=(A-bk)s \tag{16}\]  
which leads \(A-bk\) to be Hurwitz matrix and is stable.  
Recall that the geduldspiele cube is controlled by two actuators along with the \(x\)- and \(y\)-axis. By restoring \(p=[x,y]^{T}\), \(\theta=[\theta_{x},\theta_{y}]^{T}\), and \(\tau=[\tau_{x},\tau_{y}]^{T}\), we have a continuous-time state-space representation as follows:  
\[s=[x,\dot{x},\theta_{x},\dot{\theta}_{x},y,\dot{y},\theta_{y},\dot{\theta}_{y} ]^{T} \tag{17}\]  
and  
\[\dot{s}=\left[\begin{array}{cc}A_{11}&A_{12}\\ A_{21}&A_{22}\end{array}\right]s+\left[\begin{array}{cc}b_{11}&b_{12}\\ b_{21}&b_{22}\end{array}\right]\bar{\tau}+\bar{F}_{\mu} \tag{18}\]  
where  
\[A_{11}=A_{22}=\left[\begin{array}{cccc}0&1&0&0\\ 0&0&-\frac{m_{b}g}{b_{f}/b_{f}+m_{b}}&0\\ 0&0&0&1\\ 0&0&0&0\end{array}\right],\quad A_{12}=A_{21}=\left[\begin{array}{cccc}0&0&0 &0\\ 0&0&0&0\\ 0&0&0&0\\ 0&0&0&0\end{array}\right],\]  
\[b_{11}=b_{22}=[0,0,0,1]^{T},\quad b_{12}=b_{21}=[0,0,0,0]^{T},\]  
and  
\[\bar{F}_{\mu} =\frac{1}{J_{r}/r_{b}+m_{b}}[0,F_{\mu,x},0,0,0,F_{\mu,y},0,0]^{T}\] \[=\frac{1}{J_{r}/r_{b}+m_{b}}[0,-\mu m_{b}g\cos\theta_{x}\text{ sign}(\dot{x}),0,0,0,-\mu m_{b}g\cos\theta_{y}\text{sign}(\dot{y}),0,0]^{T}\]  
In addition, the state feedback control has the form of  
\[\bar{\tau}=\left[\begin{array}{c}\bar{\tau}_{x}\\ \bar{\tau}_{y}\end{array}\right]=\left[\begin{array}{cccccccc}k_{1}&k_{2}&k _{3}&k_{4}&0&0&0&0\\ 0&0&0&0&k_{5}&k_{6}&k_{7}&k_{8}\end{array}\right]\!s \tag{19}\]  
where \(k_{1}\) through \(k_{8}\) can be calculated from given desired eigenvalues.  
By rewriting (18) with shorthand notation, we have  
\[\dot{s}=As+b\bar{\tau}+\bar{F}_{\mu} \tag{20}\]  
Now, we can express the corresponding discrete-time state-space representation of (20) as  
\[s_{k+1}=(I+A\Delta t)s_{k}+b\bar{\tau}\Delta t+\bar{F}_{\mu}\Delta t \tag{21}\]  
where \(I\in\mathbb{R}^{8\times 8}\) and \(\Delta t\) is a sampling time. We note that the definition of parameters and their values appearing throughout the paper are summarized in Table 1.