psychopy.org | Reference | Downloads | Github

Tracking physical mouse movements, not cursor

Hi.

Is there any way to record movement input from a USB mouse, even when the cursor stops at the edge of the screen? Tracking just the cursor position will not do.

The objective is to record if the participant move the mouse straight forward or backwards, from corner to corner. Initially this was done with recordings of the cursor at two separate locations, and seeing if this is a straight line up or down. The problem arises when the cursor is at the edge of the screen. Because then even a diagonal movement of the physical mouse will make the cursor move in a straight line up the sides of the screen.

I wouldn’t think this is at all possible. The operating system tells us where the mouse is and the mouse is a device designed to point at things on the screen: there is no meaningful concept of values beyond the screen pixel dimensions. PsychoPy can’t extract anything out of the mouse other than what gets passed to it from the operating system. So when you say “Tracking just the cursor position will not do.”, I’m afraid that the cursor position is the mouse position for all intents and purposes. i.e. when the mouse hits a boundary, there is simply no further change in that dimension that can be measured: we can only read it through layers of software.

Additionally, there is a lot of processing of mouse movement to generate the screen pointer signal. The screen cursor position doesn’t map linearly to the physical motion of the mouse. i.e. the movement of the mouse pointer is driven by velocity and acceleration, not just displacement. (e.g. a 1 cm displacement of the mouse when moving quickly produces a much larger displacement of the pointer on the screen than a 1 cm displacement of the mouse when it is moving slowly).

i.e. in summary, a computer mouse is not like a piece of laboratory equipment that gives us reliable measurements of a physical quantity in the world. We only get to access it via layers of intervening software.

You might be able to hack something together to do what you want by using mouse.setPos to reset the mouse to the center of the screen at regular intervals. You’ll need to do some cleverness to get a coherent trajectory out of that, but that’s the only solution I can think of that could possibly work.

1 Like