A system and method are disclosed for controlling a registration overlay. The method comprises estimating a state using moving horizon estimation and determining an input of the registration overlay using the state. The system comprises an estimator configured to determine a state using moving horizon estimation; and a regulator configured to determine an input of the registration overlay using the state.