This repository has been archived by the owner on Jul 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
run-trials.m
77 lines (61 loc) · 2.16 KB
/
run-trials.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
65
66
67
68
69
70
71
72
73
74
75
76
77
%% Calculate error as a function of theta
%Set parameters
map_dim = 20;
max_theta = 2*pi;
theta_num = 40;
pathType = 'c'; %c (circular) or s (straight)
mapType = 'u'; %r (random) or u (uniform)
runs = 250;
ss = [1];
nf = [1.5];
fv = [105]*pi/180;
%Determine the theta list
theta = 0:max_theta/theta_num:max_theta;
for k = 1:length(ss)
for m = 1:length(nf)
for n = 1:length(fv)
step_size = ss(k);
noiseFactor = nf(m);
fov = fv(n);
if mapType == 'u'
map_type = 0;
else
map_type = 1;
landmarks = map3D(map_dim,1,900);
end
%Keep track of the mean square root error and its standard deviation
msr_error = zeros(1, length(theta));
msr_error_std = zeros(1, length(theta));
for i = 1:length(theta)
disp(theta(i))
errors = zeros(runs, 1);
for j = 1:runs
if map_type == 0
errors(j) = vo_model_offline(map_dim,map_type,theta(i),fov, step_size, noiseFactor, pathType);
else
errors(j) = vo_model_offline(map_dim,map_type,theta(i),fov, step_size, noiseFactor, pathType, landmarks);
end
end
msr_error(i) = mean(errors);
msr_error_std(i) = std(errors);
end
%Plot and add aesthetics
close all;
f = figure();
hold on;
errorbar(theta*(180/pi), msr_error, msr_error_std, '--bs','LineWidth',1,'MarkerFaceColor','r');
xlabel('Theta (deg)','FontSize', 12);
ylabel('Average Error Norm (m)','FontSize', 12);
chart_title = sprintf('Visual Odometry Error vs. Offset Angle \n Map Type: %i Map Dim: %i Theta Incr: %i Runs Per Theta: %i \n FOV: %.2f Step Size: %.2f Noise Factor: %.2f', ...
map_type, map_dim, length(theta), runs, round(fov*180/pi), step_size, noiseFactor);
title(chart_title, 'FontSize', 12);
xlim([-10 max_theta*180/pi+10]);
set(gca,'FontSize',14);
set(gca,'box','on');
file_name = sprintf('Figures/VO-E-%s-LM-Theta-FOV-%.2f-SS-%.2f-NF-%.2f-RPT-%d-%d',pathType, fov, step_size, noiseFactor,runs, randi(100));
saveas(f, strcat(file_name,'.png'));
saveas(f, strcat(file_name,'.fig'));
hold off;
end
end
end