Hello,
I want to detect the timing when the signal from a sensor (digital input assigned to Button#1) stops, using my script written with Timing Script v2. When I split the sensor output into the NI board and the recording system and record the sensor-off timing from MonkeyLogic (I send an event code from MonkeyLogic to the recording system) and directly from the sensor, there is about 50 msec of delay between the termination of signal to the recording system and the reception of the event code from MonkeyLogic.
When I tested the same sensor-off timing gap using a script written with Timing Script v1, the gap between sensor-off timings from the two routes (via MonkeyLogic and direct input) was less than 1 msec. Therefore, I guess there is a problem with my way of detecting the sensor-off timing with the Timing Script v2.
Below is part of my script that monitors the sensor state and sends an error code if the “LooseHold” adapter does not return success in Scene1 and 3. The sensor-off timing is detected by combining “NotAdapter” and “WaitThenHold” adapters in Scene4. The break time used in Scene1 and 3 is 100 msec.
The time stamps for the successful termination of hk_off4 in Scene4 have about 50 msec delay relative to the direct sensor inputs, whereas the time stamps for the unsuccessful termination of Scene1 and 3 have about 150 msec delay relative to the direct sensor output (additional 100 msec may due to the break time).
Can anyone find the issue with my script?
Thank you!
%% Scene1: detect the home-key onset then check the home-key hold during the pre-instruction-delay
hk_cap1 = SingleButton(button_);
hk_cap1.Button = 1;
hk_hold1 = LooseHold(hk_cap1);
hk_hold1.HoldTime = pre_inst_delay;
hk_hold1.BreakTime = break_time;
chain1 = Sequential(hk_cap1);
chain1.add(hk_hold1);
chain1.EventMarker = [110,120];
scene1 = create_scene(chain1,tlocs);
%% Scene3: check the home-key hold during the post-instruction-delay
hk_cap3 = SingleButton(button_);
hk_cap3.Button = 1;
hk_hold3 = LooseHold(hk_cap3);
hk_hold3.HoldTime = pst_inst_delay;
hk_hold3.BreakTime = break_time;
chain3 = Concurrent(hk_hold3);
if robber_flag
tc3 = TimeCounter(robber);
tc3.Duration = pst_inst_delay;
chain3.add(tc3);
elseif distractor_flag
tc3 = TimeCounter(distractor);
tc3.Duration = pst_inst_delay;
chain3.add(tc3);
end
scene3 = create_scene(chain3,tlocs);
%% Scene4: check the mvt onset and target capture
hk_cap4 = SingleButton(button_);
hk_cap4.Button = 1;
nhk_cap4 = NotAdapter(hk_cap4);
hk_off4 = WaitThenHold(nhk_cap4);
hk_off4.WaitTime = max_reaction_time;
hk_off4.HoldTime = 0;