TUMFTM / mod_vehicle_dynamics_control

TUM Roborace Team Software Stack - Path tracking control, velocity control, curvature control and state estimation.
243 stars 82 forks source link

compile and deployment of the Model with OSQP Solver #4

Open EricWang0306 opened 11 months ago

EricWang0306 commented 11 months ago

Dear all: Sorry for my English I'm a rookie but interesting in vehicle control. So I just downloaded the control model(https://github.com/TUMFTM/mod_vehicle_dynamics_control.git) and study it. Then I did some simplify to make the model simpler. But I didn't modified the trajectory tracking module because I don't know well about the algorithm.So it remains the state of simulink matlab function model input and S-Function OSQP solver for Calculation. After that I want to deploy the model and the solver to the MCU to control the vehicle. I just met some trouble on this step. My final aim is to trans my simulink model into C code and deploy the code onto our MCU, an Infineon 32-bit-tricore-microcontroller-TC397. Actually, I use simulink coder to generate the code, and use Aurix Development Studio to compile the code, and then burn the code into the MCU. The errors occurred for compiling the code generated from the model in simulink in Aurix Development Studio. And the errors show that some .h files are lacked in OSQP solver files. What's more, the .h files are Disorganized for their source. They are from like VC environment like windows.h and MATLAB source and so on. The total amount of these files is very large, and even if they are added, some code will not be recognized during compilation. So I think I can not use the way to compile the code and run the code in the MCU, including the OSQP solver. I just wanna know whether the way I deploy the model algorithm and the OSQP solver are wrong. How did you deploy them? Did anyone had the same or similar trouble and how to solve the trouble? This problem has been bothering me for more than a month, which has caused my research progress to be greatly delayed and I am exhausted. Looking forward your reply and it would be a great honor for me to get your help.

kmeetam commented 9 months ago

Dear all

I also have an problem with OSQP solver and errors are below

Error using mex In file included from D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_sfun.c:7:0: D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:9:5: error: unknown type name 'c_int' c_int n; // number of optimization variables ^~~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:10:5: error: unknown type name 'c_int' c_int m; // number of constraints ^~~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:11:5: error: unknown type name 'c_int' c_int P_nnz; // number of nonzero elements in P matrix ^~~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:12:5: error: unknown type name 'c_int' c_int A_nnz; // number of nonzero elements in A matrix ^~~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:17:5: error: unknown type name 'OSQPData' OSQPData data; ^~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:20:5: error: unknown type name 'c_int' c_int flag_bound_upd; ^~~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:21:5: error: unknown type name 'c_int' c_int flag_A_upd; ^~~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:22:5: error: unknown type name 'c_int' c_int flag_P_upd; ^~~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:23:5: error: unknown type name 'c_int' c_int flag_q_upd; ^~~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:24:5: error: unknown type name 'c_int' c_int flag_solve; ^~~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:25:5: error: unknown type name 'c_int' c_int flag_setup; ^~~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:29:5: error: unknown type name 'c_float' c_float p_0, c_float p_1, c_float p_2, c_float p_3, ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:29:19: error: unknown type name 'c_float' c_float p_0, c_float p_1, c_float p_2, c_float p_3, ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:29:33: error: unknown type name 'c_float' c_float p_0, c_float p_1, c_float p_2, c_float p_3, ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:29:47: error: unknown type name 'c_float' c_float p_0, c_float p_1, c_float p_2, c_float p_3, ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:30:3: error: unknown type name 'c_float' c_float p_4, c_float p_5, c_float p_6, c_float p_7, ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:30:17: error: unknown type name 'c_float' c_float p_4, c_float p_5, c_float p_6, c_float p_7, ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:30:31: error: unknown type name 'c_float' c_float p_4, c_float p_5, c_float p_6, c_float p_7, ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:30:45: error: unknown type name 'c_float' c_float p_4, c_float p_5, c_float p_6, c_float p_7, ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:31:1: error: unknown type name 'c_float' c_float p_8, c_float p_9, c_float p_10, c_float p_11, c_float p_13); ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:31:15: error: unknown type name 'c_float' c_float p_8, c_float p_9, c_float p_10, c_float p_11, c_float p_13); ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:31:29: error: unknown type name 'c_float' c_float p_8, c_float p_9, c_float p_10, c_float p_11, c_float p_13); ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:31:44: error: unknown type name 'c_float' c_float p_8, c_float p_9, c_float p_10, c_float p_11, c_float p_13); ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:31:59: error: unknown type name 'c_float' c_float p_8, c_float p_9, c_float p_10, c_float p_11, c_float p_13); ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:37:49: error: unknown type name 'c_float' void update_osqp_wrapper(osqp_wrapper wrapper, c_float q_upd, c_float l_upd, ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:37:65: error: unknown type name 'c_float' void update_osqp_wrapper(osqp_wrapper wrapper, c_float q_upd, c_float l_upd, ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:38:5: error: unknown type name 'c_float' c_float u_upd, c_float A_x_upd); ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_wrapper.h:38:21: error: unknown type name 'c_float' c_float u_upd, c_float A_x_upd); ^~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_sfun.c: In function 'mdlInitializeSizes': D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_sfun.c:70:5: error: unknown type name 'c_int' c_int n = p_2[0]; ^~~~~ D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqp_sfun.c: In function 'mdlOutputs': D:\iac_software\mod_vehicle_dynamics_control\misc\osqp\osqpsfun.c:237:29: error: dereferencing pointer to incomplete type 'OSQPWorkspace {aka struct OSQPWorkspace}' y[i] = wrapper->work->solution->x[i]; ^~

Error in startup_vdc (line 78) mex CFLAGS='$CFLAGS -w' misc/osqp/osqp_sfun.c misc/osqp/osqp_wrapper.c -Lmisc/osqp/lib/ -losqp_mingw -outdir build -silent -DWINDOWS_BUILD

Error in Simulink.ModelManagement.Project.Util.runMATLABCodeInBase

Error in Simulink.ModelManagement.Project.Util.runMATLABCodeInBase

Error in Simulink.ModelManagement.Project.Util.runMATLABCodeInBase

Error in Simulink.ModelManagement.Project.Util.runMATLABCodeInBase

Error in Simulink.ModelManagement.Project.Util.runMATLABScriptDuringStartup

Error in slproject.loadProject

Error in slproject.loadProject

Error in simulinkproject

Error in simulinkproject

Error in Simulink.ModelManagement.Project.File.PathUtils.loadProjectForOpenPRJ

Error in openprj>i_openSimulinkProject (line 96) valid = Simulink.ModelManagement.Project.File.PathUtils.loadProjectForOpenPRJ(filename);

Error in openprj (line 44) valid = i_openSimulinkProject(filename);

Error in open (line 142) feval(openAction,fullpath);

Error in uiopen (line 175) open(fn); Make sure that you have a compiler installed and setup for use with MATLAB using: mex -setup

Do you have any suggestion?

Thank you in advance