Mismatching dimension for field "yref" for terminal node

Hi,

if the prediction horizon is set to N there will be N+1 nodes in total (the initial one is included).
To set values at the last node, you should try ocp_solver.set(N, "yref", yref_e), which doesn’t happen in your code since the loop only goes to N-1.

An example can be found here.

Hope this helps!

Kind regards,
Josip

1 Like