I am working on an approach avoidance task with a joystick as response. Right now I am trying to achieve that the position of the joystick resets on a trial by trial basis, because it seems like the program saves the last location of the joystick, which contradicts the approach avoidance task.
In the first trial, everything is in a neutral position, and depending on the joystick movements the presented picture should increase or decrease in size, which works already. But as soon as the second trial starts, the picture already increases/decreases, even though the joystick was not touched. I think the reason for this is that the program does not reset the joystick position, because it increases/decreases in size just like in the trial before, which led to my assumption that the position does not reset. Could you help me find a way to reset the position?
Right now, my code looks like this:
sizeChange1 = 0.3 # Start with default size sizeChange2 = 0.45
sizeChange1 = 0.3 # Start with default size sizeChange2 = 0.45 joystickrec = joystick.device.getY() moved = False
yMove = joystick.getY() # Check whether joystick moved on Y dimension # Increase or decrease sizeChange variable # depending on direction of movement # e.g., make smaller if pushing away if yMove > 0: sizeChange1 -= .0066 sizeChange2 -= .01 elif yMove < 0: sizeChange1 += .0066 sizeChange2 += .01 if moved == False: joystickloc = joystick.getY() if joystickloc != joystickrec: moved = True thisExp.addData('Moved',round(t*1000)) # reaction time for movement