-
Notifications
You must be signed in to change notification settings - Fork 0
/
viz.m
79 lines (65 loc) · 1.9 KB
/
viz.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
function viz(robot, outTrajectory, targetPositions, outJointStates)
ax = show(robot,outJointStates(:,end));
% Font
ax.FontName = "Arial Narrow";
ax.FontSize = 12;
ax.FontWeight = "bold";
% Ticks
ax.XTick = [-1.5 -1 -0.5 0 0.5 1 1.5];
ax.XTickLabel = [-1.5 -1 -0.5 0 0.5 1 1.5];
ax.XTickMode = "manual";
ax.XTickLabelMode = "auto";
ax.YTick = [-1.5 -1 -0.5 0 0.5 1 1.5];
ax.YTickLabel = [-1.5 -1 -0.5 0 0.5 1 1.5];
ax.YTickMode = "manual";
ax.YTickLabelMode = "auto";
ax.ZTick = [0 0.5 1 1.5];
ax.ZTickLabel = [0 0.5 1 1.5];
ax.ZTickMode = "manual";
ax.ZTickLabelMode = "auto";
% Rulers
ax.XLim = [-1.0 1.0];
ax.XLimMode = "manual";
ax.XAxisLocation = "origin";
ax.XColor = [1 0 0];
ax.XColorMode = "manual";
ax.YLim = [-1.0 1.0];
ax.YLimMode = "manual";
ax.YAxisLocation = "origin";
ax.YColor = [0 1 0];
ax.YColorMode = "manual";
ax.ZLim = [0 1.0];
ax.ZLimMode = "manual";
ax.ZColor = [0 0 1];
ax.ZColorMode = "manual";
% Grids
ax.XGrid = "on";
ax.YGrid = "on";
ax.ZGrid = "on";
ax.GridColor = [0.15 0.15 0.15];
ax.GridColorMode = "manual";
% Position
ax.OuterPosition = [0 0.023619631901841 1 0.785276073619632];
ax.InnerPosition = [0.13 0.11 0.775 0.815];
ax.Position = [0.13 0.11 0.775 0.64];
ax.PlotBoxAspectRatio = [2 2 1];
ax.PlotBoxAspectRatioMode = "manual";
% View
ax.View = [45 45];
ax.Projection = "orthographic";
ax.CameraPosition = [10 -10 10];
ax.CameraPositionMode = "manual";
ax.CameraTarget = [0 0 0];
ax.CameraTargetMode = "manual";
ax.CameraUpVector = [0 0 1];
ax.CameraUpVectorMode = "auto";
ax.CameraViewAngle = 10;
[~, numWP] = size(targetPositions);
xyz = zeros(numWP, 3);
for i = 1:size(outTrajectory,3)
xyz(i,:) = tform2trvec(outTrajectory(:,:,i));
end
hold on
plot3(ax, xyz(:,1),xyz(:,2),xyz(:,3),'-k','LineWidth',2);
plot3(ax, targetPositions(1,:),targetPositions(2,:),targetPositions(3,:),'--r','LineWidth',2)
hold off