1 function plotGenericErrorDivided(pathName, fileName, strNorm)
9 errors = importMatrices(pathName);
10 errorsSqueezed = squeeze(errors);
11 nStep = size(errors, 3);
14 totSecondPassed = sControlLoop*(nStep-1);
15 seconds = 0:sControlLoop:totSecondPassed;
19 figure('Renderer', 'painters', 'Position', [0 0 710 550])
22 if strcmp(strNorm,'yes')
23 plot(seconds, vecnorm(errorsSqueezed(1:3,:)) );
28 plot(seconds, errorsSqueezed(1:3,:));
30 %vertical line to show where insertion begin
31 %plot([secInsertion; secInsertion], [ylim]', '--m');
32 %text([secInsertion+2], [5.6], {
'\rightarrow Inside the hole'},
'Color',
'magenta',
'FontSize',14);
35 xlab1 = xlabel(
'time [s]');
38 if strcmp(fileName,
'realgoal_Tool_error')
39 if strcmp(strNorm,'yes')
40 ylab1 = ylabel('norm of error [m]');
41 tq1 = title("Norm of Linear error between goal (real) and tool");
43 ylab1 = ylabel('errors [m]');
44 tq1 = title("Linear error between goal (real) and tool");
45 leg1 = legend('$x$','$y$', '$z$');
46 set(leg1, 'Interpreter', 'latex', 'FontSize' , legFontSize);
48 elseif strcmp(fileName, 'Tracking_error')
49 if strcmp(strNorm,'yes')
50 ylab1 = ylabel('norm [m]');
51 tq1 = title("Norm of Linear error between real pose and estimated one");
54 ylab1 = ylabel('errors [m]');
55 tq1 = title("Cartesian Linear Error");
56 leg1 = legend('$x$','$y$', '$z$');
57 set(leg1, 'Interpreter', 'latex', 'FontSize' , legFontSize);
63 if strcmp(strNorm,'yes')
64 plot(seconds, vecnorm(errorsSqueezed(4:6,:)));
69 plot(seconds, errorsSqueezed(4:6,:) );
71 %vertical line to show where insertion begin
72 %plot([secInsertion; secInsertion], [ylim]', '--m');
73 %text([secInsertion+2], [0.037], {
'\rightarrow Inside the hole'},
'Color',
'magenta',
'FontSize',14);
75 xlab2 = xlabel(
'time [s]');
77 if strcmp(fileName,
'realgoal_Tool_error')
78 if strcmp(strNorm,'yes')
79 ylab2 = ylabel('norm of error [rad]');
80 tq2 = title("Norm of Angular error between goal (real) and tool");
84 ylab2 = ylabel('errors [rad]');
85 tq2 = title("Angular error between goal (real) and tool");
86 leg2 = legend('$roll$', '$pitch$', '$yaw$');
87 set(leg2, 'Interpreter', 'latex', 'FontSize' , legFontSize);
89 elseif strcmp(fileName, 'Tracking_error')
90 if strcmp(strNorm,'yes')
91 ylab2 = ylabel('norm [rad]');
92 tq2 = title("Norm of Angular error between real pose and estimated one");
95 ylab2 = ylabel('errors [rad]');
96 tq2 = title("Cartesian Angular Error");
97 leg2 = legend('$roll$', '$pitch$', '$yaw$');
98 set(leg2, 'Interpreter', 'latex', 'FontSize' , legFontSize);
102 set(ylab1, 'Interpreter', 'latex', 'FontSize' , ylabFontSize);
103 set (tq1, 'Interpreter', 'latex', 'FontSize' , titleFontSize);
104 set(ylab2, 'Interpreter', 'latex', 'FontSize' , ylabFontSize);
105 set (tq2, 'Interpreter', 'latex', 'FontSize' , titleFontSize);
106 set (xlab1, 'Interpreter', 'latex', 'FontSize', xlabFontSize);
107 set (xlab2, 'Interpreter', 'latex', 'FontSize', xlabFontSize);
118 % a(:) = norms(i,1,:);
121 % xlabel('time [s]');
122 % ylab = ylabel('norms');
124 % tq = title("Norms (lin, ang) of Cartesian Error between the two coincident pipes");
126 % leg = legend('Linear', 'Angular');
127 % set(leg, 'Interpreter', 'latex', 'FontSize' , legFontSize);
128 % set(ylab, 'Interpreter', 'none', 'FontSize' , ylabFontSize);
130 % set (tq, 'Interpreter', 'latex', 'FontSize' , titleFontSize);