Hi All,
I am new to acados which I think is an excellent OCP solver. I use C interface and use lifted_irk for the dynamic of my OCP.
Following the examples, I used python to generate the C code external function first and then construct the OCP in C.
But the program may report error of
“type in XXX”
“Unknown external function argument type for argument 4”
“XXX” is often a random large value. And the program exit.
I check the number of the external dynamic function input is 6 (which means in_num == 6). But I found that the following code
“for (ii = 0; ii < fun->in_num - 1; ii++)”
in external_function_param_casadi_wrapper will loop ii = 0 to ii = 4. But, the input “type_in” array is passed from the function defined in acados/sim/sim_lifted_irk_integrator.c with only size 4:
" ext_fun_arg_t ext_fun_type_in[4];"
Then, it looks like that the code will try to access ext_fun_type_in[4] which may return a random value.
I try to change the code to
"
ext_fun_arg_t ext_fun_type_in[5];
void *ext_fun_in[4];
// TODO: fix this for z
ext_fun_type_in[3] = COLMAJ;
ext_fun_type_in[4] = COLMAJ;
"
Look like it works well now.
Is it really a bug? Or I make some mistakes in constructing the OCP? Is my way a correct way to fix this problem?
Thank you for your help.
Regards
Junjun