1 function [in,out]=acquireData(dataLogFileLeft,dataLogFileRight,dataLogFileHead)
2 % This
function returns the formatted data to learn the network upon.
3 % The three input files are the ones logged through yarpdatadumper.
5 %
import raw data from log files
6 dataL=dlmread(dataLogFileLeft);
7 dataR=dlmread(dataLogFileRight);
8 dataH=dlmread(dataLogFileHead);
10 %
remove the first column
15 % harmonize the starting acquisition time
16 t0=min([dataL(1,1) dataR(1,1) dataH(1,1)]);
17 dataL(:,1)=dataL(:,1)-t0;
18 dataR(:,1)=dataR(:,1)-t0;
19 dataH(:,1)=dataH(:,1)-t0;
21 %
remove the likelihood column (not used)
25 % select only the rows corresponding
26 % to
object in visibility
27 dataL=dataL(dataL(:,7)~=0,1:6);
28 dataR=dataR(dataR(:,7)~=0,1:6);
30 % the data format is now as:
34 % go on with the left/right data synchronization
35 % use the left data as pivot
43 % tilt pan ver ul vl ur vr
46 % form the output data as:
53 [~,jR]=min(abs(tR-tL(i)));
54 [~,jH]=min(abs(tH-tL(i)));
55 in(i,1:3)=dataH(jH,5:7);
65 subplot(521),hold(
'on'),grid,stairs(in(:,1));
66 ha{1}=gca;title(
'tilt');
67 set(zoom,
'ActionPostCallback',@mypostcallback);
68 set(pan,
'ActionPostCallback',@mypostcallback);
70 subplot(523),hold(
'on'),grid,stairs(in(:,2));
71 ha{2}=gca;title(
'pan');
72 set(zoom,
'ActionPostCallback',@mypostcallback);
73 set(pan,
'ActionPostCallback',@mypostcallback);
75 subplot(525),hold(
'on'),grid,stairs(in(:,3));
76 ha{3}=gca;title(
'ver');
77 set(zoom,
'ActionPostCallback',@mypostcallback);
78 set(pan,
'ActionPostCallback',@mypostcallback);
80 subplot(527),hold(
'on'),grid,stairs(in(:,[4 6]));
81 ha{4}=gca;title(
'[ul ur]');
82 set(zoom,
'ActionPostCallback',@mypostcallback);
83 set(pan,
'ActionPostCallback',@mypostcallback);
85 subplot(529),hold(
'on'),grid,stairs(in(:,[5 7]));
86 ha{5}=gca;title(
'[vl vr]');
87 set(zoom,
'ActionPostCallback',@mypostcallback);
88 set(pan,
'ActionPostCallback',@mypostcallback);
90 subplot(524),hold(
'on'),grid,stairs(out(:,1));
91 ha{6}=gca;title(
'eye-x');
92 set(zoom,
'ActionPostCallback',@mypostcallback);
93 set(pan,
'ActionPostCallback',@mypostcallback);
95 subplot(526),hold(
'on'),grid,stairs(out(:,2));
96 ha{7}=gca;title(
'eye-y');
97 set(zoom,
'ActionPostCallback',@mypostcallback);
98 set(pan,
'ActionPostCallback',@mypostcallback);
100 subplot(528),hold(
'on'),grid,stairs(out(:,3));
101 ha{8}=gca;title(
'eye-z');
102 set(zoom,
'ActionPostCallback',@mypostcallback);
103 set(pan,
'ActionPostCallback',@mypostcallback);
106 %--------------------------------------------------------------------------
107 function mypostcallback(obj,evd) %#ok<INUSL>
111 newLim=
get(evd.Axes,
'XLim');