forked from UTS-RI/Matlab-Graph-Optimization
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlotTrajectory.m
More file actions
44 lines (27 loc) · 725 Bytes
/
PlotTrajectory.m
File metadata and controls
44 lines (27 loc) · 725 Bytes
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
function y = PlotTrajectory( Graph )
Landmarks_es = Graph.Nodes.Landmark3.Values;
Robot_es = Graph.Nodes.Pose3.Values;
PoseArray = fields(Robot_es);
sizePose = size( PoseArray,1 );
LandmarkArray = fields(Landmarks_es);
sizeLandmark = size( LandmarkArray,1 );
Position_es =[];
F_es = [];
for i=1:sizePose
pose_i = Robot_es.( PoseArray{i} );
position_i = pose_i(1:3,4);
Position_es=[Position_es position_i];
end
for i=1:sizeLandmark
f_i = Landmarks_es.( LandmarkArray{i} );
F_es=[F_es f_i];
end
plot3(Position_es(1,:), Position_es(2,:),Position_es(3,:),'b');
hold on;
plot3(F_es(1,:), F_es(2,:),F_es(3,:),'go');
xlabel('X unit,: m');
ylabel('Y unit,: m');
zlabel('Z unit,: m');
axis equal
y=0;
end