예제 #1
0
파일: relay.py 프로젝트: cadenai/byodr
 def setup(self):
     _hash = hash_dict(**self._config())
     if _hash != self._config_hash:
         self._config_hash = _hash
         return self._reboot()
     else:
         return []
예제 #2
0
파일: app.py 프로젝트: cadenai/byodr
 def __init__(self, sessions, photos, **kwargs):
     super(EventHandler, self).__init__()
     self._hash = hash_dict(**kwargs)
     self._record_dir = sessions
     self._photo_dir = photos
     self._quit_event = threading.Event()
     _errors = []
     self._process_frequency = parse_option('clock.hz', int, 100, _errors,
                                            **kwargs)
     self._publish_frequency = parse_option('publish.hz', int, 2, _errors,
                                            **kwargs)
     self._vehicle = parse_option('constant.vehicle.type', str,
                                  'vehicle.byodr.2020', _errors, **kwargs)
     self._config = parse_option('constant.vehicle.config', str, 'latest',
                                 _errors, **kwargs)
     _im_width, _im_height = parse_option('image.persist.scale', str,
                                          '320x240', _errors,
                                          **kwargs).split('x')
     self._im_height = int(_im_height)
     self._im_width = int(_im_width)
     self._session_active = False
     self._session_log = ImageEventLog()
     self._photo_log = ImageEventLog()
     self._recorder = get_or_create_recorder(
         mode='record.mode.interventions',
         directory=self._record_dir,
         vehicle_type=self._vehicle,
         vehicle_config=self._config)
     self._errors = _errors
예제 #3
0
 def setup(self):
     if self.active():
         _config = self._config()
         _hash = hash_dict(**_config)
         if _hash != self._config_hash:
             self._config_hash = _hash
             self._check_user_file()
             _restarted = self._handler.restart(**_config)
             if _restarted:
                 self.ipc_server.register_start(self._handler.get_errors(),
                                                self._capabilities())
                 _frequency = self._handler.get_process_frequency()
                 self.set_hz(_frequency)
                 self.logger.info("Processing at {} Hz.".format(_frequency))
예제 #4
0
파일: app.py 프로젝트: cadenai/byodr
 def setup(self):
     if self.active():
         _config = self._config()
         _hash = hash_dict(**_config)
         if _hash != self._config_hash:
             self._config_hash = _hash
             if self._handler is not None:
                 self._handler.quit()
             self._handler = EventHandler(sessions=self._recorder_dir,
                                          photos=self._photo_dir,
                                          **_config)
             self._handler.start()
             self.ipc_server.register_start(self._handler.get_errors())
             _process_hz = self._handler.get_application_frequency()
             _publish_hz = self._handler.get_publish_frequency()
             self.set_hz(_process_hz)
             self._publish_duration = 1. / _publish_hz
             self.logger.info(
                 "Processing at {} Hz publishing at {} Hz.".format(
                     _process_hz, _publish_hz))
예제 #5
0
파일: __init__.py 프로젝트: cadenai/byodr
 def start(self, **kwargs):
     with self._lock:
         self._errors = self.internal_start(**kwargs)
         self._hash = hash_dict(**kwargs)
         self._num_starts += 1
예제 #6
0
파일: __init__.py 프로젝트: cadenai/byodr
 def is_reconfigured(self, **kwargs):
     return self._hash != hash_dict(**kwargs)