-
Notifications
You must be signed in to change notification settings - Fork 0
/
runPigeonsSubTrajExperiment.m
64 lines (57 loc) · 2.59 KB
/
runPigeonsSubTrajExperiment.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
function runPigeonsSubTrajExperiment(typeDistanceTerrain,chosenNorm,startIndex,endIndex)
% Load data for the pigeons from file.
readData = 0;
if ~readData
[trajA, trajB] = loadPigeonData();
% Pad the 2D trajectories to 3D ones.
trajA = pad2DTrajectoryTo3D(trajA);
trajB = pad2DTrajectoryTo3D(trajB);
readData = 1;
end
trajA = trajA(startIndex:endIndex, :);
trajB = trajB(startIndex:endIndex, :);
experimentExtension = ['Norm', num2str(chosenNorm)];
% Compute the distance terrain.
switch typeDistanceTerrain
case 'normal'
distanceTerrain = matching.compute_distance_terrain(trajA,trajB,chosenNorm);
case 'directionalDistance'
distanceTerrain = matching.directionalDistanceTerrain(trajA,trajB,chosenNorm);
experimentExtension = [experimentExtension, 'DirectionalDistance'];
case 'dynamicInteraction'
alpha = 1;
distanceTerrain = matching.dynamicInteractionTerrain(trajA,trajB,chosenNorm,alpha);
experimentExtension = [experimentExtension, 'DynamicInteraction'];
case 'dynamicDistance'
alpha = 1;
distanceTerrain = matching.dynamicDistanceTerrain(trajA,trajB,chosenNorm,alpha);
experimentExtension = [experimentExtension, 'DynamicDistance'];
case 'heading'
distanceTerrain = matching.headingTerrain(trajA,trajB,chosenNorm);
experimentExtension = [experimentExtension, 'Heading'];
otherwise
error('Cannot handle this choice');
end
% Trim off last point from distance terrain if the terrain is direction
% sensitive.
if ~strcmp('normal',typeDistanceTerrain)
[trajA, trajB, distanceTerrain] = trimOffLastPoint(trajA,trajB,distanceTerrain);
end
% Generate file names.
pathToResults = 'results/pigeons_subtraj/';
matchingName = [pathToResults, 'matching', experimentExtension, '.dump'];
delayPlotName = [pathToResults, 'delaySpace', experimentExtension, '.png'];
logScaleDelayPlotName = [pathToResults, 'delaySpace', experimentExtension, 'logScale.png'];
% Plot the distance terrain.
%visualise.plotDistanceTerrain(distanceTerrain);
% Compute a Locally Correct Frechet Matchting.
lcfMatching = matching.discrete_lcfm(trajA,trajB,distanceTerrain);
% Save matching on disk.
matching.writeMatching(lcfMatching,matchingName);
% Plot the trajectories with its lcf matching.
visualise.plotMatching(lcfMatching);
% Plot free space with its matching.
delayPlot = visualise.plotMatchingInFreeSpace(distanceTerrain, lcfMatching);
saveas(delayPlot,delayPlotName);
logScaleDelayPlot = visualise.plotMatchingInFreeSpace(logScaleDelaySpace(distanceTerrain), lcfMatching);
saveas(logScaleDelayPlot,logScaleDelayPlotName);