Optimal stabilization of the equilibrium positions of a rigid body using rotors