psychopy.org | Reference | Downloads | Github

Foot pedal for tracking experiment on Psychopy


#1

Hi

OS: Win 10

PsychoPy version: 1.90.1

What are you trying to achieve?:
Program a “tracking” experiment using a foot pedal as a “mouse/joystick”

Can I please ask your help regarding the following question:

  1. I believe it is not possible to program a tracking experiment using the more convencional Builder interface without adding code if I am not using a mouse, isn’t it?
  2. My pedal is not exactly a convencional joystick but is a gaming devices that is able to provide x, y (and z) coordinates to my laptop (tested this outside Python/Psychopy environment).
  3. I have programed a pilot tracking task with Psychopy were I track the position of a moving object by moving a cursor object with a “mouse” (my touchpad). Now I would like to use the coordinates provided by the pedal to perform the tracking…
  4. I have been trying to add Python script to builder but I am struggling a bit… I understand that I need to use “Pyglet” or “Pygame”, which in my poor understanding are sort of “programs” based on Python that allow using joystick devices, aren’t they? I have run into some problems while trying to use Pyglet and Pygame… there is also some info in the net that Pyglet is not working well with Psychopy… I am correct? Can anyone give advice regarding whether I should try to use Pyglet or Pygame (or something else)?

Many thanks

Tiago


#2

Hi Tiago,

Re your last point, PsychoPy uses pyglet by default when to create a window. Pygame is an older alternative to pyglet. Those underlying libraries can also be used to detect events (like keypresses) that are sent to that window. As far as I can remember, pyglet doesn’t really handle joysticks very well, so this is one of the last reasons why it is still useful to create pygame windows in PsychoPy.

You’ve already shown that you can get a tracking task working with the mouse/touch pad. In principle you could do this with input from another device. But we can’t answer about how to do this without more specific details of your mystery foot pedal/gaming device.


#3

Hi Michael

The pedal is a “CH PRO PEDALS USB” (http://www.chproducts.com/Pro-Pedals-v13-d-716.html)
Basically it has 2 separate pedals that can be moved to provide x, y and also z coordinates. However I only really need the y coordinates for my tracking task…
It is classified as a “Game controller” in my control panel.
It can provide x, z and y coordinates when I test it through the devices section in the control panel:

Please see below more detailed characteristics. Sorry if I am not providing the correct / enough info… not sure what is necessary to know… Thank you!

USB-Input Device

HID-compliant game controller:

Device HID\VID_068E&PID_00F2\6&a44f59e&0&0000 was configured.
Driver Name: input.inf
Class Guid: {745A17A0-74D3-11D0-B6FE-00A0C90F57DA}
Driver Date: 06/21/2006
Driver Version: 10.0.17134.1
Driver Provider: Microsoft
Driver Section: HID_Raw_Inst.NT
Driver Rank: 0xFF1003
Matching Device Id: HID_DEVICE_SYSTEM_GAME
Outranked Drivers: input.inf:HID_DEVICE:00FF1005
Device Updated: false
Parent Device: USB\VID_068E&PID_00F2\5&6de0d46&0&4


#4

It seems you might be able to access devices like this by importing functions from either iohub:

or iolabs:
https://groups.google.com/d/msg/psychopy-users/NmubD6G-McQ/cq93b7UJ6c0J


#5

Many thanks. Will explore that route.


#6

Hi Michael

I made many attempts with iohub and iolabs and based on my experience and on the info that I have obtained (including from the programmer of iohub), neither iohub nor iolabs is able to communicate with my device… Can I ask if you can imagine any other strategy to access this type of device?

Many thanks

Tiago


#7

I really don’t know, but suggest you look for other Python libraries that might implement communicating with such devices:

e.g. googling “HID-compliant game controller python library” shows possible candidates. If it works, such a library could be imported by your PsychoPy experiment script.


#8

Thanks!