Is there some memory in the solver?

Hi @Muhammad

This is constr_x0. init_x is only the starting point for the solver from where he tries to find a solution.

Probably because your cost is lower on this way. Some questions to come closer:

  • Do you have enough iterations for your solver that it can converge?
  • Is the accuracy high/low enough that the solution is feasible?
  • Do you get the same behavior if you have everything rotated by 45° (your ref is on the x-axis)?
    • Might the influence of u in your cost function try to reduce the used energy?
    • Other approaches: almost no weight on u or penalizing delta u ==> your actual task needs no control weighting, but not sure if weight == 0 works properly.

That you will find out, if you solve the problem once by init_x = zeros( ), init_u = zeros( ) [all of the below mentioned]

and then by solving it with e.g. your reference values for init_x. Create the solver each time new, for the case of other internal states.

2 Likes