Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MicroCART
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Distributed Autonomous Networked Control Lab
MicroCART
Commits
461199e9
Commit
461199e9
authored
8 years ago
by
Andy Snawerdt
Browse files
Options
Downloads
Patches
Plain Diff
Updated model to better support active logging
parent
1022df30
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
controls/model/loggingAnalysis/logAnalysis.m
+13
-13
13 additions, 13 deletions
controls/model/loggingAnalysis/logAnalysis.m
controls/model/modelParameters.m
+5
-1
5 additions, 1 deletion
controls/model/modelParameters.m
controls/model/test_model.slx
+0
-0
0 additions, 0 deletions
controls/model/test_model.slx
with
18 additions
and
14 deletions
controls/model/loggingAnalysis/logAnalysis.m
+
13
−
13
View file @
461199e9
...
@@ -40,7 +40,7 @@ stairs(time_model_40ms, pitch_setpoint_model_data, '.-'); hold off;
...
@@ -40,7 +40,7 @@ stairs(time_model_40ms, pitch_setpoint_model_data, '.-'); hold off;
title
(
'Lateral Controller Output'
);
title
(
'Lateral Controller Output'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'\theta (rad)'
);
ylabel
(
'\theta (rad)'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
% Plot pitch controller output
% Plot pitch controller output
subplot
(
2
,
2
,
2
);
subplot
(
2
,
2
,
2
);
...
@@ -49,7 +49,7 @@ stairs(time_model_40ms, pitchrate_setpoint_model_data, '.-'); hold off;
...
@@ -49,7 +49,7 @@ stairs(time_model_40ms, pitchrate_setpoint_model_data, '.-'); hold off;
title
(
'Pitch Controller Output'
);
title
(
'Pitch Controller Output'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'd\theta/dt (rad/s)'
);
ylabel
(
'd\theta/dt (rad/s)'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
% Plot x controller command
% Plot x controller command
subplot
(
2
,
2
,
3
);
subplot
(
2
,
2
,
3
);
...
@@ -58,7 +58,7 @@ stairs(time_model_5ms, x_command_model_data, '.-'); hold off;
...
@@ -58,7 +58,7 @@ stairs(time_model_5ms, x_command_model_data, '.-'); hold off;
title
(
'X Command'
);
title
(
'X Command'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'Command'
);
ylabel
(
'Command'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
% Plot x position
% Plot x position
subplot
(
2
,
2
,
4
);
subplot
(
2
,
2
,
4
);
...
@@ -67,7 +67,7 @@ stairs(time_model_40ms, x_position_model_data, '.-'); hold off;
...
@@ -67,7 +67,7 @@ stairs(time_model_40ms, x_position_model_data, '.-'); hold off;
title
(
'X Position'
);
title
(
'X Position'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'Position (m)'
);
ylabel
(
'Position (m)'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
%% Plot y control structure
%% Plot y control structure
...
@@ -78,7 +78,7 @@ stairs(time_model_40ms, pitch_setpoint_model_data, '.-'); hold off;
...
@@ -78,7 +78,7 @@ stairs(time_model_40ms, pitch_setpoint_model_data, '.-'); hold off;
title
(
'Longitude Controller Output '
);
title
(
'Longitude Controller Output '
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'\phi (rad)'
);
ylabel
(
'\phi (rad)'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
% Plot roll controller output
% Plot roll controller output
subplot
(
2
,
2
,
2
);
subplot
(
2
,
2
,
2
);
...
@@ -87,7 +87,7 @@ stairs(time_model_40ms, rollrate_setpoint_model_data, '.-'); hold off;
...
@@ -87,7 +87,7 @@ stairs(time_model_40ms, rollrate_setpoint_model_data, '.-'); hold off;
title
(
'Roll Controller Output'
);
title
(
'Roll Controller Output'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'd\phi/dt (rad/s)'
);
ylabel
(
'd\phi/dt (rad/s)'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
% Plot y controller command
% Plot y controller command
subplot
(
2
,
2
,
3
);
subplot
(
2
,
2
,
3
);
...
@@ -96,7 +96,7 @@ stairs(time_model_5ms, y_command_model_data, '.-'); hold off;
...
@@ -96,7 +96,7 @@ stairs(time_model_5ms, y_command_model_data, '.-'); hold off;
title
(
'Y Command'
);
title
(
'Y Command'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'Command'
);
ylabel
(
'Command'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
% Plot y position
% Plot y position
subplot
(
2
,
2
,
4
);
subplot
(
2
,
2
,
4
);
...
@@ -105,7 +105,7 @@ stairs(time_model_40ms, y_position_model_data, '.-'); hold off;
...
@@ -105,7 +105,7 @@ stairs(time_model_40ms, y_position_model_data, '.-'); hold off;
title
(
'Y Position'
);
title
(
'Y Position'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'Position (m)'
);
ylabel
(
'Position (m)'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
%% Plot z control structure
%% Plot z control structure
...
@@ -116,7 +116,7 @@ stairs(time_model_40ms, z_command_model_data, '.-'); hold off;
...
@@ -116,7 +116,7 @@ stairs(time_model_40ms, z_command_model_data, '.-'); hold off;
title
(
'Z Command'
);
title
(
'Z Command'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'Command'
);
ylabel
(
'Command'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
% Plot z position
% Plot z position
subplot
(
2
,
1
,
2
);
subplot
(
2
,
1
,
2
);
...
@@ -125,7 +125,7 @@ stairs(time_model_40ms, z_position_model_data, '.-'); hold off;
...
@@ -125,7 +125,7 @@ stairs(time_model_40ms, z_position_model_data, '.-'); hold off;
title
(
'Z Position'
);
title
(
'Z Position'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'Position (m)'
);
ylabel
(
'Position (m)'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
%% Plot yaw control structure
%% Plot yaw control structure
...
@@ -136,7 +136,7 @@ stairs(time_model_40ms, yawrate_setpoint_model_data, '.-'); hold off;
...
@@ -136,7 +136,7 @@ stairs(time_model_40ms, yawrate_setpoint_model_data, '.-'); hold off;
title
(
'Yaw Controller Output'
);
title
(
'Yaw Controller Output'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'd\psi/dt (rad/s)'
);
ylabel
(
'd\psi/dt (rad/s)'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
% Plot yaw controller command
% Plot yaw controller command
subplot
(
2
,
2
,
2
);
subplot
(
2
,
2
,
2
);
...
@@ -145,7 +145,7 @@ stairs(time_model_40ms, yaw_command_model_data, '.-'); hold off;
...
@@ -145,7 +145,7 @@ stairs(time_model_40ms, yaw_command_model_data, '.-'); hold off;
title
(
'Yaw Command'
);
title
(
'Yaw Command'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'Command'
);
ylabel
(
'Command'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
% Plot yaw position
% Plot yaw position
subplot
(
2
,
2
,
3
);
subplot
(
2
,
2
,
3
);
...
@@ -154,4 +154,4 @@ stairs(time_model_40ms, yaw_value_model_data, '.-'); hold off;
...
@@ -154,4 +154,4 @@ stairs(time_model_40ms, yaw_value_model_data, '.-'); hold off;
title
(
'Yaw Position'
);
title
(
'Yaw Position'
);
xlabel
(
'Time (s)'
);
xlabel
(
'Time (s)'
);
ylabel
(
'Value (rad)'
);
ylabel
(
'Value (rad)'
);
legend
(
'Log'
,
'Model'
);
legend
(
'Log'
,
'Model'
,
'location'
,
'northwest'
);
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
controls/model/modelParameters.m
+
5
−
1
View file @
461199e9
% Log Analysis Toggle
% Log Analysis Toggle
logAnalysisToggle
=
1
;
% 1 for log analysis, 0 for normal operation
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
% Model Parameters
m
=
1.244
;
% Quadrotor + battery mass
m
=
1.244
;
% Quadrotor + battery mass
g
=
9.81
;
% Acceleration of gravity
g
=
9.81
;
% Acceleration of gravity
...
@@ -37,12 +41,12 @@
...
@@ -37,12 +41,12 @@
% Import Data and determine errors
% Import Data and determine errors
if
logAnalysisToggle
==
1
if
logAnalysisToggle
==
1
% Import Data to Workspace
% Import Data to Workspace
data
=
importdata
(
'loggingAnalysis/logFiles/logData.csv'
);
data
=
importdata
(
'loggingAnalysis/logFiles/logData.csv'
);
% Set up time vector
% Set up time vector
time
=
data
.
data
(:,
1
);
time
=
data
.
data
(:,
1
);
runtime
=
max
(
time
);
% Determine x position error
% Determine x position error
x_setpoint
=
data
.
data
(:,
25
);
x_setpoint
=
data
.
data
(:,
25
);
...
...
This diff is collapsed.
Click to expand it.
controls/model/test_model.slx
+
0
−
0
View file @
461199e9
No preview for this file type
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment