Nonlinear observer design for a class of mechanical systems