Welcome! Log In Create A New Profile

Advanced

Touching and releasing two basrs

Posted by annaipata 
Touching and releasing two basrs
June 27, 2023 01:41PM
I'm currently working on a task in MonkeyLogic that involves a series of steps. Firstly, a fixation point will appear on the screen, serving as a visual cue for the monkeys. Once the fixation point appears, the monkeys will be required to press two bars simultaneously, using their left and right hands respectively.

The bars will need to be maintained in a pressed state for a specific duration, known as the fixation time. Once the monkeys successfully maintain the bars pressed for the required fixation time, a stimulus will be presented on the screen. This stimulus will provide instructions to the monkeys regarding which hand, either left or right, should be released.

To summarize, the task flow in MonkeyLogic consists of the following steps:

Display fixation point.
Monkeys press the left and right bars simultaneously.
Bars are maintained in a pressed state for the fixation time.
Stimulus appears on the screen.
The stimulus instructs the monkeys to release either the left or right bar.

I wrote this scropt but it does not work. Any suggestions? Thank you!

% initial fixation: check if both bars are pressed
dashboard(1,'Fix Point on');
if error_type == 0
t_target =toggleobject(fixation_point, 'eventmarker',10); % turn on target)
[chosen_LeftHand,~,t_LeftHand] = eyejoytrack('touchtarget',1,fix_time)
[chosen_RightHand,~,t_RightHand] = eyejoytrack('touchtarget',2,fix_time)
if ~chosen_LeftHand | ~chosen_RightHand
toggleobject(fixation_point);
error_type = 2; % do not tiugh one or both bars
dashboard(2,'No bars not touched ')
end
end


% %=if both bars are pressed shows teh cue, but do not release the bars
if error_type == 0
dashboard(1,'Sample on');
t_target =toggleobject(sample, 'eventmarker',20); % turn on target)
[chosen_LeftHand,~,t_LeftHand] = eyejoytrack('touchtarget',1,fix_time)
[chosen_RightHand,~,t_RightHand] = eyejoytrack('touchtarget',2,fix_time)
if chosen_LeftHand | chosen_RightHand
toggleobject(fixation_point);
error_type = 3;
dashboard(2,'Bars release in advance')
end
end


% %=if both bars are pressed shows the target, and reease the left bar
if error_type == 0
dashboard(1,'Target on');
toggleobject(sample)
t_target =toggleobject(target, 'eventmarker',40); % turn on target)
[chosen_LeftHand,~,t_LeftHand] = eyejoytrack('touchtarget',1,fix_time)
[chosen_RightHand,~,t_RightHand] = eyejoytrack('touchtarget',2,fix_time)

if ~chosen_LeftHand & chosen_RightHand % if release the correct left bar
toggleobject(target);
dashboard(2,'Correct right hand reselase')
end

if chosen_LeftHand & ~chosen_RightHand % if release the wrong igh bar
toggleobject(target);
dashboard(2,'Wrong left hand reselase')
error_type = 4; % wrong trials
end

if chosen_LeftHand & chosen_RightHand % if release both hands
toggleobject(target);
dashboard(2,'Both hands released')
error_type = 5; % both hand reselsed
end

if ~chosen_LeftHand & ~chosen_RightHand % if release both hands
toggleobject(target);
dashboard(2,'Both hands not reseased ')
error_type = 6; % both hand reselsed
end
end
Re: Touching and releasing two basrs
June 27, 2023 03:49PM
There are so many things wrong. You should read the eyejoytrack manual first.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#eyejoytrack

eyejoytrack() needs at least 4 input arguments, but you wrote only 3 in every single eyejoytrack command.

You expect simultaneous input from two bars, so you need to check both of them in one eyejoytrack command, not in two separate commands.

I guess the bars are buttons, not touchscreen. Then the tracking type should be 'acquiretouch' or 'holdtouch', not 'touchtarget'.

You may need multiple eyejoytrack commands even for one step. For example, there is no guarantee that your subject will press both bars at the same time. You can start the first eyejoytrack() with two 'acquiretouch' types and then switch to 'holdtouch' for the pressed bar and keep 'acquiretouch' for the unpressed bar in the next eyejoytrack().

The timing script v2 (a.k.a. scene framework) is easier to program this kind of behavior.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.