-
Notifications
You must be signed in to change notification settings - Fork 0
/
acados_solver_front.h
183 lines (143 loc) · 6.63 KB
/
acados_solver_front.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
* 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 ACADOS_SOLVER_front_H_
#define ACADOS_SOLVER_front_H_
#include "acados/utils/types.h"
#include "acados_c/ocp_nlp_interface.h"
#include "acados_c/external_function_interface.h"
#define FRONT_NX 25
#define FRONT_NZ 0
#define FRONT_NU 18
#define FRONT_NP 51
#define FRONT_NBX 0
#define FRONT_NBX0 25
#define FRONT_NBU 0
#define FRONT_NSBX 0
#define FRONT_NSBU 0
#define FRONT_NSH 6
#define FRONT_NSH0 0
#define FRONT_NSG 0
#define FRONT_NSPHI 0
#define FRONT_NSHN 0
#define FRONT_NSGN 0
#define FRONT_NSPHIN 0
#define FRONT_NSPHI0 0
#define FRONT_NSBXN 0
#define FRONT_NS 6
#define FRONT_NS0 0
#define FRONT_NSN 0
#define FRONT_NG 0
#define FRONT_NBXN 0
#define FRONT_NGN 0
#define FRONT_NY0 74
#define FRONT_NY 74
#define FRONT_NYN 30
#define FRONT_N 30
#define FRONT_NH 6
#define FRONT_NHN 0
#define FRONT_NH0 0
#define FRONT_NPHI0 0
#define FRONT_NPHI 0
#define FRONT_NPHIN 0
#define FRONT_NR 0
#ifdef __cplusplus
extern "C" {
#endif
// ** capsule for solver data **
typedef struct front_solver_capsule
{
// acados objects
ocp_nlp_in *nlp_in;
ocp_nlp_out *nlp_out;
ocp_nlp_out *sens_out;
ocp_nlp_solver *nlp_solver;
void *nlp_opts;
ocp_nlp_plan_t *nlp_solver_plan;
ocp_nlp_config *nlp_config;
ocp_nlp_dims *nlp_dims;
// number of expected runtime parameters
unsigned int nlp_np;
/* external functions */
// dynamics
external_function_external_param_casadi *discr_dyn_phi_fun;
external_function_external_param_casadi *discr_dyn_phi_fun_jac_ut_xt;
// cost
external_function_external_param_casadi *cost_y_fun;
external_function_external_param_casadi *cost_y_fun_jac_ut_xt;
external_function_external_param_casadi *cost_y_hess;
external_function_external_param_casadi cost_y_0_fun;
external_function_external_param_casadi cost_y_0_fun_jac_ut_xt;
external_function_external_param_casadi cost_y_0_hess;
external_function_external_param_casadi cost_y_e_fun;
external_function_external_param_casadi cost_y_e_fun_jac_ut_xt;
external_function_external_param_casadi cost_y_e_hess;
// constraints
external_function_external_param_casadi *nl_constr_h_fun_jac;
external_function_external_param_casadi *nl_constr_h_fun;
} front_solver_capsule;
ACADOS_SYMBOL_EXPORT front_solver_capsule * front_acados_create_capsule(void);
ACADOS_SYMBOL_EXPORT int front_acados_free_capsule(front_solver_capsule *capsule);
ACADOS_SYMBOL_EXPORT int front_acados_create(front_solver_capsule * capsule);
ACADOS_SYMBOL_EXPORT int front_acados_reset(front_solver_capsule* capsule, int reset_qp_solver_mem);
/**
* Generic version of front_acados_create which allows to use a different number of shooting intervals than
* the number used for code generation. If new_time_steps=NULL and n_time_steps matches the number used for code
* generation, the time-steps from code generation is used.
*/
ACADOS_SYMBOL_EXPORT int front_acados_create_with_discretization(front_solver_capsule * capsule, int n_time_steps, double* new_time_steps);
/**
* Update the time step vector. Number N must be identical to the currently set number of shooting nodes in the
* nlp_solver_plan. Returns 0 if no error occurred and a otherwise a value other than 0.
*/
ACADOS_SYMBOL_EXPORT int front_acados_update_time_steps(front_solver_capsule * capsule, int N, double* new_time_steps);
/**
* This function is used for updating an already initialized solver with a different number of qp_cond_N.
*/
ACADOS_SYMBOL_EXPORT int front_acados_update_qp_solver_cond_N(front_solver_capsule * capsule, int qp_solver_cond_N);
ACADOS_SYMBOL_EXPORT int front_acados_update_params(front_solver_capsule * capsule, int stage, double *value, int np);
ACADOS_SYMBOL_EXPORT int front_acados_update_params_sparse(front_solver_capsule * capsule, int stage, int *idx, double *p, int n_update);
ACADOS_SYMBOL_EXPORT int front_acados_set_p_global_and_precompute_dependencies(front_solver_capsule* capsule, double* data, int data_len);
ACADOS_SYMBOL_EXPORT int front_acados_solve(front_solver_capsule * capsule);
ACADOS_SYMBOL_EXPORT void front_acados_batch_solve(front_solver_capsule ** capsules, int N_batch);
ACADOS_SYMBOL_EXPORT int front_acados_free(front_solver_capsule * capsule);
ACADOS_SYMBOL_EXPORT void front_acados_print_stats(front_solver_capsule * capsule);
ACADOS_SYMBOL_EXPORT int front_acados_custom_update(front_solver_capsule* capsule, double* data, int data_len);
ACADOS_SYMBOL_EXPORT ocp_nlp_in *front_acados_get_nlp_in(front_solver_capsule * capsule);
ACADOS_SYMBOL_EXPORT ocp_nlp_out *front_acados_get_nlp_out(front_solver_capsule * capsule);
ACADOS_SYMBOL_EXPORT ocp_nlp_out *front_acados_get_sens_out(front_solver_capsule * capsule);
ACADOS_SYMBOL_EXPORT ocp_nlp_solver *front_acados_get_nlp_solver(front_solver_capsule * capsule);
ACADOS_SYMBOL_EXPORT ocp_nlp_config *front_acados_get_nlp_config(front_solver_capsule * capsule);
ACADOS_SYMBOL_EXPORT void *front_acados_get_nlp_opts(front_solver_capsule * capsule);
ACADOS_SYMBOL_EXPORT ocp_nlp_dims *front_acados_get_nlp_dims(front_solver_capsule * capsule);
ACADOS_SYMBOL_EXPORT ocp_nlp_plan_t *front_acados_get_nlp_plan(front_solver_capsule * capsule);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif // ACADOS_SOLVER_front_H_