Tim-Salzmann / l4casadi

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

Unable to integrate the lib.so exported by L4Casadi and Acados into C #10

Closed LilHu7 closed 1 year ago

LilHu7 commented 1 year ago

Hi, Tim

I constructed the OCP problem using L4casadi and acados in Python and generated libacados OCP Solver.so;

Aiming to develop this SQP_RTI solver in C environment, I developed my own main.cpp based on the template in interfaces/acados_template/acados_template/c_templates_tera/main.in.c .

Previously, all the required libs have been confirmed to be connected (Cmakelist compilation passed) It reports "segmentation fault" when run the SQP solving code "status = {model_name}_acados_solve(acados_ocp_capsule);".

Can you provide some solutions of the above issue?

Tim-Salzmann commented 1 year ago

Hi,

Thanks for reaching out! Can you confirm this problem is related to L4CasADi vs just CasADi/Acados. E.g. when you try the same procedure with a pure CasADi model in acados without L4CasADi involved, you do not experience this issue?!

Best Tim

LilHu7 commented 1 year ago

hmm, That may be the problem of Acados sovler. Thanks!

Tim-Salzmann commented 1 year ago

In this case, I would ask the question in the acados discourse: https://discourse.acados.org

If the problem ends up being specific to L4CasADi feel free to reach out here again.

Best Tim