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
36a89e0a
Commit
36a89e0a
authored
7 years ago
by
burneykb
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into virt_quad
parents
1b9adf12
a18ae6b3
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
+9
-9
9 additions, 9 deletions
controls/model/loggingAnalysis/logAnalysis.m
controls/model/modelParameters.m
+5
-4
5 additions, 4 deletions
controls/model/modelParameters.m
controls/model/test_model.slx
+0
-0
0 additions, 0 deletions
controls/model/test_model.slx
with
14 additions
and
13 deletions
controls/model/loggingAnalysis/logAnalysis.m
+
9
−
9
View file @
36a89e0a
...
...
@@ -5,20 +5,20 @@ sim('test_model.slx');
% Determine model time for various sampling times and scale it according to
% logged data timescale
indices_40ms
=
find
(
pitch_setpoint_model
.
time
>
time
(
1
));
indices_5ms
=
find
(
x_command_model
.
time
>
time
(
1
));
indices_40ms
=
find
(
pitch_setpoint_model
.
time
>
=
time
(
1
));
indices_5ms
=
find
(
x_command_model
.
time
>
=
time
(
1
));
time_model_40ms
=
pitch_setpoint_model
.
time
(
indices_40ms
);
time_model_5ms
=
x_command_model
.
time
(
indices_5ms
);
% Pull x control structure data
pitch_setpoint_model_data
=
pitch_setpoint_model
.
signals
.
values
(
indices_40ms
);
pitchrate_setpoint_model_data
=
pitchrate_setpoint_model
.
signals
.
values
(
indices_
40
ms
);
pitchrate_setpoint_model_data
=
pitchrate_setpoint_model
.
signals
.
values
(
indices_
5
ms
);
x_command_model_data
=
x_command_model
.
signals
.
values
(
indices_5ms
);
x_position_model_data
=
x_position_model
.
signals
.
values
(
indices_40ms
);
% Pull y control structure data
roll_setpoint_model_data
=
roll_setpoint_model
.
signals
.
values
(
indices_40ms
);
rollrate_setpoint_model_data
=
rollrate_setpoint_model
.
signals
.
values
(
indices_
40
ms
);
rollrate_setpoint_model_data
=
rollrate_setpoint_model
.
signals
.
values
(
indices_
5
ms
);
y_command_model_data
=
y_command_model
.
signals
.
values
(
indices_5ms
);
y_position_model_data
=
y_position_model
.
signals
.
values
(
indices_40ms
);
...
...
@@ -28,7 +28,7 @@ z_position_model_data = z_position_model.signals.values(indices_40ms);
% Pull yaw control structure data
yawrate_setpoint_model_data
=
yawrate_setpoint_model
.
signals
.
values
(
indices_40ms
);
yaw_command_model_data
=
yaw_command_model
.
signals
.
values
(
indices_
40
ms
);
yaw_command_model_data
=
yaw_command_model
.
signals
.
values
(
indices_
5
ms
);
yaw_value_model_data
=
yaw_value_model
.
signals
.
values
(
indices_40ms
);
% Pull duty cycle commands from model
...
...
@@ -59,7 +59,7 @@ legend('Log', 'Model', 'location', 'northwest');
% Plot pitch controller output
subplot
(
2
,
2
,
2
);
stairs
(
time
,
pitchrate_setpoint
,
'.-'
);
hold
on
;
grid
minor
;
stairs
(
time_model_
40
ms
,
pitchrate_setpoint_model_data
,
'.-'
);
hold
off
;
stairs
(
time_model_
5
ms
,
pitchrate_setpoint_model_data
,
'.-'
);
hold
off
;
title
(
'Pitch Controller Output'
);
xlabel
(
'Time (s)'
);
ylabel
(
'd\theta/dt (rad/s)'
);
...
...
@@ -97,7 +97,7 @@ legend('Log', 'Model', 'location', 'northwest');
% Plot roll controller output
subplot
(
2
,
2
,
2
);
stairs
(
time
,
rollrate_setpoint
,
'.-'
);
hold
on
;
grid
minor
;
stairs
(
time_model_
40
ms
,
rollrate_setpoint_model_data
,
'.-'
);
hold
off
;
stairs
(
time_model_
5
ms
,
rollrate_setpoint_model_data
,
'.-'
);
hold
off
;
title
(
'Roll Controller Output'
);
xlabel
(
'Time (s)'
);
ylabel
(
'd\phi/dt (rad/s)'
);
...
...
@@ -143,7 +143,7 @@ legend('Log', 'Model', 'location', 'northwest');
%% Plot yaw control structure
% Plot
roll
controller output
% Plot
yaw
controller output
figure
(
4
);
subplot
(
2
,
2
,
1
);
stairs
(
time
,
yawrate_setpoint
,
'.-'
);
hold
on
;
grid
minor
;
stairs
(
time_model_40ms
,
yawrate_setpoint_model_data
,
'.-'
);
hold
off
;
...
...
@@ -155,7 +155,7 @@ legend('Log', 'Model', 'location', 'northwest');
% Plot yaw controller command
subplot
(
2
,
2
,
2
);
stairs
(
time
,
yaw_command
,
'.-'
);
hold
on
;
grid
minor
;
stairs
(
time_model_
40
ms
,
yaw_command_model_data
,
'.-'
);
hold
off
;
stairs
(
time_model_
5
ms
,
yaw_command_model_data
,
'.-'
);
hold
off
;
title
(
'Yaw Command'
);
xlabel
(
'Time (s)'
);
ylabel
(
'Command'
);
...
...
This diff is collapsed.
Click to expand it.
controls/model/modelParameters.m
+
5
−
4
View file @
36a89e0a
...
...
@@ -216,7 +216,8 @@ elseif logAnalysisToggle == 1 && temp == 1
[
dataStruct
,
headers
]
=
parse_log_model
(
params
.
file
.
pathName
);
time
=
dataStruct
.
Time
.
data
;
%time = dataStruct.time.data;
time
=
time
-
time
(
1
);
runtime
=
max
(
time
);
% Determine x position error
...
...
@@ -236,12 +237,12 @@ elseif logAnalysisToggle == 1 && temp == 1
% Determine pitch error
pitch_setpoint
=
dataStruct
.
X_pos_PID_Correction
.
data
;
pitch_value
=
dataStruct
.
VRPN_
Pitch_Constant
.
data
;
pitch_value
=
dataStruct
.
Pitch_Constant
.
data
;
pitch_error
=
timeseries
(
pitch_setpoint
-
pitch_value
,
time
);
% Determine roll error
roll_setpoint
=
dataStruct
.
Y_pos_PID_Correction
.
data
;
roll_value
=
dataStruct
.
VRPN_
Roll_Constant
.
data
;
roll_value
=
dataStruct
.
Roll_Constant
.
data
;
roll_error
=
timeseries
(
roll_setpoint
-
roll_value
,
time
);
% Determine yaw error
...
...
@@ -293,7 +294,7 @@ elseif logAnalysisToggle == 1 && temp == 1
raw_gyro_data
=
timeseries
(
raw_gyro_data_arr
,
time
);
%Create time series object for z command
throttle_command
=
timeseries
(
z_command
,
time
);
throttle_command
=
timeseries
(
dataStruct
.
RC_Throttle_Constant
.
data
,
time
);
%Pull the measurements from the complimentary filter
pitch_measured_IMU
=
dataStruct
.
Pitch_Constant
.
data
;
...
...
This diff is collapsed.
Click to expand it.
controls/model/test_model.slx
+
0
−
0
View file @
36a89e0a
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