[DS1401 / dSPACE MABX2] Cannot deploy ACADOS s-function

Hi :wave:

I am having issues deploying a Simulink model that includes an ACADOS solver S-function on a dSPACE MABX2 (1401/1513).

As I was trying to build the code, following the Embedded Workflow documentation, I faced the exact same issues that user Umur details in his topic. I solved all of them following his steps. I also faced an additional error:

could not open source file "omp.h" #include <omp.h> 

in the “acados_solver_{…}.c” file. I re-installed ACADOS from scratch, explicitly disabling OpenMP. My CMake config string was the following:

CMakeConfigString = "-DBUILD_SHARED_LIBS=OFF -DACADOS_WITH_OSQP=OFF -DACADOS_WITH_OPENMP=OFF -DACADOS_NUM_THREADS=1"

Then I was able to successfully build the model. I then load the built .sdf file onto the MABX2 using ControlDesk. The application downloads successfully, but then I get the following error:

Board Index changed to %1.

I also tried to load a simplified model, with the solver from the “getting started” pendulum example, but I get the same error.

I have followed the documentation exactly both when installing ACADOS and for cross-compilation. I didn’t modify the toolchain file for DS1401 at all except for the paths in lines 5 through 17, which I am certain are correct.

Has anyone successfully deployed ACADOS to a MABX2 recently and encountered this kind of error? Any insights would be greatly appreciated.

I’ll also be reaching out to dSPACE support and will update this thread if I find a solution.

Thanks in advance!

— De

Hi De,

I think this is because of the bug fixed in acados PR #1497.
Are you on the latest version of acados?
The include should not be part of the generated code after the fix. Or more precisely, only if the option with_batch_functionality is set to true.

Best,
Jonathan

Hi,

Yes I am on the latest version of Acados. Throughout the debug process over the last few days I have deleted, re-cloned Acados from the Github repo, then re-installed it several times.

Thanks for the quick response!

— De

Hi,

please verify that the option with_batch_functionality is set to False, which is the default value.
Additionally, you might check if there is a second/old acados installation on your system.
Finally, please check that the correct template file is used.
E.g. just delete the include openmp part in interfaces/acados_template/acados_template/c_templates_tera/acados_solver.in.c.
I am quite certain that the fix is correct and that either old generated files or different acados files are used somehow.

Best,
Jonathan

Hi,

I ensured no other Acados installation was present and re-installed it, with the default flags. Indeed the include openmp line and error don’t show up anymore. I probably did still have an old Acados version when I encountered that error, sorry for the confusion.

However the original error when loading the built code onto the MABX2 still shows up. I contacted dSPACE support and they don’t have any info on the specific error.

Following their recommendation, I ensured my MABX2 model’s RAM and flash are large enough for the built code, and tried loading the code to both, to no avail. I have sent them some diagnostic files generated by the MABX in case they can extract any useful info from there. But it is probably an Acados issue. I should note that commenting out the Acados S-Function fixes the issue, and the code loads as normal.

How should I proceed? I could send any files you require to help fix the issue.

Many thanks,
De

Hi,

just to understand, you just get this error now?

Board Index changed to %1.

I hope the dSPACE support can you help to get further with this.

Best,
Jonathan

Hi,

Yes this is the error I’m getting now. If I have any further updates I will update you.

Best regards,
De