openpilot v0.9.6 release
date: 2024-01-12T10:13:37 master commit: ba792d576a49a0899b88a753fa1c52956bedf9e6
This commit is contained in:
81
third_party/acados/include/acados_c/condensing_interface.h
vendored
Normal file
81
third_party/acados/include/acados_c/condensing_interface.h
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) The acados authors.
|
||||
*
|
||||
* 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.;
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_CONDENSING_INTERFACE_H_
|
||||
#define INTERFACES_ACADOS_C_CONDENSING_INTERFACE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "acados/ocp_qp/ocp_qp_full_condensing.h"
|
||||
#include "acados/ocp_qp/ocp_qp_partial_condensing.h"
|
||||
|
||||
typedef enum {
|
||||
PARTIAL_CONDENSING,
|
||||
FULL_CONDENSING,
|
||||
} condensing_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
condensing_t condensing_type;
|
||||
} condensing_plan;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ocp_qp_xcond_config *config;
|
||||
void *dims;
|
||||
void *opts;
|
||||
void *mem;
|
||||
void *work;
|
||||
} condensing_module;
|
||||
|
||||
ocp_qp_xcond_config *ocp_qp_condensing_config_create(condensing_plan *plan);
|
||||
//
|
||||
void *ocp_qp_condensing_opts_create(ocp_qp_xcond_config *config, void *dims_);
|
||||
//
|
||||
acados_size_t ocp_qp_condensing_calculate_size(ocp_qp_xcond_config *config, void *dims_, void *opts_);
|
||||
//
|
||||
condensing_module *ocp_qp_condensing_assign(ocp_qp_xcond_config *config, void *dims_,
|
||||
void *opts_, void *raw_memory);
|
||||
//
|
||||
condensing_module *ocp_qp_condensing_create(ocp_qp_xcond_config *config, void *dims_,
|
||||
void *opts_);
|
||||
//
|
||||
int ocp_qp_condense(condensing_module *module, void *qp_in, void *qp_out);
|
||||
//
|
||||
int ocp_qp_expand(condensing_module *module, void *qp_in, void *qp_out);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif // INTERFACES_ACADOS_C_CONDENSING_INTERFACE_H_
|
||||
91
third_party/acados/include/acados_c/dense_qp_interface.h
vendored
Normal file
91
third_party/acados/include/acados_c/dense_qp_interface.h
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) The acados authors.
|
||||
*
|
||||
* 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.;
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_DENSE_QP_INTERFACE_H_
|
||||
#define INTERFACES_ACADOS_C_DENSE_QP_INTERFACE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "acados/dense_qp/dense_qp_common.h"
|
||||
|
||||
typedef enum { DENSE_QP_HPIPM, DENSE_QP_QORE, DENSE_QP_QPOASES, DENSE_QP_OOQP, DENSE_QP_DAQP } dense_qp_solver_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
dense_qp_solver_t qp_solver;
|
||||
} dense_qp_solver_plan;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
qp_solver_config *config;
|
||||
void *dims;
|
||||
void *opts;
|
||||
void *mem;
|
||||
void *work;
|
||||
} dense_qp_solver;
|
||||
|
||||
qp_solver_config *dense_qp_config_create(dense_qp_solver_plan *plan);
|
||||
//
|
||||
dense_qp_dims *dense_qp_dims_create();
|
||||
//
|
||||
dense_qp_in *dense_qp_in_create(qp_solver_config *config, dense_qp_dims *dims);
|
||||
//
|
||||
dense_qp_out *dense_qp_out_create(qp_solver_config *config, dense_qp_dims *dims);
|
||||
//
|
||||
void *dense_qp_opts_create(qp_solver_config *config, dense_qp_dims *dims);
|
||||
//
|
||||
acados_size_t dense_qp_calculate_size(qp_solver_config *config, dense_qp_dims *dims, void *opts_);
|
||||
//
|
||||
dense_qp_solver *dense_qp_assign(qp_solver_config *config, dense_qp_dims *dims, void *opts_,
|
||||
void *raw_memory);
|
||||
//
|
||||
dense_qp_solver *dense_qp_create(qp_solver_config *config, dense_qp_dims *dims, void *opts_);
|
||||
//
|
||||
int dense_qp_solve(dense_qp_solver *solver, dense_qp_in *qp_in, dense_qp_out *qp_out);
|
||||
//
|
||||
void dense_qp_inf_norm_residuals(dense_qp_dims *dims, dense_qp_in *qp_in, dense_qp_out *qp_out,
|
||||
double *res);
|
||||
//
|
||||
bool dense_qp_set_field_double_array(const char *field, double *arr, dense_qp_in *qp_in);
|
||||
//
|
||||
bool dense_qp_set_field_int_array(const char *field, int *arr, dense_qp_in *qp_in);
|
||||
//
|
||||
bool dense_qp_get_field_double_array(const char *field, dense_qp_in *qp_in, double *arr);
|
||||
//
|
||||
bool dense_qp_get_field_int_array(const char *field, dense_qp_in *qp_in, int *arr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif // INTERFACES_ACADOS_C_DENSE_QP_INTERFACE_H_
|
||||
89
third_party/acados/include/acados_c/external_function_interface.h
vendored
Normal file
89
third_party/acados/include/acados_c/external_function_interface.h
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) The acados authors.
|
||||
*
|
||||
* 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.;
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_EXTERNAL_FUNCTION_INTERFACE_H_
|
||||
#define INTERFACES_ACADOS_C_EXTERNAL_FUNCTION_INTERFACE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "acados/utils/external_function_generic.h"
|
||||
|
||||
|
||||
|
||||
/************************************************
|
||||
* generic external parametric function
|
||||
************************************************/
|
||||
|
||||
//
|
||||
void external_function_param_generic_create(external_function_param_generic *fun, int np);
|
||||
//
|
||||
void external_function_param_generic_free(external_function_param_generic *fun);
|
||||
|
||||
|
||||
|
||||
/************************************************
|
||||
* casadi external function
|
||||
************************************************/
|
||||
|
||||
//
|
||||
void external_function_casadi_create(external_function_casadi *fun);
|
||||
//
|
||||
void external_function_casadi_free(external_function_casadi *fun);
|
||||
//
|
||||
void external_function_casadi_create_array(int size, external_function_casadi *funs);
|
||||
//
|
||||
void external_function_casadi_free_array(int size, external_function_casadi *funs);
|
||||
|
||||
|
||||
|
||||
/************************************************
|
||||
* casadi external parametric function
|
||||
************************************************/
|
||||
|
||||
//
|
||||
void external_function_param_casadi_create(external_function_param_casadi *fun, int np);
|
||||
//
|
||||
void external_function_param_casadi_free(external_function_param_casadi *fun);
|
||||
//
|
||||
void external_function_param_casadi_create_array(int size, external_function_param_casadi *funs,
|
||||
int np);
|
||||
//
|
||||
void external_function_param_casadi_free_array(int size, external_function_param_casadi *funs);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif // INTERFACES_ACADOS_C_EXTERNAL_FUNCTION_INTERFACE_H_
|
||||
428
third_party/acados/include/acados_c/ocp_nlp_interface.h
vendored
Normal file
428
third_party/acados/include/acados_c/ocp_nlp_interface.h
vendored
Normal file
@@ -0,0 +1,428 @@
|
||||
/*
|
||||
* Copyright (c) The acados authors.
|
||||
*
|
||||
* 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.;
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_OCP_NLP_INTERFACE_H_
|
||||
#define INTERFACES_ACADOS_C_OCP_NLP_INTERFACE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// acados
|
||||
#include "acados/ocp_nlp/ocp_nlp_common.h"
|
||||
#include "acados/ocp_nlp/ocp_nlp_constraints_bgh.h"
|
||||
#include "acados/sim/sim_erk_integrator.h"
|
||||
#include "acados/sim/sim_irk_integrator.h"
|
||||
#include "acados/sim/sim_lifted_irk_integrator.h"
|
||||
#include "acados/sim/sim_gnsf.h"
|
||||
#include "acados/utils/types.h"
|
||||
// acados_c
|
||||
#include "acados_c/ocp_qp_interface.h"
|
||||
#include "acados_c/sim_interface.h"
|
||||
|
||||
|
||||
/// Solution methods for optimal control problems.
|
||||
typedef enum
|
||||
{
|
||||
SQP,
|
||||
SQP_RTI,
|
||||
INVALID_NLP_SOLVER,
|
||||
} ocp_nlp_solver_t;
|
||||
|
||||
|
||||
/// Types of the cost function.
|
||||
typedef enum
|
||||
{
|
||||
LINEAR_LS,
|
||||
NONLINEAR_LS,
|
||||
CONVEX_OVER_NONLINEAR,
|
||||
EXTERNAL,
|
||||
INVALID_COST,
|
||||
} ocp_nlp_cost_t;
|
||||
|
||||
|
||||
/// Types of the system dynamics, discrete or continuous time.
|
||||
typedef enum
|
||||
{
|
||||
CONTINUOUS_MODEL,
|
||||
DISCRETE_MODEL,
|
||||
INVALID_DYNAMICS,
|
||||
} ocp_nlp_dynamics_t;
|
||||
|
||||
|
||||
/// Constraint types
|
||||
typedef enum
|
||||
{
|
||||
/// Comprises simple bounds, polytopic constraints,
|
||||
/// general non-linear constraints.
|
||||
BGH,
|
||||
|
||||
/// Comprises simple bounds, polytopic constraints,
|
||||
/// general non-linear constraints, and positive definite constraints.
|
||||
BGP,
|
||||
|
||||
INVALID_CONSTRAINT,
|
||||
} ocp_nlp_constraints_t;
|
||||
|
||||
|
||||
/// Regularization types
|
||||
typedef enum
|
||||
{
|
||||
NO_REGULARIZE,
|
||||
MIRROR,
|
||||
PROJECT,
|
||||
PROJECT_REDUC_HESS,
|
||||
CONVEXIFY,
|
||||
INVALID_REGULARIZE,
|
||||
} ocp_nlp_reg_t;
|
||||
|
||||
|
||||
/// Structure to store the configuration of a non-linear program
|
||||
typedef struct ocp_nlp_plan_t
|
||||
{
|
||||
/// QP solver configuration.
|
||||
ocp_qp_solver_plan_t ocp_qp_solver_plan;
|
||||
|
||||
/// Simulation solver configuration for each stage.
|
||||
sim_solver_plan_t *sim_solver_plan;
|
||||
|
||||
/// Nlp solver type.
|
||||
ocp_nlp_solver_t nlp_solver;
|
||||
|
||||
/// Regularization type, defaults to no regularization.
|
||||
ocp_nlp_reg_t regularization;
|
||||
|
||||
/// Cost type for each stage.
|
||||
ocp_nlp_cost_t *nlp_cost;
|
||||
|
||||
/// Dynamics type for each stage.
|
||||
ocp_nlp_dynamics_t *nlp_dynamics;
|
||||
|
||||
/// Constraints type for each stage.
|
||||
ocp_nlp_constraints_t *nlp_constraints;
|
||||
|
||||
/// Horizon length.
|
||||
int N;
|
||||
|
||||
} ocp_nlp_plan_t;
|
||||
|
||||
|
||||
/// Structure to store the state/configuration for the non-linear programming solver
|
||||
typedef struct ocp_nlp_solver
|
||||
{
|
||||
ocp_nlp_config *config;
|
||||
void *dims;
|
||||
void *opts;
|
||||
void *mem;
|
||||
void *work;
|
||||
} ocp_nlp_solver;
|
||||
|
||||
|
||||
/// Constructs an empty plan struct (user nlp configuration), all fields are set to a
|
||||
/// default/invalid state.
|
||||
///
|
||||
/// \param N Horizon length
|
||||
ACADOS_SYMBOL_EXPORT ocp_nlp_plan_t *ocp_nlp_plan_create(int N);
|
||||
|
||||
/// Destructor for plan struct, frees memory.
|
||||
///
|
||||
/// \param plan_ The plan struct to destroy.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_plan_destroy(void* plan_);
|
||||
|
||||
|
||||
/// Constructs an nlp configuration struct from a plan.
|
||||
///
|
||||
/// \param plan The plan (user nlp configuration).
|
||||
ACADOS_SYMBOL_EXPORT ocp_nlp_config *ocp_nlp_config_create(ocp_nlp_plan_t plan);
|
||||
|
||||
/// Desctructor of the nlp configuration.
|
||||
///
|
||||
/// \param config_ The configuration struct.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_config_destroy(void *config_);
|
||||
|
||||
|
||||
/// Constructs an struct that contains the dimensions of the variables.
|
||||
///
|
||||
/// \param config_ The configuration struct.
|
||||
ACADOS_SYMBOL_EXPORT ocp_nlp_dims *ocp_nlp_dims_create(void *config_);
|
||||
|
||||
/// Destructor of The dimension struct.
|
||||
///
|
||||
/// \param dims_ The dimension struct.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_dims_destroy(void *dims_);
|
||||
|
||||
|
||||
/// Constructs an input struct for a non-linear programs.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
ACADOS_SYMBOL_EXPORT ocp_nlp_in *ocp_nlp_in_create(ocp_nlp_config *config, ocp_nlp_dims *dims);
|
||||
|
||||
/// Destructor of the inputs struct.
|
||||
///
|
||||
/// \param in The inputs struct.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_in_destroy(void *in);
|
||||
|
||||
|
||||
/// Sets the sampling times for the given stage.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param in The inputs struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field Has to be "Ts" (TBC other options).
|
||||
/// \param value The sampling times (floating point).
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_in_set(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_in *in, int stage,
|
||||
const char *field, void *value);
|
||||
|
||||
///
|
||||
// void ocp_nlp_in_get(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_in *in, int stage,
|
||||
// const char *field, void *value);
|
||||
|
||||
/// Sets the function pointers to the dynamics functions for the given stage.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param in The inputs struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param fun_type The name of the function type, either impl_ode_fun,
|
||||
/// impl_ode_fun_jac_x_xdot, impl_ode_jac_x_xdot_u (TBC)
|
||||
/// \param fun_ptr Function pointer to the dynamics function.
|
||||
ACADOS_SYMBOL_EXPORT int ocp_nlp_dynamics_model_set(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_in *in,
|
||||
int stage, const char *fun_type, void *fun_ptr);
|
||||
|
||||
|
||||
/// Sets the function pointers to the cost functions for the given stage.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param in The inputs struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field The name of the field, either nls_res_jac,
|
||||
/// y_ref, W (others TBC)
|
||||
/// \param value Cost values.
|
||||
ACADOS_SYMBOL_EXPORT int ocp_nlp_cost_model_set(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_in *in,
|
||||
int stage, const char *field, void *value);
|
||||
|
||||
|
||||
/// Sets the function pointers to the constraints functions for the given stage.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param in The inputs struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field The name of the field, either lb, ub (others TBC)
|
||||
/// \param value Constraints function or values.
|
||||
ACADOS_SYMBOL_EXPORT int ocp_nlp_constraints_model_set(ocp_nlp_config *config, ocp_nlp_dims *dims,
|
||||
ocp_nlp_in *in, int stage, const char *field, void *value);
|
||||
|
||||
///
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_constraints_model_get(ocp_nlp_config *config, ocp_nlp_dims *dims,
|
||||
ocp_nlp_in *in, int stage, const char *field, void *value);
|
||||
|
||||
/* out */
|
||||
|
||||
/// Constructs an output struct for the non-linear program.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
ACADOS_SYMBOL_EXPORT ocp_nlp_out *ocp_nlp_out_create(ocp_nlp_config *config, ocp_nlp_dims *dims);
|
||||
|
||||
/// Destructor of the output struct.
|
||||
///
|
||||
/// \param out The output struct.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_out_destroy(void *out);
|
||||
|
||||
|
||||
/// Sets fields in the output struct of an nlp solver, used to initialize the solver.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param out The output struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field The name of the field, either x, u, pi.
|
||||
/// \param value Initialization values.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_out_set(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_out *out,
|
||||
int stage, const char *field, void *value);
|
||||
|
||||
|
||||
/// Gets values of fields in the output struct of an nlp solver.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param out The output struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field The name of the field, either x, u, z, pi.
|
||||
/// \param value Pointer to the output memory.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_out_get(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_out *out,
|
||||
int stage, const char *field, void *value);
|
||||
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_get_at_stage(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_solver *solver,
|
||||
int stage, const char *field, void *value);
|
||||
|
||||
// TODO(andrea): remove this once/if the MATLAB interface uses the new setters below?
|
||||
ACADOS_SYMBOL_EXPORT int ocp_nlp_dims_get_from_attr(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_out *out,
|
||||
int stage, const char *field);
|
||||
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_constraint_dims_get_from_attr(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_out *out,
|
||||
int stage, const char *field, int *dims_out);
|
||||
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_cost_dims_get_from_attr(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_out *out,
|
||||
int stage, const char *field, int *dims_out);
|
||||
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_qp_dims_get_from_attr(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_out *out,
|
||||
int stage, const char *field, int *dims_out);
|
||||
|
||||
/* opts */
|
||||
|
||||
/// Creates an options struct for the non-linear program.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
ACADOS_SYMBOL_EXPORT void *ocp_nlp_solver_opts_create(ocp_nlp_config *config, ocp_nlp_dims *dims);
|
||||
|
||||
/// Destructor of the options.
|
||||
///
|
||||
/// \param opts The options struct.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_solver_opts_destroy(void *opts);
|
||||
|
||||
/// Sets an option.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param opts_ The options struct.
|
||||
/// \param field Name of the option.
|
||||
/// \param value Value of the option.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_solver_opts_set(ocp_nlp_config *config, void *opts_, const char *field, void* value);
|
||||
|
||||
|
||||
// ACADOS_SYMBOL_EXPORT void ocp_nlp_solver_opts_get(ocp_nlp_config *config, void *opts_, const char *field, void* value);
|
||||
|
||||
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_solver_opts_set_at_stage(ocp_nlp_config *config, void *opts_, int stage, const char *field, void* value);
|
||||
|
||||
|
||||
/// TBC
|
||||
/// Updates the options.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param opts_ The options struct.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_solver_opts_update(ocp_nlp_config *config, ocp_nlp_dims *dims, void *opts_);
|
||||
|
||||
|
||||
/* solver */
|
||||
|
||||
/// Creates an ocp solver.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param opts_ The options struct.
|
||||
/// \return The solver.
|
||||
ACADOS_SYMBOL_EXPORT ocp_nlp_solver *ocp_nlp_solver_create(ocp_nlp_config *config, ocp_nlp_dims *dims, void *opts_);
|
||||
|
||||
/// Destructor of the solver.
|
||||
///
|
||||
/// \param solver The solver struct.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_solver_destroy(void *solver);
|
||||
|
||||
/// Solves the optimal control problem. Call ocp_nlp_precompute before
|
||||
/// calling this functions (TBC).
|
||||
///
|
||||
/// \param solver The solver struct.
|
||||
/// \param nlp_in The inputs struct.
|
||||
/// \param nlp_out The output struct.
|
||||
ACADOS_SYMBOL_EXPORT int ocp_nlp_solve(ocp_nlp_solver *solver, ocp_nlp_in *nlp_in, ocp_nlp_out *nlp_out);
|
||||
|
||||
|
||||
|
||||
/// Resets the memory of the QP solver
|
||||
///
|
||||
/// \param solver The solver struct.
|
||||
/// \param nlp_in The inputs struct.
|
||||
/// \param nlp_out The output struct.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_solver_reset_qp_memory(ocp_nlp_solver *solver, ocp_nlp_in *nlp_in, ocp_nlp_out *nlp_out);
|
||||
|
||||
|
||||
/// Performs precomputations for the solver. Needs to be called before
|
||||
/// ocl_nlp_solve (TBC).
|
||||
///
|
||||
/// \param solver The solver struct.
|
||||
/// \param nlp_in The inputs struct.
|
||||
/// \param nlp_out The output struct.
|
||||
ACADOS_SYMBOL_EXPORT int ocp_nlp_precompute(ocp_nlp_solver *solver, ocp_nlp_in *nlp_in, ocp_nlp_out *nlp_out);
|
||||
|
||||
|
||||
/// Computes cost function value.
|
||||
///
|
||||
/// \param solver The solver struct.
|
||||
/// \param nlp_in The inputs struct.
|
||||
/// \param nlp_out The output struct.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_eval_cost(ocp_nlp_solver *solver, ocp_nlp_in *nlp_in, ocp_nlp_out *nlp_out);
|
||||
|
||||
|
||||
/// Computes the residuals.
|
||||
///
|
||||
/// \param solver The solver struct.
|
||||
/// \param nlp_in The inputs struct.
|
||||
/// \param nlp_out The output struct.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_eval_residuals(ocp_nlp_solver *solver, ocp_nlp_in *nlp_in, ocp_nlp_out *nlp_out);
|
||||
|
||||
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_eval_param_sens(ocp_nlp_solver *solver, char *field, int stage, int index, ocp_nlp_out *sens_nlp_out);
|
||||
|
||||
/* get */
|
||||
/// \param config The configuration struct.
|
||||
/// \param solver The solver struct.
|
||||
/// \param field Supports "sqp_iter", "status", "nlp_res", "time_tot", ...
|
||||
/// \param return_value_ Pointer to the output memory.
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_get(ocp_nlp_config *config, ocp_nlp_solver *solver,
|
||||
const char *field, void *return_value_);
|
||||
|
||||
/* set */
|
||||
/// Sets the initial guesses for the integrator for the given stage.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param solver The ocp_nlp_solver struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field Supports "z_guess", "xdot_guess" (IRK), "phi_guess" (GNSF-IRK)
|
||||
/// \param value The initial guess for the algebraic variables in the integrator (if continuous model is used).
|
||||
ACADOS_SYMBOL_EXPORT void ocp_nlp_set(ocp_nlp_config *config, ocp_nlp_solver *solver,
|
||||
int stage, const char *field, void *value);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif // INTERFACES_ACADOS_C_OCP_NLP_INTERFACE_H_
|
||||
263
third_party/acados/include/acados_c/ocp_qp_interface.h
vendored
Normal file
263
third_party/acados/include/acados_c/ocp_qp_interface.h
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
* Copyright (c) The acados authors.
|
||||
*
|
||||
* 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.;
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_OCP_QP_INTERFACE_H_
|
||||
#define INTERFACES_ACADOS_C_OCP_QP_INTERFACE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "acados/ocp_qp/ocp_qp_common.h"
|
||||
#include "acados/ocp_qp/ocp_qp_xcond_solver.h"
|
||||
|
||||
|
||||
/// QP solver types (Enumeration).
|
||||
///
|
||||
/// Full list of fields:
|
||||
/// PARTIAL_CONDENSING_HPIPM
|
||||
/// PARTIAL_CONDENSING_HPMPC
|
||||
/// PARTIAL_CONDENSING_OOQP
|
||||
/// PARTIAL_CONDENSING_OSQP
|
||||
/// PARTIAL_CONDENSING_QPDUNES
|
||||
/// FULL_CONDENSING_HPIPM
|
||||
/// FULL_CONDENSING_QPOASES
|
||||
/// FULL_CONDENSING_QORE
|
||||
/// FULL_CONDENSING_OOQP
|
||||
/// INVALID_QP_SOLVER
|
||||
///
|
||||
/// Note: In this enumeration the partial condensing solvers have to be
|
||||
/// specified before the full condensing solvers.
|
||||
typedef enum {
|
||||
PARTIAL_CONDENSING_HPIPM,
|
||||
#ifdef ACADOS_WITH_HPMPC
|
||||
PARTIAL_CONDENSING_HPMPC,
|
||||
#else
|
||||
PARTIAL_CONDENSING_HPMPC_NOT_AVAILABLE,
|
||||
#endif
|
||||
#ifdef ACADOS_WITH_OOQP
|
||||
PARTIAL_CONDENSING_OOQP,
|
||||
#else
|
||||
PARTIAL_CONDENSING_OOQP_NOT_AVAILABLE,
|
||||
#endif
|
||||
#ifdef ACADOS_WITH_OSQP
|
||||
PARTIAL_CONDENSING_OSQP,
|
||||
#else
|
||||
PARTIAL_CONDENSING_OSQP_NOT_AVAILABLE,
|
||||
#endif
|
||||
#ifdef ACADOS_WITH_QPDUNES
|
||||
PARTIAL_CONDENSING_QPDUNES,
|
||||
#else
|
||||
PARTIAL_CONDENSING_QPDUNES_NOT_AVAILABLE,
|
||||
#endif
|
||||
FULL_CONDENSING_HPIPM,
|
||||
#ifdef ACADOS_WITH_QPOASES
|
||||
FULL_CONDENSING_QPOASES,
|
||||
#else
|
||||
FULL_CONDENSING_QPOASES_NOT_AVAILABLE,
|
||||
#endif
|
||||
#ifdef ACADOS_WITH_DAQP
|
||||
FULL_CONDENSING_DAQP,
|
||||
#else
|
||||
FULL_CONDENSING_DAQP_NOT_AVAILABLE,
|
||||
#endif
|
||||
#ifdef ACADOS_WITH_QORE
|
||||
FULL_CONDENSING_QORE,
|
||||
#else
|
||||
FULL_CONDENSING_QORE_NOT_AVAILABLE,
|
||||
#endif
|
||||
#ifdef ACADOS_WITH_OOQP
|
||||
FULL_CONDENSING_OOQP,
|
||||
#else
|
||||
FULL_CONDENSING_OOQP_NOT_AVAILABLE,
|
||||
#endif
|
||||
INVALID_QP_SOLVER,
|
||||
} ocp_qp_solver_t;
|
||||
|
||||
|
||||
/// Struct containing qp solver
|
||||
typedef struct
|
||||
{
|
||||
ocp_qp_solver_t qp_solver;
|
||||
} ocp_qp_solver_plan_t;
|
||||
|
||||
|
||||
/// Linear ocp configuration.
|
||||
typedef struct
|
||||
{
|
||||
ocp_qp_xcond_solver_config *config;
|
||||
ocp_qp_xcond_solver_dims *dims;
|
||||
void *opts;
|
||||
void *mem;
|
||||
void *work;
|
||||
} ocp_qp_solver;
|
||||
|
||||
|
||||
/// Initializes the qp solver configuration.
|
||||
/// TBC should this be private/static - no, used in ocp_nlp
|
||||
void ocp_qp_xcond_solver_config_initialize_from_plan(
|
||||
ocp_qp_solver_t solver_name, ocp_qp_xcond_solver_config *solver_config);
|
||||
|
||||
/// Constructs a qp solver config and Initializes with default values.
|
||||
///
|
||||
/// \param plan The qp solver plan struct.
|
||||
ocp_qp_xcond_solver_config *ocp_qp_xcond_solver_config_create(ocp_qp_solver_plan_t plan);
|
||||
|
||||
/// Destructor for config struct, frees memory.
|
||||
///
|
||||
/// \param config The config object to destroy.
|
||||
void ocp_qp_xcond_solver_config_free(ocp_qp_xcond_solver_config *config);
|
||||
|
||||
|
||||
/// Constructs a struct that contains the dimensions for the variables of the qp.
|
||||
///
|
||||
/// \param N The number of variables.
|
||||
ocp_qp_dims *ocp_qp_dims_create(int N);
|
||||
|
||||
/// Destructor of The dimension struct.
|
||||
///
|
||||
/// \param dims The dimension struct.
|
||||
void ocp_qp_dims_free(void *dims);
|
||||
|
||||
//
|
||||
ocp_qp_xcond_solver_dims *ocp_qp_xcond_solver_dims_create(ocp_qp_xcond_solver_config *config, int N);
|
||||
//
|
||||
ocp_qp_xcond_solver_dims *ocp_qp_xcond_solver_dims_create_from_ocp_qp_dims(
|
||||
ocp_qp_xcond_solver_config *config, ocp_qp_dims *dims);
|
||||
//
|
||||
void ocp_qp_xcond_solver_dims_free(ocp_qp_xcond_solver_dims *dims_);
|
||||
|
||||
void ocp_qp_xcond_solver_dims_set(void *config_, ocp_qp_xcond_solver_dims *dims,
|
||||
int stage, const char *field, int* value);
|
||||
|
||||
|
||||
/// Constructs an input object for the qp.
|
||||
///
|
||||
/// \param dims The dimension struct.
|
||||
ocp_qp_in *ocp_qp_in_create(ocp_qp_dims *dims);
|
||||
|
||||
|
||||
void ocp_qp_in_set(ocp_qp_xcond_solver_config *config, ocp_qp_in *in,
|
||||
int stage, char *field, void *value);
|
||||
|
||||
/// Destructor of the inputs struct.
|
||||
///
|
||||
/// \param in_ The inputs struct.
|
||||
void ocp_qp_in_free(void *in_);
|
||||
|
||||
|
||||
/// Constructs an outputs object for the qp.
|
||||
///
|
||||
/// \param dims The dimension struct.
|
||||
ocp_qp_out *ocp_qp_out_create(ocp_qp_dims *dims);
|
||||
|
||||
/// Destructor of the output struct.
|
||||
///
|
||||
/// \param out_ The output struct.
|
||||
void ocp_qp_out_free(void *out_);
|
||||
|
||||
|
||||
/// Getter of output struct
|
||||
void ocp_qp_out_get(ocp_qp_out *out, const char *field, void *value);
|
||||
|
||||
|
||||
/// Constructs an options object for the qp.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
void *ocp_qp_xcond_solver_opts_create(ocp_qp_xcond_solver_config *config,
|
||||
ocp_qp_xcond_solver_dims *dims);
|
||||
|
||||
/// Destructor of the options struct.
|
||||
///
|
||||
/// \param opts The options struct to destroy.
|
||||
void ocp_qp_xcond_solver_opts_free(ocp_qp_xcond_solver_opts *opts);
|
||||
|
||||
|
||||
/// Setter of the options struct.
|
||||
///
|
||||
/// \param opts The options struct.
|
||||
void ocp_qp_xcond_solver_opts_set(ocp_qp_xcond_solver_config *config,
|
||||
ocp_qp_xcond_solver_opts *opts, const char *field, void* value);
|
||||
|
||||
/// TBC Should be private/static?
|
||||
acados_size_t ocp_qp_calculate_size(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims, void *opts_);
|
||||
|
||||
|
||||
/// TBC Reserves memory? TBC Should this be private?
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param opts_ The options struct.
|
||||
/// \param raw_memory Pointer to raw memory to assign to qp solver.
|
||||
ocp_qp_solver *ocp_qp_assign(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims,
|
||||
void *opts_, void *raw_memory);
|
||||
|
||||
/// Creates a qp solver. Reserves memory.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param opts_ The options struct.
|
||||
ocp_qp_solver *ocp_qp_create(ocp_qp_xcond_solver_config *config,
|
||||
ocp_qp_xcond_solver_dims *dims, void *opts_);
|
||||
|
||||
|
||||
/// Destroys a qp solver. Frees memory.
|
||||
///
|
||||
/// \param solver The qp solver
|
||||
void ocp_qp_solver_destroy(ocp_qp_solver *solver);
|
||||
|
||||
void ocp_qp_x_cond_solver_free(ocp_qp_xcond_solver_config *config,
|
||||
ocp_qp_xcond_solver_dims *dims, void *opts_);
|
||||
|
||||
|
||||
/// Solves the qp.
|
||||
///
|
||||
/// \param solver The solver.
|
||||
/// \param qp_in The inputs struct.
|
||||
/// \param qp_out The output struct.
|
||||
int ocp_qp_solve(ocp_qp_solver *solver, ocp_qp_in *qp_in, ocp_qp_out *qp_out);
|
||||
|
||||
|
||||
/// Calculates the infinity norm of the residuals.
|
||||
///
|
||||
/// \param dims The dimension struct.
|
||||
/// \param qp_in The inputs struct.
|
||||
/// \param qp_out The output struct.
|
||||
/// \param res Output array for the residuals.
|
||||
void ocp_qp_inf_norm_residuals(ocp_qp_dims *dims, ocp_qp_in *qp_in, ocp_qp_out *qp_out,
|
||||
double *res);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif // INTERFACES_ACADOS_C_OCP_QP_INTERFACE_H_
|
||||
137
third_party/acados/include/acados_c/sim_interface.h
vendored
Normal file
137
third_party/acados/include/acados_c/sim_interface.h
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (c) The acados authors.
|
||||
*
|
||||
* 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.;
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_SIM_INTERFACE_H_
|
||||
#define INTERFACES_ACADOS_C_SIM_INTERFACE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "acados/sim/sim_common.h"
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ERK,
|
||||
IRK,
|
||||
GNSF,
|
||||
LIFTED_IRK,
|
||||
INVALID_SIM_SOLVER,
|
||||
} sim_solver_t;
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sim_solver_t sim_solver;
|
||||
} sim_solver_plan_t;
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sim_config *config;
|
||||
void *dims;
|
||||
void *opts;
|
||||
void *mem;
|
||||
void *work;
|
||||
} sim_solver;
|
||||
|
||||
|
||||
|
||||
/* config */
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT sim_config *sim_config_create(sim_solver_plan_t plan);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void sim_config_destroy(void *config);
|
||||
|
||||
/* dims */
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void *sim_dims_create(void *config_);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void sim_dims_destroy(void *dims);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void sim_dims_set(sim_config *config, void *dims, const char *field, const int* value);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void sim_dims_get(sim_config *config, void *dims, const char *field, int* value);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void sim_dims_get_from_attr(sim_config *config, void *dims, const char *field, int *dims_out);
|
||||
|
||||
/* in */
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT sim_in *sim_in_create(sim_config *config, void *dims);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void sim_in_destroy(void *out);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT int sim_in_set(void *config_, void *dims_, sim_in *in, const char *field, void *value);
|
||||
|
||||
|
||||
/* out */
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT sim_out *sim_out_create(sim_config *config, void *dims);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void sim_out_destroy(void *out);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT int sim_out_get(void *config, void *dims, sim_out *out, const char *field, void *value);
|
||||
|
||||
/* opts */
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void *sim_opts_create(sim_config *config, void *dims);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void sim_opts_destroy(void *opts);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void sim_opts_set(sim_config *config, void *opts, const char *field, void *value);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void sim_opts_get(sim_config *config, void *opts, const char *field, void *value);
|
||||
|
||||
/* solver */
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT acados_size_t sim_calculate_size(sim_config *config, void *dims, void *opts_);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT sim_solver *sim_assign(sim_config *config, void *dims, void *opts_, void *raw_memory);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT sim_solver *sim_solver_create(sim_config *config, void *dims, void *opts_);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT void sim_solver_destroy(void *solver);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT int sim_solve(sim_solver *solver, sim_in *in, sim_out *out);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT int sim_precompute(sim_solver *solver, sim_in *in, sim_out *out);
|
||||
//
|
||||
ACADOS_SYMBOL_EXPORT int sim_solver_set(sim_solver *solver, const char *field, void *value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif // INTERFACES_ACADOS_C_SIM_INTERFACE_H_
|
||||
Reference in New Issue
Block a user