AUV-Coop-Assembly
Master Thesis for Robotics Engineering. Cooperative peg-in-hole assembly with two underwater vehicles guided by vision
plotYDot.m
1 function plotYDot(rootPath, robotName, ydotName)
2 
3 legFontSize = 13;
4 titleFontSize = 16;
5 ylabFontSize = 15;
6 
7 yDotstr = strcat( '/', ydotName, '.txt');
8 yDot = importMatrices(strcat(rootPath, robotName, yDotstr));
9 nRow = size(yDot, 1);
10 nStep = size(yDot, 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
19 hold on;
20 for i = 1:4
21  a(:) = yDot(i,1,:);
22  plot(seconds, a);
23 end
24 xlabel('time [s]');
25 leg = legend('$\dot{q}_1$','$\dot{q}_2$', '$\dot{q}_3$', '$\dot{q}_4$');
26 ylab = ylabel('Joint command [rad/s]');
27 tq = title(strcat(robotName, ' Joint command sent (' ,ydotName, '[1:4])'));
28 set(leg, 'Interpreter', 'latex', 'FontSize' , legFontSize);
29 set (tq, 'Interpreter', 'none', 'FontSize' , titleFontSize);
30 set (ylab, 'Interpreter', 'none', 'FontSize', ylabFontSize);
31 hold off
32 
33 %plot vehicle command (TODO divide linear and ang vel??)
34 figure
35 hold on;
36 for i = 5:10
37  a(:) = yDot(i,1,:);
38  plot(seconds, a);
39 end
40 xlabel('time [s]');
41 leg = legend('$\dot{x}$','$\dot{y}$', '$\dot{z}$', '$w_x$', '$w_y$', '$w_z$');
42 ylab = ylabel('vehicle commands [m/s], [rad/s]');
43 tq = title(strcat(robotName, ' Vehicle command sent (', ydotName, '[5:10])'));
44 set(leg, 'Interpreter', 'latex', 'FontSize' , legFontSize);
45 set (tq, 'Interpreter', 'latex', 'FontSize' , titleFontSize);
46 set (ylab, 'Interpreter', 'latex', 'FontSize', ylabFontSize);
47 hold off