coin-or / qpOASES

Open-source C++ implementation of the recently proposed online active set strategy
GNU Lesser General Public License v2.1
365 stars 127 forks source link

CPU overload for qpOASES_e in Simulink Real Time / Matlab #72

Open svigerske opened 4 years ago

svigerske commented 4 years ago

Issue created by migration from Trac.

Original creator: Andrea

Original creation time: 2017-09-07 16:28:53

Assignee: ferreau

Version: 3.2.1

Hi,

I'm trying to run a Simulink Model in real time on a target machine (Linux Computer with 1 CPU) for code generation purposes, I use the C implementation of qpOASES within a matlab function block (meaning the function is called in each simulation step).

The discrete model runs in Simulink multitasking mode, with sample times of 5 and 20 ms. The problem is, the solver throws a CPU overload error at 0.685 seconds unless I restrict CPU time and number of iterations. It works if I set CPU time to 4ms and gradually allow more iterations in each timestep OR if I restrict the number of iterations to 20. Gradually increasing only the iterations without limiting CPU time does not work, nor does setting only the CPU time.

My guess is that some part of the initialisation process takes too long, but I would be grateful about any hints on what could be the issue.

Once I get the model to run properly (e.g. using 5 and 30 ms sample times), it runs pretty fast (TET around 0.04 ms). Using qpOASES in normal mode in an offline Simulink simulation model works, too - the QP problem is solved in max 3 ms even in the first cycle, so I highly doubt that there is a problem with the QP itself.

Thanks!