AUV-Coop-Assembly
Master Thesis for Robotics Engineering. Cooperative peg-in-hole assembly with two underwater vehicles guided by vision
plotNonCoopVel.m
1 function plotNonCoopVel(rootPath, coordName, robotName)
2 
3 legFontSize = 19;
4 titleFontSize = 18;
5 ylabFontSize = 17;
6 xlabFontSize = 17;
7 
8 
9 fileName = strcat('nonCoopVel', robotName, '.txt');
10 xDot = importMatrices(strcat(rootPath, coordName, fileName));
11 xDotSqueez = squeeze(xDot);
12 nRow = size(xDot, 1);
13 nStep = size(xDot, 3);
14 
15 %millisecond indicated in missionManager
16 global sControlLoop
17 totSecondPassed = sControlLoop*(nStep-1);
18 seconds = 0:sControlLoop:totSecondPassed;
19 
20 %plot vel
21 figure('Renderer', 'painters', 'Position', [0 0 710 550])
22 subplot(2,1,1)
23 plot(seconds, xDotSqueez(1:3,:));
24 
25 xlab = xlabel('time [s]');
26 if strcmp(robotName, 'g500_A')
27  tq = title('A: Non Cooperative Tool Linear Velocities');
28 else
29  tq = title('B: Non Cooperative Tool Linear Velocities');
30 end
31 ylab = ylabel('Velocities [m/s]');
32 leg = legend('$\dot{x}$','$\dot{y}$', '$\dot{z}$');
33 
34 subplot(2,1,2)
35 plot(seconds, xDotSqueez(4:6,:));
36 
37 xlab2 = xlabel('time [s]');
38 if strcmp(robotName, 'g500_A')
39  tq2 = title('A: Non Cooperative Tool Angular Velocities');
40 else
41  tq2 = title('B: Non Cooperative Tool Angular Velocities');
42 end
43 ylab2 = ylabel('Velocities [rad/s]');
44 leg2 = legend('$w_x$', '$w_y$', '$w_z$');
45 
46 
47 set(leg, 'Interpreter', 'latex', 'FontSize' , legFontSize);
48 set (tq, 'Interpreter', 'latex', 'FontSize' , titleFontSize);
49 set (ylab, 'Interpreter', 'latex', 'FontSize', ylabFontSize);
50 set (xlab, 'Interpreter', 'latex', 'FontSize', xlabFontSize);
51 set(leg2, 'Interpreter', 'latex', 'FontSize' , legFontSize);
52 set (tq2, 'Interpreter', 'latex', 'FontSize' , titleFontSize);
53 set (ylab2, 'Interpreter', 'latex', 'FontSize', ylabFontSize);
54 set (xlab2, 'Interpreter', 'latex', 'FontSize', xlabFontSize);
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 %% plot vel OLD
70 % figure
71 % hold on;
72 % for i = 1:nRow
73 % a(:) = xDot(i,1,:);
74 % plot(seconds, a);
75 % end
76 % xlabel('time [s]');
77 % ylab = ylabel(strcat('NonCooperative vel of ' , robotName ,' [m/s], [rad/s]'));
78 % tq = title(strcat(robotName, ' Non Cooperative vel of tool $J_{tool} \dot{y}$'));
79 %
80 % if nRow == 6
81 % leg = legend('$\dot{x}$','$\dot{y}$', '$\dot{z}$', '$w_x$', '$w_y$', '$w_z$');
82 % elseif nRow == 5
83 % leg = legend('$\dot{x}$','$\dot{y}$', '$\dot{z}$', '$w_y$', '$w_z$');
84 %
85 % end
86 % set(leg, 'Interpreter', 'latex', 'FontSize' , legFontSize);
87 % set (tq, 'Interpreter', 'latex', 'FontSize' , titleFontSize);
88 % set (ylab, 'Interpreter', 'latex', 'FontSize', ylabFontSize);
89 % hold off