def getRotCount(self, axis): """*UNUSED* determines actual number of rotations in case of rotary actuator. """ self.rotcount = ANC350lib.Int32(0) ANC350lib.positionerGetRotCount(self.handle, axis, ctypes.byref(self.rotcount)) return self.rotcount.value
def getReferenceRotCount(self, axis): """*UNUSED* determines actual position of addressed axis. """ self.rotcount = ANC350lib.Int32(0) ANC350lib.positionerGetReferenceRotCount(self.handle, axis, ctypes.byref(self.rotcount)) return self.rotcount.value
def getReference(self, axis): """*UNUSED* determines distance of reference mark to origin. """ self.pos = ANC350lib.Int32(0) self.validity = ctypes.c_bool(None) ANC350lib.positionerGetReference(self.handle, axis, ctypes.byref(self.pos), ctypes.byref(self.validity)) return self.pos.value, self.validity.value
def getFrequency(self, axis): """Determines the frequency on the stepper. :param axis: axis number from 0 to 2 for steppers :type axis: integer :return: measured frequency in Hz """ self.freq = ANC350lib.Int32(0) ANC350lib.positionerGetFrequency(self.handle, axis, ctypes.byref(self.freq)) return self.freq.value
def connect(self): """| Establishes connection to the first attocube device found. | **Pay attention: the 0 that you give to the ANC350lib.Int32 is the first attocube device; not the first of the 6 positioners.** """ self.handle = ANC350lib.Int32(0) try: ANC350lib.positionerConnect(0, ctypes.byref( self.handle)) #0 means "first device" self.logger.info('connected to first (and only) attocube device') except Exception as e: self.logger.error('unable to connect!') raise e
def getDcLevel(self, axis): """| Determines the status actual DC level on the scanner (or stepper). | **Again: the 0 is for the number of controller units, not the 6 positioners.** :param axis: axis number from 3 to 5 for scanners :type axis: integer :return: measured DC level in mV """ self.dclev = ANC350lib.Int32(0) ANC350lib.positionerGetDcLevel(self.handle, axis, ctypes.byref(self.dclev)) return self.dclev.value
def getSpeed(self, axis): """| Determines the actual speed. | In case of standstill of this actor this is the calculated speed resultingfrom amplitude setpoint, frequency, and motor parameters. | In case of movement this is measured speed. :param axis: axis number from 0 to 2 for steppers :type axis: integer :return: speed in nm/s """ self.spd = ANC350lib.Int32(0) ANC350lib.positionerGetSpeed(self.handle, axis, ctypes.byref(self.spd)) return self.spd.value
def getPosition(self, axis): """| Determines actual position of addressed stepper axis. | **Pay attention: the sensor resolution is specified for 200nm.** :param axis: axis number from 0 to 2 for steppers :type axis: integer :return: position in nm """ self.pos = ANC350lib.Int32(0) ANC350lib.positionerGetPosition(self.handle, axis, ctypes.byref(self.pos)) return self.pos.value
def capMeasure(self, axis): """| Determines the capacitance of the piezo addressed by axis. | **Pay attention: the 0 that you give to the ANC350lib.Int32 is the first Attocube device; not the first of the 6 positioners.** :param axis: axis number from 0 to 2 for steppers and 3 to 5 for scanners :type axis: integer :return: capacitance value in mF """ self.status = ANC350lib.Int32(0) ANC350lib.positionerCapMeasure(self.handle, axis, ctypes.byref(self.status)) return self.status.value
def getAmplitude(self, axis): """| Determines the actual amplitude. | In case of standstill of the actor this is the amplitude setpoint. | In case of movement the amplitude set by amplitude control is determined. :param axis: axis number from 0 to 2 for steppers :type axis: integer :return: measured amplitude in mV """ self.status = ANC350lib.Int32(0) ANC350lib.positionerGetAmplitude(self.handle, axis, ctypes.byref(self.status)) return self.status.value
def getStepwidth(self, axis): """| Determines the step width. | In case of standstill of the motor this is the calculated step width resulting from amplitude setpoint, frequency, and motor parameters. | In case of movement this is measured step width. :param axis: axis number from 0 to 2 for steppers :type axis: integer :return: stepwidth in nm """ self.stepwdth = ANC350lib.Int32(0) ANC350lib.positionerGetStepwidth(self.handle, axis, ctypes.byref(self.stepwdth)) self.logger.debug('stepwidth is here ' + str(self.stepwdth.value)) return self.stepwdth.value
def getStatus(self, axis): """| Determines the status of the selected axis. | *It is not clear whether it also works for the scanner, or only for the stepper.* | result: bit0 (moving) (+1), bit1 (stop detected) (+2), bit2 (sensor error) (+4), bit3 (sensor disconnected) (+8). :param axis: axis number from 0 to 2 for steppers and 3 to 5 for scanners :type axis: integer :return: 1: moving, 2: stop detected, 4: sensor error, 8: sensor disconnected """ self.status = ANC350lib.Int32(0) ANC350lib.positionerGetStatus(self.handle, axis, ctypes.byref(self.status)) status = self.status.value out = {} out['moving'] = (status & 1) == 1 out['stop'] = (status & 2) == 2 out['error'] = (status & 4) == 4 out['disconnected'] = (status & 8) == 8 return out