Setting yref_e using Python interface for trajectory tracking NMPC

Hi,

I have implemented a NMPC trajectory tracking controller in Casadi and I am trying to transfer my problem over to Acados for real time use, using the Python interface. Since my reference is time-varying, I am trying to set yref and yref_e for each stage like in the MATLAB interface. But as far as I can tell there is no way to set yref_e. I have tried setting yref at stage N instead (as they do in the racecar example) but from the resulting solver solution the initialized yref_e value is still the one the solver uses. Furthermore, the final state completely disregards the state bounds! Am I doing something wrong here? Is it possible to use the EXTERNAL cost type and let the time varying reference be a parameter value and set that instead in order to implement trajectory tracking?

Help greatly appreciated, thanks!

Cheers!
Martin

Sorry, so setting yref at N is indeed the way to do it. I still think its somewhat confusing that you need to set yref_e when creating the ocp object and then if you want to change it you set yref at stage N, unlike the MATLAB interface where you set yref_e.

Exactly.
I see it can be confusing.
y_ref_e is basically just to allow for y to have a different dimension at the terminal node, which one often needs, since there are no controls on the terminal shooting node.

That makes a lot of sense, thanks for clearing it up!

Cheers!

Hi, But how to set different y_ref at N?