-
Notifications
You must be signed in to change notification settings - Fork 2
/
plottinScript.m
89 lines (80 loc) · 3.24 KB
/
plottinScript.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
%% Plotting script
%assumes is run as part of main, having params and dataset already loaded.
%script options
all=false;
noOffset=false;
onlyWSpace=true;
filtered=true;
%numbered as the filed in input.ftData
if(noOffset || all)
% compute the offset that minimizes the difference with
% the estimated F/T (so if the estimates are wrong, the offset
% estimated in this way will be totally wrong)
for ftIdx =1:length(sensorsToAnalize)
ft = sensorsToAnalize{ftIdx};
[ftDataNoOffset.(ft),offset.(ft)]=removeOffset(dataset.ftData.(ft),dataset.estimatedFtData.(ft));
[filteredNoOffset.(ft),filteredOffset.(ft)]=removeOffset(dataset.filteredFtData.(ft),dataset.estimatedFtData.(ft));
end
dataset.ftDataNoOffset=ftDataNoOffset;
dataset.filteredNoOffset=filteredNoOffset;
end
if(~onlyWSpace || all)
for ftIdx =1:length(sensorsToAnalize)
ft = sensorsToAnalize{ftIdx};
if(~noOffset || all)
% Plot ftDataNoOffset and/vs estimatedFtData
if(~filtered ||all)
FTplots(struct(ft,dataset.ftData.(ft),strcat('estimated',ft),dataset.estimatedFtData.(ft)),dataset.time);
else
FTplots(struct(ft,dataset.filteredFtData.(ft),strcat('estimated',ft),dataset.estimatedFtData.(ft)),dataset.time);
end
end
if(noOffset || all)
% Plot ftDataNoOffset and/vs estimatedFtData
if(~filtered ||all)
FTplots(struct(ft,dataset.ftDataNoOffset.(ft),strcat('estimated',ft),dataset.estimatedFtData.(ft)),dataset.time);
else
FTplots(struct(ft,dataset.filteredNoOffset.(ft),strcat('estimated',ft),dataset.estimatedFtData.(ft)),dataset.time);
end
end
end
end
if(onlyWSpace || all)
% Plot forces in wrench space
if(~noOffset || all)
% %with offset
for ftIdx =1:length(sensorsToAnalize)
ft = sensorsToAnalize{ftIdx};
if(~filtered ||all)
figure,plot3_matrix(dataset.ftData.(ft)(:,1:3));hold on;
else
figure,plot3_matrix(dataset.filteredFtData.(ft)(:,1:3));hold on;
end
plot3_matrix(dataset.estimatedFtData.(ft)(:,1:3)); grid on;
legend('measuredData','estimatedData','Location','west');
title(strcat({'Wrench space '},escapeUnderscores(ft))); % title(strcat({'Wrench space '},ft), 'Interpreter', 'none');
xlabel('F_{x}');
ylabel('F_{y}');
zlabel('F_{z}');
axis equal;
end
end
if(noOffset || all)
%without offset
for ftIdx =1:length(sensorsToAnalize)
ft = sensorsToAnalize{ftIdx};
if(~filtered ||all)
figure,plot3_matrix(dataset.ftDataNoOffset.(ft)(:,1:3));hold on;
else
figure,plot3_matrix(dataset.filteredNoOffset.(ft)(:,1:3));hold on;
end
plot3_matrix(dataset.estimatedFtData.(ft)(:,1:3)); grid on;
legend('measuredDataNoOffset','estimatedData','Location','west');
title(strcat({'Wrench space '},escapeUnderscores(ft)));
xlabel('F_{x}');
ylabel('F_{y}');
zlabel('F_{z}');
axis equal;
end
end
end