Can you use an iterative numerical solver in your constraint function?


Just wondering if this is supported by acados/casadi. I have a nonlinear constraint h(x) that I do not know how to write down analytically (it’s the inverse kinematics to a robot, currently solved using Gauss-Newton in our implementation). Is it possible to apply this constraint to an acados OCP, or do I need a closed-form h(x)?

From what I understand, I believe it’s not supported, but just wanted to ask the wider community.


I suggest you extend the dynamic system with this implicit equation and an (algebraic) state.
The implicit integrators in acados are iterative numerical solvers and should be able to handle this.
With such an augmentation you should be able to write the constraint wiht a closed form.

Does that work for you?


Hi Jonathan,

Thanks, think I understand what you mean, but is there an example in the example pack with something like this?

In the meantime, we have reformulated to use the forward kinematics of the robot as an equality constraint.