-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcalib_rt.m
78 lines (57 loc) · 1.89 KB
/
calib_rt.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
%% init: create class objs and load data
clear;
% [FileName,PathName] = uigetfile('*.xml', 'Select the setting file', 'C:\Workspace\Data\');
% settingFile = [PathName, FileName];
settingFile = 'C:\Workspace\Data\cuhksz-2016.3.15\r2-rightback-bidir-mk127-2016031520\config\setting-simcalibmap3d-vmckf.xml';
configXml = readXml_vmckf(settingFile);
% measure
measure = ClassMeasure(configXml.PathFold, configXml.NameMk, configXml.NameOdo);
measure.ReadRecData;
measure.PruneData(configXml.ThreshTransPruneData, configXml.ThreshRotPruneData);
% init solver
solverRt = ClassSolverRt;
q_c_b = configXml.qcbInit;
sigma_q_c_b = configXml.qcbSigmaInit;
pt3_c_b = configXml.pt3cbInit;
sigma_pt3_c_b = configXml.pt3cbSigmaInit;
solverRt.InitXFull(q_c_b, sigma_q_c_b, pt3_c_b, sigma_pt3_c_b);
% init ground truth
mu_x_true = configXml.MuXTrue;
%% solve in rt, main loop
vecLp = measure.odo.lp;
rec_mu = [];
rec_sigma = cell(0,1);
odoLast = measure.GetOdoLp(vecLp(1));
odoLast.sigma = zeros(3,3);
for i = 1:(numel(vecLp))
lpNow = vecLp(i);
% get measure now
odoNow = measure.GetOdoLp(lpNow);
odoNow = solverRt.FunPrpgOdo(odoLast, odoNow);
mkNow = measure.GetMkLp(lpNow);
% set measure now
solverRt.SetMeasNew(odoNow, mkNow);
% refresh calib res
solverRt.CalibFull;
% renew measure rec
solverRt.RenewMeasRec;
% record
% rec_mu = [rec_mu; solverRt.x_full.'-mu_x_true.'];
rec_mu = [rec_mu; solverRt.x_full.'];
rec_sigma{end+1, 1} = solverRt.sigma_x_full;
% renew odoLast
odoLast = odoNow;
% display info
% disp(['loop: ', num2str(i)]);
end
%% draw results
vec_id = [1;2;3;4];
DrawPlotEnv( rec_mu, rec_sigma, vec_id );
vec_id = [5;6];
DrawPlotEnv( rec_mu, rec_sigma, vec_id );
disp('x_full:');
disp(solverRt.x_full);
disp('error');
disp(solverRt.x_full - mu_x_true);
disp('sigma_x_full:');
disp(solverRt.sigma_x_full);