Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MechaRaptor - Data Processing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Aerospace and Mechanical Engineering
tlambert
MechaRaptor - Data Processing
Commits
7c7d37b1
Verified
Commit
7c7d37b1
authored
2 years ago
by
Thomas Lambert
Browse files
Options
Downloads
Patches
Plain Diff
refact: use mean angle for each module
parent
b1bae618
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
processall.m
+10
-8
10 additions, 8 deletions
processall.m
utils/syncdata.m
+14
-14
14 additions, 14 deletions
utils/syncdata.m
with
24 additions
and
22 deletions
processall.m
+
10
−
8
View file @
7c7d37b1
...
@@ -52,24 +52,26 @@ function ExpData = processall(idFile)
...
@@ -52,24 +52,26 @@ function ExpData = processall(idFile)
ExpData
(
iTest
)
.
tunnelFile
=
idTable
(
iTest
,
:)
.
wtFile
{:};
ExpData
(
iTest
)
.
tunnelFile
=
idTable
(
iTest
,
:)
.
wtFile
{:};
% Load and clean experimental data
% Load and clean experimental data
ardu
Data
=
loadardu
(
ExpData
(
iTest
)
.
arduFile
);
[
ardu
Short
,
arduFull
]
=
loadardu
(
ExpData
(
iTest
)
.
arduFile
);
tunnelData
=
loadtunnel
(
ExpData
(
iTest
)
.
tunnelFile
,
...
tunnelData
=
loadtunnel
(
ExpData
(
iTest
)
.
tunnelFile
,
...
CUTOFF_MULTIPLIER
*
idTable
(
iTest
,
:)
.
freq
);
CUTOFF_MULTIPLIER
*
idTable
(
iTest
,
:)
.
freq
);
% Sync the two data sources
% Sync the two data sources
[
ardu
Data
,
tunnelData
,
ExpData
(
iTest
)
.
arduStart
,
ExpData
(
iTest
)
.
tunnelStart
]
=
...
[
ardu
Short
,
tunnelData
,
ExpData
(
iTest
)
.
arduStart
,
ExpData
(
iTest
)
.
tunnelStart
]
=
...
syncdata
(
ardu
Data
,
tunnelData
);
syncdata
(
ardu
Short
,
tunnelData
);
% Save the cleaned data
% Save the cleaned data
% Split datasets between front and aft
% Split datasets between front and aft
ExpData
(
iTest
)
.
front
.
arduData
=
arduData
(:,
[
1
:
3
,
6
]);
ExpData
(
iTest
)
.
front
.
arduFull
=
arduFull
(:,
[
1
:
3
,
6
]);
ExpData
(
iTest
)
.
aft
.
arduData
=
arduData
(:,
[
1
,
4
:
5
,
7
]);
ExpData
(
iTest
)
.
aft
.
arduFull
=
arduFull
(:,
[
1
,
4
:
5
,
7
]);
ExpData
(
iTest
)
.
front
.
arduShort
=
arduShort
(:,
[
1
:
2
,
4
]);
ExpData
(
iTest
)
.
aft
.
arduShort
=
arduShort
(:,
[
1
,
3
,
5
]);
ExpData
(
iTest
)
.
front
.
tunnelData
=
tunnelData
(:,
1
:
6
);
ExpData
(
iTest
)
.
front
.
tunnelData
=
tunnelData
(:,
1
:
6
);
ExpData
(
iTest
)
.
aft
.
tunnelData
=
tunnelData
(:,
7
:
end
);
ExpData
(
iTest
)
.
aft
.
tunnelData
=
tunnelData
(:,
7
:
end
);
end
% [FIXME] A few plots just to check
plottime
(
ExpData
(
iTest
),
'arduShort'
,
true
);
plottime
(
ExpData
(
1
),
false
);
end
end
end
This diff is collapsed.
Click to expand it.
utils/syncdata.m
+
14
−
14
View file @
7c7d37b1
function
[
arduSynced
,
tunnelSynced
,
arduStart
,
tunnelStart
]
=
syncdata
(
ardu
Data
,
tunnelData
)
function
[
arduSynced
,
tunnelSynced
,
arduStart
,
tunnelStart
]
=
syncdata
(
ardu
Short
,
tunnelData
)
% SYNCDATA Synchronize datasets from the Arduio and the Wind Tunnel.
% SYNCDATA Synchronize datasets from the Arduio and the Wind Tunnel.
% -----
% -----
% The acquisition of data is realized from two different sources on two different machines:
% The acquisition of data is realized from two different sources on two different machines:
...
@@ -35,7 +35,7 @@ function [arduSynced, tunnelSynced, arduStart, tunnelStart] = syncdata(arduData,
...
@@ -35,7 +35,7 @@ function [arduSynced, tunnelSynced, arduStart, tunnelStart] = syncdata(arduData,
ENC_PRECISION
=
12
;
% 12-bits encoders
ENC_PRECISION
=
12
;
% 12-bits encoders
ATI_RESOL
=
1
/
80
;
% Resolution of ATI sensor in Z direction, [N];
ATI_RESOL
=
1
/
80
;
% Resolution of ATI sensor in Z direction, [N];
CRIT_ARDU
=
3
;
% Start when we have a change > 3 times the encoder resolution
CRIT_ARDU
=
3
;
% Start when we have a change > 3 times the encoder resolution
CRIT_WT
=
3
;
% Start when we have a change > 2 the resolution
CRIT_WT
=
40
;
% Start when we have a change > 2 the resolution
% Abbreviations
% Abbreviations
nbits
=
2
^
ENC_PRECISION
;
nbits
=
2
^
ENC_PRECISION
;
...
@@ -43,28 +43,28 @@ function [arduSynced, tunnelSynced, arduStart, tunnelStart] = syncdata(arduData,
...
@@ -43,28 +43,28 @@ function [arduSynced, tunnelSynced, arduStart, tunnelStart] = syncdata(arduData,
critWtDiff
=
CRIT_WT
*
ATI_RESOL
/
WT_SAMPLING
;
% Criterion for the WT differential
critWtDiff
=
CRIT_WT
*
ATI_RESOL
/
WT_SAMPLING
;
% Criterion for the WT differential
% Detect start of wing motion in Arduino and wind tunnel datasets
% Detect start of wing motion in Arduino and wind tunnel datasets
arduStart
=
getstartardu
(
ardu
Data
,
CRIT_ARDU
*
encRes
);
arduStart
=
getstartardu
(
ardu
Short
,
CRIT_ARDU
*
encRes
);
tunnelStart
=
getstarttunnel
(
tunnelData
,
critWtDiff
);
% [FIXME]
Should probably start later?
tunnelStart
=
getstarttunnel
(
tunnelData
,
critWtDiff
);
% [FIXME]
USE FINDPEAKS
% Trim everything before wing starts in both datasets
% Trim everything before wing starts in both datasets
% arduData = arduData(arduStart:end, :);
%
arduData = arduData(arduStart:end, :);
% tunnelData = tunnelData(tunnelStart:end, :);
%
tunnelData = tunnelData(tunnelStart:end, :);
% Set both datasets time to 0 for the first element
% Set both datasets time to 0 for the first element
ardu
Data
(:,
1
)
=
ardu
Data
(:,
1
)
-
ardu
Data
(
1
,
1
);
ardu
Short
(:,
1
)
=
ardu
Short
(:,
1
)
-
ardu
Short
(
1
,
1
);
% Interpolate arduino over wt time sampling
% Interpolate arduino over wt time sampling
time
=
0
:
1
/
WT_SAMPLING
:
size
(
tunnelData
,
1
)
/
WT_SAMPLING
;
time
=
0
:
1
/
WT_SAMPLING
:
size
(
tunnelData
,
1
)
/
WT_SAMPLING
;
dummy
=
interp1
(
ardu
Data
(:,
1
)
/
1000
,
ardu
Data
(:,
2
:
end
),
time
);
dummy
=
interp1
(
ardu
Short
(:,
1
),
ardu
Short
(:,
2
:
end
),
time
);
ardu
Data
=
[
time
'
,
dummy
];
ardu
Short
=
[
time
'
,
dummy
];
% Cut longests dataset
% Cut longests dataset
maxTime
=
max
(
size
(
ardu
Data
,
1
),
size
(
tunnelData
,
1
));
maxTime
=
max
(
size
(
ardu
Short
,
1
),
size
(
tunnelData
,
1
));
ardu
Data
(
maxTime
:
end
,
:)
=
[];
ardu
Short
(
maxTime
:
end
,
:)
=
[];
tunnelData
(
maxTime
:
end
,
:)
=
[];
tunnelData
(
maxTime
:
end
,
:)
=
[];
% Assign output properly now that we are synced
% Assign output properly now that we are synced
arduSynced
=
ardu
Data
;
arduSynced
=
ardu
Short
;
tunnelSynced
=
tunnelData
;
tunnelSynced
=
tunnelData
;
% Trim first and lasts seconds of datasets (remove possible transient effects)
% Trim first and lasts seconds of datasets (remove possible transient effects)
...
@@ -80,8 +80,8 @@ end
...
@@ -80,8 +80,8 @@ end
function
startArdu
=
getstartardu
(
arduData
,
dCrit
)
function
startArdu
=
getstartardu
(
arduData
,
dCrit
)
% GETSTARTARDU Get the starting point for the arduino dataset
% GETSTARTARDU Get the starting point for the arduino dataset
FRONT_IDX
=
2
:
3
;
% Indexes of the front module angles
FRONT_IDX
=
2
;
% Indexes of the front module angles
AFT_IDX
=
4
:
5
;
% Indexes of the aft module angles
AFT_IDX
=
3
;
% Indexes of the aft module angles
% Get the starting index of each set separately
% Get the starting index of each set separately
startFront
=
(
mean
(
findallstarts
(
arduData
(:,
FRONT_IDX
),
dCrit
)));
startFront
=
(
mean
(
findallstarts
(
arduData
(:,
FRONT_IDX
),
dCrit
)));
...
...
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