Skip to content
Snippets Groups Projects
Commit 79fbc6dd authored by leprob001's avatar leprob001
Browse files

The tracking method can now be selected in the soundsource combination table.

parent ae1933f3
No related branches found
No related tags found
No related merge requests found
Showing with 38 additions and 53 deletions
182
\ No newline at end of file
183
\ No newline at end of file
......@@ -32,7 +32,6 @@ callbacks.openTrackTrajectoryOutput = @artoa.controller.track.trajectoryOutput.o
callbacks.switchHideDeletedDataPoints = @artoa.controller.switchHideDeletedPoints;
%% Prepare callbacks for track parameter
callbacks.comboboxTrackingMethod = @artoa.controller.track.parameter.comboboxTrackingMethod;
callbacks.checkboxDopplerCorrection = @artoa.controller.track.parameter.checkboxDopplerCorrection;
callbacks.comboboxInterpolationMethod = @artoa.controller.track.parameter.comboboxInterpolationMethod;
callbacks.comboboxSoundspeedMethod = @artoa.controller.track.parameter.comboboxSoundspeedMethod;
......
function [newValue] = comboboxTrackingMethod(~, ~)
%COMBOBOXTRACKINGMETHOD Summary of this function goes here
% Detailed explanation goes here
global artoaGui artoaWorkspace;
selectedIndex = artoaGui.trackParameter.comboboxTrackingMethod.Value;
newValue = artoaGui.trackParameter.comboboxTrackingMethod.String{selectedIndex};
artoaWorkspace.trackParameter.trackingMethodValue = selectedIndex;
artoaWorkspace.trackParameter.trackingMethodString = newValue;
end
......@@ -10,7 +10,8 @@ variableNames = { ...
'referencePosition', ...
'soundspeed1', ...
'soundspeed2', ...
'soundspeed3' ...
'soundspeed3', ...
'trackingMethod' ...
};
%% Create struct for workspace
......
......@@ -11,7 +11,8 @@ emptyCell = { ...
'', ...
1464, ...
1464, ...
1464 ...
1464, ...
'' ...
};
end
......
......@@ -28,6 +28,12 @@ if any(isnan(pCombinationsTable.soundspeed1)) ...
return;
end
if any(isempty(pCombinationsTable.trackingMethod)) ...
|| any(strcmp(pCombinationsTable.trackingMethod, ''))
message = 'You must select a tracking method for all combinations!';
return;
end
success = true;
end
......
......@@ -28,7 +28,7 @@ for i = 1:length(trajectories)
generatedTracks{i, 1} = '';
end
generatedTracks{i, 2} = trajectories{i}.id;
generatedTracks{i, 3} = trajectories{i}.trackParameter.trackingMethodString;
generatedTracks{i, 3} = strjoin(trajectories{i}.trackParameter.soundsourceCombinations.trackingMethod, ', ');
end
tableHandle.Data = generatedTracks;
......
......@@ -23,8 +23,7 @@ availableCallbacks = { ...
'openTrackParameter', ...
'openTrackTrajectoryOutput', ...
'switchHideDeletedDataPoints', ...
'comboboxTrackingMethod', ... % FIRST ITEM TRACK PARAMETER CALLBACKS
'checkboxDopplerCorrection', ...
'checkboxDopplerCorrection', ... % FIRST ITEM TRACK PARAMETER CALLBACKS
'comboboxInterpolationMethod', ...
'comboboxSoundspeedMethod', ...
'checkboxPlotResiduals', ...
......@@ -268,31 +267,21 @@ buttonHeight = .3;
% Tracking method frame
artoaGui.trackParameter.frameTrackingMethod = uipanel( ...
artoaGui.trackParameter.frameCorrections = uipanel( ...
'Parent', artoaGui.trackParameter.frameTrackingParameter, ...
'Title', 'Tracking Method', ...
'Title', 'Corrections', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [left .75 width .20] ...
);
artoaGui.trackParameter.comboboxTrackingMethod = uicontrol( ...
'Parent', artoaGui.trackParameter.frameTrackingMethod, ...
'String', pTrackingMethods, ...
'Style', 'popupmenu', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .5 .9 .4], ...
'CallBack', pCallbacks.comboboxTrackingMethod ...
);
artoaGui.trackParameter.checkboxDopplerCorrection = uicontrol( ...
'Parent', artoaGui.trackParameter.frameTrackingMethod, ...
'Parent', artoaGui.trackParameter.frameCorrections, ...
'String', 'Apply Doppler Correction', ...
'Style', 'checkbox', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .1 .9 .3], ...
'Position', [left .5 .9 .3], ...
'Value', 1, ...
'CallBack', pCallbacks.checkboxDopplerCorrection ...
);
......@@ -396,8 +385,11 @@ columns = { ...
'End', ...
'Sound Sources', ...
'Reference Position', ...
'Sound Speed', 'Sound Speed', 'Sound Speed' ...
'Sound Speed', 'Sound Speed', 'Sound Speed', ...
'Tracking Method' ...
};
columnFormat = cell(1, length(columns));
columnFormat{end} = pTrackingMethods;
artoaGui.trackParameter.tableSoundSourceCombinations = uitable( ...
artoaGui.trackParameter.frameTrackingParameter, ...
'Units', 'normalized', ...
......@@ -405,10 +397,11 @@ artoaGui.trackParameter.tableSoundSourceCombinations = uitable( ...
'Data', cell(1, length(columns)), ...
'ColumnName', columns, ...
'ColumnEditable', true, ...
'ColumnFormat', (columnFormat), ...
'CellSelectionCallback', pCallbacks.tableSoundSourceCombinationsSelection,... %@(app,event) disp(num2str(event.Indices)) ...
'CellEditCallback', pCallbacks.tableSoundSourceCombinationsEdit ...
);
clear columns;
clear columns columnFormat;
% Track buttons frame
......
......@@ -236,8 +236,7 @@ for oCombination = 1:size(soundsourceCombinations, 1)
preparedData, ...
currentCombination, ...%trajectory(end, :), ...
floatReferenceTime, ...
pSoundVelocity(oCombination, :), ...
pTrackingParameter.trackingMethodString ...
pSoundVelocity(oCombination, :) ...
);
% remove NaNs from segment
......
function [segmentPositions, segmentDates, segmentClockError, segmentResiduals] = calculateCombinationSegment(pCorrectedData, pCombinationDetails, pFloatReferenceTime, pSoundVelocity, pTrackingMethod)
function [segmentPositions, segmentDates, segmentClockError, segmentResiduals] = calculateCombinationSegment(pCorrectedData, pCombinationDetails, pFloatReferenceTime, pSoundVelocity)
%CALCULATECOMBINATIONSEGMENT Combination segment calculation.
% Using the input data, the function calculates the segment positions,
% its corresponding dates as well as the clock error (in case of hyperbolic calculation)
......@@ -20,14 +20,6 @@ function [segmentPositions, segmentDates, segmentClockError, segmentResiduals] =
% used.
% For all other methods, only one value needs to be set.
% Unit: [m/s]
% pTrackingMethod (string/char):
% Contains the tracking algorithm that should be used.
% Available methods:
% least square
% exclusive least square
% circular
% hyperbolic
%
%
% Returns:
% segmentPositions (double):
......@@ -50,7 +42,7 @@ segmentVelocities = struct();
soundsourceNames = unique(strsplit(strtrim(pCombinationDetails.soundsources{1}), ' '));
%% Get tracking method
trackingMethod = lower(pTrackingMethod);
trackingMethod = lower(pCombinationDetails.trackingMethod{:});
%% Get start and end point
segmentStart = pCombinationDetails{1, 1};
......@@ -151,7 +143,7 @@ end
switch trackingMethod
case {'least square', 'exclusive least square'}
for oDates = 1:length(intersectedToaDates)
if strcmp(pTrackingMethod, 'exclusive least square') ...
if strcmp(trackingMethod, 'exclusive least square') ...
&& (sum(~isnan(distanceToSoundsources{oDates})) ~= length(soundsourcePositions))
segmentPositions = [segmentPositions; [NaN, NaN]];
segmentClockError = [segmentClockError; NaN(1, 3)];
......@@ -194,7 +186,7 @@ switch trackingMethod
otherwise
% prepare soundsource infos
[segmentPositions, segmentClockError] = artoa.plugins.tracking.callTrackingMethod( ...
pTrackingMethod, ...
trackingMethod, ...
pluginTables, ...
pluginSoundsourcePositions, ...
pCombinationDetails ...
......
if ~artoa.data.hasMember(artoaWorkspace, 'trackParameter', 'soundsourceCombinations', 'trackingMethod')
artoaWorkspace.trackParameter.soundsourceCombinations.trackingMethod(:) = {''};
end
if artoa.data.hasMember(artoaWorkspace, 'trackParameter', 'trackingMethodString')
rmfield(artoaWorkspace.trackParameter, 'trackingMethodString');
end
if artoa.data.hasMember(artoaWorkspace, 'trackParameter', 'trackingMethodValue')
rmfield(artoaWorkspace.trackParameter, 'trackingMethodValue');
end
\ No newline at end of file
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