osqp / osqp-matlab

Matlab interface for OSQP
https://osqp.org/
Apache License 2.0
42 stars 25 forks source link

tlc file error occurred while generating the code #53

Open sinnoha opened 9 months ago

sinnoha commented 9 months ago

Hello, I created a new Simulink model following the steps of https://github.com/osqp/osqp/issues/113#issuecomment-1228963920 and the simulation worked fine,

image

but when I generated the code, I got the following error

Error:Error: File: C:\Program Files\MATLAB\R2023a\rtw\c\tlc\lib\blkiolib.tlc Line: 2429 Column: 13
The == and != operators can only be used to compare values of the same type

here is the model file and detail error message : err_msg.txt osqp_demo.zip

Can anyone give me some help or advice? Thanks!

BTW, I can generate the code for the example model quadcopter_example_codegen

sinnoha commented 9 months ago

In shorts, I solved the problem with the following modifications. The problem comes from an out of the range error,

tlc_repair

I'm not sure if this is a bug or not, I'll add more information after verifying the generated code in detail. (and learn more about OSQP to figure out the meaning of x, y, prim_inf_cert, dual_inf_cert)