First, I would like to express my sincere gratitude to the acados developers for creating such wonderful software.
I am currently generating problems using Python and MATLAB interfaces for the same dynamics and OCP, and comparing the two results.
Under identical conditions, the closed loop simulation results show that the Python interface performs much better than Matlab, but I am unable to understand why the two show different results.
Below is a summary of the current problem situation.
The generated code for Python and MATLAB is different. The C files in the c_generated_code folder are the same, but the files in c_generated_code/{model_name} _model folder, such as _gnsf_phi_fun.c, are different when generated by the Python and MATLAB interfaces, respectively.
To make the two codes completely identical, I overrode the C file generated by Python with MATLAB and executed a closed loop, but the performance is different, and the MATLAB version is still not good.
The remaining issue is the process of generating the mex file, so I think there is an element in this part that is causing the performance degradation.
However, I understand that the mex interface file is simply a wrapper. Even though all the generated C files are identical, I am curious about the reason for the performance degradation.
Regarding the differences you observed between Python and Matlab: please check the generated json files for both solvers. If they are the same, then also the generated C code should be the same.
And I found that json file is somewhat different in some part, and I think that causes the different performance.
I have to scrutinize where the difference is (Because generated json file is too long), but I think I found where I should start.
One question is, then what if I copy json file generated from Python and paste it into matlab json file?
Can you tell me how json file is referred to the code generation in acados(Matlab version)? Then I think I can do my best to study further so that the same code can be produced.
Thank you again you guys for such a wonderful software again. I always feel surprise If you are accepting donations, I would be happy to contribute.
In theory, the defaults should be the same in python and MATLAB, so if you find differences between the two json files that is likely due to some option being changed in python but not in MATLAB or vice versa.
You can build an OCP solver in MATLAB based on a json generated from python as described in this PR: