Optimal Control on the Cubli System