Joystick
 
 
 
PST User Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        


12»»

Joystick Expand / Collapse
Author
Message
Posted 11/6/2006 2:44:15 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 1/3/2008 6:52:17 PM
Posts: 3, Visits: 8
I'm looking for information on the new joystick feature of EPrime 2.0 Beta.  Specifically, what types of joysticks are compatible with EPrime (I want to make sure I buy a joystick that is compatible), and two, how is data recorded using this feature.  I am specifically interested in finding a way to record the position of the joystick on a relatively continuous basis (e.g., every 1-5 millisecond ideally) as participants view various stimuli.  If anyone has information along these lines, I would greatly appreciate it if you passed it along.
Post #20
Posted 11/7/2006 3:52:38 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Moderators
Last Login: 2/1/2008 8:32:03 AM
Posts: 13, Visits: 28
Hello,

1) Although we do not endorse any specific joystick vendor the following joysticks have been confirmed to work:
- Wingman Attack 2 from Logitech
- Various makes/models of the Microsoft Sidewinder series

It is our belief that any USB joystick device that Windows recognizes would be accessible in E-Prime.

2) The following is a code sample taken from an InLine object that can be used to continually poll a device:

Dim stickResponse As JoystickResponseData
Do
Set stickResponse = _ CJoystickResponseData(Joystick.History(Joystick.History.Count))

If (Not stickResponse Is Nothing) Then

' Use button 4 as a terminating sentinel
If (stickResponse.IsButton4) Then
Exit Do
End If

Dim displayOffsetX as integer
Dim displayOffsetY as integer

displayOffsetX = stickResponse.CursorX
displayOffsetY = stickResponse.CursorY

End If

Loop Until (False)

' Clean up
Set stickResponse = Nothing


Psychology Software Tools will be posting more robust, downloadable sample experiments in the weeks to come so please stay posted.

Thank you


-------------------------------------------
Christopher Neff
Software Engineer
Psychology Software Tools, Inc.
Post #39
Posted 12/19/2006 7:44:26 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/11/2007 5:04:23 AM
Posts: 1, Visits: 11
A related issue...I am trying to design an experiment in which subjects respond to a slide by deflecting the joystick and then pressing a button to enter their response. I would like E-Prime to log the x, y coordinates of the joystick at the time the button press occurs. Is there a code sample somewhere that does that? (or any other info on how to use a joystick in E-Prime 2)?

Thanks.

Post #113
Posted 1/16/2007 11:55:08 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 1/23/2007 7:05:06 PM
Posts: 4, Visits: 7
We are also trying to use the joystick in an experiment where the subject points in a direction using the joystick. We can get data from the joystick with the mouse emulation setting on, but we are getting screen coordinates that are constrained by the sides of the screen and we get too many data points at the 0,0 location- the same issue we faced using E-Prime 1.0 and a mouse.

Any information regarding the methods and attributes of the JoystickResponseData object that would enable us to get the change in position of the joystick from rest to the pointing position would be helpful.

Thanks.

Post #134
Posted 1/19/2007 4:34:20 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Moderators
Last Login: 2/1/2008 8:32:03 AM
Posts: 13, Visits: 28
Hello,

The following InLine code sample should hopefully provide some insight into the use of the JoystickResponseData object:

'Returns the x-coordinate of the joystick cursor when the joystick response came in.

Dim xPos As Integer
Dim joystickClicks As Integer

'joystick is listed as the 2nd 'input object, so joystick data is
'stored in InputMasks.Item(2)
joystickClicks = JoystickSlide.InputMasks.Item(2).Responses.Count

If joystickClicks > 0 Then

Dim rdJoystick1 As JoystickResponseData
Set rdJoystick1 = CJoystickResponseData(JoystickSlide.InputMasks.Item(2).Responses(1))

xPos = rdJoystick1.CursorX
If xPos <= Display.XRes/2 Then

Display.Canvas.Text 0, .75 * Display.YRes, "response " & "made on left side of display"

ElseIf xPos > Display.XRes/2 Then

Display.Canvas.Text 0, .75 * Display.YRes, "response " & "made on right side of display"

End If

Else

GoTo NoJoystickInput

End If

Sleep 2500

NoJoystickInput:
' Do Something

To change the limits of the cursor, try the following lines:

Dim centerX, centerY As Integer

centerX = Display.XRes / 2
centerY = Display.YRes / 2

' Set the cursor limit to a 50 by 50 pixel area in the center of the screen
Joystick.SetCursorLimits centerX - 50, centerY - 50, _
centerX + 50, centerY + 50

Thank you


-------------------------------------------
Christopher Neff
Software Engineer
Psychology Software Tools, Inc.
Post #143
Posted 1/23/2007 7:05:06 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 1/23/2007 7:05:06 PM
Posts: 4, Visits: 7
Chris,

Thanks for the quick response. I tried a lot of variations of the code and settings of the Joystick device in E-Prime 2.0 and I can not seem to get the joystick to move the cursor on a TextDisplay. If I move the cursor with the mouse, pressing the joystick button will initiate the response and the position of the cursor can be read (I display the x,y position on the screen and can make the values change by moving the mouse and pressing a joystick button). I just can't seem to get the joystick to move the cursor. I tested the joystick with Windows' Control Panel: Game Controller utility and it seems to to be working correctly and moves the cursor in the text box there. It is a Logitech Attack 3.

Also, I appreciate the example code to constrain the cursor, however, we want to achieve the opposite effect. We are trying to calculate the angle that the subject is pointing to from the rest position of the joystick. Constraining the cursor through code or through normal Windows' mouse movements impacts the pointing angle we are trying to capture. (If you try to point to the top left corner of a room by dragging the mouse, you'll see that the mouse pointer tends to ride up along the left side of the screen and get stuck at the top left corner or 0,0).

So, ideally, we would set the cursor at the start of each TextDisplay to the center of the screen and then ask the subject to point in a direction with the joystick. If we can read the x,y axis values of the joystick directly, we could interpolate the angle where they are pointing.

The JoystickResponseData object has CursorX and CursorY attributes. Does it have the X and Y axis values that can be read directly from the joystick?  I understand that E-Prime 2.0 is Beta, but is there any detailed documentation available yet about the Joystick device implementation?

Thanks.

Post #149
Posted 1/24/2007 8:36:13 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member