A simple Julia interface to acados

Hi there!

I’ve been glancing at acados for a while, wanting to try it out. Since I enjoy programming in Julia, I put together a simple little interface package to help me generate acados controllers with dynamics implemented in Julia.

My interface targets the acados python interface, and is rather limited at the moment. Consider it highly experimental for now. Eventually, it would of course be nice to bypass python completely, but alas, no time to write all the required code generation at the moment so through python it is :sweat_smile:

Give it a spin if you’re interested, I’d also welcome PRs or issues, should you feel like submitting any!

3 Likes

Hi,

nice project!
I think one interesting thing would be to be able to use Julia AD to generate the nonlinearities in the problem definition and their derivative as C functions.
This would enable one to use compare with the CasADi generated functions and it would allow people who have there models in Julia to use them in acados more directly.
However, I don’t know if many people model their applications in Julia. I think it is more popular for scientific computing than for engineering.
Of course this would require some more work and would also require touching the C part of acados.

Thanks for sharing :slight_smile:
Best,
Jonathan

Thanks!

I was contemplating to write a C interface such that acados could call directly into Julia like you describe, and if I would extend this further that would probably be the next step.

You’re right, the number of people using julia in the engineering space is certainly less than those using it for scientific computing. It is picking up a bit of steam on the engineering side though which is exciting :slight_smile: I’m part of a team developing a modelica-like acausal modeling language in Julia, ModelingToolkit.jl, and I’ve also been writing some control-systems related tools in julia, like ControlSystems.jl and the control toolbox in JuliaSim as well as the multibody model library for ModelingToolkit.jl, Multibody.jl. These tools actually have a number of MPC and optimal-control tools attached to them already, but at the moment none taget the same space as acados, super-low latency and embedded, hence my interest in acados to fill this gap!

1 Like

Is there any C example available that is not derived from any of the high-level interfaces and does not use CasADi?

I’m looking at examples like examples/c/simple_dae_example.c but cannot get a good grasp of what functions I would have to provide if I were to completely avoid casadi.

(Side note, I could’t post a link to the example above, discourse claimed that posting a link to github was prohibited?)

Interesting to read about the progress of modelling tools Julia!
It would of course be really nice to be able to connect acados to these tools.

Regarding the external functions:

The best way to see which external functions are needed by each acados module is the file which generates them.

Then one needs to create a wrapper in C for the Julia generated external functions similar to how it is done for the CasADi ones, in this file.

There are a few examples that use “generic” external functions, e.g. this one, however these functions have basically hardcoded with which argument types they are called by acados, as oppossed to the casadi wrapper which converts those arguments automatically, see here.

Anyway, a first step would be to try to use one of the acados modules with a Julia generated function and see if there are any blockers.