Time varying reference

Hi alltogether,

I am new to acados and trying to set up my first running example. I would like to use a linear least squares term and provide a time varying reference y_ref similar to:
http://acado.sourceforge.net/matlab/doc/html/matlab/acado/packages/+acado/@OCP/minimizeLSQ.html

I checked all the matlab examples, but I could not find an example as all of them use a constant y_ref over the horizon. Also all my tries where not successful.

Do you know how to provide a time varying reference?

Thanks a lot! :slight_smile:

Hi Chris,

welcome to the forum! :tada:

You can set the y_ref value stage wise after creating the solver, as it is done here:

Cheers,
Jonathan

Hey Jonathan,

thank you for your quick response! In this example the reference is passed in a loop scalar-wise. Is there a possibility to pass it as a vector in one function call?

Greetings
Christian

If you want to set the same y_ref value for multiple subsequent stages, say stage s0 to stage se.
You can do something like this:

    ocp.set('cost_y_ref', yr, s0, se);

Otherwise, you will have to use multiple function calls.

Cheers