% track the center of the track

% beep at the beginning of the tracking
fs_sin=8000;
fs0=800;
t=0 : 1/fs_sin : 0.1;
beep0 = sin(fs0*2*pi*t);

fprintf('North: ');
sound(beep0,fs_sin);
pause(10);
[~, ~, locationArray, ~, VTRecsReturned, ~] = NlxGetNewVTData(vt_acq_ent);
x_N = double(locationArray(end - 1)).*scale_x;
y_N = (-1)*double(locationArray(end)).*scale_y;
fprintf('x_N: %s , y_N: %s \r',num2str(x_N),num2str(y_N));

fprintf('East: ');
sound(beep0,fs_sin);
pause(10);
[~, ~, locationArray, ~, VTRecsReturned, ~] = NlxGetNewVTData(vt_acq_ent);
x_E = double(locationArray(end - 1)).*scale_x;
y_E = (-1)*double(locationArray(end)).*scale_y;
fprintf('x_E: %s , y_E: %s \r',num2str(x_E),num2str(y_E));

fprintf('South: ');
sound(beep0,fs_sin);
pause(10);
[~, ~, locationArray, ~, VTRecsReturned, ~] = NlxGetNewVTData(vt_acq_ent);
x_S = double(locationArray(end - 1)).*scale_x;
y_S = (-1)*double(locationArray(end)).*scale_y;
fprintf('x_S: %s , y_S: %s \r',num2str(x_S),num2str(y_S));

fprintf('West: ');
sound(beep0,fs_sin);
pause(10);
[~, ~, locationArray, ~, VTRecsReturned, ~] = NlxGetNewVTData(vt_acq_ent);
x_W = double(locationArray(end - 1)).*scale_x;
y_W = (-1)*double(locationArray(end)).*scale_y;
fprintf('x_W: %s , y_W: %s \r',num2str(x_W),num2str(y_W));

x_center=(x_N+x_E+x_S+x_W)/4;
y_center=(y_N+y_E+y_S+y_W)/4;
fprintf('center: %s , %s, \r',num2str(x_center),num2str(y_center));

sound(beep0,fs_sin);