OSQP makes Matlab crash for some problems

I am experiencing an issue when trying to switch to OSQP for my particular problem. The problem is running fine with
qp_solver = ‘partial_condensing_hpipm’;
but setting
qp_solver = ‘partial_condensing_osqp’;
causes Matlab to crash when the generated solver is called. Code generation and compiling seem to run as it should.

I have tried with a couple of the examples:

  • “acados\examples\acados_matlab_octave\masses_chain_model\example_closed_loop.m” runs perfectly fine with either hpipm or OSQP.
  • “\acados\examples\acados_matlab_octave\wind_turbine_nx6\example_ocp.m” seems to have the same problem as I am experiencing with the setup I have defined; with partial_condensing_hpipm, the solver is running fine, but changing to partial_condensing_osqp makes my Matlab crash on solver execution.

My Acados is on commit 459a8b8dbd4de1cb384123e4e9fe941d807e3c3b.
I have experienced the same with Matlab R2020a and R2021b.

Thanks for the good work!


I just tried this on Linux, there you get errors printed to your terminal.
In this case, I get:

OSQP interface can not handle ns>0 yet: what about implementing it? :slight_smile:

So, the current OSQP acados interface does not support soft constraints.
I just added a check, such that there is a Matlab error, for Windows users


Hi Jonathan,
Thanks a lot for your fast response. That explains it :slight_smile:

@FreyJo did the crash happen in the acados mex file or in the OSQP library code?

@imcinerney The crash happened in the acados interface to OSQP, specifically here:

:relieved: Thanks. I was worried we had an issue in OSQP somewhere that caused a segfault.

1 Like