How to restart the solver?

Hi,

I’m using c file generated by python to solve an mpc problem. The solver works well but sometimes it returns :
SQP_RTI: QP solver returned error status 3 QP iteration 1.

And the return value is 4.

Does this mean the solver cannot find a solution? When this happens, the whole program terminates, which may pose great danger to my robot. Could anyone tell me how to prevent the program from terminating when this happen and restart the solver safely in C++?

Thanks for your support in advance!

Hi,

Does this mean the solver cannot find a solution?

Yes.
More precisely, the QP solver cannot solve the current QP sobproblem.
It might be infeasible.
It might also be because the SQP iterate results in a bad linearization.
If you are using HPIPM, QP status 3 means NAN_SOL, see https://github.com/giaf/hpipm/blob/master/include/hpipm_common.h#L62

For resetting the solver, you can look at this function in Python and do something similar in C.
https://docs.acados.org/python_interface/index.html?highlight=reset#acados_template.acados_ocp_solver.AcadosOcpSolver.reset

Best,
Jonathan