-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain_test.m
63 lines (48 loc) · 1.21 KB
/
main_test.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
%% Initialization
close all;
clc;
addpath('Data')
addpath('Scripts')
addpath('Functions')
addpath('Classes')
% Load the configuration parameters for the algorithms
config
% Load the data
% load_precomputed_data = true;
% load_data
%% SVD estimation
clc;
index = 14000;
delta_index = 1;
ls1 = laserscans{index};
ls2 = laserscans{index+delta_index};
dtheta_tot = 0;
for i = index:index+delta_index
dtheta_tot = dtheta_tot + odometries{i}.dtheta;
end
alpha = svd_estimation(ls1, ls2);
fprintf("SVD estimation = %f\n", alpha);
fprintf("sum of odometries = %f\n\n", dtheta_tot);
dtheta_tot = zeros(length(laserscans)-delta_index,1);
alphas = [];
alphas_idx = [];
alpha_old = 0;
for i = 1:delta_index:length(laserscans)-delta_index
ls1 = laserscans{i};
ls2 = laserscans{i+delta_index};
alpha = wrapToPi(svd_estimation(ls1, ls2));
alphas = [alphas, alpha_old + alpha];
alphas_idx = [alphas_idx, i];
alpha_old = alpha_old + alpha;
end
figure(), clf, hold on;
plot(alphas_idx, alphas);
plot(th);
plot(gt(:, 4));
legend(['SVD estimate'; 'EKF estimate'; 'Ground truth']);
grid on;
xlabel('time index');
ylabel('theta [rad]');
% plot(1:1:length(alpha),alpha);
% hold on
% plot(1:1:length(alpha),dtheta_tot);