 The master thesis takes a different approach to the system modelling by deriving a non-linear quaternion-based dynamic model which is used to derive a non-linear sliding mode controller to stabilize the balance and a path-following model predictive controller to plan and execute smooth trajectories.The complete master thesis and all material including MATLAB source code and C++ controller implementations are publicly available on GitHub.Ballbots have also appeared in the science fiction world.