class OwlShutter(AbstractHardwarePlugin, ShutterPlugin): def _init(self): Logger().trace("OwlShutter._init()") AbstractHardwarePlugin._init(self) ShutterPlugin._init(self) self._hardware = OwlHardware() def _defineConfig(self): AbstractHardwarePlugin._defineConfig(self) ShutterPlugin._defineConfig(self) def _triggerOnShutter(self): """ Set the shutter on. """ self._hardware.setOutput(True) def _triggerOffShutter(self): """ Set the shutter off. """ self._hardware.setOutput(False) def init(self): Logger().trace("OwlShutter.init()") self._hardware.setAxis(AXIS_TABLE[self.capacity]), AbstractHardwarePlugin.init(self) def shutdown(self): Logger().trace("OwlShutter.shutdown()") self._triggerOffShutter() AbstractHardwarePlugin.shutdown(self) ShutterPlugin.shutdown(self)
def _init(self): Logger().trace("OwlAxis._init()") AbstractHardwarePlugin._init(self) AbstractAxisPlugin._init(self) self._hardware = OwlHardware()
class OwlAxis(AbstractHardwarePlugin, AbstractAxisPlugin): def _init(self): Logger().trace("OwlAxis._init()") AbstractHardwarePlugin._init(self) AbstractAxisPlugin._init(self) self._hardware = OwlHardware() def _defineConfig(self): AbstractAxisPlugin._defineConfig(self) AbstractHardwarePlugin._defineConfig(self) def init(self): Logger().trace("OwlAxis.init()") self._hardware.setAxis(AXIS_TABLE[self.capacity]), AbstractHardwarePlugin.init(self) def shutdown(self): Logger().trace("OwlAxis.shutdown()") self.stop() AbstractHardwarePlugin.shutdown(self) AbstractAxisPlugin.shutdown(self) def read(self): pos = self._hardware.read() - self._offset return pos def drive(self, pos, useOffset=True, wait=True): Logger().debug("OwlAxis.drive(): '%s' drive to %.1f" % (self.capacity, pos)) currentPos = self.read() self._checkLimits(pos) if useOffset: pos += self._offset # Only move if needed if abs(pos - currentPos) > AXIS_ACCURACY or not useOffset: self._hardware.drive(pos) # Wait end of movement if wait: self.waitEndOfDrive() def waitEndOfDrive(self): while self.isMoving(): time.sleep(config.SPY_REFRESH_DELAY / 1000.) self.waitStop() def startJog(self, dir_): self._hardware.startJog(dir_, MANUAL_SPEED_TABLE[self._manualSpeed]) def stop(self): self.__driveFlag = False self._hardware.stop() self.waitStop() def waitStop(self): pass def isMoving(self): status = self._hardware.getStatus() if status != '0': return True else: return False
def _init(self): Logger().trace("OwlShutter._init()") AbstractHardwarePlugin._init(self) ShutterPlugin._init(self) self._hardware = OwlHardware()