forked from landoskape/vrControl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPositionSensor.m
More file actions
59 lines (52 loc) · 1.71 KB
/
PositionSensor.m
File metadata and controls
59 lines (52 loc) · 1.71 KB
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
classdef PositionSensor < EventLogging
%POSITIONSENSOR Abstract class for tracking positions from a sensor
% Takes care of logging positions and times every time readPosition is
% called. Has a zeroing function.
properties (Dependent = true)
Positions
PositionTimes
end
properties (Access = protected)
ZeroOffset = 0;
end
methods (Abstract, Access = protected)
[x, time] = readAbsolutePosition(obj)
end
methods
function clearPositionData(obj)
clearEventData(obj);
end
function value = get.Positions(obj)
value = obj.ValuesBuffer(1:obj.EventCount);
end
function value = get.PositionTimes(obj)
value = obj.TimesBuffer(1:obj.EventCount);
end
% function zero(obj, log)
% % zeros the position counter relative to sensor current position, and if
% % (optional) log is true, will log that zero in Positions and PositionTimes
% if nargin < 2
% log = false; % by default don't log zero at this time
% end
% [x1, ~, time] = readAbsolutePosition(obj);
% obj.ZeroOffset = x1;
% % if log
% % logEvent(obj, 0, time);
% % end
% end
% function [x1, x2, time] = readPosition(obj)
% % reads, logs and returns the current position. Also records
% % the time the reading was made (according to the timekeeper)
% [x1, x2, time] = readAbsolutePosition(obj);
% x1 = x1(obj.DaqChannelIdx);
% x1 = x1 - obj.ZeroOffset;
% % logEvent(obj, x1, time);
% end
% function x1 = readPositionAndZero(obj)
% [x1,~,~] = readPosition(obj);
% x1 = x1 - obj.ZeroOffset;
% obj.ZeroOffset = x1;
% obj.ZeroOffset
% end
end
end