def _calibration_failure(self, sender: Device):
        log.warn("Failed to calibrate.")
        self._print_results()

        pymoab.setIcon(pymoab.Icon.BLANK)
        pymoab.setText(pymoab.Text.ERROR)
        pymoab.sync()
        sleep(2)

        sender.stop()
    def on_joy_down(self, sender: IDevice):
        menu_item = self.menu_items[self.menu_idx]
        sender.set_next_device(menu_item.device)
        pymoab.setIcon(pymoab.Icon[menu_item.icon2])
        pymoab.setText(pymoab.Text[menu_item.text])

        # save the menu item so we pop back up to this index when we return
        sender.previous_menu = self.menu_idx

        sender.stop()
    def _calibration_success(self, sender: Device):
        log.info("Calibration Success.")
        self._print_results()
        self._write_calibration(sender)

        pymoab.setIcon(pymoab.Icon.CHECK)
        pymoab.setText(pymoab.Text.CAL_COMPLETE)
        pymoab.sync()
        sleep(2)

        sender.stop()
    def _start_calibration(self):
        if self.ball_detector:
            pymoab.setIcon(pymoab.Icon.BLANK)
            pymoab.setText(pymoab.Text.CAL_INSTR)

            # start search here
            self.found_ball = False
            self.hue_low = 180
            self.hue_high = 0
            self.hue_steps = 20
            self.count = 0
            self.ball_detector.config.hue = int(180 / self.hue_steps)
            self.state = CalibrationState.WaitUser
Exemple #5
0
def signal_handler(sig, frame) -> int:
    log.info(f"Signal {sig} received, shutting down...")

    # Lower the plate and deactivate the servos
    # lowerPlate is 155º; testing a lower position of 160º
    pymoab.setServoPositions(155, 155, 155)
    pymoab.sync()
    time.sleep(0.2)

    pymoab.disableServoPower()
    pymoab.sync()
    time.sleep(0.1)

    # Clear the screen
    pymoab.setIcon(pymoab.Icon.BLANK)
    pymoab.setText(pymoab.Text.BLANK)
    pymoab.sync()
    time.sleep(0.1)

    sys.exit(0)
 def display_menu_item(self, idx: int):
     pymoab.setIcon(pymoab.Icon[self.menu_items[idx].icon])
     pymoab.setText(pymoab.Text[self.menu_items[idx].text])