Resetting/Dissociating pointer location from mouse movement

nmrghe's Avatar

nmrghe

11 Aug, 2017 03:09 AM

Hi Chris,

I’m in the Jazayeri Lab, and I have a quick question for you regarding Mworks: I am currently trying to design a psychophysics experiment where I require participants (among other things) to use the mouse to move a cursor (white dot) along a horizontal line on the display. Once the cursor has reached a target location, the participant has to press a key to validate and the experiment moves on to the next trial. My issue is the following: on the next trial, I would like the cursor to reappear at the center of the display, i.e., not where the physical mouse pointer is (since the participant had just moved the mouse to previous target location). Is there a way to either dissociate mouse movement from the physical location of the hidden pointer, or alternatively, to reset the physical location of the pointer at the center of the display at the beginning of each trial?

I tried to offset the cursor position by the final location of the pointer on the previous trial, but this is not a satisfying solution since the hidden pointer eventually "runs away” from the screen, at which point the cursor cannot cover the whole screen anymore. Do you have any thoughts? Do you think I’d have a better chance to work around this issue by using a USB HID Device instead of a mouse?

Let me know when you get a chance!

PS: I had forgotten to thank you for helping me with an issue I had while trying to connect a client to a server running different version of Mworks. This problem is solved now :)

Best,
Nicolas

  1. Support Staff 1 Posted by Christopher Sta... on 12 Aug, 2017 06:35 PM

    Christopher Stawarz's Avatar

    Hi Nicolas,

    Is there a way to either dissociate mouse movement from the physical location of the hidden pointer, or alternatively, to reset the physical location of the pointer at the center of the display at the beginning of each trial?

    At present, neither of these options is supported by MWorks. Although we could add support for either of them, I think I'd prefer the second.

    Alternatively, we could enhance the mouse input device to expose the change in x/y position from one mouse-movement event to the next. Even when the cursor is "stuck" at a display boundary, the OS still provides position change information, which indicates how far the pointer would have moved if it could. Your MWorks experiment could add those position deltas to your cursor's starting position to determine its current location. I think this is probably the best option.

    Do you think I’d have a better chance to work around this issue by using a USB HID Device instead of a mouse?

    That might work, although it probably wouldn't be easy.

    The issue is that the USB HID interface is very low level. While you can get mouse position changes, the values are on an arbitrary (or, at least, unknown to me) scale. You'd have to figure out how to map them to MWorks display coordinates, and the mapping might be different for different mice.

    Also, some pointing devices (e.g. trackpads or Bluetooth mice) may not be accessible via USB HID at all.

    Chris

  2. 2 Posted by nmrghe on 12 Aug, 2017 07:30 PM

    nmrghe's Avatar

    Hi Chris,

    Thanks for getting back to me. I'd also prefer the second option, i.e, being able to reset the mouse pointer position––this is actually what I used when coding my experiment in Matlab/Psychtoolbox. The alternative you propose (working with mouse movements as opposed to cursor movements which are limited by the display boundaries) could also work for me. Any chance you could add either of these features in one of the next nightly-built versions? I don’t have a good sense of how long your to-do list is (probably long ^^), but I’m planning to run subjects on my task soon, so whenever you get a chance, I’d really appreciate if you can implement that.

    Let me know if you think that’s doable in the next few days/weeks. Also, feel free to make our conversation ‘public’ on the website if you think other people might be interested.

    Thanks!
    Nicolas

  3. Support Staff 3 Posted by Christopher Sta... on 15 Aug, 2017 02:16 PM

    Christopher Stawarz's Avatar

    Any chance you could add either of these features in one of the next nightly-built versions?

    I'm working on it. I'll try to get something in to the nightly build in the next few days.

    Chris

  4. 4 Posted by nmrghe on 15 Aug, 2017 02:20 PM

    nmrghe's Avatar

    Awesome, thank you so much!

    Nicolas

  5. Support Staff 5 Posted by Christopher Sta... on 16 Aug, 2017 01:53 PM

    Christopher Stawarz's Avatar

    Hi Nicolas,

    The current MWorks nightly build has a new action: move_mouse_cursor. Usage is straightforward: You give it a mouse input device and x/y position in degrees, and it moves the cursor to that position.

    When you have a chance, please try it out and let me know if it meets your requirements.

    Thanks,
    Chris

  6. 6 Posted by nmrghe on 16 Aug, 2017 03:38 PM

    nmrghe's Avatar

    Hi Chris,

    I just tested it, it works beautifully; simple and easy to use! thanks for being so quick at implementing this solution.

    Have a great day!
    Nicolas

  7. Christopher Stawarz closed this discussion on 16 Aug, 2017 04:17 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac