Is there a way to limit the total optimization time to avoid
<model name>_acados_solve(<capsule>) taking more time than the controller loop period?
If there isn’t such an interface, how should my code handle this potential risk?
And in practice, how should I take extra care of the time needed for optimization in a real-time robotic application?
Thanks for your suggestions.
No it is not possible for acados to know beforehand how long an SQP iteration will take on a specific hardware and for a specific problem.
However, if one uses RTI, i.e. a single linearization and a single QP solve, the CPU time should be pretty deterministic.
You can additionally limit the number of QP solver iterations.
Those are definitely relevant questions for MPC practice that are not trivial to answer in general.