-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexp_sim_calibrecord.m
182 lines (153 loc) · 6.31 KB
/
exp_sim_calibrecord.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
% do calib and record results, by simulation dataset: initguo, init, mslam, vslam
clear;
close all;
%% init
set_odo = 1;
set_img = 1;
set_st = 1;
set_end = 20;
stdratio_odo_st = 0;
stdratio_odo_end = 0.04;
stdratio_odo_step = 0.001;
std_img_st = 0;
std_img_end = 1;
std_img_step = 1;
bDoRecord = true;
bCalibSp = true;
bCalibSpOdo = true;
bCalibSpOdoTmp = true;
%% do calib. loop
for set = set_st:set_end
set_odo = set;
set_img = set;
for stdratio_odo = stdratio_odo_st:stdratio_odo_step:stdratio_odo_end
stdratio_lin = stdratio_odo;
stdratio_rot = stdratio_odo;
str_suffix_odo = [ ...
'-el', num2str(stdratio_lin), ...
'-er', num2str(stdratio_rot), ...
'-s', num2str(set_odo), ...
];
odofilename = ['Odo', str_suffix_odo, '.rec'];
for std_img = std_img_st:std_img_step:std_img_end
std_imgu = std_img;
std_imgv = std_img;
str_suffix_mk = [ ...
'-eu', num2str(std_imgu), ...
'-ev', num2str(std_imgv), ...
'-s', num2str(set_img), ...
];
markfilename = ['Mk', str_suffix_mk, '.rec'];
str_file_record = ['.\temp\results', str_suffix_odo, str_suffix_mk, '.mat'];
if exist(str_file_record, 'file')
continue;
end
%% init: create class objs and load data
% setting
setting = YAML.read('setting-slam-sim.yml');
setting.path.odofilename = odofilename;
setting.path.markfilename = markfilename;
setting.error.odo.stdratio_lin = stdratio_lin;
setting.error.odo.stdratio_rot = stdratio_rot;
setting.error.mk.std_imgu = std_imgu;
setting.error.mk.std_imgv = std_imgv;
% measure
measure = ClassMeasure(setting.path.fold, setting.path.markfilename, setting.path.odofilename);
measure.ReadRecData;
measure_raw = ClassMeasure();
measure.CopyTo(measure_raw);
measure.PruneData(setting.prune.thresh_lin, setting.prune.thresh_rot);
% compute velocity by interpolation
measure.odo = Odo_Interpolate(measure.odo, measure_raw.odo, measure_raw.time, 1);
% solver
solver = ClassSolverSlam(setting);
% map
map = ClassMap;
% calib
calib = ClassCalib(setting);
% slam configure
options_mslam = struct(...
'bCalibExtRot', true, 'bCalibExtLin', true,...
'bCalibTmp', false, 'bCalibOdo', false);
options_vslam = struct(...
'bCalibExtRot', true, 'bCalibExtLin', true,...
'bCalibTmp', false, 'bCalibOdo', false, ...
'bCalibCamMat', false, 'bCalibCamDist', false);
% record
struct_record = [];
struct_record.stdratio_lin = stdratio_lin;
struct_record.stdratio_rot = stdratio_rot;
struct_record.std_imgu = std_imgu;
struct_record.std_imgv = std_imgv;
%% init by guo's solution
solver.SolveInitGuo(measure, calib);
calib.DispCalib;
struct_record.result_initvo = calib.GetCalibResult;
%% init by my solution
solver.SolveGrndPlaneLin(measure, calib);
solver.SolveYawXY(measure, calib);
calib.DispCalib;
struct_record.result_initmk = calib.GetCalibResult;
if bCalibSp
%% calib with m-slam
% init. map from odometry and mark observation
map.InitMap(measure, calib);
% do m-slam-calib
solver.SolveJointOptMSlam(measure, calib, map, options_mslam);
% display v-slam-calib results
calib.DispCalib;
% record
struct_record.result_mslam = calib.GetCalibResult;
%% calib with v-slam
% do v-slam-calib
solver.SolveJointOptVSlam(measure, calib, map, options_vslam);
% display v-slam-calib results
calib.DispCalib;
% record
struct_record.result_vslam = calib.GetCalibResult;
end
if bCalibSpOdo
%% calib with m-slam
options_mslam.bCalibOdo = true;
% do m-slam-calib
solver.SolveJointOptMSlam(measure, calib, map, options_mslam);
% display v-slam-calib results
calib.DispCalib;
% record
struct_record.result_mslamodo = calib.GetCalibResult;
%% calib with v-slam
options_vslam.bCalibOdo = true;
% do v-slam-calib
solver.SolveJointOptVSlam(measure, calib, map, options_vslam);
% display v-slam-calib results
calib.DispCalib;
% record
struct_record.result_vslamodo = calib.GetCalibResult;
end
if bCalibSpOdoTmp
%% calib with m-slam
options_mslam.bCalibOdo = true;
options_mslam.bCalibTmp = true;
% do m-slam-calib
solver.SolveJointOptMSlam(measure, calib, map, options_mslam);
% display v-slam-calib results
calib.DispCalib;
% record
struct_record.result_mslamodotemp = calib.GetCalibResult;
%% calib with v-slam
options_vslam.bCalibOdo = true;
options_vslam.bCalibTmp = true;
% do v-slam-calib
solver.SolveJointOptVSlam(measure, calib, map, options_vslam);
% display v-slam-calib results
calib.DispCalib;
% record
struct_record.result_vslamodotemp = calib.GetCalibResult;
end
%% record
if bDoRecord
save(str_file_record, 'struct_record');
end
end
end
end