Hi everyone,
first of all: ACADOS is an awesome tool, I have already been using its predecessor ACADO extensively, it is amazing to see how things have progressed.
Now my specific problem: I am using the ACADOS MATLAB interface to generate c-code, including the s-function c-code. Next I compile the s-function and run it as part of a pretty large simulink model (let’s call it “control.slx”) which implements all the algorithms required to control an even larger plant model (let’s call it “plant.slx”). Obviously, I connect “plant.slx” and “control.slx” to simulate the closed loop, which works fine.
Ideally, I could now generate self-contained c-code from the model “control.slx” that I can deploy to embedded platforms. In fact, I did that in the past already, but only with s-functions that I generated using the legacy code tool shipped with MATLAB. As the legacy code tool allows generation of the *.tlc file along with the s-function’s c-code, these s-functions could be inlined and the autogenrated s-function c-code did not appear anywhere in the code to be deployed (neither did “simtruc.h” and other Simulink related code). The ACADOS-generated s-functino however comes without that *.tlc file …
Interestingly, I remember ACADO made use of the legacy code tool, so deployment was pretty much straight forward. In ACADOS, this seems no longer the case. After all, I am missing the *.tlc file that mirrors the s-function c-code. I know it is a pain to write *.tlc files, even Mathworks employees avoid it
. I am now assessing my options to achieve code-generation with the ACADOS s-function inlined.
Options and Questions:
- Use legacy code tool to generate an s-function myself, including the *.tlc file that belongs to it. Are there specific reasons you do not use the legacy code tool but manually implement the s-function for code generation?
- Write the *.tlc file myself for the specific s-function I would like to embed.
- Write a code generator that writes the *.tlc file equivalent of the automatically generated s-function c-code, depending on the “simulink_opts”.
Any opinions and suggestions that might help?
Best,
Philipp