Matlab mex : acados_ocp.m error

Dear all,

I have followed the instructions on : https://docs.acados.org/interfaces/index.html
for running the matlab mex interface, thereby I had the following issue.

I run acados/examples/matlab_mex/pendulum_on_cart_model/example_ocp.m

Most .mex were sucessfuly built and then acados_ocp.m faild with the following error code:

Invalid MEX-file '/export/home/armin/src/MATLAB/acados/examples/matlab_mex/pendulum_on_cart_model/build/ocp_create.mexa64':
/export/home/armin/src/MATLAB/acados/examples/matlab_mex/pendulum_on_cart_model/../../../lib/libacados.so: undefined symbol:
OptionsCPY.

Error in acados_ocp (line 70)
			obj.C_ocp = ocp_create(obj.model_struct, obj.opts_struct);

Error in example_ocp (line 248)
ocp = acados_ocp(ocp_model, ocp_opts);

Had the same error on other examples as well.

Edit:
I am using Ubuntu 16.04.6 LTS, gcc 6.5.0 and MATLAB R2018a.

Thanks for the help!

Cheers
Armin

Hey Armin,

Interesting. I could not reproduce the error, on my machine.
Do you use the recent master?
I found OptionsCPY is used by qpOASES.
I would suggest too clean the lib folder and compile acados again without qpOASES.

Cheers,
Jonathan

Hey Jonathan,

I did that and the this error dissapeard ( does this imply that I cannot use qpOASES in matlab mex?)

However, now I got a new error

Reference to non-existent field 'print_info'.

Error in generate_c_code_implicit_ode (line 35)
        if opts.print_info

Error in ocp_generate_casadi_ext_fun (line 52)
		generate_c_code_implicit_ode(model_struct, opts_struct);

Error in acados_ocp (line 74)
				ocp_generate_casadi_ext_fun(obj.model_struct, obj.opts_struct);

Error in example_ocp (line 248)
ocp = acados_ocp(ocp_model, ocp_opts);

Cheers,
Armin

Hey Armin,

actually, the interface also works with qpOASES. So, this was just a temporary fix.

Regarding your current error. It seems to occur in this file:


However, the print_info part only appears in the comments.
Thus, I think it is most likely that you have an older version of this file somewhere in your matlab path and Matlab is using this instead.
I suggest going through your Matlab path and removing other acados versions or even remove them from your system.
These are just Matlab files, so you can also set breakpoints to find which file is actually used.

Best,
Jonathan

1 Like

Hi Jonathan,

indeed that was the trick! Thanks for your help!

I had no other versions of acados but all folder and subfolders were added to the MATLAB path on my PC, so it was taking the functions from
.../acados/experimental

Removing this folder from the path did it for me, I was now able to run the examples and use the matlab mex interface.

Cheers,
Armin

1 Like