I have been working to deploy my MPC controller onto dSpace MicroAutoBox3. All went well until I finally tried to ‘Go Online’ with my model on ControlDesk.
ControlDesk crashes with error saying it failed to load the .rta file.
I am starting to wonder if deploying ACADOS s-Funtion on dSpace MircoAutoBox3 (DS1403) is possible at the first place, eventhough the documentation mentions on succeeding to do so.
So, I am calling out for any piece of wisdom out there in the community from anybody who had any success in running ACADOS s-Function on dSpace MircoAutoBox3 (DS1403)
I am open to all related discussions on this topic.
I am thrilled that you have reached out to me! Thank you!
Yes, the build process in ConfigurationDesk has been successful all along. But the issue happens when I try to “Go Online” in ControlDesk. It always seem to fail while it tries to load the .rta file. Am I missing something?
Same as you I made the modifications you mentioned. Below is my toolchain.cmake file for reference. It will be helpful if you can provide your toolchain.cmake file too. It needs to be noted that i had to change the commad to
What dSpace products are needed? Is ConfiguationDesk and ControlDesk enough? or do I need to install Real-Time Interface (RTI) as well? (I thought this product only exists for MABX2 compatibility but reading through the toolchain.cmake file made me suspicious that I might need this too) or even some other products as well?
Did you copy the files in dSPACE RCPHIL 2023A into a new folder without blankspace in the name (in my case, dSPACE_RCPHIL_2023-A) as well?
I am not sure if you problem is related toacados. Maybe try to build a model without the ACADOS s-function and try to go online in ControlDesk. ControlDesk is just a monitoring software, going online does only mean that the MABIII sends data to you PC.
To answer you questions:
ConfigurationDesk and ControlDeks are enough. You don’t need any additional software
It seems the only difference in the .cmake file isthe following line:
SET(CMAKE_SYSTEM_PROCESSOR "ppc")
on what grounds did you decide to set complier like this?
I know on the manual it says,
“It is possible to locate the correct compiler path from the Simulink dSPACE build output”
and I thought this meant the build output I get on ConfigurationDesk when I build in ConfigurationDesk, where I get,
Target compiler is "ARMV7-GNU" at "C:\Program Files\dSPACE RCPHIL 2023-A\Compiler\Linux_4.14_GCC_10.3\target\arm-linux-gnueabihf"
I suspect since we are both using MABX3, cmake system processor and the compiler should be same?
Am Iooking at a wrong place?
This is quite weird… I have been using dSpace MABX3 without any issues before I started using Acados in my model. Plus, about the point you made on that ControlDesk is only for monitoring, doesn’t it also serves a role of loading programs on to the MABX3?
After an extensive trial and error over the weekend, for some reason, unlike the “Embedded Workflow” instructions, I found out that, the “Include directories”, “Source files” and “Libraries” settings which is stated that it should be configured in Simulink model configuration parameters, under Code Generation / Custom Code, should actually be removed and the same setting must be configured in ConfigurationDesk under Build / Build Configuration / Default Build Configuration Set / Custom Code instead.
In short,
Remove the “Include directories”, “Source files” and “Libraries” settings in Simulink.
Set those settings in ConfigurationDesk under Build / Build Configuration / Default Build Configuration Set / Custom Code instead.
This may have been because of my lack of knowledge on how dSpace software works, but it seems to be something that has changed in the newer versions of MAB3. I will be glad to hear from any of you who has explanations to add on to this. I hope this helps any of you out there struggling with related issues and I want to thanks Jannis for helping me out.
Edit the Toolchain-dSPACEDS1403.cmake file, which is located at 'acados_root_folder'/cmake as following. In this instruction the ‘acados_root_folder’ is C:/acados/
In the Acados root folder, create a folder named buildDS1403\, and inside this folder create another folder named dSPACE_RCPHIL_2023A\. The key is not having any white space in its full path. Placing them in buildDS1403\ is only for file managing purposes.
From C:\Program Files\dSPACE RCPHIL 2023-A\ copy the folders Complier\, Exe\, DS1401\ into the newly created 'acados_root_folder'/buildDS1403/dSPACE_RCPHIL_2023A\. If you are missing something, you might have to review your dSpace installations.
Navigate to 'acados_root_folder'\buildDS1403\ and enter the following commands in order to cross-compile and build.
C:\acados\ <-- my acados root folder
├── buildDS1403\
│ └── dSPACE_RCPHIL_2023A\ <-- You are inside here when running cmake -S ../ -B ./
│ └── Complier\ <-- copied from C:\Program Files\dSPACE RCPHIL 2023-A
│ └── DS1401\ <-- copied from C:\Program Files\dSPACE RCPHIL 2023-A
│ └── Exe\ <-- copied from C:\Program Files\dSPACE RCPHIL 2023-A
│ └── (build files will be generated here) <-- You will find the two folders lib and include in buildDS401/install
2. Build the S-Function
In your MATLAB working directory, where you have your Simulink model (which is yet to have the Acados s-Function in it), in this example’s case it is C:\MicroAutobox3\Simulation\, create a folder named c_generated_code\.
In the MATLAB working directory, make sure you have the acados_env_variables_windows.m appropriately modified to point the Acados installation path. Run this.
In the MATLAB working directory, create your Acados solver generation scripts and run them to build the s-Function. The build results will be created in the c_generated_code\ folder that we have created before.
within the c_generated_code\ folder, you will the s-Function file has been generated. (The name of the generated s-Function can be found in the output message of the s-Function generation script). Add the generated s-Function in your existing Simulink model using the ‘S-Function’ block.
Recall that in acados.org “Embedded Workflow” , it tells you to source files: all *.c files in your c_generated_code folder. The following is the PowerShell command to obtain a space separated list of all the *.c files in a directory.