Acados Solver Plugins

Gnererate new acados solver plugins

class acados_solver_plugins.solver_plugin_generator.SolverPluginGenerator(custom_export_path: str | None = None, library_name: str | None = None)[source]

Minimalist template-based code generation module to generate acados::AcadosSolver derived objects.

Relevant external API documentation : jinja2, acados_template.

_generate_file_from_template(template_filename, export_filename, **template_render_args)[source]
generate_solver_plugin(acados_ocp: acados_template.AcadosOcp, plugin_class_name: str, solver_description: str | None = None, x_index_map: dict | None = None, z_index_map: dict | None = None, p_index_map: dict | None = None, u_index_map: dict | None = None) acados_template.AcadosOcpSolver[source]

Generate the solver plugin from a python Acados OCP model.

Parameters:
  • acados_ocp (AcadosOcp) – Acados OCP model

  • plugin_class_name (str) – Class name for the generated plugin of type “acados::<plugin_class_name>”

  • solver_description (str, optional) – Short description for the exported plugin, defaults to None

  • x_index_map (dict, optional) – Differential state index map, defaults to None

  • z_index_map (dict, optional) – Algebraic state index map, defaults to None

  • p_index_map (dict, optional) – Parameters index map, defaults to None

  • u_index_map (dict, optional) – Parameters index map, defaults to None

Returns:

the acados OCP solver generated as a by-product

Return type:

AcadosOcpSolver

jinga_env_loader

Jinja environment loader initialized as a jinja2.PackageLoader looking for templates in the installation folder of the module.

Load previously built acados solver plugins (not implemented yet)

class acados_solver_plugins.solver_plugin_loader.SolverPluginLoader(custom_import_path: str | None = None, library_name: str | None = None)[source]
load_solver_plugin(solver_plugin_name: str)[source]

Load a Acados OCP solver from previously exported plugin. TODO.

Miscellaneous functions

acados_solver_plugins.utils.uppercase_to_underscore(string: str) str[source]

Reformat a camel case string to snake case.

Parameters:

string (str) – The string to reformat

Returns:

Snake case reformated string

Return type:

str

>>> uppercase_to_underscore("TestClass")
"test_class"