Esempio n. 1
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        self.host = self.config.get("host")
        self.__current_selected_channel = None
        self.lock = gevent.lock.RLock()
        self.__busy = False
Esempio n. 2
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        self.TADmin = self.config.get("TADmin", int, default = 150000)
        self.TADmax = self.config.get("TADmax", int, default = 700000)

        self.factor = 0
        self.offset = 0
        self.__move_task = None

        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 = 4
        # set default factor and offset for TAD to micron calculation
        # from Leo Rousset
        self.factor = self.config.get("factor", float, default = 1.92782,)
        # dto. but this is depending on the installation
        self.offset = self.config.get("offset", float, default = 0)

        # setting it to self.factor is setting it to 1 micro tolerance
        self.tns_allowed_divergence = self.config.get("tns_allowed_divergence", float, default = self.factor)

        self.cname = "PiezoJack"
        self._hw_status = AxisState("READY")
Esempio n. 3
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        self._axis_moves = {}

        self.factor = 1

        # config
        _target_attribute_name = self.config.get("target_attribute")
        _gating_ds = self.config.get("gating_ds")

        try:
            self.target_attribute = AttributeProxy(_target_attribute_name)
        except:
            elog.error("Unable to connect to attrtribute %s " % _target_attribute_name)

        # External DS to use for gating.
        # ex: PI-E517 for zap of HPZ.
        if _gating_ds is not None:
            self.gating_ds = DeviceProxy(_gating_ds)
            self.external_gating = True
            elog.info("external gating True ; gating ds= %s " % _gating_ds)
        else:
            # No external gating by default.
            self.external_gating = False

        # _pos0 must be in controller unit.
        self._pos0 = self.target_attribute.read().value * self.factor
        elog.info("initial position : %g (in ctrl units)" % self._pos0)
Esempio n. 4
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 = 0  # 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
Esempio n. 5
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        self.addr_dict = []
        host, port = self.config.get("exporter_address").split(":")
        self.addr_dict["address"] = host
        self.addr_dict["port"] = int(port)
        self.pos_attr_suffix = "Position"
        self.state_cmd = "getMotorState"
Esempio n. 6
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        self.axis_info = dict()

        try:
            self.ds_name = self.config.get("ds_name")
        except:
            elog.debug("no 'ds_name' defined in config for %s" % name)
Esempio n. 7
0
    def __init__(self, name, config, axes, encoders):
        """Contructor"""
        Controller.__init__(self, name, config, axes, encoders)

        # Records the list of axes
        self.axes_names = []
        self.axis_list  = {}

        # Underlying libicepap object
        self.libdevice = {}
        self.libtraj   = {}
Esempio n. 8
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        self._axis_moves = {}
        self.__encoders = {}

        self.__error_mode = False
        self._hw_status = AxisState("READY")
        self.__hw_limit = (None, None)

        self._hw_status.create_state("PARKED", "mot au parking")

        # Access to the config.
        try:
            self.host = self.config.get("host")
        except:
            elog.debug("no 'host' defined in config for %s" % name)

        # Adds Mockup-specific settings.
        self.axis_settings.add('init_count', int)
        self.axis_settings.add('atrubi', float)
        self.axis_settings.add('round_earth', bool)
        self.axis_settings.add('geocentrisme', bool)
Esempio n. 9
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        self._controller_error_codes = [
            (0x8000, "Abnormal reset detected."),
            (0x4000, "ComPic cannot communicate internally with MotorPic1 or MotorPic2"),
            (0x2000, "MotorPic2 has sent an unexpected response (internal error)"),
            (0x1000, "MotorPic1 has sent an unexpected response (internal error)"),
            (0x800, "Error reading ADC. A voltage could not be read"),
            (0x400, "48V level low or high current draw detected"),
            (0x200, "5V level on driver board outside limits"),
            (0x100, "3V3 level on driver board outside limits"),
            (0x80, "Sensor board communication error detected"),
            (0x40, "Parity or frame error RS422 sensor UART. Check cable/termination"),
            (0x20, "Wrong data format on external sensor (RS422 or TCP/IP)"),
            (0x10, "External sensor not detected (RS422 and TCP/IP)"),
            (0x08, "Problem with UART on host. Check cable and termination"),
            (0x04, "Host command error - driver board (e.g. buffer overrun)"),
            (0x02, "300 ms command timeout ocurred"),
            (0x01, "Command execution gave a warning"),
        ]

        self._motor_error_codes = [
            (0x80, "48V low or other critical error, motor is stopped"),
            (0x40, "Temperature limit reached, motor is stopped"),
            (0x20, "Motor is parked"),
            (0x10, "Max or min encoder limit was reached in target mode, \
            or motor was stopped due to external limit signal "),
            (0x8, "Target mode is active"),
            (0x4, "Target position was reached (if target mode is active). \
            Also set during parking/unparking. "),
            (0x2, "Motor direction"),
            (0x1, "Motor is running"),
        ]

        self.host = self.config.get("host")
Esempio n. 10
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        self.host = self.config.get("host")
        self.cname = "E753"
Esempio n. 11
0
 def __init__(self, name, config, axes, encoders):
     """Contructor"""
     Controller.__init__(self, name, config, axes, encoders)
Esempio n. 12
0
    def __init__(self, name, config, axes, encoders):
        """Contructor"""
        Controller.__init__(self, name, config, axes, encoders)

        self.libdevice = None
Esempio n. 13
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        self.serial_line = self.config.get("serial_line")
Esempio n. 14
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        self.host = self.config.get("host")
        self.socket_lock = lock.Semaphore()
Esempio n. 15
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        # Gets host from xml config.
        self.host = self.config.get("host")
Esempio n. 16
0
 def __init__(self, name, config, axes, encoders):
     Controller.__init__(self, name, config, axes, encoders)
Esempio n. 17
0
    def __init__(self, name, config, axes, encoders):
        Controller.__init__(self, name, config, axes, encoders)

        # Gets DS name from xml config.
        self.ds_name = self.config.get("ds_name")