Optimization fails when terminal state touches constraints

Hi :wave:

I am new to acados and am trying out the interface. However, I am having trouble with a simple modification of the acados_python/getting_started/minimal_example_closed_loop.py code. Essentially, I just want to change the yref to direct the system to x=3 but set the constraint on the position x to be [-2,2]. This causes the optimization to fail (with status=2) on iteration 23.

This seems like a very simple modification to the simplest code, yet it is failing. I have tried changing the parameters and adding slack variables but nothing has worked consistently. Here is the minimum code change required to reproduce the error: Update minimal_example_closed_loop.py · Federico-PizarroBejarano/acados@4f6605a · GitHub

If I add slack variables it works, but any slight change in the weight matrices causes it to fail again: Update minimal_example_closed_loop.py · Federico-PizarroBejarano/acados@94eec9c · GitHub

I am unsure if I am doing everything correctly, but it seems extremely sensitive to weights and initializations despite being the most simple example. Let me know if I am doing something wrong, or if I need to robustify the parameters. Thank you very much!

Can acados not handle goals outside of the constraints?

1 Like

Hi,
I just checked your problem.
The solver runs into maximum number of iterations in the very first problem and seems to oscillate between two points.
It works if I set
solver_options.nlp_solver_step_length = 0.7
Alternatively you could try with globalization.
Also RTI gives some decent results.
I recommend to check the solver statistics.

Best,
Jonathan

1 Like

Hi Jonathan,

Thank you! I will check that out. Sorry, I am still getting used to looking and understanding the solver statistics but I will take a closer look. I also found that increasing the cost weight on R immediately solved the problem and increased the speed of the solution.

Thanks for the help, looking forward to getting to know acados better!
-Federico