mirror of
https://github.com/ROB-535-F21-Team-3/Control-Project.git
synced 2025-08-24 11:12:44 +00:00
Simulation Stop Index & Obstacle Plotting
- Add parameter to stop simulation when specified index in reference trajectory is reached - Modify `forwardIntegrate` to return `Xobs` for plotting - Plot obstacles in part2 testing figure - Change some line plotting styles for clarity
This commit is contained in:
@@ -54,8 +54,9 @@ classdef MPC_Class
|
||||
];
|
||||
|
||||
% Simulation Parameters
|
||||
T_s = 0.01; % Step Size [s]
|
||||
T_p = 0.5; % Prediction Horizon [s]
|
||||
T_s = 0.01; % Step Size [s]
|
||||
T_p = 0.5; % Prediction Horizon [s]
|
||||
sim_stop_idx = 2e3; % Index in reference trajectory to stop sim
|
||||
|
||||
% Decision Variables
|
||||
nstates = 6; % Number of states per prediction
|
||||
@@ -126,10 +127,9 @@ classdef MPC_Class
|
||||
obj.ndecinputs = obj.npredinputs * obj.ninputs;
|
||||
obj.ndec = obj.ndecstates + obj.ndecinputs;
|
||||
|
||||
% Check if `Y_curr` is within prediction horizon of
|
||||
% the end of `Y_ref`
|
||||
% Stop simulation when `sim_stop_idx` is reached
|
||||
obj.FLAG_terminate = 0;
|
||||
if size(obj.Y_ref, 1) - obj.ref_idx < obj.npred
|
||||
if obj.ref_idx > obj.sim_stop_idx
|
||||
obj.FLAG_terminate = 1;
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user