Howdy, Stranger!

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

Supported by

Setting joystick axes motion as allowed response on joystick plugin

Hey y'all!

In my experiment, participants are to indicate if they have seen a stimulus by moving a joystick to the left or right. If a movement to the left stands for yes (or no) will be randomized.
I'm using the joystick plugin. If I get it right, I need to define both correct responses and allowed responses in order to receive information about accuracy and correctness of participant's answers in the data output.

My problem is that I don't know how to define x-axis movement as the allowed response in the joystick block.

I have used "joystick.get_joyinput(joybuttonlist=None, timeout=None)" to find out how the axis are handled. I got the following output: (u'joyaxismotion', [-3.0517578125e-05, -3.0517578125e-05, -3.0517578125e-05], 2203741). I know that the first three numbers stand for the x, y, and z axis and the last number for a time stamp.

I have tried to write "u'joyaxismotion' ", "joyaxismotion", "u'joyaxismotion[0]' ", and so on into the allowed response field and I always get the following error: "The variable (e.g.) 'joyaxesmotion' does not exist. Tip: Use the variable inspector (Ctrl+I) to see all variables". I get this error message even if I did create this variable.

Anyway, I'm having a tough time with this problem and I can't figure out how to solve it on my own. So I'd really appreciate it if you have some ideas and input how to handle it! :blush:

Love your work!

Comments

  • Hi,

    I have literally no idea about Joysticks or that plugin, but the error you describe usually occurs if you forget the [] in Opensesame items (see here) . So maybe try something like: [joyaxismotion]?

    Sorry for not being a better help here.

    Eduard

    Buy Me A Coffee

  • Hi Eduard!

    First and foremost - Thanks for your reply :-)

    I've tried to put [ ] around the variables I used for the "allowed response" field in the joystick plugin. It didn't work...I begin to wonder if you can set joystick motions as allowed responses at all with the plugin?

  • Okay. Then I don't know myself. Maybe you can access the joystick in an inline_script? Similarly to how you can access for example keyboards. Then you can implement an if statement that makes sure only a certain response is triggering the continuation of the script. Again, this is just guessing on my end. I don't know whether these variables are available and what they would look like.

    sorry,
    Eduard

    Buy Me A Coffee

  • Hey!

    In the end, I'm going to use the joystick plugin only to initialize the joystick. To get my problem fixed I now use:

    running = True

    t0 = time.time()        
    while running:
        # get input
        position, timestamp = joystick.get_joyaxes(timeout=50000)   #get joystick movement
        if position[1] > 0.8:                                       #define threshold of y-axis movement
            joy_dir = "down"
            joy_rt = time.time() - t0                               #reaction time
            if var.stimulus_occ == "yes":                           #correct response
                joy_cor = 1
            else:
                joy_cor = 0
            running = False
        elif position[1] < (-0.8):
            joy_dir = "up"
            joy_rt = time.time() - t0
            if var.stimulus_occ == "yes":
                joy_cor = 0
            else:
                joy_cor = 1
            running = False
    else:
        print(joy_dir)
        print(joy_rt)
        print(joy_cor)
    print("done")
    
    var.joy_y = position[1]
    var.joy_dir = joy_dir                                                   # create variables
    var.joy_rt = joy_rt
    var.joy_cor=joy_cor
    

    I feel like it's a bit inconvenient and could definitely be more elegant. Also, I'm passing on accuracy outputs and reaction time information from the plug in...but hey, it works! I'm getting the joystick movement and if it was the correct movement for the stimulus occurrence.

    I'm running in other difficulties now - I'll open another discussion for that though. Thanks a lot for your support Ed!

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