Hi, I have used Acados to implement an MPC, the base project is running without problems in both MATLAB and generated code for x86 target from Simulink. I’m now trying to introduce a couple of constraints, when I run the code generated from Simulink it returns me an Error Status 3 in QP solver, running the same controller configuration (same code) with MATLAB, with the same logged input data, runs without any problems
This is the way I have set up my constraints
% set up states & controls
vy = MX.sym('vy');
omega = MX.sym('omega');
psi_err = MX.sym('psi_err');
lat_err = MX.sym('lat_err');
delta = MX.sym('delta');
x = vertcat(vy, omega, psi_err, lat_err, delta);
% parameters
vx = MX.sym('vx');
k = MX.sym('k');
p = vertcat(vx, k);
alpha_f = -atan2(lf*omega + vy,vx) + delta;
alpha_r = atan2(lr*omega - vy,vx);
constraint.alpha_front_min = -0.12; % minimum front slip angle [rad]
constraint.alpha_front_max = 0.12; % maximum front slip angle [rad]
constraint.alpha_rear_min = -0.12; % minimum rear slip angle [rad]
constraint.alpha_rear_max = 0.12; % maximum rear slip angle [rad]
% define constraints struct
constraint.expr = vertcat(alpha_f, alpha_r);
And this is how I use them when generating the solver and the s-function
ocp_model.set('constr_expr_h', constraint.expr);
ocp_model.set('constr_lh', [...
constraint.alpha_front_min,...
constraint.alpha_rear_min,...
]);
ocp_model.set('constr_uh', [...
constraint.alpha_front_max,...
constraint.alpha_rear_max,...
]);
Also placing a very simple input makes the error appear instantly, which make me think that I have some kind of misconfiguration in simulink
Do I need some additional configuration to run the solver with constraints in Simulink? Thank you!