You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
524 lines
19 KiB
524 lines
19 KiB
#
|
|
# Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren,
|
|
# Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor,
|
|
# Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan,
|
|
# Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl
|
|
#
|
|
# This file is part of acados.
|
|
#
|
|
# The 2-Clause BSD License
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions are met:
|
|
#
|
|
# 1. Redistributions of source code must retain the above copyright notice,
|
|
# this list of conditions and the following disclaimer.
|
|
#
|
|
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
# this list of conditions and the following disclaimer in the documentation
|
|
# and/or other materials provided with the distribution.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
# POSSIBILITY OF SUCH DAMAGE.;
|
|
#
|
|
|
|
{%- if solver_options.qp_solver %}
|
|
{%- set qp_solver = solver_options.qp_solver %}
|
|
{%- else %}
|
|
{%- set qp_solver = "FULL_CONDENSING_HPIPM" %}
|
|
{%- endif %}
|
|
|
|
{%- if solver_options.hessian_approx %}
|
|
{%- set hessian_approx = solver_options.hessian_approx %}
|
|
{%- elif solver_options.sens_hess %}
|
|
{%- set hessian_approx = "EXACT" %}
|
|
{%- else %}
|
|
{%- set hessian_approx = "GAUSS_NEWTON" %}
|
|
{%- endif %}
|
|
|
|
{%- if constraints.constr_type %}
|
|
{%- set constr_type = constraints.constr_type %}
|
|
{%- else %}
|
|
{%- set constr_type = "NONE" %}
|
|
{%- endif %}
|
|
|
|
{%- if constraints.constr_type_e %}
|
|
{%- set constr_type_e = constraints.constr_type_e %}
|
|
{%- else %}
|
|
{%- set constr_type_e = "NONE" %}
|
|
{%- endif %}
|
|
|
|
{%- if cost.cost_type %}
|
|
{%- set cost_type = cost.cost_type %}
|
|
{%- else %}
|
|
{%- set cost_type = "NONE" %}
|
|
{%- endif %}
|
|
|
|
{%- if cost.cost_type_e %}
|
|
{%- set cost_type_e = cost.cost_type_e %}
|
|
{%- else %}
|
|
{%- set cost_type_e = "NONE" %}
|
|
{%- endif %}
|
|
|
|
{%- if cost.cost_type_0 %}
|
|
{%- set cost_type_0 = cost.cost_type_0 %}
|
|
{%- else %}
|
|
{%- set cost_type_0 = "NONE" %}
|
|
{%- endif %}
|
|
|
|
{%- if dims.nh %}
|
|
{%- set dims_nh = dims.nh %}
|
|
{%- else %}
|
|
{%- set dims_nh = 0 %}
|
|
{%- endif %}
|
|
|
|
{%- if dims.nphi %}
|
|
{%- set dims_nphi = dims.nphi %}
|
|
{%- else %}
|
|
{%- set dims_nphi = 0 %}
|
|
{%- endif %}
|
|
|
|
{%- if dims.nh_e %}
|
|
{%- set dims_nh_e = dims.nh_e %}
|
|
{%- else %}
|
|
{%- set dims_nh_e = 0 %}
|
|
{%- endif %}
|
|
|
|
{%- if dims.nphi_e %}
|
|
{%- set dims_nphi_e = dims.nphi_e %}
|
|
{%- else %}
|
|
{%- set dims_nphi_e = 0 %}
|
|
{%- endif %}
|
|
{%- if solver_options.model_external_shared_lib_dir %}
|
|
{%- set model_external_shared_lib_dir = solver_options.model_external_shared_lib_dir %}
|
|
{%- endif %}
|
|
{%- if solver_options.model_external_shared_lib_name %}
|
|
{%- set model_external_shared_lib_name = solver_options.model_external_shared_lib_name %}
|
|
{%- endif %}
|
|
|
|
{# control operator #}
|
|
{%- if os and os == "pc" %}
|
|
{%- set control = "&" %}
|
|
{%- else %}
|
|
{%- set control = ";" %}
|
|
{%- endif %}
|
|
|
|
{# acados linking libraries and flags #}
|
|
{%- if acados_link_libs and os and os == "pc" %}
|
|
{%- set link_libs = acados_link_libs.qpoases ~ " " ~ acados_link_libs.hpmpc ~ " " ~ acados_link_libs.osqp -%}
|
|
{%- set openmp_flag = acados_link_libs.openmp %}
|
|
{%- else %}
|
|
{%- set openmp_flag = " " %}
|
|
{%- if qp_solver == "FULL_CONDENSING_QPOASES" %}
|
|
{%- set link_libs = "-lqpOASES_e" %}
|
|
{%- else %}
|
|
{%- set link_libs = "" %}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
|
|
{# acados flags #}
|
|
ACADOS_FLAGS = -fPIC -std=c99 {{ openmp_flag }} #-fno-diagnostics-show-line-numbers -g
|
|
{%- if qp_solver == "FULL_CONDENSING_QPOASES" %}
|
|
ACADOS_FLAGS += -DACADOS_WITH_QPOASES
|
|
{%- endif %}
|
|
{%- if qp_solver == "PARTIAL_CONDENSING_OSQP" %}
|
|
ACADOS_FLAGS += -DACADOS_WITH_OSQP
|
|
{%- endif %}
|
|
{%- if qp_solver == "PARTIAL_CONDENSING_QPDUNES" %}
|
|
ACADOS_FLAGS += -DACADOS_WITH_QPDUNES
|
|
{%- endif %}
|
|
# # Debugging
|
|
# ACADOS_FLAGS += -g3
|
|
|
|
MODEL_OBJ=
|
|
{%- if solver_options.integrator_type == "ERK" %}
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_expl_ode_fun.o
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_expl_vde_forw.o
|
|
{%- if hessian_approx == "EXACT" %}
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_expl_ode_hess.o
|
|
{%- endif %}
|
|
{%- elif solver_options.integrator_type == "IRK" %}
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_impl_dae_fun.o
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_impl_dae_fun_jac_x_xdot_z.o
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_impl_dae_jac_x_xdot_u_z.o
|
|
{%- if hessian_approx == "EXACT" %}
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_impl_dae_hess.o
|
|
{%- endif %}
|
|
{%- elif solver_options.integrator_type == "LIFTED_IRK" %}
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_impl_dae_fun.o
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_impl_dae_fun_jac_x_xdot_u.o
|
|
{%- if hessian_approx == "EXACT" %}
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_impl_dae_hess.o
|
|
{%- endif %}
|
|
{%- elif solver_options.integrator_type == "GNSF" %}
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_gnsf_phi_fun.o
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_gnsf_phi_fun_jac_y.o
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_gnsf_phi_jac_y_uhat.o
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_gnsf_f_lo_fun_jac_x1k1uz.o
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_gnsf_get_matrices_fun.o
|
|
{%- elif solver_options.integrator_type == "DISCRETE" %}
|
|
{%- if model.dyn_ext_fun_type == "casadi" %}
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_dyn_disc_phi_fun.o
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_dyn_disc_phi_fun_jac.o
|
|
{%- if hessian_approx == "EXACT" %}
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.name }}_dyn_disc_phi_fun_jac_hess.o
|
|
{%- endif %}
|
|
{%- else %}
|
|
MODEL_OBJ+= {{ model.name }}_model/{{ model.dyn_source_discrete }}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
|
|
|
|
OCP_OBJ=
|
|
{%- if constr_type == "BGP" and dims_nphi > 0 %}
|
|
OCP_OBJ+= {{ model.name }}_constraints/{{ model.name }}_phi_constraint.o
|
|
{%- endif %}
|
|
{%- if constr_type_e == "BGP" and dims_nphi_e > 0 %}
|
|
OCP_OBJ+= {{ model.name }}_constraints/{{ model.name }}_phi_e_constraint.o
|
|
{%- endif %}
|
|
|
|
{%- if constr_type == "BGH" and dims_nh > 0 %}
|
|
OCP_OBJ+= {{ model.name }}_constraints/{{ model.name }}_constr_h_fun_jac_uxt_zt.o
|
|
OCP_OBJ+= {{ model.name }}_constraints/{{ model.name }}_constr_h_fun.o
|
|
{%- if hessian_approx == "EXACT" %}
|
|
OCP_OBJ+= {{ model.name }}_constraints/{{ model.name }}_constr_h_fun_jac_uxt_zt_hess.o
|
|
{%- endif %}
|
|
{%- endif %}
|
|
|
|
{%- if constr_type_e == "BGH" and dims_nh_e > 0 %}
|
|
OCP_OBJ+= {{ model.name }}_constraints/{{ model.name }}_constr_h_e_fun_jac_uxt_zt.o
|
|
OCP_OBJ+= {{ model.name }}_constraints/{{ model.name }}_constr_h_e_fun.o
|
|
{%- if hessian_approx == "EXACT" %}
|
|
OCP_OBJ+= {{ model.name }}_constraints/{{ model.name }}_constr_h_e_fun_jac_uxt_zt_hess.o
|
|
{%- endif %}
|
|
{%- endif %}
|
|
|
|
{%- if cost_type_0 == "NONLINEAR_LS" %}
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_y_0_fun.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_y_0_fun_jac_ut_xt.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_y_0_hess.c
|
|
{%- elif cost_type_0 == "EXTERNAL" %}
|
|
{% if cost.cost_ext_fun_type_0 == "casadi" %}
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_ext_cost_0_fun.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_ext_cost_0_fun_jac.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_ext_cost_0_fun_jac_hess.c
|
|
{% else %}
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ cost.cost_source_ext_cost_0 }}
|
|
{% endif %}
|
|
{%- endif %}
|
|
{%- if cost_type == "NONLINEAR_LS" %}
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_y_fun.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_y_fun_jac_ut_xt.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_y_hess.c
|
|
{%- elif cost_type == "EXTERNAL" %}
|
|
{% if cost.cost_ext_fun_type == "casadi" %}
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_ext_cost_fun.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_ext_cost_fun_jac.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_ext_cost_fun_jac_hess.c
|
|
{% elif cost.cost_source_ext_cost != cost.cost_source_ext_cost_0 %}
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ cost.cost_source_ext_cost }}
|
|
{% endif %}
|
|
{%- endif %}
|
|
{%- if cost_type_e == "NONLINEAR_LS" %}
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_y_e_fun.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_y_e_fun_jac_ut_xt.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_y_e_hess.c
|
|
{%- elif cost_type_e == "EXTERNAL" %}
|
|
{% if cost.cost_ext_fun_type_e == "casadi" %}
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_ext_cost_e_fun.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_ext_cost_e_fun_jac.c
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ model.name }}_cost_ext_cost_e_fun_jac_hess.c
|
|
{% elif cost.cost_source_ext_cost_e != cost.cost_source_ext_cost_0 %}
|
|
OCP_OBJ+= {{ model.name }}_cost/{{ cost.cost_source_ext_cost_e }}
|
|
{% endif %}
|
|
{%- endif %}
|
|
OCP_OBJ+= acados_solver_{{ model.name }}.o
|
|
|
|
|
|
SIM_OBJ=
|
|
SIM_OBJ+= acados_sim_solver_{{ model.name }}.o
|
|
|
|
EX_OBJ=
|
|
EX_OBJ+= main_{{ model.name }}.o
|
|
|
|
EX_SIM_OBJ=
|
|
EX_SIM_OBJ+= main_sim_{{ model.name }}.o
|
|
|
|
OBJ=
|
|
OBJ+= $(MODEL_OBJ)
|
|
{%- if solver_options.integrator_type != "DISCRETE" %}
|
|
OBJ+= $(SIM_OBJ)
|
|
{%- endif %}
|
|
OBJ+= $(OCP_OBJ)
|
|
|
|
EXTERNAL_DIR=
|
|
EXTERNAL_LIB=
|
|
|
|
{%- if model_external_shared_lib_dir and model_external_shared_lib_name %}
|
|
EXTERNAL_DIR+= {{ model_external_shared_lib_dir }}
|
|
EXTERNAL_LIB+= {{ model_external_shared_lib_name }}
|
|
{%- endif %}
|
|
|
|
INCLUDE_PATH = {{ acados_include_path }}
|
|
LIB_PATH = {{ acados_lib_path }}
|
|
|
|
{%- if solver_options.integrator_type == "DISCRETE" %}
|
|
all: clean casadi_fun example
|
|
shared_lib: ocp_shared_lib
|
|
{%- else %}
|
|
all: clean casadi_fun example_sim example
|
|
shared_lib: bundled_shared_lib ocp_shared_lib sim_shared_lib
|
|
{%- endif %}
|
|
|
|
CASADI_MODEL_SOURCE=
|
|
{%- if solver_options.integrator_type == "ERK" %}
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_expl_ode_fun.c
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_expl_vde_forw.c
|
|
{%- if hessian_approx == "EXACT" %}
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_expl_ode_hess.c
|
|
{%- endif %}
|
|
{%- elif solver_options.integrator_type == "IRK" %}
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_impl_dae_fun.c
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_impl_dae_fun_jac_x_xdot_z.c
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_impl_dae_jac_x_xdot_u_z.c
|
|
{%- if hessian_approx == "EXACT" %}
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_impl_dae_hess.c
|
|
{%- endif %}
|
|
{%- elif solver_options.integrator_type == "LIFTED_IRK" %}
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_impl_dae_fun.c
|
|
# CASADI_MODEL_SOURCE+= {{ model.name }}_impl_dae_fun_jac_x_xdot_z.c
|
|
# CASADI_MODEL_SOURCE+= {{ model.name }}_impl_dae_jac_x_xdot_u_z.c
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_impl_dae_fun_jac_x_xdot_u.c
|
|
{%- if hessian_approx == "EXACT" %}
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_impl_dae_hess.c
|
|
{%- endif %}
|
|
{%- elif solver_options.integrator_type == "GNSF" %}
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_gnsf_phi_fun.c
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_gnsf_phi_fun_jac_y.c
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_gnsf_phi_jac_y_uhat.c
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_gnsf_f_lo_fun_jac_x1k1uz.c
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_gnsf_get_matrices_fun.c
|
|
{%- elif solver_options.integrator_type == "DISCRETE" and model.dyn_ext_fun_type == "casadi" %}
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_dyn_disc_phi_fun.c
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_dyn_disc_phi_fun_jac.c
|
|
{%- if hessian_approx == "EXACT" %}
|
|
CASADI_MODEL_SOURCE+= {{ model.name }}_dyn_disc_phi_fun_jac_hess.c
|
|
{%- endif %}
|
|
{%- endif %}
|
|
{%- if constr_type == "BGP" and dims_nphi > 0 %}
|
|
CASADI_CON_PHI_SOURCE=
|
|
CASADI_CON_PHI_SOURCE+= {{ model.name }}_phi_constraint.c
|
|
{%- endif %}
|
|
{%- if constr_type_e == "BGP" and dims_nphi_e > 0 %}
|
|
CASADI_CON_PHI_E_SOURCE=
|
|
CASADI_CON_PHI_E_SOURCE+= {{ model.name }}_phi_e_constraint.c
|
|
{%- endif %}
|
|
{%- if constr_type == "BGH" and dims_nh > 0 %}
|
|
CASADI_CON_H_SOURCE=
|
|
CASADI_CON_H_SOURCE+= {{ model.name }}_constr_h_fun_jac_uxt_zt.c
|
|
CASADI_CON_H_SOURCE+= {{ model.name }}_constr_h_fun.c
|
|
{%- if hessian_approx == "EXACT" %}
|
|
CASADI_CON_H_SOURCE+= {{ model.name }}_constr_h_fun_jac_uxt_zt_hess.c
|
|
{%- endif %}
|
|
{%- endif %}
|
|
|
|
{%- if dims_nh_e > 0 %}
|
|
CASADI_CON_H_E_SOURCE=
|
|
CASADI_CON_H_E_SOURCE+= {{ model.name }}_constr_h_e_fun_jac_uxt_zt.c
|
|
CASADI_CON_H_E_SOURCE+= {{ model.name }}_constr_h_e_fun.c
|
|
{%- if hessian_approx == "EXACT" %}
|
|
CASADI_CON_H_E_SOURCE+= {{ model.name }}_constr_h_e_fun_jac_uxt_zt_hess.c
|
|
{%- endif %}
|
|
{%- endif %}
|
|
|
|
{%- if cost_type == "NONLINEAR_LS" %}
|
|
CASADI_COST_Y_SOURCE=
|
|
CASADI_COST_Y_SOURCE+= {{ model.name }}_cost_y_fun.c
|
|
CASADI_COST_Y_SOURCE+= {{ model.name }}_cost_y_fun_jac_ut_xt.c
|
|
CASADI_COST_Y_SOURCE+= {{ model.name }}_cost_y_hess.c
|
|
{%- endif %}
|
|
{%- if cost_type_e == "NONLINEAR_LS" %}
|
|
CASADI_COST_Y_E_SOURCE=
|
|
CASADI_COST_Y_E_SOURCE+= {{ model.name }}_cost_y_e_fun.c
|
|
CASADI_COST_Y_E_SOURCE+= {{ model.name }}_cost_y_e_fun_jac_ut_xt.c
|
|
CASADI_COST_Y_E_SOURCE+= {{ model.name }}_cost_y_e_hess.c
|
|
{%- endif %}
|
|
{%- if cost_type_0 == "NONLINEAR_LS" %}
|
|
CASADI_COST_Y_0_SOURCE=
|
|
CASADI_COST_Y_0_SOURCE+= {{ model.name }}_cost_y_0_fun.c
|
|
CASADI_COST_Y_0_SOURCE+= {{ model.name }}_cost_y_0_fun_jac_ut_xt.c
|
|
CASADI_COST_Y_0_SOURCE+= {{ model.name }}_cost_y_0_hess.c
|
|
{%- endif %}
|
|
|
|
casadi_fun:
|
|
{%- if model.dyn_ext_fun_type == "casadi" %}
|
|
( cd {{ model.name }}_model {{ control }} gcc $(ACADOS_FLAGS) -c $(CASADI_MODEL_SOURCE))
|
|
{%- endif %}
|
|
{%- if constr_type == "BGP" and dims_nphi > 0 %}
|
|
( cd {{ model.name }}_constraints {{ control }} gcc $(ACADOS_FLAGS) -c $(CASADI_CON_PHI_SOURCE))
|
|
{%- endif %}
|
|
{%- if constr_type_e == "BGP" and dims_nphi_e > 0 %}
|
|
( cd {{ model.name }}_constraints {{ control }} gcc $(ACADOS_FLAGS) -c $(CASADI_CON_PHI_E_SOURCE))
|
|
{%- endif %}
|
|
{%- if constr_type == "BGH" and dims_nh > 0 %}
|
|
( cd {{ model.name }}_constraints {{ control }} gcc $(ACADOS_FLAGS) -c $(CASADI_CON_H_SOURCE))
|
|
{%- endif %}
|
|
{%- if constr_type_e == "BGH" and dims_nh_e > 0 %}
|
|
( cd {{ model.name }}_constraints {{ control }} gcc $(ACADOS_FLAGS) -c $(CASADI_CON_H_E_SOURCE))
|
|
{%- endif %}
|
|
{%- if cost_type == "NONLINEAR_LS" %}
|
|
( cd {{ model.name }}_cost {{ control }} gcc $(ACADOS_FLAGS) -c $(CASADI_COST_Y_SOURCE))
|
|
{%- endif %}
|
|
{%- if cost_type_e == "NONLINEAR_LS" %}
|
|
( cd {{ model.name }}_cost {{ control }} gcc $(ACADOS_FLAGS) -c $(CASADI_COST_Y_E_SOURCE))
|
|
{%- endif %}
|
|
{%- if cost_type_0 == "NONLINEAR_LS" %}
|
|
( cd {{ model.name }}_cost {{ control }} gcc $(ACADOS_FLAGS) -c $(CASADI_COST_Y_0_SOURCE))
|
|
{%- endif %}
|
|
|
|
main:
|
|
gcc $(ACADOS_FLAGS) -c main_{{ model.name }}.c -I $(INCLUDE_PATH)/blasfeo/include/ -I $(INCLUDE_PATH)/hpipm/include/ \
|
|
-I $(INCLUDE_PATH) -I $(INCLUDE_PATH)/acados/ \
|
|
{%- if qp_solver == "FULL_CONDENSING_QPOASES" %}
|
|
-I $(INCLUDE_PATH)/qpOASES_e/
|
|
{%- endif %}
|
|
|
|
main_sim:
|
|
gcc $(ACADOS_FLAGS) -c main_sim_{{ model.name }}.c -I $(INCLUDE_PATH)/blasfeo/include/ -I $(INCLUDE_PATH)/hpipm/include/ \
|
|
-I $(INCLUDE_PATH) -I $(INCLUDE_PATH)/acados/
|
|
|
|
ocp_solver:
|
|
gcc $(ACADOS_FLAGS) -c acados_solver_{{ model.name }}.c -I $(INCLUDE_PATH)/blasfeo/include/ -I $(INCLUDE_PATH)/hpipm/include/ \
|
|
-I $(INCLUDE_PATH) -I $(INCLUDE_PATH)/acados/ \
|
|
{%- if qp_solver == "FULL_CONDENSING_QPOASES" %}
|
|
-I $(INCLUDE_PATH)/qpOASES_e/
|
|
{%- endif %}
|
|
|
|
sim_solver:
|
|
gcc $(ACADOS_FLAGS) -c acados_sim_solver_{{ model.name }}.c -I $(INCLUDE_PATH)/blasfeo/include/ -I $(INCLUDE_PATH)/hpipm/include/ \
|
|
-I $(INCLUDE_PATH) -I $(INCLUDE_PATH)/acados/ \
|
|
{%- if qp_solver == "FULL_CONDENSING_QPOASES" %}
|
|
-I $(INCLUDE_PATH)/qpOASES_e/
|
|
{%- endif %}
|
|
|
|
example: ocp_solver main
|
|
gcc $(ACADOS_FLAGS) -o main_{{ model.name }} $(EX_OBJ) $(OBJ) -L $(LIB_PATH) \
|
|
-lacados -lhpipm -lblasfeo \
|
|
{{ link_libs }} \
|
|
-lm \
|
|
-I $(INCLUDE_PATH)/blasfeo/include/ \
|
|
-I $(INCLUDE_PATH)/hpipm/include/ \
|
|
-I $(INCLUDE_PATH) \
|
|
-I $(INCLUDE_PATH)/acados/ \
|
|
{%- if qp_solver == "FULL_CONDENSING_QPOASES" %}
|
|
-I $(INCLUDE_PATH)/qpOASES_e/
|
|
{%- endif %}
|
|
|
|
|
|
example_sim: sim_solver main_sim
|
|
gcc $(ACADOS_FLAGS) -o main_sim_{{ model.name }} $(EX_SIM_OBJ) $(MODEL_OBJ) $(SIM_OBJ) -L $(LIB_PATH) \
|
|
-lacados -lhpipm -lblasfeo \
|
|
{{ link_libs }} \
|
|
-lm \
|
|
-I $(INCLUDE_PATH)/blasfeo/include/ \
|
|
-I $(INCLUDE_PATH)/acados/ \
|
|
|
|
{%- if solver_options.integrator_type != "DISCRETE" %}
|
|
|
|
bundled_shared_lib: casadi_fun ocp_solver sim_solver
|
|
gcc $(ACADOS_FLAGS) -shared -o libacados_solver_{{ model.name }}.so $(OBJ) \
|
|
-I $(INCLUDE_PATH)/blasfeo/include/ \
|
|
-I $(INCLUDE_PATH)/hpipm/include/ \
|
|
-I $(INCLUDE_PATH) \
|
|
-L $(LIB_PATH) \
|
|
-lacados -lhpipm -lblasfeo \
|
|
{{ link_libs }} \
|
|
-lm \
|
|
|
|
ocp_shared_lib: casadi_fun ocp_solver
|
|
gcc $(ACADOS_FLAGS) -shared -o libacados_ocp_solver_{{ model.name }}.so $(OCP_OBJ) $(MODEL_OBJ) \
|
|
-I $(INCLUDE_PATH)/blasfeo/include/ \
|
|
-I $(INCLUDE_PATH)/hpipm/include/ \
|
|
-I $(INCLUDE_PATH) \
|
|
-L$(EXTERNAL_DIR) -l$(EXTERNAL_LIB) \
|
|
-L $(LIB_PATH) -lacados -lhpipm -lblasfeo \
|
|
{{ link_libs }} \
|
|
-lm \
|
|
|
|
{%- else %}
|
|
|
|
ocp_shared_lib: casadi_fun ocp_solver
|
|
gcc $(ACADOS_FLAGS) -shared -o libacados_ocp_solver_{{ model.name }}.so $(OCP_OBJ) $(MODEL_OBJ) \
|
|
-I $(INCLUDE_PATH)/blasfeo/include/ \
|
|
-I $(INCLUDE_PATH)/hpipm/include/ \
|
|
-I $(INCLUDE_PATH) \
|
|
-L$(EXTERNAL_DIR) -l$(EXTERNAL_LIB) \
|
|
-L $(LIB_PATH) -lacados -lhpipm -lblasfeo \
|
|
{{ link_libs }} \
|
|
-lm \
|
|
|
|
{%- endif %}
|
|
|
|
ocp_cython_c: ocp_shared_lib
|
|
cython \
|
|
-o acados_ocp_solver_pyx.c \
|
|
-I $(INCLUDE_PATH)/../interfaces/acados_template/acados_template \
|
|
$(INCLUDE_PATH)/../interfaces/acados_template/acados_template/acados_ocp_solver_pyx.pyx \
|
|
|
|
ocp_cython_o: ocp_cython_c
|
|
clang $(ACADOS_FLAGS) -c -O2 \
|
|
-o acados_ocp_solver_pyx.o \
|
|
-I /usr/include/python3.8 \
|
|
-I $(INCLUDE_PATH)/blasfeo/include/ \
|
|
-I $(INCLUDE_PATH)/hpipm/include/ \
|
|
-I $(INCLUDE_PATH) \
|
|
acados_ocp_solver_pyx.c \
|
|
|
|
ocp_cython: ocp_cython_o
|
|
clang $(ACADOS_FLAGS) -shared \
|
|
-o acados_ocp_solver_pyx.so \
|
|
-Wl,-rpath=$(LIB_PATH) \
|
|
acados_ocp_solver_pyx.o \
|
|
$(abspath .)/libacados_ocp_solver_{{ model.name }}.so \
|
|
-L $(LIB_PATH) -lacados -lhpipm -lblasfeo -lqpOASES_e \
|
|
{{ link_libs }} \
|
|
-lm \
|
|
|
|
sim_shared_lib: casadi_fun sim_solver
|
|
gcc $(ACADOS_FLAGS) -shared -o libacados_sim_solver_{{ model.name }}.so $(SIM_OBJ) $(MODEL_OBJ) -L$(EXTERNAL_DIR) -l$(EXTERNAL_LIB) \
|
|
-L $(LIB_PATH) -lacados -lhpipm -lblasfeo \
|
|
{{ link_libs }} \
|
|
-lm \
|
|
|
|
{%- if os and os == "pc" %}
|
|
|
|
clean:
|
|
del \Q *.o 2>nul
|
|
del \Q *.so 2>nul
|
|
del \Q main_{{ model.name }} 2>nul
|
|
|
|
clean_ocp_shared_lib:
|
|
del \Q libacados_ocp_solver_{{ model.name }}.so 2>nul
|
|
del \Q acados_solver_{{ model.name }}.o 2>nul
|
|
|
|
{%- else %}
|
|
|
|
clean:
|
|
rm -f *.o
|
|
rm -f *.so
|
|
rm -f main_{{ model.name }}
|
|
|
|
clean_ocp_shared_lib:
|
|
rm -f libacados_ocp_solver_{{ model.name }}.so
|
|
rm -f acados_solver_{{ model.name }}.o
|
|
|
|
{%- endif %}
|
|
|