% bw1=load('c1/bw_logger_9_17_18_16.log');
% bw2=load('c2/bw_logger_9_17_18_38.log');
% bw3=load('c3/bw_logger_9_17_18_16.log');
% cpu1=load('c1/cpu_logger_9_17_18_16.log');
% cpu2=load('c2/cpu_logger_9_17_18_38.log');
% cpu3=load('c3/cpu_logger_9_17_18_16.log');
% t1=load('c1/respInfo.log');
% t2=load('c2/respInfo.log');
% t3=load('c3/respInfo.log');
% hostcp=load('cpu_logger_9_17_19_33.log');
% hostcpu=load('/home/wang/Project/voronoi-loc/lujia/icra13code/log/test1/cpu_logger_9_17_18_14.log');
%
% %correct time difference
% cpu2(:,1) = cpu2(:,1) - 1287;
% cpu3(:,1) = cpu3(:,1) + 30;
% bw2(:,1) = bw2(:,1) - 1287;
% bw3(:,1) = bw3(:,1) + 30;
% t2(:,4) = t2(:,4) - 1287;
% t3(:,4) = t3(:,4) + 30;
% t2(:,5) = t2(:,5) - 1287;
% t3(:,5) = t3(:,5) + 30;
% hostcp(:,1) = hostcp(:,1) - 4649;
% hostcpu(:,1) = hostcpu(:,1) + 100;
%
% t0 = cpu1(1,1);
% cpu1(:,1) = cpu1(:,1) - t0;
% cpu2(:,1) = cpu2(:,1) - t0;
% cpu3(:,1) = cpu3(:,1) - t0;
% bw1(:,1) = bw1(:,1) - t0;
% bw2(:,1) = bw2(:,1) - t0;
% bw3(:,1) = bw3(:,1) - t0;
% t1(:,4) = t1(:,4) - t0;
% t2(:,4) = t2(:,4) - t0;
% t3(:,4) = t3(:,4) - t0;
% t1(:,5) = t1(:,5) - t0;
% t2(:,5) = t2(:,5) - t0;
% t3(:,5) = t3(:,5) - t0;
% hostcp(:,1) = hostcp(:,1) - t0;
% hostcpu(:,1) = hostcpu(:,1) - t0; % old
% %correct time tails
%
% %plot compared host cpu usage
% figure
% plot(hostcp(:,1), hostcp(:,2), 'b*-', 'LineWidth', 3)
% hold on
% plot(hostcpu(:,1), hostcpu(:,2), 'ro-', 'LineWidth', 3)
% xlabel('Time Sequence', 'FontName', 'Times New Roman', 'Fontsize', 14, 'FontWeight', 'bold')
% ylabel('CPU Usage', 'FontName', 'Times New Roman', 'Fontsize', 14, 'FontWeight', 'bold')
% legend('Without Control','With Control','FontName', 'Times New Roman', 'Fontsize', 14,'FontWeight','bold')
%
% plot bw info
figure
set(gca, 'FontName', 'Times New Roman', 'Fontsize', 14, 'FontWeight', 'bold');
plot(bw1(:,1), bw1(:,2), 'bo-', 'LineWidth', 3)
hold on
plot(bw2(:,1), bw2(:,2), 'rx-', 'LineWidth', 3)
plot(bw3(:,1), bw3(:,2), 'g.-', 'LineWidth', 3)
xlabel('Time Sequence', 'FontName', 'Times New Roman', 'Fontsize', 14, 'FontWeight', 'bold')
ylabel('Bandwidth Usage / Ping Delay', 'FontName', 'Times New Roman', 'Fontsize', 14, 'FontWeight', 'bold')
legend('Robot 1','Robot 2','Robot 3','FontName', 'Times New Roman', 'Fontsize', 14,'FontWeight','bold')
% plot ToR
figure;
set(gca, 'FontName', 'Times New Roman', 'Fontsize', 14, 'FontWeight', 'bold');
plot(t1(:,4), t1(:,6), 'bo-', 'LineWidth', 3)
hold on
plot(t2(:,4), t2(:,6), 'rx-', 'LineWidth', 3)
plot(t3(:,4), t3(:,6), 'g.-', 'LineWidth', 3)
xlabel('Time Sequence', 'FontName', 'Times New Roman', 'Fontsize', 14, 'FontWeight', 'bold')
ylabel('Time to Response', 'FontName', 'Times New Roman', 'Fontsize', 14, 'FontWeight', 'bold')
legend('Robot 1','Robot 2','Robot 3','FontName', 'Times New Roman', 'Fontsize', 14,'FontWeight','bold')
icra13code/log