Code Generation with qpOASES

589 views
Skip to first unread message

Odd Quatar

unread,
Feb 3, 2022, 5:26:25 AM2/3/22
to CasADi
Hi,

I am trying to implement a parametrized NLP which needs to be solved in a receding horizon fashion (NMPC) and ultimately need to deployed on an embedded platform that supports both C and C++.

I was able to set up my problem in CasADi and got good results using IPOPT and SQP method using qpOASES solver. Unfortunately, the SQP method with OSQP and QRQP solvers does not provide robust solutions and often fails with the following error.
 Capture.PNG

It seems from the previous posts that a self-contained C code can only be generated with QRQP and OSQP solvers. Since qpOASES (I guess) is fully written in C++ and my embedded platform supports C++. Would there be any way of generating self contained C++ code with  CasADi? Any leads in this regard would be appreciated.

Cheers

Marc-Simon Schäfer

unread,
Feb 4, 2022, 12:00:13 PM2/4/22
to CasADi
Hi,
related to the error: what happens if you set error_on_fail = false? Make sure to set it for the QP, not only for the NLP! e.g.:
opts.qpsol_options.error_on_fail = false;

Bye

sandeep kumar r

unread,
Feb 4, 2022, 12:08:05 PM2/4/22
to Marc-Simon Schäfer, CasADi
Do try the bfgs Hessian approximation with sqpmethod. The Hessian regularisation within sqpmethod is not robust. Convergence was slower but it solved the problem.

Regards
R Sandeep Kumar

--
Sent from CasADi's user forum at http://forum.casadi.org.
---
You received this message because you are subscribed to the Google Groups "CasADi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to casadi-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/casadi-users/8b497c15-ed36-4c4c-a121-07a8f27506a3n%40googlegroups.com.

Odd Quatar

unread,
Feb 5, 2022, 6:00:04 AM2/5/22
to CasADi
Many thanks, Kumar, although a bit slower but it worked nicely with osqp. Have you had experience with code generation as well?

sandeep kumar r

unread,
Feb 5, 2022, 6:06:11 AM2/5/22
to Odd Quatar, CasADi
Dear Odd Quatar,

I don't have experience with importing codes to hardware.
If you intend to osqp on hardware, please check their website. They have support for embedded application. 

Regards
Sandeep

Reply all
Reply to author
Forward
0 new messages