-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprojectorFigCalibrateTest.m
95 lines (84 loc) · 2.77 KB
/
projectorFigCalibrateTest.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
function projectorFigCalibrateTest(trackableName,host,calibrationFile)
% The "projectorFigCalibrateTest" function test the projector figure
% calibration. Move the trackable object around and the circle on the
% ground should project right on top of it. If it does not, run the
% projector figure calibration function again.
%
% SYNTAX: TODO: Add syntax
% output = projectorFigCalibrateTest(trackableName,host,calibrationFile)
%
% INPUTS:
% trackableName - (string)
% Name of OptiTrack trackable used for calibration routine. Name must
% match name assigned in OptiTrack's rigid bodies properties.
%
% host - (string)
% IP address or host name of computer running optitrack that is
% streaming data from the VRPN Streaming Engine.
%
% calibrationFile - (string)
% Path to projector calibration file.
%
% EXAMPLES:
% projectorFigCalibrateTest('K8','192.168.2.145','projectorFigCalData.mat');
%
% NOTES:
%
% NECESSARY FILES:
% +trackable, projectorFigure.m
%
% SEE ALSO:
% projectorFigCalibrate | projectorFigure
%
% AUTHOR:
% Rowland O'Flaherty (http://rowlandoflaherty.com)
%
% VERSION:
% Created 08-APR-2015
%-------------------------------------------------------------------------------
%% Check Inputs
% Check number of inputs
narginchk(3,3)
% Check input arguments for errorss
assert(ischar(trackableName),...
'projectorFigCalibrateTest:trackableName',...
'Input argument "trackableName" must be a string')
assert(ischar(host),...
'projectorFigCalibrateTest:host',...
'Input argument "host" must be a string')
assert(ischar(calibrationFile) && exist(calibrationFile,'file') == 2,...
'projectorFigCalibrateTest:calibrationFile',...
'Input argument "calibrationFile" must be valid path to a calibration file.')
%% Splash info
clc
fprintf('+===========================================+\n');
fprintf('| Projector Figure Calibration Test Routine |\n');
fprintf('+===========================================+\n');
fprintf('\n');
fprintf('Testing calibration file:\n%s\n',calibrationFile);
fprintf('\n');
fprintf('Move trackable object around.\n');
fprintf('The circle on floor should follow it.\n');
fprintf('If it does not follow it,\n');
fprintf('re-run the "projectorFigCalibrate" function.\n');
fprintf('\n');
fprintf('Press ctrl-c to stop test program.');
%% Create figure
close all
projectorFigure(calibrationFile,true);
%% Create trackable
T = trackable.trackable(false,trackableName,host);
T.init();
T.orientationGlobalRotation_ = quaternion([0 0 pi])' * T.orientationGlobalRotation_;
T.update();
%% Initialize circle
lineH = plot(T.position(1),T.position(2),'o','MarkerSize',40,'MarkerFaceColor','w');
drawnow;
%% Follow
while 1
T.update();
lineH.XData = T.position(1);
lineH.YData = T.position(2);
pause(.001);
end
end