Canonical Formalism for Modelling and Control of Rigid Body Dynamics