Millisecond Forums

Two joystics at the same time

https://forums.millisecond.com/Topic5412.aspx

By piotr_styrkowiec - 2/3/2011

Hello


I would like to use two joysticks at once, this is one for the left hand and the other one for the right hand in one experiment.


I would like to have following set of right and wrong responses: with the left joystick forward - correct, back - incorrect; with the right joystick forward - incorrect, back - correct. This of course would go for one task, this is one stimulus on the screen and responses as just described.


How should I code this?


How should I label these two joysticks as two input devices? They will use two different USB com ports.


Please somebody help me.


Will be very grateful for any info.


piotr

By Dave - 2/3/2011

AFAIK, Inquisit isn't able to do this natively, i.e. it doesn't expose any means to differentiate between the two connected joysticks and will effectively treat response as if they came from a single device. Two possible solutions come to mind:


(1) Consolidate the two joysticks into a single device at the hardware level (much like http://brm.psychonomic-journals.org/content/39/4/797.full.pdf). Will require at least basic understanding of electronics and soldering skills.


(2) Consolidate the two joysticks into a single device at the software level. I.e. use a virtual driver such as GlovePie to map the inputs from both joysticks to a single virtual device. Not sure if this will work, but should be worth a shot.


Regards,


~Dave

By piotr_styrkowiec - 2/10/2011



Though I
know how to solder thankfully I didn’t have to study electronics. It’s working
pretty well with GlovePIE. Thanks a lot for advice Dave! I only wonder whether
that app adds a significant delay to the recorded RTs, this is if the responses
are stored longer in the buffer before proceeding to the CPU. Hope it’s not
working this way.  

By Dave - 2/10/2011

Hi Piotr,


thanks for reporting back. I'm glad using GlovePie seems to do the trick for you. Here are a couple of additional remarks:


I only wonder whether
that app adds a significant delay to the recorded RTs, this is if the responses
are stored longer in the buffer before proceeding to the CPU.


(1) Even if this were the case, it usually doesn't matter. In your typical within-subjects design, trials of *all* conditions would be affected equally by the potential  delay, leading only to a shift of the RT mean. The *difference* between mean RTs for the various conditions however will be unaffected, i.e., mRT1-mRT2=200ms, regardless of whether mRT1=600 and mRT2=400 or mRT1=630 and mRT=430. In Psychology, researchers are usually not interested in *absolute* RTs, but in the difference between RTs.


(2) You can effectively test for any delays introduced by GlovePie by first running the task with a single joystick (i.e., sans GlovePie) and then with the "virtual" device (i.e., with GlovePie). Then look for systematic differences in RT data for the two runs.


(3) It would be nice if you could outline the necessary configuration steps, etc. for GlovePie here. I'm sure other users wanting to do something similar would greatly appreciate it.


Thanks,


~Dave

By piotr_styrkowiec - 2/10/2011

You're right with the case of RTs - we are interested in defferences not in absolute RTs.


In respect to 'outline of the necessary configuration'. I'll do it with pleasure though please tell me what do mean exactly by that - I've never written sth like that.


piotr

By Dave - 2/10/2011

In respect to 'outline of the necessary configuration'. I'll do it with pleasure though please tell me what do mean exactly by that - I've never written sth like that.


It would be great if you could describe your GlovePie settings as well as the GlovePie script responsible for the input mapping and the related Inquisit settings (inputdevice, etc.). If there are any typical pitfalls you encountered while you worked this out, it would be nice if you could mention these, too. Maybe you can even attach a small Inquisit script and the corresponding GlovePie script to this thread (see the 'Options' tab when posting a reply).  Basically, just tell us what you had to do to get this working.


Thanks,


Dave

By piotr_styrkowiec - 2/11/2011





Responding with two joysticks in one task using
Inquisit.


Example task for the participant: when the
vertical arrow pointing up is displayed move LEFT joystick forward. When the
displayed vertical arrow is pointing down move RIGHT joystick backward. These
are the correct answers. Other answers – e.g. arrow pointing up, right joystick
forward movement etc. are incorrect.


There are 4 possible responses: left forward
and backward, right forward and backward.


We assign letters to this responses for example
this way: left forward Q, left backward W, right forward E, right backward R.


Then we write a standard script in Inquisit
that displays us arrows and we set in appropriate point valid and correct
responses


/ validresponse =
("q", "w", "e", "r")


/ correctresponse
= ("q")


or


/ correctresponse
= ("r")


We connect two joysticks to the
computer. Next we need to download the GlovePIE program (http://glovepie.org/). This program helps to
map joystick movements onto buttons presses that we need. You don’t need to
instal the GlovePIE. Once you download it, you simply open it and use it.


In the GlovePIE program in the main window we
need to write a short script:


 


var.d = 0.25  //Joystick deadzone; set to whatever you need


Key.Q = Joystick1.y<-var.d


Key.W = Joystick1.y>var.d


Key.E = Joystick2.y<-var.d


Key.R = Joystick2.y>var.d


 


This script assigns forward movement with one
joystick to the Q button press, backward movement of the same device to W
button press etc.


Be careful with setting the deadzone value. To
small will mean that even gentle hand movements will be recorded, to high value
will mean that hand movement needs to very strong in order to be recorded.  


Don’t forget to RUN the GlovePIE script before
running the Inquisit script!


Now everything should work. Run the experiment,
give few answers (right and wrong). I do it this way that if there is a 12
trials in total I first respond for 6 times only with the left hand and then 6
responses only with the right hand. I also try to keep following order of
responses: forward, backward, forward, backward etc. This is necessary for
checking which joystick is treated by the computer as the Joystick1 and which
as the Joystick2 (because we need to put the on the proper sides). In order to
do so you need to open the data file and look at the response recording. Remember
that Inquisit uses Scan Code, this is each key has a unique code. So key Q is
16, key W is 17, key E is 18 and key R is 19. Hence if you answering in the
following order: left forward, left backward, right forward, right leftward you
should obtain either this sequence 16,17,18,19 either this one 18,19,16,17. It
depends on that how your computer assigns real joysticks to Joystick1 and
Joystick2. My computer does it arbitrary. This I have got two joysticks Manta
and Genius and my computer sets Manta as the Joystick1 and Genius as the Joystick2
no matter to which comport I connect them and in which order (i.e. Manta first,
Genius second). I don’t know what is the rule unfortunately. That’s why I look
at data file and response recording. Maybe someone can help.


One important remark. As I said I have got
joysticks from two different producers. I expect that when two similar
joysticks are used they will be treated as two different devices by the
GlovePIE. This is I hope it won’t be the case that two joysticks of the same
producer will be seen as the same and will both submit responses to the
Joystick1 device for example, while the Joystick2 device won’t collect
responses. Again, maybe someone knows something about that – please tell.

By Dave - 2/11/2011

This is great! Thank you for taking the time to write this up -- much appreciated!


~Dave