trajectory_optimization v1.3.1
Loading...
Searching...
No Matches
trajectory_optimization Namespace Reference

Namespace for trajectory_optimization package. More...

Classes

struct  is_vector
 
struct  is_vector< std::vector< T, A > >
 
class  PerformanceLogger
 
struct  PerformanceMetrics
 
class  TrajectoryOptimizationAckermannNode
 
class  TrajectoryOptimizationNode
 
class  TrajectoryOptimizationRWSNode
 

Typedefs

typedef std::variant< karl_solver_capsule *, shuttle_solver_capsule * > ocp_model_capsule_t
 

Functions

ocp_model_capsule_t acados_create_capsule (const std::string &model_name)
 Creates the model-specific acados capsule selected by the configured model name.
 
int acados_create (ocp_model_capsule_t capsule)
 Wrapper around the generated acados create function for the selected model.
 
int acados_create_with_discretization (ocp_model_capsule_t capsule, int n_time_steps, double *new_time_steps)
 Wrapper around the generated acados create function with custom discretization.
 
int acados_free_capsule (ocp_model_capsule_t capsule)
 Wrapper around the generated acados capsule cleanup function.
 
int acados_free (ocp_model_capsule_t capsule)
 Wrapper around the generated acados solver cleanup function.
 
int acados_solve (ocp_model_capsule_t capsule)
 Wrapper around the generated acados solve function.
 
void acados_evaluate_dynamics (ocp_model_capsule_t capsule, int stage, double *x, double *u, double *x_dot)
 Evaluates the explicit model dynamics for a shooting stage.
 
int acados_reset (ocp_model_capsule_t capsule, int reset_qp_solver_mem, int reset_numerical_values, int reset_solver_options, int reset_x_to_x0_bar)
 Resets selected solver memory without freeing and recreating the capsule.
 
int acados_update_params_sparse (ocp_model_capsule_t capsule, int stage, int *idx, double *p, int n_update)
 Wrapper around the generated sparse parameter update function.
 
int acados_set_p_global_and_precompute_dependencies (ocp_model_capsule_t capsule, double *data, int data_len)
 Wrapper around the generated global-parameter update function.
 
void acados_print_stats (ocp_model_capsule_t capsule)
 Wrapper around the generated acados statistics printer.
 
ocp_nlp_in * acados_get_nlp_in (ocp_model_capsule_t capsule)
 Wrapper around the generated accessor for the OCP input structure.
 
ocp_nlp_out * acados_get_nlp_out (ocp_model_capsule_t capsule)
 Wrapper around the generated accessor for the OCP output structure.
 
ocp_nlp_solver * acados_get_nlp_solver (ocp_model_capsule_t capsule)
 Wrapper around the generated accessor for the OCP solver instance.
 
ocp_nlp_config * acados_get_nlp_config (ocp_model_capsule_t capsule)
 Wrapper around the generated accessor for the OCP configuration.
 
void * acados_get_nlp_opts (ocp_model_capsule_t capsule)
 Wrapper around the generated accessor for the OCP solver options.
 
ocp_nlp_dims * acados_get_nlp_dims (ocp_model_capsule_t capsule)
 Wrapper around the generated accessor for the OCP dimensions.
 

Variables

template<typename C >
constexpr bool is_vector_v = is_vector<C>::value
 

Detailed Description

Namespace for trajectory_optimization package.

Typedef Documentation

◆ ocp_model_capsule_t

typedef std::variant<karl_solver_capsule*, shuttle_solver_capsule*> trajectory_optimization::ocp_model_capsule_t

Definition at line 23 of file ocp_model_handler.hpp.

Function Documentation

◆ acados_create()

int trajectory_optimization::acados_create ( ocp_model_capsule_t capsule)
inline

Wrapper around the generated acados create function for the selected model.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
Returns
Status code returned by the generated acados function.

Definition at line 57 of file ocp_model_handler.hpp.

57{ ACADOS_DISPATCH(acados_create); }
#define ACADOS_DISPATCH(function_name,...)

◆ acados_create_capsule()

ocp_model_capsule_t trajectory_optimization::acados_create_capsule ( const std::string & model_name)
inline

Creates the model-specific acados capsule selected by the configured model name.

