1 function plotForcesTorquesWorld(rootPath, robotName, strNorm)
8 coordName = 'Coordinator/';
9 vecFor = importMatrices(strcat(rootPath, robotName, '/forces.txt'));
10 vecTor = importMatrices(strcat(rootPath, robotName, '/torques.txt'));
12 wTt = importMatrices(strcat(rootPath, coordName, fileName));
13 nStep = min( size(vecFor, 3), size(wTt, 3));
16 w_vecFor =zeros(3,nStep);
17 w_vecTor =zeros(3,nStep);
19 w_vecFor (:,i) = wTt(1:3,1:3,i) * vecFor(:,:,i);
20 w_vecTor (:,i) = wTt(1:3,1:3,i) * vecTor(:,:,i);
23 %millisecond indicated in missionManager
25 totSecondPassed = sControlLoop*(nStep-1);
26 seconds = 0:sControlLoop:totSecondPassed;
31 figure('Renderer', 'painters', 'Position', [0 0 710 550])
34 if strcmp(strNorm, 'yes')
35 plot(seconds, vecnorm(w_vecFor));
36 ylab = ylabel('norm of force [N]');
37 tq = title("Norm of force vector projected in world");
41 plot(seconds, w_vecFor);
42 leg = legend('x','y', 'z');
43 ylab = ylabel('forces [N]');
44 tq = title(strcat("forces projected in world"));
45 set(leg, 'Interpreter', 'latex', 'FontSize' , legFontSize);
49 xlab = xlabel('time [s]');
50 plot([secInsertion; secInsertion], [0,15], '--m');
51 text([secInsertion+2], [14], {
'\rightarrow Inside the hole'},
'Color',
'magenta',
'FontSize',14);
58 if strcmp(strNorm, 'yes')
59 plot(seconds, vecnorm(w_vecTor));
60 ylab2 = ylabel('norm of torque [N*m]');
61 tq2 = title('Norm of torque vector projected in world');
66 plot(seconds, w_vecTor);
67 leg2 = legend('x','y', 'z');
68 ylab2 = ylabel('torques [N*m]');
69 tq2 = title(strcat("torques projected in world"));
70 set(leg2, 'Interpreter', 'latex', 'FontSize' , legFontSize);
75 xlab2 = xlabel('time [s]');
77 plot([secInsertion; secInsertion], [ylim]', '--m');
78 text([secInsertion+2], [18.7], {
'\rightarrow Inside the hole'},
'Color',
'magenta',
'FontSize',14);
81 set (tq,
'Interpreter',
'latex',
'FontSize' , titleFontSize);
82 set (ylab,
'Interpreter',
'latex',
'FontSize', ylabFontSize);
83 set (xlab,
'Interpreter',
'latex',
'FontSize', xlabFontSize);
84 set (tq2,
'Interpreter',
'latex',
'FontSize' , titleFontSize);
85 set (ylab2,
'Interpreter',
'latex',
'FontSize', ylabFontSize);
86 set (xlab2,
'Interpreter',
'latex',
'FontSize', xlabFontSize);