OCP solver fails after adding nonlinear constraint

Hello,

I have been working on the following OCP recently and I have trouble getting a solution when control allocation is implemented into the constraints.



Here is the code repo:

https://github.com/ErcBunny/learn_acados.

To reproduce, please run omnihex.py. Without the allocation part (see the referenced lines below), the code runs nicely.

https://github.com/ErcBunny/learn_acados/blob/d8f9346a6d3841c4a5bca7f899a263308de4916a/omnihex.py#L154

https://github.com/ErcBunny/learn_acados/blob/d8f9346a6d3841c4a5bca7f899a263308de4916a/omnihex.py#L185

And this is what I can get when the allocation part is commented out as shown in the above code.

But once the control allocation part is involved, the solver (HPIPM) returns NaN immediately, even if the allocated thrust constraints are not violated as shown above in thrust.png.

I sincerely look forward to your suggestions. Thank you for reading and have a good day~

Hi,

I think the term allocation is used in a confusing way in your post.
I changed the title of this thread to
“OCP solver fails after adding nonlinear constraint”

You will need to initialize the solver explicitly, for this problem formulation.
The default initialization is zeros, and an sqrt() constraint can not be linearized at 0.

Cheers!

1 Like

Hi Jonathan,

Thank you for pointing out the problem here. I tried with a nonlinear constraint without sqrt() and it worked without initializing the solver explicitly.

Thanks again!