As in this video: https://www.youtube.com/watch?v=qce5Vguj5Jg
In this new version (did not see the learning part in the past versions), with three to four trials, Cubli can learn to balance on a new surface.
Robotics Stack Exchange is a question and answer site for professional robotic engineers, hobbyists, researchers and students. It only takes a minute to sign up.Sign up to join this community
You should start by reading their academic papers:
A Linear–quadratic regulator (LQR) controller with an accurate state-space representation is implemented in Gajamohan's first and second paper. A high quality motor controller with torque-control is also necessary for the system to work.
The learning algorithm is called gradient descent algorithm. It is used to find the local minimum, and is used to find the initial wheel velocities. They mentioned in this robohub post is to implement the learning algorithm, and is finally implemented by Mr. Muehlebach three years afterwards in 2016.
 G. Mohanarajah and M. Waibel, "Cubli – A cube that can jump up, balance, and walk across your desk", Robohub, 2013, http://robohub.org/swiss-robots-cubli-a-cube-that-can-jump-up-balance-and-walk-across-your-desk/
 M. Muehlebach, and R. D'Andrea, "Nonlinear Analysis and Control of a Reaction Wheel-Based 3-D Inverted Pendulum", in IEEE Transactions on Control Systems Technology, 2016.