Dynamics and control of flexible-links mechanism