acados / acados

Fast and embedded solvers for nonlinear optimal control
Other
824 stars 249 forks source link

How to generate C code #937

Closed Teruru-52 closed 1 year ago

Teruru-52 commented 1 year ago

Dear FreyJo

I want to utilize acados for solving OCP in c language, on Ubuntu 22.04. I have read the acados documentation but could not figure out how to generate c code. Here is my understanding.

  1. Create a python file for c code generation.
  2. Describe problem formulation like examples/acados_python/getting_started/minimal_example_ocp.py
  3. Call ocp.generate() to generate acados_ocp_nlp.json.
  4. Generate c code from acados_ocp_nlp.json. (I don't know)

Please tell me how to generate c code correctly. Best regards.

FreyJo commented 1 year ago

Hi, the workflow is to prototype a solver in Python. Then you automatically have a c_generated_code folder, with a minimal main file that shows how to use it in a C environment. Good luck!