Skip to content
Snippets Groups Projects
Verified Commit 16b426b9 authored by Thomas Lambert's avatar Thomas Lambert :helicopter:
Browse files

feat(sync): include semiflapping cases

parent dde75955
No related branches found
No related tags found
No related merge requests found
......@@ -35,8 +35,8 @@ function [arduSynced, tunnelSynced, arduStartTime, tunnelStartTime] = ...
END_TRIM_SECONDS = 2; % Number of seconds to trim at the end, [s]
% Detect start of wing motion in Arduino and wind tunnel datasets
[arduStartIdx, arduStartTime] = getstartardu(arduShort);
[tunnelStartIdx, tunnelStartTime] = getstarttunnel(tunnelData);
[arduStartIdx, arduStartTime, steadyIdx] = getstartardu(arduShort);
[tunnelStartIdx, tunnelStartTime] = getstarttunnel(tunnelData, steadyIdx);
% Trim everything before wing starts in both datasets
arduShort = arduShort(arduStartIdx:end, :);
......@@ -70,24 +70,30 @@ function [arduSynced, tunnelSynced, arduStartTime, tunnelStartTime] = ...
end
function [startIdx, startTime] = getstartardu(arduData)
function [startIdx, startTime, steadyIdx] = getstartardu(arduData)
% GETSTARTARDU Get the starting po int for the arduino dataset and the flapping direction at
% start
ANGLE_IDX = [2, 3]; % Indexes of the front and aft angles in arduData file
N_STABLE_VAL = 20; % Number of stable values before beginnig of motion
DCRIT = 0.1; % Deviation from the mean to be considered a "large" deviation
STD_NO_MOTION = 3; % A standard deviation less than 1deg means no motion
% Get a first approximation for the starting point of each wing set
startIdx = [NaN, NaN];
steadyIdx = [NaN, NaN];
for i = 1:2
startIdx(i) = findsignalstart(arduData(:, ANGLE_IDX(i)), N_STABLE_VAL, 'ardu', DCRIT);
if std(arduData(:, ANGLE_IDX(i))) > STD_NO_MOTION
startIdx(i) = findsignalstart(arduData(:, ANGLE_IDX(i)), N_STABLE_VAL, 'ardu', DCRIT);
else
steadyIdx(i) = i;
end
end
startIdx = min(startIdx);
startTime = arduData(startIdx, 1);
end
function [startIdx, startTime] = getstarttunnel(tunnelData)
function [startIdx, startTime] = getstarttunnel(tunnelData, steadyIdx)
% GETSTARTTUNNEL Get the starting point for the wind tunnel dataset
% Only use the Fz to determine starting point
......@@ -101,7 +107,9 @@ function [startIdx, startTime] = getstarttunnel(tunnelData)
startIdx = [NaN, NaN];
for i = 1:2
startIdx(i) = findsignalstart(tunnelData(:, FZ_IDX(i)), SAMPLING / 2, 'tunnel', DCRIT);
if steadyIdx(i) ~= i
startIdx(i) = findsignalstart(tunnelData(:, FZ_IDX(i)), SAMPLING / 2, 'tunnel', DCRIT);
end
end
startIdx = TRIM_MS + min(startIdx);
startTime = startIdx / SAMPLING;
......
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