Skip to content
Snippets Groups Projects
Commit 461199e9 authored by Andy Snawerdt's avatar Andy Snawerdt
Browse files

Updated model to better support active logging

parent 1022df30
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,7 @@ stairs(time_model_40ms, pitch_setpoint_model_data, '.-'); hold off;
title('Lateral Controller Output');
xlabel('Time (s)');
ylabel('\theta (rad)');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
% Plot pitch controller output
subplot(2, 2, 2);
......@@ -49,7 +49,7 @@ stairs(time_model_40ms, pitchrate_setpoint_model_data, '.-'); hold off;
title('Pitch Controller Output');
xlabel('Time (s)');
ylabel('d\theta/dt (rad/s)');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
% Plot x controller command
subplot(2, 2, 3);
......@@ -58,7 +58,7 @@ stairs(time_model_5ms, x_command_model_data, '.-'); hold off;
title('X Command');
xlabel('Time (s)');
ylabel('Command');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
% Plot x position
subplot(2, 2, 4);
......@@ -67,7 +67,7 @@ stairs(time_model_40ms, x_position_model_data, '.-'); hold off;
title('X Position');
xlabel('Time (s)');
ylabel('Position (m)');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
%% Plot y control structure
......@@ -78,7 +78,7 @@ stairs(time_model_40ms, pitch_setpoint_model_data, '.-'); hold off;
title('Longitude Controller Output ');
xlabel('Time (s)');
ylabel('\phi (rad)');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
% Plot roll controller output
subplot(2, 2, 2);
......@@ -87,7 +87,7 @@ stairs(time_model_40ms, rollrate_setpoint_model_data, '.-'); hold off;
title('Roll Controller Output');
xlabel('Time (s)');
ylabel('d\phi/dt (rad/s)');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
% Plot y controller command
subplot(2, 2, 3);
......@@ -96,7 +96,7 @@ stairs(time_model_5ms, y_command_model_data, '.-'); hold off;
title('Y Command');
xlabel('Time (s)');
ylabel('Command');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
% Plot y position
subplot(2, 2, 4);
......@@ -105,7 +105,7 @@ stairs(time_model_40ms, y_position_model_data, '.-'); hold off;
title('Y Position');
xlabel('Time (s)');
ylabel('Position (m)');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
%% Plot z control structure
......@@ -116,7 +116,7 @@ stairs(time_model_40ms, z_command_model_data, '.-'); hold off;
title('Z Command');
xlabel('Time (s)');
ylabel('Command');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
% Plot z position
subplot(2, 1, 2);
......@@ -125,7 +125,7 @@ stairs(time_model_40ms, z_position_model_data, '.-'); hold off;
title('Z Position');
xlabel('Time (s)');
ylabel('Position (m)');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
%% Plot yaw control structure
......@@ -136,7 +136,7 @@ stairs(time_model_40ms, yawrate_setpoint_model_data, '.-'); hold off;
title('Yaw Controller Output');
xlabel('Time (s)');
ylabel('d\psi/dt (rad/s)');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
% Plot yaw controller command
subplot(2, 2, 2);
......@@ -145,7 +145,7 @@ stairs(time_model_40ms, yaw_command_model_data, '.-'); hold off;
title('Yaw Command');
xlabel('Time (s)');
ylabel('Command');
legend('Log', 'Model');
legend('Log', 'Model', 'location', 'northwest');
% Plot yaw position
subplot(2, 2, 3);
......@@ -154,4 +154,4 @@ stairs(time_model_40ms, yaw_value_model_data, '.-'); hold off;
title('Yaw Position');
xlabel('Time (s)');
ylabel('Value (rad)');
legend('Log', 'Model');
\ No newline at end of file
legend('Log', 'Model', 'location', 'northwest');
\ No newline at end of file
% Log Analysis Toggle
logAnalysisToggle = 1; % 1 for log analysis, 0 for normal operation
% Define Simulink Runtime (if logAnalysisToggle is selected, this will be
% automatically set based on the log files time)
runtime = 20;
% Model Parameters
m = 1.244; % Quadrotor + battery mass
g = 9.81; % Acceleration of gravity
......@@ -37,12 +41,12 @@
% Import Data and determine errors
if logAnalysisToggle == 1
% Import Data to Workspace
data = importdata('loggingAnalysis/logFiles/logData.csv');
% Set up time vector
time = data.data(:, 1);
runtime = max(time);
% Determine x position error
x_setpoint = data.data(:, 25);
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment