Understanding terminal state cost and constraints


I have use acados for a nonlinear ocp with a robot manipulator. I want to understand further how terminal cost and constraints work. Because if I just use the same cost and constraint for the path nodes and the terminal nodes then the solver cannot find a solution. However, if I only use the cost and constraint for the path node and ignore the last terminal state than the solver converges.
For a correct implementation the cost and constraint should be on the last state as well I would think. So is acados structured that it just has N states and N-1 control inputs and the Nth state is the terminal state. If so, why can I not use the same cost there (without the part for the input of course)?

I am just trying to understand potential issues. Would be great if you could clarify this for me :slight_smile:



note that the path cost is given in “continuous time”, thus, it is multiplied by the length of the shooting interval.
On the other hand, the terminal cost term is not multiplied.

Regarding constraints: the only difference about the terminal one is that u does not enter.

Does that answer your question?


thanks yes that helps. It might be helpful to document that because I miss understood this based on the problem formulation and the documentation of the python interface.