Dear community,
I am using acados in matlab to solve an MPC problem for trajectory tracking. Hence, i have time varying references. I set these references in a loop with counter variable ii via
ocp.set('cost_y_ref', [x_ref(:,ii+1);u_ref(:,ii+1)], ii);
(My stage cost is based on the expression expr_y = [sym_x; sym_u];
)
It seems that the optimal input sequence of the ocp always ends exactly(!) at the last value of u_ref (even if put nonsense values in there which do not fit to the reference in the states). This looks like a terminal equality constraint on the inputs to me…
I am using cost_type = ‘linear_ls’;
The weights in my cost function are very high on the states and very low on the inputs. The weights for my terminal cost is zero and the terminal cost uses expr_y_e = [sym_x];. So there is no input involved in the terminal cost.
Does anyone knows how to explain that behavior? The optimal input sequence at the end of the prediction horizon is always exactly ending at its reference value even if this leads to a deviation in the state (which is weighted much stronger)?