I am trying to use the Matlab interface of acados to implement a simple mpc controller in a closed-loop simulation. I noticed that if I create the solver as ocp = acados_ocp(ocp_model, ocp_opts); it fails several times during a simulation with status 4 (SQP_RTI: QP solver returned error status 3 QP iteration 44. in the terminal).
On the other hand if I generate the code with ocp.generate_c_code; and create the solver by typing ocp = my_model_mex_solver; It never fails in the same simulation setup.
Why do they behave differently? Shouldn’t they be equivalent?
Maybe the code generation introduces some default solver setup that I am missing in the other case?
I experience the same problem in both MacOs and Ubuntu.
Thanks for any suggestion.
I loaded the simple test code in this repo. As I said what is weird is that the native MEX interface fails several time whereas the code generation never fail, despite the simulation setup is exactly the same. Thus I was wondering if the two interfaces introduce different settings (possibly not voluntarily) and, if this is the case, which are these settings.
Thank you for your support. This is what I was looking for, now I get the same behavior: indeed if the solver fails using the native interface then it fails also using the template based interface and viceversa.
Thanks also for your suggestion about the choice of the condensing factor.