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:
Sravan Balaji
2021-12-12 16:29:20 -05:00
parent 5534819d90
commit 6f6db84c23
3 changed files with 17 additions and 11 deletions

View File

@@ -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