Skip to content
Permalink
Browse files

checks: return ACADOS_FAILURE -> exit(1)

  • Loading branch information...
FreyJo committed Aug 21, 2019
1 parent def3ff7 commit 7ff4da5ed3097aa07e02a1b5dda05b16467f76e2
@@ -517,7 +517,7 @@ int_t dense_qp_ooqp(void *config_, dense_qp_in *qp_in, dense_qp_out *qp_out, voi
if (ns > 0)
{
printf("\nOOQP interface can not handle ns>0 yet: what about implementing it? :)\n");
return ACADOS_FAILURE;
exit(1);
}

acados_timer tot_timer, qp_timer, interface_timer;
@@ -484,7 +484,11 @@ int ocp_nlp_constraints_bgh_model_set(void *config_, void *dims_,
int ii;
int *ptr_i;

if (!dims || !model || !field || !value) return ACADOS_FAILURE;
if (!dims || !model || !field || !value)
{
printf("ocp_nlp_constraints_bgh_model_set: got Null pointer \n");
exit(1);
}

int nu = dims->nu;
int nx = dims->nx;
@@ -442,7 +442,11 @@ int ocp_nlp_constraints_bghp_model_set(void *config_, void *dims_,
int ii;
int *ptr_i;

if (!dims || !model || !field || !value) return ACADOS_FAILURE;
if (!dims || !model || !field || !value)
{
printf("ocp_nlp_constraints_bghp_model_set: got Null pointer \n");
exit(1);
}

int nu = dims->nu;
int nx = dims->nx;
@@ -199,7 +199,10 @@ int ocp_nlp_cost_external_model_set(void *config_, void *dims_, void *model_,
int status = ACADOS_SUCCESS;

if ( !config_ || !dims_ || !model_ || !value_ )
status = ACADOS_FAILURE;
{
printf("ocp_nlp_cost_external_model_set: got Null pointer \n");
exit(1);
}

ocp_nlp_cost_external_dims *dims = dims_;
ocp_nlp_cost_external_model *model = model_;
@@ -251,7 +254,6 @@ int ocp_nlp_cost_external_model_set(void *config_, void *dims_, void *model_,
{
printf("\nerror: model entry: %s not available in module ocp_nlp_cost_external\n", field);
exit(1);
// status = ACADOS_FAILURE;
}
return status;
}
@@ -304,7 +304,10 @@ int ocp_nlp_cost_ls_model_set(void *config_, void *dims_, void *model_,
int status = ACADOS_SUCCESS;

if ( !config_ || !dims_ || !model_ || !value_ )
status = ACADOS_FAILURE;
{
printf("ocp_nlp_cost_ls_model_set: got NULL pointer \n");
exit(1);
}

ocp_nlp_cost_ls_dims *dims = dims_;
ocp_nlp_cost_ls_model *model = model_;
@@ -257,7 +257,10 @@ int ocp_nlp_cost_nls_model_set(void *config_, void *dims_, void *model_,
int status = ACADOS_SUCCESS;

if ( !config_ || !dims_ || !model_ || !value_ )
status = ACADOS_FAILURE;
{
printf("ocp_nlp_cost_nls_model_set: got NULL pointer \n");
exit(1);
}

ocp_nlp_cost_nls_dims *dims = dims_;
ocp_nlp_cost_nls_model *model = model_;
@@ -326,7 +329,6 @@ int ocp_nlp_cost_nls_model_set(void *config_, void *dims_, void *model_,
{
printf("\nerror: field %s not available in ocp_nlp_cost_nls_model_set\n", field);
exit(1);
// status = ACADOS_FAILURE;
}
return status;
}
@@ -351,7 +351,7 @@ int ocp_qp_hpmpc(void *config_, ocp_qp_in *qp_in, ocp_qp_out *qp_out, void *opts
if (ns[ii] > 0)
{
printf("\nHPMPC interface can not handle ns>0 yet: what about implementing it? :)\n");
return ACADOS_FAILURE;
exit(1);
}
}

@@ -1065,7 +1065,7 @@ int ocp_qp_ooqp(void *config_, ocp_qp_in *qp_in, ocp_qp_out *qp_out, void *opts_
if (ns[ii] > 0)
{
printf("\nOOQP interface can not handle ns>0 yet: what about implementing it? :)\n");
return ACADOS_FAILURE;
exit(1);
}
}

@@ -1247,7 +1247,7 @@ int ocp_qp_osqp(void *config_, void *qp_in_, void *qp_out_, void *opts_, void *m
if (ns[ii] > 0)
{
printf("\nOSQP interface can not handle ns>0 yet: what about implementing it? :)\n");
return ACADOS_FAILURE;
exit(1);
}
}

@@ -401,7 +401,8 @@ int ocp_qp_partial_condensing_solver(void *config_, ocp_qp_in *qp_in, ocp_qp_out
}
else
{
solver_status = ACADOS_FAILURE;
printf("\nocp_qp_partial_condensing_solver: memory is NULL\n");
exit(1);
}

// expand
@@ -784,7 +784,7 @@ int ocp_qp_qpdunes(void *config_, ocp_qp_in *in, ocp_qp_out *out, void *opts_, v
if (ns[ii] > 0)
{
printf("\nqpDUNES interface can not handle ns>0 yet: what about implementing it? :)\n");
return ACADOS_FAILURE;
exit(1);
}
}

@@ -375,7 +375,8 @@ int sim_out_get_(void *config_, void *dims_, sim_out *out, const char *field, vo
}
else
{
status = ACADOS_FAILURE;
printf("sim_out_get_: field %s not supported \n", field);
exit(1);
}

return status;
@@ -438,7 +439,6 @@ int sim_opts_set_(sim_opts *opts, const char *field, void *value)
else
{
printf("\nerror: field %s not available in sim_opts_set\n", field);
status = ACADOS_FAILURE; // TODO remove
exit(1);
}
return status; // TODO remove
@@ -181,7 +181,6 @@ int sim_erk_model_set(void *model_, const char *field, void *value)
{
printf("\nerror: sim_erk_model_set: wrong field: %s\n", field);
exit(1);
// return ACADOS_FAILURE;
}

return ACADOS_SUCCESS;
@@ -447,10 +446,8 @@ void *sim_erk_memory_assign(void *config, void *dims, void *opts_, void *raw_mem

int sim_erk_memory_set(void *config_, void *dims_, void *mem_, const char *field, void *value)
{
// sim_config *config = config_;
int status = ACADOS_FAILURE;

return status;
printf("sim_erk_memory_set field %s is not supported! \n", field);
exit(1);
}

int sim_erk_memory_set_to_zero(void *config_, void * dims_, void *opts_, void *mem_, const char *field)
@@ -463,7 +460,8 @@ int sim_erk_memory_set_to_zero(void *config_, void * dims_, void *opts_, void *m
}
else
{
status = ACADOS_FAILURE;
printf("sim_erk_memory_set_to_zero field %s is not supported! \n", field);
exit(1);
}

return status;
@@ -597,8 +595,8 @@ int sim_erk(void *config_, sim_in *in, sim_out *out, void *opts_, void *mem_, vo

if ( opts->ns != opts->tableau_size )
{
printf("Error in sim_erk: the Butcher tableau size does not match ns");
return ACADOS_FAILURE;
printf("Error in sim_erk: the Butcher tableau size does not match ns\n");
exit(1);
}
int ns = opts->ns;

@@ -617,18 +615,18 @@ int sim_erk(void *config_, sim_in *in, sim_out *out, void *opts_, void *mem_, vo
// assert - only use supported features
if (nz != 0)
{
printf("nz should be zero - DAEs are not supported by the ERK integrator");
return ACADOS_FAILURE;
printf("sim_erk: nz should be zero - DAEs are not supported by the ERK integrator\n");
exit(1);
}
if (opts->output_z)
{
printf("opts->output_z should be false - DAEs are not supported for the ERK integrator");
return ACADOS_FAILURE;
printf("sim_erk: opts->output_z should be false - DAEs are not supported for the ERK integrator\n");
exit(1);
}
if (opts->sens_algebraic)
{
printf("opts->sens_algebraic should be false - DAEs are not supported for the ERK integrator");
return ACADOS_FAILURE;
printf("sim_erk: opts->sens_algebraic should be false - DAEs are not supported for the ERK integrator\n");
exit(1);
}

int nf = opts->num_forw_sens;
@@ -608,8 +608,7 @@ int sim_gnsf_precompute(void *config_, sim_in *in, sim_out *out, void *opts_, vo
if (model->get_gnsf_matrices == NULL && model->auto_import_gnsf)
{
printf("sim_gnsf error: get_gnsf_matrices function seems to be unset!\n");
status = ACADOS_FAILURE;
return status;
exit(1);
}

if (model->auto_import_gnsf)
@@ -651,8 +650,7 @@ int sim_gnsf_precompute(void *config_, sim_in *in, sim_out *out, void *opts_, vo
if (dt == 0.0)
{
printf("sim_gnsf error: simulation time = 0; seems to be unset!\n");
status = ACADOS_FAILURE;
return status;
exit(1);
}
mem->dt = dt;

@@ -1408,7 +1406,8 @@ int sim_gnsf_memory_set(void *config_, void *dims_, void *mem_, const char *fiel
}
else
{
status = ACADOS_FAILURE;
printf("sim_gnsf_memory_set field %s is not supported! \n", field);
exit(1);
}

return status;
@@ -1429,7 +1428,8 @@ int sim_gnsf_memory_set_to_zero(void *config_, void * dims_, void *opts_, void *
}
else
{
status = ACADOS_FAILURE;
printf("sim_gnsf_memory_set_to_zero field %s is not supported! \n", field);
exit(1);
}

return status;
@@ -1750,7 +1750,7 @@ int sim_gnsf(void *config, sim_in *in, sim_out *out, void *args, void *mem_, voi
if ( opts->ns != opts->tableau_size )
{
printf("Error in sim_gnsf: the Butcher tableau size does not match ns");
return ACADOS_FAILURE;
exit(1);
}

// necessary integers
@@ -1781,7 +1781,7 @@ int sim_gnsf(void *config, sim_in *in, sim_out *out, void *args, void *mem_, voi
if (mem->dt != in->T / opts->num_steps)
{
printf("ERROR sim_gnsf: mem->dt n!= in->T/opts->num_steps, check initialization\n");
return ACADOS_FAILURE;
exit(1);
}

// assign variables from workspace
@@ -1946,7 +1946,7 @@ int sim_gnsf(void *config, sim_in *in, sim_out *out, void *args, void *mem_, voi
if (opts->output_z || opts->sens_algebraic)
{
printf("ERROR sim_gnsf: output_z and sens_algebraic not supported with fully linear structure exploitation\n");
return ACADOS_FAILURE;
exit(1);
}
}
else
@@ -197,7 +197,6 @@ int sim_irk_model_set(void *model_, const char *field, void *value)
{
printf("\nerror: sim_irk_model_set: wrong field: %s\n", field);
exit(1);
// return ACADOS_FAILURE;
}

return ACADOS_SUCCESS;
@@ -407,7 +406,8 @@ int sim_irk_memory_set(void *config_, void *dims_, void *mem_, const char *field
}
else
{
status = ACADOS_FAILURE;
printf("sim_irk_memory_set: field %s is not supported! \n", field);
exit(1);
}

return status;
@@ -433,7 +433,8 @@ int sim_irk_memory_set_to_zero(void *config_, void * dims_, void *opts_, void *m
}
else
{
status = ACADOS_FAILURE;
printf("sim_irk_memory_set: field %s is not supported! \n", field);
exit(1);
}

return status;
@@ -674,7 +675,7 @@ int sim_irk(void *config_, sim_in *in, sim_out *out, void *opts_, void *mem_, vo
if ( opts->ns != opts->tableau_size )
{
printf("Error in sim_irk: the Butcher tableau size does not match ns");
return ACADOS_FAILURE;
exit(1);
}
int ns = opts->ns;

@@ -177,7 +177,6 @@ int sim_lifted_irk_model_set(void *model_, const char *field, void *value)
{
printf("\nerror: sim_lifted_irk_model_set: wrong field: %s\n", field);
exit(1);
// return ACADOS_FAILURE;
}

return ACADOS_SUCCESS;
@@ -422,9 +421,8 @@ int sim_lifted_irk_memory_set(void *config_, void *dims_, void *mem_, const char
// sim_config *config = config_;
// sim_lifted_irk_memory *mem = (sim_lifted_irk_memory *) mem_;

int status = ACADOS_FAILURE;

return status;
printf("sim_lifted_irk_memory_set field %s is not supported! \n", field);
exit(1);
}


@@ -447,7 +445,8 @@ int sim_lifted_irk_memory_set_to_zero(void *config_, void * dims_, void *opts_,
}
else
{
status = ACADOS_FAILURE;
printf("sim_lifted_irk_memory_set_to_zero field %s is not supported! \n", field);
exit(1);
}

return status;
@@ -590,23 +589,23 @@ int sim_lifted_irk(void *config_, sim_in *in, sim_out *out, void *opts_, void *m
if ( opts->ns != opts->tableau_size )
{
printf("Error in sim_lifted_irk: the Butcher tableau size does not match ns");
return ACADOS_FAILURE;
exit(1);
}
// assert - only use supported features
if (nz != 0)
{
printf("nz should be zero - DAEs are not supported by the lifted IRK integrator");
return ACADOS_FAILURE;
exit(1);
}
if (opts->output_z)
{
printf("opts->output_z should be false - DAEs are not supported for the lifted IRK integrator");
return ACADOS_FAILURE;
exit(1);
}
if (opts->sens_algebraic)
{
printf("opts->sens_algebraic should be false - DAEs are not supported for the lifted IRK integrator");
return ACADOS_FAILURE;
exit(1);
}

int ii, jj, ss;
@@ -188,7 +188,7 @@ int main()
if (acados_return != 0)
{
printf("error in sim solver\n");
return ACADOS_FAILURE;
exit(1);
}

cpu_time += out->info->CPUtime;
@@ -215,7 +215,7 @@ int main() {
if (acados_return != 0)
{
printf("error in sim solver\n");
return ACADOS_FAILURE;
exit(1);
}
casadi_times[i] = out->info->ADtime;
gnsf_times[i] = out->info->CPUtime;

0 comments on commit 7ff4da5

Please sign in to comment.
You can’t perform that action at this time.