Surface Pi.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:Hill-MATE-ROV-2016-2017 作者: SeaRams 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号