Skip to content
Snippets Groups Projects
Commit 3c4943be authored by leprob001's avatar leprob001
Browse files

Introduced backward tracking feature.

parent b6c6cacc
No related branches found
No related tags found
No related merge requests found
207 209
\ No newline at end of file \ No newline at end of file
...@@ -34,6 +34,7 @@ callbacks.convertProfilesToRfb = @artoa.controller.file.profile2rfb.open; ...@@ -34,6 +34,7 @@ callbacks.convertProfilesToRfb = @artoa.controller.file.profile2rfb.open;
%% Prepare callbacks for track parameter %% Prepare callbacks for track parameter
callbacks.checkboxDopplerCorrection = @artoa.controller.track.parameter.checkboxDopplerCorrection; callbacks.checkboxDopplerCorrection = @artoa.controller.track.parameter.checkboxDopplerCorrection;
callbacks.checkboxBackwardTracking = @artoa.controller.track.parameter.checkboxBackwardTracking;
callbacks.comboboxInterpolationMethod = @artoa.controller.track.parameter.comboboxInterpolationMethod; callbacks.comboboxInterpolationMethod = @artoa.controller.track.parameter.comboboxInterpolationMethod;
callbacks.comboboxSoundspeedMethod = @artoa.controller.track.parameter.comboboxSoundspeedMethod; callbacks.comboboxSoundspeedMethod = @artoa.controller.track.parameter.comboboxSoundspeedMethod;
callbacks.checkboxPlotResiduals = @artoa.controller.track.parameter.checkboxPlotResiduals; callbacks.checkboxPlotResiduals = @artoa.controller.track.parameter.checkboxPlotResiduals;
......
function [newValue] = checkboxBackwardTracking(~, ~)
%CHECKBOXDOPPLERCORRECTION Summary of this function goes here
% Detailed explanation goes here
global artoaGui artoaWorkspace;
newValue = logical(artoaGui.trackParameter.checkboxBackwardTracking.Value);
artoaWorkspace.trackParameter.enableBackwardTracking = newValue;
%% Flip current soundsource combination table
artoaWorkspace.trackParameter.soundsourceCombinations = ...
flipud(artoaWorkspace.trackParameter.soundsourceCombinations);
begin = artoaWorkspace.trackParameter.soundsourceCombinations.combinationBegin;
artoaWorkspace.trackParameter.soundsourceCombinations.combinationBegin = ...
artoaWorkspace.trackParameter.soundsourceCombinations.combinationEnd;
artoaWorkspace.trackParameter.soundsourceCombinations.combinationEnd = begin;
artoa.controller.track.parameter.updateGui();
end
\ No newline at end of file
...@@ -11,13 +11,26 @@ referencePosition = ''; ...@@ -11,13 +11,26 @@ referencePosition = '';
isNotNan = ~isnan(artoaWorkspace.satData.lat_sat) & ~isnan(artoaWorkspace.satData.lon_sat); isNotNan = ~isnan(artoaWorkspace.satData.lat_sat) & ~isnan(artoaWorkspace.satData.lon_sat);
knownPositions = [artoaWorkspace.satData.lat_sat(isNotNan), artoaWorkspace.satData.lon_sat(isNotNan)]; knownPositions = [artoaWorkspace.satData.lat_sat(isNotNan), artoaWorkspace.satData.lon_sat(isNotNan)];
if ~(size(knownPositions, 1) == 0) if ~(size(knownPositions, 1) == 0)
if artoaWorkspace.trackParameter.enableBackwardTracking
referencePosition = [num2str(knownPositions(end, 1)) ' ' num2str(knownPositions(end, 2))];
else
referencePosition = [num2str(knownPositions(1, 1)) ' ' num2str(knownPositions(1, 2))]; referencePosition = [num2str(knownPositions(1, 1)) ' ' num2str(knownPositions(1, 2))];
end
end
%% Set start and end date
if ~artoaWorkspace.trackParameter.enableBackwardTracking
startDate = floor(min(artoaWorkspace.toaData.toaDate(artoaWorkspace.toaData.status ~= 2)));
endDate = floor(max(artoaWorkspace.toaData.toaDate(artoaWorkspace.toaData.status ~= 2)));
else
startDate = floor(max(artoaWorkspace.toaData.toaDate(artoaWorkspace.toaData.status ~= 2)));
endDate = floor(min(artoaWorkspace.toaData.toaDate(artoaWorkspace.toaData.status ~= 2)));
end end
%% Create default cell %% Create default cell
emptyCell = { ... emptyCell = { ...
floor(min(artoaWorkspace.toaData.toaDate(artoaWorkspace.toaData.status ~= 2))), ... startDate, ...
floor(max(artoaWorkspace.toaData.toaDate(artoaWorkspace.toaData.status ~= 2))), ... endDate, ...
'', ... '', ...
referencePosition, ... referencePosition, ...
1464, ... 1464, ...
......
...@@ -14,6 +14,7 @@ callbacks = artoaGui.callbacks.main; ...@@ -14,6 +14,7 @@ callbacks = artoaGui.callbacks.main;
%% Create workspace variables %% Create workspace variables
if pForceOverwrite || ~isfield(artoaWorkspace, 'trackParameter') if pForceOverwrite || ~isfield(artoaWorkspace, 'trackParameter')
artoaWorkspace.trackParameter = struct(); artoaWorkspace.trackParameter = struct();
artoaWorkspace.trackParameter.enableBackwardTracking = false;
% setup sound source combinations % setup sound source combinations
artoaWorkspace.trackParameter.soundsourceCombinations = ... artoaWorkspace.trackParameter.soundsourceCombinations = ...
......
...@@ -16,6 +16,8 @@ for i = 1:length(fieldNames) ...@@ -16,6 +16,8 @@ for i = 1:length(fieldNames)
switch fieldNames{i} switch fieldNames{i}
case 'dopplerCorrection' case 'dopplerCorrection'
artoaGui.trackParameter.checkboxDopplerCorrection.Value = currentValue; artoaGui.trackParameter.checkboxDopplerCorrection.Value = currentValue;
case 'enableBackwardTracking'
artoaGui.trackParameter.checkboxBackwardTracking.Value = currentValue;
case 'plotResiduals' case 'plotResiduals'
artoaGui.trackParameter.checkboxPlotResiduals.Value = currentValue; artoaGui.trackParameter.checkboxPlotResiduals.Value = currentValue;
case 'trackingMethodValue' case 'trackingMethodValue'
......
...@@ -25,6 +25,7 @@ availableCallbacks = { ... ...@@ -25,6 +25,7 @@ availableCallbacks = { ...
'openTrackTrajectoryOutput', ... 'openTrackTrajectoryOutput', ...
'switchHideDeletedDataPoints', ... 'switchHideDeletedDataPoints', ...
'checkboxDopplerCorrection', ... % FIRST ITEM TRACK PARAMETER CALLBACKS 'checkboxDopplerCorrection', ... % FIRST ITEM TRACK PARAMETER CALLBACKS
'checkboxBackwardTracking', ...
'comboboxInterpolationMethod', ... 'comboboxInterpolationMethod', ...
'comboboxSoundspeedMethod', ... 'comboboxSoundspeedMethod', ...
'checkboxPlotResiduals', ... 'checkboxPlotResiduals', ...
...@@ -279,6 +280,17 @@ artoaGui.trackParameter.checkboxDopplerCorrection = uicontrol( ... ...@@ -279,6 +280,17 @@ artoaGui.trackParameter.checkboxDopplerCorrection = uicontrol( ...
'CallBack', pCallbacks.checkboxDopplerCorrection ... 'CallBack', pCallbacks.checkboxDopplerCorrection ...
); );
artoaGui.trackParameter.checkboxBackwardTracking = uicontrol( ...
'Parent', artoaGui.trackParameter.frameOptions, ...
'String', 'Enable backward tracking', ...
'Style', 'checkbox', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .1 .9 .3], ...
'Value', 0, ...
'CallBack', pCallbacks.checkboxBackwardTracking ...
);
% Interpolation method frame % Interpolation method frame
artoaGui.trackParameter.frameInterpolationMethod = uipanel( ... artoaGui.trackParameter.frameInterpolationMethod = uipanel( ...
'Parent', artoaGui.trackParameter.frameTrackingParameter, ... 'Parent', artoaGui.trackParameter.frameTrackingParameter, ...
......
...@@ -227,11 +227,18 @@ for oCombination = 1:size(soundsourceCombinations, 1) ...@@ -227,11 +227,18 @@ for oCombination = 1:size(soundsourceCombinations, 1)
elseif isempty(currentCombination.referencePosition{1}) elseif isempty(currentCombination.referencePosition{1})
currentCombination.referencePosition{1} = num2str(trajectory(end, :)); currentCombination.referencePosition{1} = num2str(trajectory(end, :));
end end
[segmentPositions, segmentDates, segmentClockError, segmentResiduals] = artoa.trajectory.calculateCombinationSegment( ...
[ ...
segmentPositions, ...
segmentDates, ...
segmentClockError, ...
segmentResiduals ...
] = artoa.trajectory.calculateCombinationSegment( ...
preparedData, ... preparedData, ...
currentCombination, ...%trajectory(end, :), ... currentCombination, ...%trajectory(end, :), ...
floatReferenceTime, ... floatReferenceTime, ...
pSoundVelocity(oCombination, :) ... pSoundVelocity(oCombination, :), ...
pTrackingParameter.enableBackwardTracking ...
); );
% remove NaNs from segment % remove NaNs from segment
......
function [segmentPositions, segmentDates, segmentClockError, segmentResiduals] = calculateCombinationSegment(pCorrectedData, pCombinationDetails, pFloatReferenceTime, pSoundVelocity) function [ ...
segmentPositions, ...
segmentDates, ...
segmentClockError, ...
segmentResiduals ...
] = ...
calculateCombinationSegment( ...
pCorrectedData, ...
pCombinationDetails, ...
pFloatReferenceTime, ...
pSoundVelocity, ...
pBackwardTracking ...
)
%CALCULATECOMBINATIONSEGMENT Combination segment calculation. %CALCULATECOMBINATIONSEGMENT Combination segment calculation.
% Using the input data, the function calculates the segment positions, % Using the input data, the function calculates the segment positions,
% its corresponding dates as well as the clock error (in case of hyperbolic calculation) % its corresponding dates as well as the clock error (in case of hyperbolic calculation)
...@@ -20,6 +32,8 @@ function [segmentPositions, segmentDates, segmentClockError, segmentResiduals] = ...@@ -20,6 +32,8 @@ function [segmentPositions, segmentDates, segmentClockError, segmentResiduals] =
% used. % used.
% For all other methods, only one value needs to be set. % For all other methods, only one value needs to be set.
% Unit: [m/s] % Unit: [m/s]
% pBackwardTracking (bool):
% If true, the data will be prepared for backward tracking
% %
% Returns: % Returns:
% segmentPositions (double): % segmentPositions (double):
...@@ -54,11 +68,18 @@ for i = 2:length(soundsourceNames) ...@@ -54,11 +68,18 @@ for i = 2:length(soundsourceNames)
end end
%% Remove all dates that are out of bounds %% Remove all dates that are out of bounds
if pBackwardTracking
tmp = segmentStart;
segmentStart = segmentEnd;
segmentEnd = tmp;
end
intersectedToaDates = intersectedToaDates( ... intersectedToaDates = intersectedToaDates( ...
intersectedToaDates >= segmentStart ... intersectedToaDates >= segmentStart ...
& intersectedToaDates <= segmentEnd ... & intersectedToaDates <= segmentEnd ...
); );
%% Create a table for every soundsource (required by tracking plugin system) %% Create a table for every soundsource (required by tracking plugin system)
pluginTables = struct(); pluginTables = struct();
for i = 1:length(soundsourceNames) for i = 1:length(soundsourceNames)
...@@ -110,7 +131,15 @@ for oDates = 1:lenIntersectedToaDates ...@@ -110,7 +131,15 @@ for oDates = 1:lenIntersectedToaDates
end end
warning('on'); warning('on');
% Call the corresponding tracking method from the plugin folder %% Backward tracking
% if enabled, everything needs to be upside down for the calculation
if pBackwardTracking
for i = 1:length(soundsourceNames)
pluginTables.(soundsourceNames{i}) = flipud(pluginTables.(soundsourceNames{i}));
end
end
%% Call the corresponding tracking method from the plugin folder
[segmentPositions, segmentClockError] = artoa.plugins.tracking.callTrackingMethod( ... [segmentPositions, segmentClockError] = artoa.plugins.tracking.callTrackingMethod( ...
trackingMethod, ... trackingMethod, ...
pluginTables, ... pluginTables, ...
...@@ -118,6 +147,13 @@ warning('on'); ...@@ -118,6 +147,13 @@ warning('on');
pCombinationDetails ... pCombinationDetails ...
); );
%% Restore backward tracking changes
% if enabled, the calculated positions need to be flipped upside down to be
% able to display them correctly
if pBackwardTracking
segmentPositions = flipud(segmentPositions);
segmentClockError = flipud(segmentClockError);
end
%% Store toa dates %% Store toa dates
segmentDates = intersectedToaDates; segmentDates = intersectedToaDates;
......
%% Backward tracking features
if ~artoa.data.hasMember(artoaWorkspace, 'trackParameter', 'enableBackwardTracking')
artoaWorkspace.trackParameter.enableBackwardTracking = false;
end
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