Visual C support in Matlab/Simulink

Hello,

I was already able to use acados on Matlab sucessfully in closed loop simulation with MinGw.
Next step is to run it on a speedgoad for a real application.
Therefore, the Problem is created in Simulink. It can be used to programm the speedgoad.

Unfortunatelly it only supports the Visual C/Visual C++ compiler and not MinGw.
I tried to build the minimal_example_ocp.m with Microsoft Visual C++ 2017 ©.

Therefore i used following commands:

  • git clone https://github.com/acados/acados.git
  • cd acados
  • git submodule update --recursive --init
  • mkdir build
  • cd build
  • cmake.exe -G “Visual Studio 15 2017 Win64” -D BLASFEO_TARGET=GENERIC -D HPIPM_TARGET=GENERIC -D ACADOS_INSTALL_DIR=… -DBUILD_SHARED_LIBS=OFF -DACADOS_EXAMPLES=OFF -DACADOS_UNIT_TESTS=OFF …
  • msbuild INSTALL.vcxproj

Then started Matlab

  • mex -setup: MEX configured to use 'Microsoft Visual C++ 2017 ©
  • mbuild -setup: MBUILD configured to use ‘Microsoft Visual C++ 2017 ©’
  • run \acados\examples\acados_matlab_octave\acados_env_variables_windows.m
  • run acados\examples\acados_matlab_octave\getting_started\minimal_example_ocp.m

The first files succeeded to build, but then it crashed. Can anyone help me please?

compiling C:\Users\Freddy\acados_VC\acados\examples\acados_matlab_octave…\interfaces\acados_matlab_octave\ocp_create.c
Building with ‘Microsoft Visual C++ 2017 ©’.
MEX completed successfully.
compiling C:\Users\Freddy\acados_VC\acados\examples\acados_matlab_octave…\interfaces\acados_matlab_octave\ocp_destroy.c
Building with ‘Microsoft Visual C++ 2017 ©’.
MEX completed successfully.
compiling C:\Users\Freddy\acados_VC\acados\examples\acados_matlab_octave…\interfaces\acados_matlab_octave\ocp_create_ext_fun.c
Building with ‘Microsoft Visual C++ 2017 ©’.
MEX completed successfully.
compiling C:\Users\Freddy\acados_VC\acados\examples\acados_matlab_octave…\interfaces\acados_matlab_octave\ocp_destroy_ext_fun.c
Building with ‘Microsoft Visual C++ 2017 ©’.
MEX completed successfully.
compiling C:\Users\Freddy\acados_VC\acados\examples\acados_matlab_octave…\interfaces\acados_matlab_octave\ocp_solve.c
Building with ‘Microsoft Visual C++ 2017 ©’.
MEX completed successfully.
compiling C:\Users\Freddy\acados_VC\acados\examples\acados_matlab_octave…\interfaces\acados_matlab_octave\ocp_precompute.c
Building with ‘Microsoft Visual C++ 2017 ©’.
MEX completed successfully.
compiling C:\Users\Freddy\acados_VC\acados\examples\acados_matlab_octave…\interfaces\acados_matlab_octave\ocp_set.c
Building with ‘Microsoft Visual C++ 2017 ©’.
MEX completed successfully.
compiling C:\Users\Freddy\acados_VC\acados\examples\acados_matlab_octave…\interfaces\acados_matlab_octave\ocp_get.c
Building with ‘Microsoft Visual C++ 2017 ©’.
MEX completed successfully.
compiling C:\Users\Freddy\acados_VC\acados\examples\acados_matlab_octave…\interfaces\acados_matlab_octave\ocp_eval_param_sens.c
Building with ‘Microsoft Visual C++ 2017 ©’.
MEX completed successfully.
acados MEX interface compiled successfully
Building with ‘Microsoft Visual C++ 2017 ©’.
Error using mbuild (line 166)
Unable to complete successfully.
Bibliothek “C:\Users\Freddy\acados_VC\acados\examples\acados_matlab_octave\getting_started\libpendulum.lib” und Objekt
“C:\Users\Freddy\acados_VC\acados\examples\acados_matlab_octave\getting_started\libpendulum.exp” werden erstellt.
LINK : fatal error LNK1561: Einstiegspunkt muss definiert werden.

Error in ocp_generate_casadi_ext_fun (line 170)
mbuild(c_files_path{:}, ‘-output’, lib_name, ‘CFLAGS="$CFLAGS"’, ‘LDTYPE="-shared"’, [‘LDEXT=’, ldext]);

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

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

Thank you a lot and best regards,
Freddy

Hi Freddy,

sorry, I do not really know what the issue is.
The problem seems to occur when compiling the CasADi generated model functions.
Also, the error being German makes it harder to google.
Did you make some progress with the issue meanwhile?

I guess you mean speedgoat though :grin:

Cheers,
Jonathan

Hi FreyJo,

thank you for the answer.
Yes I also think the problem is the CasADi module, as it was compiled using MinGW. Unfortunately I did not really make process until now. If I will find a solution I will write it here.

Cheers,
Freddy