Minimal_example_ocp.m fails to run on fresh (re)install

Hi,

I’m a new user of acados running Ubuntu 18.04 and MATLAB 2020b and Casadi 3.5.5. I installed acados a while ago and it worked great!

Then, I rebooted my computer, and acados stopped working. I removed the build folder and recompiled acados via cmake, opened a new terminal, navigated to the getting_started examples folder, and and sourced the env.sh.

I then add the acados MATLAB folder and its subfolders to the MATLAB path. When I run minimal_example_ocp.m, it builds fine I get the following error:

...
...
compiling /home/felix/Documents/acados/examples/acados_matlab_octave/getting_started/../../../interfaces/acados_matlab_octave/ocp_get.c
Building with 'gcc'.
MEX completed successfully.
compiling /home/felix/Documents/acados/examples/acados_matlab_octave/getting_started/../../../interfaces/acados_matlab_octave/ocp_eval_param_sens.c
Building with 'gcc'.
MEX completed successfully.
acados MEX interface compiled successfully
Error using generate_c_code_explicit_ode
Too many input arguments.

Error in ocp_generate_casadi_ext_fun (line 47)
        generate_c_code_explicit_ode(model_struct, opts_struct);

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

Error in minimal_example_ocp (line 107)
ocp = acados_ocp(ocp_model, ocp_opts);

I’m on v 0.1.7 of acados, if that helps.

One possible clue is that on startup, the MATLAB terminal prints the following warning:

Warning: Name is nonexistent or not a directory: /home/felix/Documents/acados/examples/acados_matlab_octave/getting_started/../../../external/casadi-matlab 

However, I couldn’t find any external/casadi-matlab anywhere on my system.

Any help would be appreciated. Thanks in advance!

Hi @fhk24891,
what happens if you debug it line by line? Is he using the correct generate_c_code_explicit_ode file or do you have several acados installs on your path?

Maybe clean your MATLAB path to make sure you only have the proper directories added.

If you install CasADi separately, you don’t need it in the acados/external/ location.

Regards

1 Like

Hi @mss,

Thanks for the tips - I’m not at that machine at the moment, but will try as soon as possible and update, hopefully tomorrow or the day after. Really appreciate it.

I didn’t realize there were multiple generate_c_code_explicit_odes, I’ll have to look. It is possible I have multiple acados installs, I previously got an error saying that I needed to recompile acados (or perhaps it was casadi).

@mss Just tried running minimal_example_ocp.m again, and it ran with no errors. I don’t believe I’ve changed anything (I didn’t even close matlab since I last tried it), but who knows. In any case, it’s working fine now. Simulink (simulink_example_advanced.m) also works fine. I’m closing this topic.

In case it’s helpful for anyone else, this is what the relevant parts of my MATLABPATH look like:


	/home/felix/Documents/MATLAB/casadi-matlabR2014b
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/casadi
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/casadi/jit
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/casadi/jit/clang
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/casadi/jit/clang/3.4.2
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/casadi/jit/clang/3.4.2/include
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/cmake
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/matlab
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/matlab/slprj
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/matlab/slprj/_jitprj
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/matlab/slprj/_sfprj
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/matlab/slprj/_sfprj/EMLReport
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/matlab/slprj/_sfprj/EMLReport/sc4w5LkXdqXQgvoj1TqvpYG
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/matlab/slprj/_sfprj/mpc_demo
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/matlab/slprj/_sfprj/mpc_demo/_self
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/matlab/slprj/_sfprj/mpc_demo/_self/sfun
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/matlab/slprj/_sfprj/mpc_demo/_self/sfun/info
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/matlab/slprj/_sfprj/precompile
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/examples/python
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/include
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/include/casadi
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/include/casadi/core
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/include/casadi/core/runtime
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/include/osqp
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/include/qdldl
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/lib
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/lib/cmake
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/lib/cmake/osqp
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/lib/cmake/qdldl
	/home/felix/Documents/MATLAB/casadi-matlabR2014b/pkgconfig
...
	/home/felix/Documents/acados/interfaces/acados_matlab_octave
	/home/felix/Documents/acados/interfaces/acados_matlab_octave/acados_template_mex
...