Parameters
[in]model_nameName of the generated acados model.
Returns
Variant containing the concrete acados capsule pointer.
Exceptions
std::invalid_argumentIf no generated model matches the given name.

Definition at line 32 of file ocp_model_handler.hpp.

32 {
33 if (model_name == "karl") {
34 return karl_acados_create_capsule();
35 } else if (model_name == "shuttle") {
36 return shuttle_acados_create_capsule();
37 } else {
38 throw std::invalid_argument("Invalid model name: " + model_name);
39 }
40}

◆ acados_create_with_discretization()

int trajectory_optimization::acados_create_with_discretization ( ocp_model_capsule_t capsule,
int n_time_steps,
double * new_time_steps )
inline

Wrapper around the generated acados create function with custom discretization.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
[in]n_time_stepsNumber of shooting intervals.
[in]new_time_stepsTime-step array passed through to acados.
Returns
Status code returned by the generated acados function.

Definition at line 67 of file ocp_model_handler.hpp.

67 {
68 ACADOS_DISPATCH(acados_create_with_discretization, n_time_steps, new_time_steps);
69}

◆ acados_evaluate_dynamics()

void trajectory_optimization::acados_evaluate_dynamics ( ocp_model_capsule_t capsule,
int stage,
double * x,
double * u,
double * x_dot )
inline

Evaluates the explicit model dynamics for a shooting stage.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
[in]stageShooting stage whose dynamics function is evaluated.
[in]xState vector at which to evaluate the dynamics.
[in]uControl vector at which to evaluate the dynamics.
[out]x_dotEvaluated state derivative.

Definition at line 104 of file ocp_model_handler.hpp.

104 {
105 std::array<ext_fun_arg_t, 2> input_types = {COLMAJ, COLMAJ};
106 std::array<void*, 2> inputs = {x, u};
107 std::array<ext_fun_arg_t, 1> output_types = {COLMAJ};
108 std::array<void*, 1> outputs = {x_dot};
109
110 external_function_external_param_casadi* function = nullptr;
111
112 if (std::holds_alternative<karl_solver_capsule*>(capsule)) {
113 function = &std::get<karl_solver_capsule*>(capsule)->expl_ode_fun[stage]; // NOLINT
114 } else if (std::holds_alternative<shuttle_solver_capsule*>(capsule)) {
115 function = &std::get<shuttle_solver_capsule*>(capsule)->expl_ode_fun[stage]; // NOLINT
116 } else {
117 throw std::invalid_argument("Invalid capsule type.");
118 }
119 function->evaluate(function, input_types.data(), inputs.data(), output_types.data(), outputs.data());
120}

◆ acados_free()

int trajectory_optimization::acados_free ( ocp_model_capsule_t capsule)
inline

Wrapper around the generated acados solver cleanup function.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
Returns
Status code returned by the generated acados function.

Definition at line 85 of file ocp_model_handler.hpp.

85{ ACADOS_DISPATCH(acados_free); }

◆ acados_free_capsule()

int trajectory_optimization::acados_free_capsule ( ocp_model_capsule_t capsule)
inline

Wrapper around the generated acados capsule cleanup function.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
Returns
Status code returned by the generated acados function.

Definition at line 77 of file ocp_model_handler.hpp.

77{ ACADOS_DISPATCH(acados_free_capsule); }

◆ acados_get_nlp_config()

ocp_nlp_config * trajectory_optimization::acados_get_nlp_config ( ocp_model_capsule_t capsule)
inline

Wrapper around the generated accessor for the OCP configuration.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
Returns
Pointer to the model-specific ocp_nlp_config.

Definition at line 196 of file ocp_model_handler.hpp.

196{ ACADOS_DISPATCH(acados_get_nlp_config); }

◆ acados_get_nlp_dims()

ocp_nlp_dims * trajectory_optimization::acados_get_nlp_dims ( ocp_model_capsule_t capsule)
inline

Wrapper around the generated accessor for the OCP dimensions.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
Returns
Pointer to the model-specific ocp_nlp_dims.

Definition at line 212 of file ocp_model_handler.hpp.

212{ ACADOS_DISPATCH(acados_get_nlp_dims); }

◆ acados_get_nlp_in()

ocp_nlp_in * trajectory_optimization::acados_get_nlp_in ( ocp_model_capsule_t capsule)
inline

