Ejemplo n.º 1
0
 def __init__(self, auto_pilot=False):
     self.copter_interface = CopterInterface()
     self.auto_pilot = auto_pilot
Ejemplo n.º 2
0
class ElatedCopter():
    def __init__(self, auto_pilot=False):
        self.copter_interface = CopterInterface()
        self.auto_pilot = auto_pilot

    def configure_interface(self, auto_pilot):
        copter_logger = self.setup_logger()
        if auto_pilot:
            logging.info("Auto Pilot Mode")
            self.copter_interface.configure(auto_pilot=auto_pilot, imu_logger=copter_logger)
        else:
            logging.info("Manual Mode")
            self.copter_interface.configure()

    def setup_logger(self):
        copter_logger = CopterLogger()
        self.copter_interface.add_log_configs_dicts(copter_logger.get_interested_loggers())
        return copter_logger

    def process(self):
        print("ElatedCopter processing ...")
        cid = self.copter_interface.get_first_copter()
        if cid:
            self.copter_interface.connect(cid)
            self.configure_interface(self.auto_pilot)
        else:
            print("No copters found!!!")
        self.close()

    def close(self):
        self.copter_interface.close()