Discrete Dynamics or Variable Sampling Time

Hi,

is it possible to create discrete dynamics from python interface? The reason I would want discrete dynamics is that I would like to use variable timestep along the prediction horizon.

Thanks

Hi @kabzo,

I was implementing nonuniform discretizations for Python yesterday.
Please check out this branch:
https://github.com/FreyJo/acados/tree/nonuniform_templates/
Especially these 2 examples are doing the same thing, once with uniform, once with nonuniform discretization:

There might still be some changes on how it is to be used, e.g. I am thinking if it is more convenient to pass shooting nodes or time steps.

Feel free to try or ask if something is not clear :slight_smile:

Cheers,
Jonathan

Thanks @FreyJo!!! I did try the examples and it was exactly what I wanted, thanks!

I tried your latest PR with my OCP, https://github.com/acados/acados/pull/573, and it works well!

Thanks
Juraj

1 Like

Hi Jonathan,

Thank you for the feature!

But one question. Is it possible to set nonuniform discretizations in runtime after a solver has been compiled?

Regards,
Alex

Hi Alex,

this is not possible at the moment.
There is at least one module which precomputes stuff by assuming the time for a shooting interval is constant.
That’s why I only added to option to set this when formulating the OCP.

Best,
Jonathan

Thank you for fast reply!

How is it difficult? If it does not touch on the core functionality, maybe I will be able to implement the feature?
If so, could you point out me for this module and give me couple hints how do it?

Regards,
Alex

What has to be done in C, is this:

In the Python interface it would have to be added in the setter:

In Matlab/Octave, this is the setter function:

For the GNSF-IRK integrator it is assumed to be constant, I am not sure about other modules.

Since this might cause issues, I am still not sure if we want to have this in the master.
But I hope it is helpful for you.

Cheers

1 Like

Hi @FreyJo, I am trying to run the examples discussed here and I am not able to find them. Please, could you say me where I can get them?

Thanks in advance

josu