Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

MS XBox 360 Controller and OpenSesame 27.1

edited February 2013 in OpenSesame

Hello,

this is mainly just a report and more like a personal note by myself which may be useful for others.
From OpenSesame 27.1 onwards the Joystick-Plugin is included by default and as far as I have tested it in our lab (Win 7 Pro 64bit) it works with the MS XBox 360-USB controller (with the official XBox 360 driver installed, not just the generic Win 7 driver).

We tested all buttons and could figure out what is working and what does not work (yet) and which button matches which number to fill in as response in the joystick item of OpenSesame. As this is quite tedious, I want to document it here (in case somebody else uses the same controller or I need to look it up again ;-))

So here is the result:


Diagram from wikimedia commons, CC BY-SA 3.0 by alphatron

Button: Number in OpenSesame (tested with expyriment backend)

Face Button A (green): 1

Face Button B (red): 2

Face Button X (blue): 3

Face Button Y (yellow): 4

Left Bumper: 5

Right Bumper: 6

Trigger Left: not functional

Trigger Right: not functional

D-Pad: not functional

Start: 8

Back: 7

Left Stick: 9 (click only, axes not functional)

Right Stick: 10 (click only, axes not functional)

As I have not used the joystick plugin so far, I do not know if axes really receive a number or one has to write something like "up;down" in the response field. If somebody knows more about this or finds it out please post a comment.

Also, I did not manage to get a python inline script running, obviously, something is missing in the documentation (which module do I need to import?). This could be helpful to test more quickly what numeric codes are available. If somebody has a working example at hand and is willing to share this, wow, that would be great.

Cheers,

Johannes

Comments

  • edited February 2013

    Hi Johannes,

    Nice to see someone is using that plugin and figuring out what to do with it!

    The joystick plugin uses PyGame to communicate with joysticks and controllers. There are custom Python functions, useable in inline_script, defined in libjoystick.py. With these functions, you can use the axes, hats and balls (get_joyballs: best function name I've ever written). So it is possible to create an inline_script to use the axes.

    The joystick item, however, simply checks for buttonpresses. Axis, hat and ball movement is not read out (mostly because I found it difficult to determine what should be returned: a movement direction, movement speed, axis state etc?). Therefore, using the joystick item within OpenSesame will never allow you to use any other input than buttonpresses.

    If you (or anybody else) have some ideas on aforementioned problem with returnvalues, than please do let me know!

    Cheers!
    Edwin

    P.S. I have some working inline_code at home. Will post it when I get there (probably sometime this weekend)

  • edited 1:57PM

    It just dawned on me that I have an example online already (d'oh!). See here: https://github.com/esdalmaijer/joystick/blob/master/joystick/joystick_demonstration.opensesame

  • edited 1:57PM

    Nice to see someone is using that plugin and figuring out what to do with it!

    You'll be glad to hear that your plug-in is also being used by a PhD student here in Marseille. She takes a laptop + gamepad to schools to test kids on-site. It works really well.

  • edited February 2013

    Hi Johannes,

    If you want to test out things further, use the following code in an inline_script (be sure to add a joystick item sometime before you use the inline_script):

    from openexp.canvas import canvas
    from libjoystick import libjoystick
    
    # create canvas object
    canvas = canvas(exp)
    canvas.clear()
    
    # create joystick object
    joystick = libjoystick(exp,joybuttonlist=None,timeout=None)
    
    # create basic canvas
    joyinputs = joystick.input_options() # returns: [buttons, axes, balls, hats]
    joyinputtypes = ["buttons", "axes", "balls", "hats"]
    for i in range(0,len(joyinputtypes)):
        disptext = "You have " + str(joyinputs[i]) + " " + joyinputtypes[i]
        canvas.text(disptext, center=True, y=100+i*50,html=True)
    canvas.show()
    
    # joystick interaction
    stop = False
    timeout = 20000 # ms
    t0 = self.time()
    while not stop:
        # get input
        eventtype, value, time = joystick.get_joyinput(timeout=10)
        # present input
        if eventtype != None:
            # reset canvas
            canvas.rect(0, self.get("height")/2, self.get("width"), self.get("height")/2, fill=True, color=self.get("background"))
            # update canvas
            canvas.text(eventtype, center=True, y=self.get("height")/2+50)
            canvas.text(value, center=True, y=self.get("height")/2+100)
            canvas.show()
        # stop
        if self.time() - t0 > timeout:
            stop=True
    

    It displays any new input you give: type and input value (example: "joybuttonpress" and "4", or "joyaxismotion" and "[0 0 -1]" if you have three axes).

    Good luck with the testing!

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games