mirror of
https://github.com/ROB-535-F21-Team-3/Control-Project.git
synced 2025-08-14 06:48:33 +00:00
Adjust Some Parameters
- Increase `sim_stop_idx` to near the limit - Adjust some cost parameters - Remove unused `NL` cost parameter - Increase `fmincon` iteration & evaluation limits - Decrease `fmincon` constraint tolerance
This commit is contained in:
@@ -54,9 +54,9 @@ classdef MPC_Class
|
||||
];
|
||||
|
||||
% Simulation Parameters
|
||||
T_s = 0.01; % Step Size [s]
|
||||
T_p = 0.5; % Prediction Horizon [s]
|
||||
sim_stop_idx = 2.0e3; % Index in reference trajectory to stop sim
|
||||
T_s = 0.01; % Step Size [s]
|
||||
T_p = 0.5; % Prediction Horizon [s]
|
||||
sim_stop_idx = 8700; % Index in reference trajectory to stop sim
|
||||
|
||||
% Decision Variables
|
||||
nstates = 6; % Number of states per prediction
|
||||
@@ -81,28 +81,25 @@ classdef MPC_Class
|
||||
|
||||
% MPC & Optimization Parameters
|
||||
Q = [ ... % State Error Costs
|
||||
1e-2; ... % x_err [m]
|
||||
1e-2; ... % x_err [m]
|
||||
1e-2; ... % u_err [m/s]
|
||||
1e-2; ... % y_err [m]
|
||||
1e-2; ... % y_err [m]
|
||||
1e-2; ... % v_err [m/s]
|
||||
1e-2; ... % psi_err [rad]
|
||||
1e-2; ... % psi_err [rad]
|
||||
1e-2; ... % r_err [rad/s]
|
||||
];
|
||||
R = [ ... % Input Error Costs
|
||||
1e0; ... % delta_f_err [rad]
|
||||
1e-1; ... % delta_f_err [rad]
|
||||
1e-2; ... % F_x_err [N]
|
||||
];
|
||||
NL = [ ... % Nonlinear Constraint Cost
|
||||
1e6; ... % within track bounds
|
||||
1e6; ... % outside obstacles
|
||||
];
|
||||
options = ...
|
||||
optimoptions( ...
|
||||
'fmincon', ...
|
||||
'MaxFunctionEvaluations', 3000, ...
|
||||
'MaxIterations', 3000, ...
|
||||
'MaxFunctionEvaluations', 5000, ...
|
||||
'MaxIterations', 5000, ...
|
||||
'SpecifyConstraintGradient', true, ...
|
||||
'SpecifyObjectiveGradient', true ...
|
||||
'SpecifyObjectiveGradient', true, ...
|
||||
'ConstraintTolerance', 1e-3 ...
|
||||
);
|
||||
|
||||
% Constraint Parameters
|
||||
@@ -176,13 +173,6 @@ classdef MPC_Class
|
||||
obj.FLAG_terminate = 1;
|
||||
end
|
||||
|
||||
% Stop sim if nonlinear constraint was violated
|
||||
[c, ~] = obj.nonlcon(Z_err);
|
||||
if any(c > 0)
|
||||
disp('Found point violates nonlinear inequality constraint')
|
||||
obj.FLAG_terminate = 1;
|
||||
end
|
||||
|
||||
% NOTE: Error = Actual - Reference
|
||||
% => Actual = Error + Reference
|
||||
Z_ref = obj.get_ref_decision_variable();
|
||||
|
Reference in New Issue
Block a user