Problem with code generation

Hi, I’m trying to generate an NMPC code for a mobile manipulator in Matlab (in Ubuntu), but for now I had no success. During the compilation, I receive “Segmentation violation” and Matlab crashes.

In order to find out the issue, I tried to generate only the integrator.
The model name is “mobileManipulator3Link_model”

The result was to receive the following message:

Error using mex
/usr/bin/ld: cannot find -lmobileManipulator3Link_model
collect2: error: ld returned 1 exit status


Error in sim_set_ext_fun (line 205)
            mex( mex_flags, FLAGS, ['-DSET_FIELD=', set_fields{ii}],...

Error in acados_sim (line 109)
            obj.C_sim_ext_fun = sim_set_ext_fun(obj.C_sim, obj.C_sim_ext_fun, obj.model_struct, obj.opts_struct);

Error in MM_inter_trial (line 1036)
sim = acados_sim(sim_model, sim_opts);

Furthermore, the library libmobileManipulator3Link_model.so never appears in the build folder as well as the .mexa64 files.

It seems like the pc runs out of memory. However, in htop I cannot see any saturation of the memory (the PC has a 32Gb RAM).

Do you have any suggestions? Is the problem actually the amount of memory? Is there a limitation on the maximum robot degrees of Freedom that acados can handle (my mobile manipulator has 6-DoF).

Thank you

Hi @spyros

It seems that the actual issue is happening earlier, in the CasADi code generation, or more likely in the compilation of those functions.
Could you try to debug this file a bit and check where it is failing?

Cheers,
Jonathan

Hello @FreyJo,

Thank you for your response.

I debugged the file as you suggested. The problem is located at

system(['gcc -O2 -fPIC -shared ', strjoin(unique(c_files_path), ' '), ' -o ', out_lib]);

where I received the following message:

gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.

Regards,
Spyros

Do the minimal examples work for you?

The error seems to be typically related to running out of memory.
Is your model really large?
Maybe you can just print the command from the system call and run it outside of Matlab to see if it is a Matlab problem.
Maybe you can also remove the -O2 flag, which might make the compiler require less memory.

But I am just guessing now.
Good luck!