How do I set different DT dynamics per stage?

Hi :wave:

I’m using multiple shooting with a non-uniform grid (more nodes at the beginning then at the end). This helps me to have a long prediction horizon without adding much more nodes (=> decision variables => computation time.
Since the time between nodes differs along the horizon, the (sample) time at which the dynamic equations are discretized also differs. Acados does this automatically when the dynamics are provided explicitly, using the explicit Runge-Kutta integrator. This results in different A and B matrices for each stage in the horizon, which is what I want. However, the built-in ERK integrator also introduces additional computation time, as the discretization is done online.

To avoid the extra computation time of using ERK, I would like to provide each stage of the OCP with a model that is pre-discretized at a stage-dependent sampling time. Is there a build-in function that allows me to set the A and B matrices for each stage?

Kind regards,



you can use the DISCRETE dyanimics module and make A and B parameters.
There will be the overhead of one CasADi function call though.
Another way is to use GNSF with a purely linear model.
In this case, the matrices A, B will be precomputed.


1 Like