def processJoystick():
joystick = pygame.joystick.Joystick(0) #Was in main while loop, does this work? *NOT TESTED
joystick.init()
for event in pygame.event.get(): # User did something
if event.type == pygame.JOYBUTTONDOWN:
if(joystick.get_button(10) == 1 and joystick.get_button(11) == 1): #press button 11 and 12 at the same time to kill
global running
running = False
if(abs(joystick.get_axis(1)) > 0.1): #has to be moved at least a little to trigger
processForwardBackward(joystick.get_axis(1)) #"1" should be the forward-backwards axis. CHECK THIS
elif(abs(joystick.get_axis(3)) > 0.1):
processYaw(joystick.get_axis(3)) #"2" should be the twist axis. CHECK THIS
else:
global motorLeft, motorRight
motorLeft = THRUSTER_MID
motorRight = THRUSTER_MID
processVertical(joystick)
processHat(joystick)
processClaw(joystick)
limitAmps()
评论列表
文章目录