# Simple QP implementation

Hi all,

I have been using ACADOS for a while and have an SQP problem formulation which I have working on some embedded hardware via the (extremely useful) Simulink interfaces.

For a few reasons (which I wont go in to) I want to compare this model to a linearised version using a vanilla QP on the embedded hardware - and I would ideally like to do this using the ACADOS Simulink interfaces.

I already have an implementation of the QP using the HPIPM toolbox so I know this is all working.

My question is: Is it possible/simple to get ACADOS to do just the QP step using the equivalent of HPIPMs OCP problem formulation? My attempts so far have not been fruitful.

Thanks,
Will.

Hi,

I suggest to just phrase a QP as an OCP NLP and just use solve that with acados.
i.e. use linear discrete dynamics, quadratic cost and linear constraints.

Cheers,
Jonathan

I tried that and found that I do not converge to the same solution as the QP with the same formulation - probably what you would expect, although I was a bit surprised it doesn’t converge to the optimal solution given the linear nature of the problem.

I guess I will have to be content with what it gives me.

Cheers,
Will.

Hi Will,

I am also trying to implement a simple (dense) QP for linear MPC using ACADOS, hopefully in Simulink too.
Have you managed to get the expected results, i.e., the same as with using HPIPM directly?
Perhaps the difference was caused by the scaling of the cost in continuous vs. discrete time, as explained here.

Kind regards,
Josip

Hi Josip,

I didn’t manage to do it in ACADOS.

My main motivation for trying to do this was the handy simulink interface (s-functions) that ACADOS provide. In the end I realised that the ACADOS simulink interface is very similar to the template that HPIPM provide. I used the ACADOS s-function to help me develop the HPIPM one for my needs.

Thanks,
Will.

Hello Will,

thank you for the reply, nice that you managed using HPIPM anyway
Also, a linear MPC example has recently been added to acados, perhaps it might be useful for you in the future.

May I ask, what is the hardware you’re implementing the algorithms on? I will be working with an embedded system soon as well, perhaps there are some specific things to note (apart from these) when deploying the solvers.

Kind regards,
Josip