Predictive control of spatial flexible mechanisms