Tim-Salzmann / l4casadi

Use PyTorch Models with CasADi for data-driven optimization or learning-based optimal control. Supports Acados.
MIT License
366 stars 27 forks source link

Using realtime l4casadi with acados #33

Closed mandralis closed 5 months ago

mandralis commented 5 months ago

Hello Tim,

I am trying to use a neural network model in a real-time mpc framework that is running with acados. What is the recommended way of doing this. A bit of context:

Even when I am using a simple MLP that is wrapped with l4casadi and compiled with acados, the computation time of each MPC step becomes prohibitively expensive to run in real time.

To circumvent this I am trying to use the RealTimeL4Casadi class. However, I am unsure on how to get it to work with acados. Do you have a simple use case or example that can help me get started ?

Best, Ioannis

Tim-Salzmann commented 5 months ago

Hi Ioannis,

yes, there is an exampe in the examples / realtime folder:

https://github.com/Tim-Salzmann/l4casadi/blob/main/examples/realtime/mpc_mlp_example.py

Best Tim

mandralis commented 5 months ago

Thanks. This clarified things