Beispiel #1
0
        if pitch != 0:
            userMovement = True

        if yaw != 0:
            userMovement = True

        if gaz != 0:
            userMovement = True

        if joystick.get_button(3) == 1 and not drone.findSphero:
            print("Start finding sphero")
            drone.findSphero = True
            drone.moveScaler = .25

            # Upper and lower bounds for circle pixel radius
            drone.minCircleRadius = 5
            drone.maxCircleRadius = 20

        if joystick.get_button(2) and drone.findSphero:
            print("Stop finding sphero")
            drone.findSphero = False

        # --- Move camera ---

        # Triggers to tilt
        if not (joystick.get_button(0) == 1) and joystick.get_axis(2) > 0.05:
            tiltDelta = scale(joystick.get_axis(2), -10)

        if not (joystick.get_button(0) == 1) and joystick.get_axis(5) > 0.05:
            tiltDelta = scale(joystick.get_axis(5), 10)
        if pitch != 0:
            userMovement = True

        if yaw != 0:
            userMovement = True

        if gaz != 0:
            userMovement = True

        if joystick.get_button(3) == 1 and not drone.findSphero:
            print("Start finding sphero")
            drone.findSphero = True
            drone.moveScaler = .25

            # Upper and lower bounds for circle pixel radius
            drone.minCircleRadius = 5
            drone.maxCircleRadius = 20

        if joystick.get_button(2) and drone.findSphero:
            print("Stop finding sphero")
            drone.findSphero = False

        # --- Move camera ---

        # Triggers to tilt
        if not(joystick.get_button(0) == 1) and joystick.get_axis(2) > 0.05:
            tiltDelta = scale(joystick.get_axis(2), -10)

        if not(joystick.get_button(0) == 1) and joystick.get_axis(5) > 0.05:
            tiltDelta = scale(joystick.get_axis(5), 10)