def __init__(self, config): """ Build a Controller instance. If another controller is already instantiated on the system (or if this is instantiated somewhere other than a robot) then this method will raise a RuntimeError. """ if not opentrons.config.IS_ROBOT: MODULE_LOG.warning( 'This is intended to run on a robot, and while it can connect ' 'to a smoothie via a usb/serial adapter unexpected things ' 'using gpios (such as smoothie reset or light management) ' 'will fail') self.config = config or opentrons.config.robot_configs.load() self._gpio_chardev = build_gpio_chardev('gpiochip0') self._board_revision = BoardRevision.UNKNOWN # We handle our own locks in the hardware controller thank you self._smoothie_driver = driver_3_0.SmoothieDriver_3_0_0( config=self.config, gpio_chardev=self._gpio_chardev, handle_locks=False) self._cached_fw_version: Optional[str] = None try: self._module_watcher = aionotify.Watcher() self._module_watcher.watch( alias='modules', path='/dev', flags=(aionotify.Flags.CREATE | aionotify.Flags.DELETE)) except AttributeError: MODULE_LOG.warning( 'Failed to initiate aionotify, cannot watch modules ' 'or door, likely because not running on linux')
def __init__(self, config=None): """ Initializes a robot instance. Notes ----- This class is a singleton. That means every time you call :func:`__init__` the same instance will be returned. There's only once instance of a robot. """ self.config = config or load() self._driver = driver_3_0.SmoothieDriver_3_0_0(config=self.config) self.modules = [] self.fw_version = self._driver.get_fw_version() self.INSTRUMENT_DRIVERS_CACHE = {} self.model_by_mount = {'left': None, 'right': None} # TODO (artyom, 09182017): once protocol development experience # in the light of Session concept is fully fleshed out, we need # to properly communicate deprecation of commands. For now we'll # leave it as is for compatibility with documentation. self._commands = [] self._unsubscribe_commands = None self.reset()
def __init__(self, config=None, broker=None): """ Initializes a robot instance. Notes ----- This class is a singleton. That means every time you call :func:`__init__` the same instance will be returned. There's only once instance of a robot. """ super().__init__(broker) self.config = config or load() self._driver = driver_3_0.SmoothieDriver_3_0_0(config=self.config) self._attached_modules: Dict[str, Any] = {} # key is port + model self.fw_version = self._driver.get_fw_version() self.INSTRUMENT_DRIVERS_CACHE = {} self._instruments = {} self.model_by_mount = { 'left': { 'model': None, 'id': None, 'name': None }, 'right': { 'model': None, 'id': None, 'name': None } } self._commands = [] self._unsubscribe_commands = None self._smoothie_lock = Lock() self.reset()
def __init__(self, config, loop, force=False): """ Build a Controller instance. If another controller is already instantiated on the system (or if this is instantiated somewhere other than a robot) then this method will raise a RuntimeError. If `force` is specified as `True`, delete the lockfile and connect anyway. This is intended specifically for the purpose of fixing an issue where the update server connects to get the smoothie firmware version but does not disconnect. It should only be specified true by the opentrons main server process. """ if not opentrons.config.IS_ROBOT: raise RuntimeError('{} may only be instantiated on a robot' .format(self.__class__.__name__)) try: self._lock = _Locker() except RuntimeError: if force: self._lock = None else: raise self.config = config or opentrons.config.robot_configs.load() # We handle our own locks in the hardware controller thank you self._smoothie_driver = driver_3_0.SmoothieDriver_3_0_0( config=self.config, handle_locks=False) self._cached_fw_version: Optional[str] = None
def __init__(self, config): """ Build a Controller instance. If another controller is already instantiated on the system (or if this is instantiated somewhere other than a robot) then this method will raise a RuntimeError. """ if not opentrons.config.IS_ROBOT: MODULE_LOG.warning( 'This is intended to run on a robot, and while it can connect ' 'to a smoothie via a usb/serial adapter unexpected things ' 'using gpios (such as smoothie reset or light management) ' 'will fail') self.config = config or opentrons.config.robot_configs.load() # We handle our own locks in the hardware controller thank you self._smoothie_driver = driver_3_0.SmoothieDriver_3_0_0( config=self.config, handle_locks=False) self._cached_fw_version: Optional[str] = None