Dynamics of systems of rigid bodies