Discrete dynamics

Hi.
First of all, thank you for some amazing work. I am a former user of ACADO who have now started to transition to ACADOS and so far I am positively surprised. Although you are still using Global Variables the code seems cleaner and I am especially fund of the support of different solver backends, the use of CasADi.
Documentation is unfortunately still not on par with Acado but I am sure it will get there soon.
One thing that I yet have to experiment with is the code generation of Acados. With ACADO code generation “always” happened, even when using the MATLAB and Python interfaces. Is it correct to say that this is no longer the case with Acados?

Finally, to the topic/question of this post: Do you have any plans of any support for discrete dynamics?
From the problem formulation only continuous dynamics seems supported.
Supporting discrete dynamics as in the difference equation x(k+1) = f(x(k), u(u)) seems fairly trivial to me, since it would just be a matter of disabling the discretization and shooting mechanism? But I guess the interfaces for this is not exposed?

Where would I need to look to achieve the above, given that my dynamics and constraints are all discrete and given for each of the stages in the horizon?

Best regards
Thomas Jespersen

1 Like

Hi Thomas,

first of all, thanks for the positive feedback!

In acados, typically only the problem functions are generated using CasADi, these are then compiled and linked against acados to create a problem specific solver.

Another kind of Code generation is the rendering of the C templates, which produce a function to generate an acados OCP solver/ integrator, a minimal main file to showcase how to call it, and a Makefile.
The Python interface is based on these templates and the Matlab interface supports this workflow as a way to go embedded.

For more background information, look for “code generation” in our paper.

As to the topic of this post:
Discrete Dynamics are supported from the C part of acados, but this option has indeed not been added to the interfaces yet.

C example:

Since your problem is quite specific and involves some options that are not part of the interfaces (yet), also regarding your other post, the main options I see for you is
a) to extend the interface for your needs
b) to generate your OCP solver directly in C

Best,
Jonathan

Hi Jonathan,

Are there any updates on discrete dynamics from the Python interface? Is this something that is planned to be implemented or not a priority for the foreseeable future?

Thanks for the amazing work you do!!

Best regards
Martin

Hi Martin,

actually, I added this feature 3 weeks ago, collaborating with @mindthomas.


This is the relevant Python example: https://github.com/acados/acados/blob/master/examples/acados_python/getting_started/ocp/example_ocp_dynamics_formulations.py

Thanks! :pray:

Cheers,

Jonathan

Awesome! Thanks to the both of you!

Best,
Martin