Wrapper around the generated accessor for the OCP input structure.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
Returns
Pointer to the model-specific ocp_nlp_in.

Definition at line 172 of file ocp_model_handler.hpp.

172{ ACADOS_DISPATCH(acados_get_nlp_in); }

◆ acados_get_nlp_opts()

void * trajectory_optimization::acados_get_nlp_opts ( ocp_model_capsule_t capsule)
inline

Wrapper around the generated accessor for the OCP solver options.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
Returns
Pointer to the model-specific options object.

Definition at line 204 of file ocp_model_handler.hpp.

204{ ACADOS_DISPATCH(acados_get_nlp_opts); }

◆ acados_get_nlp_out()

ocp_nlp_out * trajectory_optimization::acados_get_nlp_out ( ocp_model_capsule_t capsule)
inline

Wrapper around the generated accessor for the OCP output structure.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
Returns
Pointer to the model-specific ocp_nlp_out.

Definition at line 180 of file ocp_model_handler.hpp.

180{ ACADOS_DISPATCH(acados_get_nlp_out); }

◆ acados_get_nlp_solver()

ocp_nlp_solver * trajectory_optimization::acados_get_nlp_solver ( ocp_model_capsule_t capsule)
inline

Wrapper around the generated accessor for the OCP solver instance.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
Returns
Pointer to the model-specific ocp_nlp_solver.

Definition at line 188 of file ocp_model_handler.hpp.

188{ ACADOS_DISPATCH(acados_get_nlp_solver); }

◆ acados_print_stats()

void trajectory_optimization::acados_print_stats ( ocp_model_capsule_t capsule)
inline

Wrapper around the generated acados statistics printer.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.

Definition at line 164 of file ocp_model_handler.hpp.

164{ ACADOS_DISPATCH(acados_print_stats); }

◆ acados_reset()

int trajectory_optimization::acados_reset ( ocp_model_capsule_t capsule,
int reset_qp_solver_mem,
int reset_numerical_values,
int reset_solver_options,
int reset_x_to_x0_bar )
inline

Resets selected solver memory without freeing and recreating the capsule.

Definition at line 125 of file ocp_model_handler.hpp.

129 {
130 ACADOS_DISPATCH(acados_reset, reset_qp_solver_mem, reset_numerical_values, reset_solver_options, reset_x_to_x0_bar);
131}

◆ acados_set_p_global_and_precompute_dependencies()

int trajectory_optimization::acados_set_p_global_and_precompute_dependencies ( ocp_model_capsule_t capsule,
double * data,
int data_len )
inline

Wrapper around the generated global-parameter update function.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
[in]dataGlobal parameter buffer.
[in]data_lenNumber of entries in data.
Returns
Status code returned by the generated acados function.

Definition at line 155 of file ocp_model_handler.hpp.

155 {
156 ACADOS_DISPATCH(acados_set_p_global_and_precompute_dependencies, data, data_len);
157}

◆ acados_solve()

int trajectory_optimization::acados_solve ( ocp_model_capsule_t capsule)
inline

Wrapper around the generated acados solve function.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
Returns
Status code returned by the generated acados function.

Definition at line 93 of file ocp_model_handler.hpp.

93{ ACADOS_DISPATCH(acados_solve); }

◆ acados_update_params_sparse()

int trajectory_optimization::acados_update_params_sparse ( ocp_model_capsule_t capsule,
int stage,
int * idx,
double * p,
int n_update )
inline

Wrapper around the generated sparse parameter update function.

Parameters
[in]capsuleVariant holding the model-specific acados capsule.
[in]stageShooting stage to update.
[in]idxIndices of the parameters to overwrite.
[in]pParameter values written to the selected indices.
[in]n_updateNumber of updated parameter entries.
Returns
Status code returned by the generated acados function.

Definition at line 143 of file ocp_model_handler.hpp.

143 {
144 ACADOS_DISPATCH(acados_update_params_sparse, stage, idx, p, n_update);
145}

Variable Documentation

◆ is_vector_v

template<typename C >
bool trajectory_optimization::is_vector_v = is_vector<C>::value
inlineconstexpr

Definition at line 43 of file trajectory_optimization_node.hpp.