Example #1
0
    def log_level(self, lvl):
        """Changes IcePAP and eMotion libraries verbose level"""

        # Change in the eMotion library
        log.level(lvl)

        # Value mapping between the two libraries
        #        eMotion == IcePAP
        #   NOTSET ==  0 == 0 == DBG_NONE
        #   DEBUG  == 10 == 4 == DBG_DATA
        #   INFO   == 20 == 2 == DBG_TRACE
        #   WARNING== 30 ==
        #   ERROR  == 40 == 1 == DBG_ERROR
        #   CRITIC == 50 ==
        #
        val = {
            log.NOTSET: 0,
            log.DEBUG: 4,
            log.INFO: 2,
            log.ERROR: 1,
        }[lvl]

        # Change in the IcePAP library
        self.libdevice.set_verbose(val)

        # Always return the current eMotion level
        self.log_info("log_level(%s) called, lib(%d)" %
                      (log.getLevelName(lvl), val))
        return log.level()
Example #2
0
    def __init__(self, name, config, axes, encoders):
        """

        :type self: ???
        """
        Controller.__init__(self, name, config, axes, encoders)

        # *Analog* limits of linear use of capacitive sensor.
        self.TADmin = self.config.get("TADmin", int, default=150000)
        self.TADmax = self.config.get("TADmax", int, default=700000)

        self.factor = 1  # conversion factor from TNS to microns.

        self._move_task = None

        # set the length of the given piezo,
        # the other needed attributes being calculated in class PiezoSize
        length = self.config.get("PiezoLength", float, 15)  # microns
        band = self.config.get("PiezoBand", float, 4)       # microns
        self._PiezoSize = PiezoSize(length, band)
        self._piezo_settle_sleep = 1  # seconds

        self._icepap_retries = 8

        # Capacitive Sensor's TNS to microns.
        # Measured by Leo Rousset in linear system.
        # 1 TNS = 1.75887 microns
        self.CS_tns2microns = 1.75887

        # leverage arm
        self.system_factor = 82.0/28.0   # ~2.93 (theorical value)
        self.system_factor = 2.8         # measured (cos taken into account in measurement...)

        # TNS to bender movement conversion factor
        self.bender_factor = self.CS_tns2microns * self.system_factor  # 4.925

        # Default factor for TNS to microns conversion   # 4.74
        # This value has shown to be different for the two sides of the mirror
        # we used for testing. It needs to be configurable.
        self.bender_factor = self.config.get("factor", float, default=self.bender_factor)

        # This value will decide in which distance from the calculated target_tns the icepap position
        # needs to be, before it is acceptable to go on to regulate the position with the piezo.
        self.tns_allowed_divergence = self.config.get("tns_allowed_divergence", float, default=0.5)

        # the controllers name. The axes will have names given by the configuration.
        self.cname = "PiezoJack"
        # one has to start somewhere. Be ready for the start.
        self._hw_status = AxisState("READY")

        # Attempt to open a logger for the controller
        self.log = alog.getLogger('Contr '+self.cname)
        # set axis logging to the same level as elog.level
        self.log.setLevel(elog.level())
        self.log.info(
            "{0:s}logging for controller {1:s}: level {2:s}{3:s}".format(bcolors.RED + bcolors.BOLD, self.cname,
                                                                         elog.getLevelName(elog.level()), bcolors.ENDC))
        self.piezo = None
        self.icepap = None
Example #3
0
    def __init__(self, *args, **kwargs):
        """

        :type self: ???
        """
        Controller.__init__(self, *args, **kwargs)

        # *Analog* limits of linear use of capacitive sensor.
        self.TADmin = self.config.get("TADmin", int, default=150000)
        self.TADmax = self.config.get("TADmax", int, default=700000)

        self.factor = 1  # conversion factor from TNS to microns.

        self._move_task = None

        # set the length of the given piezo,
        # the other needed attributes being calculated in class PiezoSize
        length = self.config.get("PiezoLength", float, 15)  # microns
        band = self.config.get("PiezoBand", float, 4)  # microns
        self._PiezoSize = PiezoSize(length, band)
        self._piezo_settle_sleep = 1  # seconds

        self._icepap_retries = 8

        # Capacitive Sensor's TNS to microns.
        # Measured by Leo Rousset in linear system.
        # 1 TNS = 1.75887 microns
        self.CS_tns2microns = 1.75887

        # leverage arm
        self.system_factor = 82.0 / 28.0  # ~2.93 (theorical value)
        self.system_factor = 2.8  # measured (cos taken into account in measurement...)

        # TNS to bender movement conversion factor
        self.bender_factor = self.CS_tns2microns * self.system_factor  # 4.925

        # Default factor for TNS to microns conversion   # 4.74
        # This value has shown to be different for the two sides of the mirror
        # we used for testing. It needs to be configurable.
        self.bender_factor = self.config.get("factor",
                                             float,
                                             default=self.bender_factor)

        # This value will decide in which distance from the calculated target_tns the icepap position
        # needs to be, before it is acceptable to go on to regulate the position with the piezo.
        self.tns_allowed_divergence = self.config.get("tns_allowed_divergence",
                                                      float,
                                                      default=0.5)

        # the controllers name. The axes will have names given by the configuration.
        self.cname = "PiezoJack"
        # one has to start somewhere. Be ready for the start.
        self._hw_status = AxisState("READY")

        # Attempt to open a logger for the controller
        self.log = alog.getLogger('Contr ' + self.cname)
        # set axis logging to the same level as elog.level
        self.log.setLevel(elog.level())
        self.log.info(
            "{0:s}logging for controller {1:s}: level {2:s}{3:s}".format(
                bcolors.RED + bcolors.BOLD, self.cname,
                elog.getLevelName(elog.level()), bcolors.ENDC))
        self.piezo = None
        self.icepap = None