File Renaming / Reorganization & Minor Changes

- Add 1/2 coefficient to cost function
- Move `MPC_Class.m` to "Deliverables" folder
- Modify `part2_test_controller.m` plotting style a bit
- Rename `part2_MPC_controller.m` to `sravan_MPC_controller.m`
This commit is contained in:
Sravan Balaji
2021-12-12 16:03:27 -05:00
parent 0812db21ef
commit 5534819d90
3 changed files with 10 additions and 6 deletions

View File

@@ -200,7 +200,7 @@ classdef MPC_Class
H = diag(H);
% Evaluate cost function (quadratic function)
J = Z_err.' * H * Z_err;
J = 0.5 * Z_err.' * H * Z_err;
end
end

View File

@@ -9,13 +9,17 @@ info = getTrajectoryInfo(Y,U)
%% Figures
% Plot segmented trajectory for debugging purposes
close all;
figure(1)
hold on;
grid on;
plot(Y(:,1), Y(:,3), '-');
load('TestTrack.mat')
plot(TestTrack.bl(1,:), TestTrack.bl(2,:), '--r');
plot(TestTrack.br(1,:), TestTrack.br(2,:), '--r');
plot(TestTrack.cline(1,:), TestTrack.cline(2,:), '-.g');
load('ROB535_ControlProject_part1_Team3.mat')
plot(Y(:,1), Y(:,3), 'b-');
plot(ROB535_ControlProject_part1_state(:,1), ROB535_ControlProject_part1_state(:,3), 'k-');
plot(TestTrack.bl(1,:), TestTrack.bl(2,:), 'r.-');
plot(TestTrack.br(1,:), TestTrack.br(2,:), 'r.-');
plot(TestTrack.cline(1,:), TestTrack.cline(2,:), 'g.-');