Howdy, Stranger!

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

Supported by

[solved] joystick

edited April 2012 in OpenSesame

Hi Sebastian. I'm trying to configure a gamepad using the psychopy joystick module. However, when I try to import the module using
from psychopy.hardware import joystick
OpenSesame says me that it "cannot import name joystick". Since OpenSesame 0.26 includes the last version of PsychoPy, it sounds strange.

Do you know the source of the problem?

Aside from that, have you ever tried to use a gamepad in OpenSesame? How does it work?

Thanks.

Andrea

Comments

  • edited 9:17AM

    Hi Andrea,

    The joystick module simply hasn't been included (oops), so that's explains the error. Luckily, it has been included in the Python portable distribution: http://osdoc.cogsci.nl/getting-started/running-with-python-portable

    I have personally never used a joystick, so I couldn't say much about it. But you might want to check out this discussion: http://forum.cogsci.nl/index.php?p=/discussion/comment/194

    Good luck!

    Cheers,
    Sebastiaan

  • edited 9:17AM

    Ah ok. I already tried to use the portable distribution, but it crashes when I go to run the experiment. I don't know why.

  • edited 9:17AM

    If you run into any trouble with the portable distribution, please leave a comment here: http://forum.cogsci.nl/index.php?p=/discussion/69/opensesame-portable#Item_17 I'm sure Edwin will be willing to look at it.

    Cheers!

  • edited April 2012

    Ok! I imported the hardware folder from the python portable version (that continues to crash on my computer, I'll write to Edwin about that) to OpenSesame (no installation needed version). I tried the psychopy.hardware.joystick class and it works well in OpenSesame.

    Here is a simple code by which I tested the response time of my gamepad using the PsychoPy backend. It records a gamepad button, but I'm sure it also works for the axes.

    
    from psychopy import visual, core
    from psychopy.hardware import joystick
    
    joy=joystick.Joystick(0)
    
    press = visual.TextStim(self.experiment.window, pos=(0,0), color = 'black', height = 25, font = 'Times', text = 'Press and release the key 2 on the gamepad...')
    
    start=core.Clock()
    
    while joy.getButton(2) == False:
        press.draw()
        self.experiment.window.flip()
        pass
    t1 = start.getTime()
    while joy.getButton(2) == True:
        press.draw()
        self.experiment.window.flip()
        pass
    t2 = start.getTime()
    print('Press time = ', t2-t1)
    

    I mark this post as solved! :)>-

  • edited 9:17AM

    Really, that just worked? That's good to know.

    How exactly did you do it? Did you extract the library.zip, insert the hardware folder, and re-zip it? Or did you simply paste the hardware folder into the OpenSesame folder?

    And thanks for the script, I'm sure it'll be helpful to a lot of people!

  • edited 9:17AM

    I simply first deleted the library.zip from my installation folder, then I just copied the library.zip from the portable version to the installation folder. ;)

    Previously, I tried to use Pygame to read the gamepad, but it didn't work.

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