Hi,
I’m trying to understand the differences between using the Explicit Runge-Kutta (ERK) integrator provided by ACADOS and implementing a discrete-time model where the system dynamics are integrated externally using the RK4 method (Runge-Kutta 4).
In my case, I implemented the discrete-time dynamics using RK4 as shown below, and I noticed that it is computationally faster compared to using the ERK integrator in ACADOS:
k1 = self.model.fc_func(acados_model.x, acados_model.u)
k2 = self.model.fc_func(acados_model.x + self.dt / 2 * k1, acados_model.u)
k3 = self.model.fc_func(acados_model.x + self.dt / 2 * k2, acados_model.u)
k4 = self.model.fc_func(acados_model.x + self.dt * k3, acados_model.u)
f_disc = acados_model.x + self.dt / 6 * (k1 + 2 * k2 + 2 * k3 + k4)
acados_model.disc_dyn_expr = f_disc
However, I wonder if using the sim_method_step_size
with the ERK integrator allows for more accurate integration over subintervals, and whether this explains the difference in behavior.
Could you clarify the exact differences between these two approaches? Also, if the differences are minimal, are there specific solver options or settings I should pay attention to when using the discrete-time implementation?
Thank you in advance for your guidance!