NMPC Controller not buildable for Raspberry Pi
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
My NMPC Controller controls an inverted pendulum system. The NMPC works perfectly fine when I run it in my Simulink/Simscape Multibody model. I already have some MPC controllers in my project that work perfectly fine when I build them for Raspberry. However when I want to build the my project with the NMPC for my Raspberry I get the following build errors:
Undefined function or variable 'stateFunction'. Function 'znlmpc_confun.m' (#1061.9169.9209), line 257, column 14: "handles.hStateFcn(xk, uk, parameters{:})"
Component:MATLAB Function | Category:Coder error
Function call failed. Function 'znlmpc_confun.m' (#1061.876.970), line 27, column 1: "[ceq, Jceq] = stateEvolution(coredata, handles, X, U, runtimedata.Parameters, co"
Component:MATLAB Function | Category:Coder error
Function call failed. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.5108.5173), line 129, column 14: "@(z) znlmpc_confun(z(:), blkData, runtimedata, userdata, handles)"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'varargout_1'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.5108.5173), line 129, column 14: "@(z) znlmpc_confun(z(:), blkData, runtimedata, userdata, handles)"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'varargout_2'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.5108.5173), line 129, column 14: "@(z) znlmpc_confun(z(:), blkData, runtimedata, userdata, handles)"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'varargout_3'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.5108.5173), line 129, column 14: "@(z) znlmpc_confun(z(:), blkData, runtimedata, userdata, handles)"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'varargout_4'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.5108.5173), line 129, column 14: "@(z) znlmpc_confun(z(:), blkData, runtimedata, userdata, handles)"
Component:MATLAB Function | Category:Coder error
Function call failed. P-code function 'checkNonlinearInputs.p' produced an error.
Component:MATLAB Function | Category:Coder error
Function call failed. P-code function 'checkNonlinearInputs.p' produced an error.
Component:MATLAB Function | Category:Coder error
Function call failed. P-code function 'fmincon.p' produced an error.
Component:MATLAB Function | Category:Coder error
Function call failed. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.5860.5944), line 144, column 5: "[z, cost, ExitFlag, Out] = fmincon(CostFcn, z0, A, B, [], [], zLB, zUB, ConFcn, "
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'z'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.5861.5862), line 144, column 6: "z"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'cost'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.5864.5868), line 144, column 9: "cost"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'ExitFlag'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.5870.5878), line 144, column 15: "ExitFlag"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'Out'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.5880.5883), line 144, column 25: "Out"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'ExitFlag'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.6005.6013), line 146, column 9: "ExitFlag"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'Out'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.6024.6027), line 146, column 28: "Out"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'z'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.6180.6181), line 150, column 40: "z"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'X'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.6146.6147), line 150, column 6: "X"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'U'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.6149.6150), line 150, column 9: "U"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'e'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.6152.6153), line 150, column 12: "e"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'U'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.6360.6361), line 153, column 14: "U"
Component:MATLAB Function | Category:Coder error
Undefined function or variable 'Out'. The first assignment to a local variable determines its class. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.6557.6560), line 158, column 76: "Out"
Component:MATLAB Function | Category:Coder error
Error limit reached. Suppressing further error messages. Function 'Nonlinear MPC Controller/MPC/NLMPC' (#475.6496.6500), line 158, column 15: "info"
Component:MATLAB Function | Category:Coder error
Errors occurred during parsing of MATLAB function 'system_model/Regler/Model Predictive Controllers/NMPC/Nonlinear MPC Controller/MPC/NLMPC'
Component:MATLAB Function | Category:Coder error
### Build procedure for system_model aborted due to an error.
Build Summary
Top model targets built: Model Action Rebuild Reason ======================================================================== system_model Failed Code generation information file does not exist. 0 of 1 models built (0 models already up to date) Build duration: 0h 0m 9.6977s
Errors occurred during parsing of MATLAB function 'system_model/Regler/Model Predictive Controllers/NMPC/Nonlinear MPC Controller/MPC/NLMPC'
Do I have to do anything special for building my NMPC for Raspberry?
0 Kommentare
Antworten (1)
Emmanouil Tzorakoleftherakis
am 27 Jun. 2023
Hard to tell without providing more details but I have a suspicion that you are defining the state and const functions as anonymous functions? If that's the case, that is not supported for code generation and you should use double quotes instead. For example
nlobj.Model.StateFcn = "pendulumDT0"
0 Kommentare
Siehe auch
Kategorien
Mehr zu Controller Creation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!