AUV-Coop-Assembly
Master Thesis for Robotics Engineering. Cooperative peg-in-hole assembly with two underwater vehicles guided by vision
plot6DVectorDivided.m
1 function plot6DVectorDivided(rootPath, robotName, vecName)
2 
3 legFontSize = 19;
4 titleFontSize = 18;
5 ylabFontSize = 17;
6 xlabFontSize = 17;
7 
8 vecNamestr = strcat( '/', vecName, '.txt');
9 vec = importMatrices(strcat(rootPath, robotName, vecNamestr));
10 nStep = size(vec, 3);
11 
12 %millisecond indicated in missionManager
13 global sControlLoop
14 totSecondPassed = sControlLoop*(nStep-1);
15 seconds = 0:sControlLoop:totSecondPassed;
16 
17 % plot joint commands
18 figure('Renderer', 'painters', 'Position', [0 0 710 550])
19 subplot(2,1,1);
20 hold on;
21 for i = 1:3
22  a(:) = vec(i,1,:);
23  plot(seconds, a);
24 end
25 xlab = xlabel('time [s]');
26 leg = legend('$\dot{x}$','$\dot{y}$', '$\dot{z}$');
27 
28 if strcmp(vecName, 'toolVel4Collision')
29  ylab = ylabel('Linear Velocity [m/s]');
30  tq = title('Tool Velocities due to Collisions');
31 elseif strcmp(vecName, 'toolVel4Grasp')
32  ylab = ylabel('Linear Velocity [m/s]');
33  tq = title('Tool Velocities due to Grasp Constraint');
34 else
35  ylab = ylabel(' vector [?]');
36  tq = title(strcat(robotName, " LINEAR " ,vecName));
37 end
38 
39 subplot(2,1,2);
40 hold on;
41 for i = 4:6
42  a(:) = vec(i,1,:);
43  plot(seconds, a);
44 end
45 xlab2 = xlabel('time [s]');
46 
47 leg2 = legend('$w_{x}$','$w_{y}$', '$w_{z}$');
48 if strcmp(vecName, 'toolVel4Collision')
49  ylab2 = ylabel('Angular Velocity [rad/s]');
50  tq2 = title('Tool Velocities due to Collisions');
51 elseif strcmp(vecName, 'toolVel4Grasp')
52  ylab2 = ylabel('Angular Velocity [rad/s]');
53  tq2 = title('Tool Velocities due to Grasp Constraint');
54 else
55  ylab2 = ylabel(' vector [?]');
56  tq2 = title(strcat(robotName, " ANGULAR " ,vecName));
57 end
58 
59 set(leg, 'Interpreter', 'latex', 'FontSize' , legFontSize);
60 set (tq, 'Interpreter', 'latex', 'FontSize' , titleFontSize);
61 set (ylab, 'Interpreter', 'latex', 'FontSize', ylabFontSize);
62 set (xlab, 'Interpreter', 'latex', 'FontSize', xlabFontSize);
63 
64 set(leg2, 'Interpreter', 'latex', 'FontSize' , legFontSize);
65 set (tq2, 'Interpreter', 'latex', 'FontSize' , titleFontSize);
66 set (ylab2, 'Interpreter', 'latex', 'FontSize', ylabFontSize);
67 set (xlab2, 'Interpreter', 'latex', 'FontSize', xlabFontSize);
68