Beispiel #1
0
        f"Auto-heading: {'On' if pioneer.motion.auto_heading_active else 'Off':>3}",
        2,
        4,
    )

    screen.print_at(f"Depth: {pioneer.depth} mm", 2, 6)

    screen.print_at(f"Roll: {pioneer.pose['roll']:7.2f}°", 2, 8)
    screen.print_at(f"Pitch: {pioneer.pose['pitch']:6.2f}°", 2, 9)
    screen.print_at(f"Yaw: {pioneer.pose['yaw']:8.2f}°", 2, 10)


def state_printer(pioneer: Pioneer):
    """Draws a box and fills it with information from the drone"""
    with ManagedScreen() as screen:
        effects = [
            Print(screen, Box(screen.width, 12, uni=screen.unicode_aware), 0,
                  0)
        ]
        screen.set_scenes([Scene(effects)])
        while True:
            screen.draw_next_frame()
            print_state(screen, pioneer)
            screen.refresh()
            sleep(0.2)


if __name__ == "__main__":
    p = Pioneer(slaveModeEnabled=True)
    state_printer(p)
Beispiel #2
0
def pioneer():
    from blueye.sdk import Pioneer

    return Pioneer()
Beispiel #3
0
def mocked_pioneer(mocked_clients):
    from blueye.sdk import Pioneer

    return Pioneer(autoConnect=False)
Beispiel #4
0
def mocked_slave_pioneer(mocked_clients):
    from blueye.sdk import Pioneer

    return Pioneer(autoConnect=False, slaveModeEnabled=True)
Beispiel #5
0
        elif -upper < value < -lower:
            return (value + lower) / (upper - lower)
        else:
            return 0

    def handleLeftXAxis(self, value):
        self.pioneer.motion.yaw = self.filterAndNormalize(value)

    def handleLeftYAxis(self, value):
        self.pioneer.motion.heave = self.filterAndNormalize(value)

    def handleRightXAxis(self, value):
        self.pioneer.motion.sway = self.filterAndNormalize(value)

    def handleRightYAxis(self, value):
        self.pioneer.motion.surge = -self.filterAndNormalize(value)


if __name__ == "__main__":
    try:
        p = Pioneer()
        handler = JoystickHandler(p)
        while True:
            events = inputs.get_gamepad()
            for event in events:
                if event.code in handler.eventToFunctionMap:
                    handler.eventToFunctionMap[event.code](event.state)

    except KeyboardInterrupt:
        pass