-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdatasetWrapper.m
36 lines (29 loc) · 1.18 KB
/
datasetWrapper.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
load('VictoriaDatasetxylmk.mat')
% The pose graph object from matlab
victoria_pg = poseGraph;
% A container to link the landmarks ids to their ids in the graph
map_lmkid_graphid = containers.Map();
% Loop through each measurements
for i = 1:length(SLAMInputs)
measurement = SLAMInputs{i};
if (measurement.type == "odometry")
addRelativePose(victoria_pg, measurement.measurement', measurement.info_vec);
current_node = victoria_pg.NumNodes;
end
if (measurement.type == "landmark")
if (isKey(map_lmkid_graphid, num2str(measurement.id)))
id_lmk = map_lmkid_graphid(num2str(measurement.id));
addPointLandmark(victoria_pg, measurement.measurement', measurement.info_vec, current_node, id_lmk);
else
addPointLandmark(victoria_pg, measurement.measurement', measurement.info_vec);
map_lmkid_graphid(num2str(measurement.id)) = victoria_pg.LandmarkNodeIDs(end);
end
end
end
% Graph optimization
victoria_pg = optimizePoseGraph(victoria_pg, 'builtin-trust-region',...
'VerboseOutput', 'off',...
'InitialTrustRegionRadius',10);
figure
show(victoria_pg,'IDs','off');
title('victoria graph');