def set_motor_group_focus_mode(self, focus_mode): """Sets a focus mode for the motors group""" for motor in self.motors_list: if ( motor["setCmd"] is not None and focus_mode in motor["focusingModes"].keys() ): if motor["velocity"] is not None: tine.set( self.server_address + "/" + motor["motorAddr"], "Velocity", motor["velocity"], ) time.sleep(0.5) motor["status"] = motor["statusModes"]["Move"] tine.set( self.server_address + "/" + motor["motorAddr"], motor["setCmd"], motor["focusingModes"][str(focus_mode)], ) logging.getLogger("HWR").debug( "EMBLMotorsGroup: send %s : %.4f" % (motor["motorAddr"], motor["focusingModes"][str(focus_mode)]) ) time.sleep(0.1) if motor["motorName"] in ("In", "Out", "Top", "But"): self.wait_motor_ready(motor["motorName"], timeout=10) time.sleep(1) logging.getLogger("HWR").debug( "EMBLMotorsGroup: motor %s ready" % motor["motorAddr"] )
def set_motor_position(self, motor_name, new_position, timeout=None): """Sets motor value. Direct tine.set cmd is used""" for motor in self.motors_list: if motor["motorName"] == motor_name: if motor["velocity"] is not None: tine.set( self.server_address + "/" + motor["motorAddr"], "Velocity", motor["velocity"], ) motor["status"] = motor["statusModes"]["Move"] tine.set( self.server_address + "/" + motor["motorAddr"], motor["setCmd"], new_position, ) logging.getLogger("HWR").debug( "EMBLMotorsGroup: send %s : %.4f" % (motor["motorAddr"], new_position) ) time.sleep(0.2) self.wait_motor_ready(motor_name, timeout=10) time.sleep(1) logging.getLogger("HWR").debug( "EMBLMotorsGroup: motor %s ready" % motor["motorAddr"] ) break
def stop_motor(self, motor_name): """Stops motor movement""" for motor in self.motors_list: if motor['motorName'] == motor_name: if motor['setCmd'] is not None: tine.set(self.server_address + self.group_address + "/" +motor_name, motor['stopCmd']) break
def stop_motor(self, motor_name): """Stops motor movement""" for motor in self.motors_list: if motor["motorName"] == motor_name: if motor["setCmd"] is not None: tine.set( self.server_address + self.group_address + "/" + motor_name, motor["stopCmd"], ) break
def stop_motor(self, motor_name): """ Descript. : stops motor movement Arguments : motor name Return : - """ for motor in self.motors_list: if motor['motorName'] == motor_name: if motor['setCmd'] is not None: tine.set(self.server_address + self.group_address + "/" +motor_name, motor['stopCmd']) break
def set_motor_focus_mode(self, motor_name, focus_mode): """Sets a focus mode for an individual motor""" for motor in self.motors_list: if motor['motorName'] == motor_name: if motor['setCmd'] is not None \ and focus_mode in motor['focusingModes'].keys(): if motor['velocity'] is not None: tine.set(self.server_address + "/" + motor['motorAddr'], 'Velocity', motor['velocity']) tine.set(self.server_address + "/" + motor['motorAddr'], motor['setCmd'], motor['focusingModes'][focus_mode]) time.sleep(1) break
def set_motor_position(self, motor_name, new_position): """ Descript. : sets motor value. Direct tine.set cmd is used Arguments : motor name, new value Return : - """ for motor in self.motors_list: if motor['motorName'] == motor_name: if motor['velocity'] is not None: tine.set(self.server_address + "/" + motor['motorAddr'], 'Velocity', motor['velocity']) tine.set(self.server_address + "/" + motor['motorAddr'], motor['setCmd'], new_position) time.sleep(0.5)
def set_motor_position(self, motor_name, new_position, timeout=None): """Sets motor value. Direct tine.set cmd is used""" for motor in self.motors_list: if motor['motorName'] == motor_name: if motor['velocity'] is not None: tine.set(self.server_address + "/" + motor['motorAddr'], 'Velocity', motor['velocity']) motor['status'] = motor['statusModes']['Move'] tine.set(self.server_address + "/" + motor['motorAddr'], motor['setCmd'], new_position) time.sleep(0.2) self.wait_motor_ready(motor_name, timeout=10) time.sleep(1) break
def before_unlock_actions(self): for command in self.before_unlock_commands: addr = command["address"] prop = command["property"] if len(command["argument"]) == 0: arg = [0] else: try: arg = [eval(command["argument"])] except : arg = [command["argument"]] if command["type"] == "set" : tine.set(addr, prop, arg) elif command["type"] == "query" : tine.query(addr, prop, arg[0])
def set_motor_group_focus_mode(self, focus_mode): """ Descript. : sets a focus mode for the motors group Arguments : focus mode name Return : - """ for motor in self.motors_list: if motor['setCmd'] is not None \ and focus_mode in motor['focusingModes'].keys(): if motor['velocity'] is not None: tine.set(self.server_address + "/" + motor['motorAddr'], 'Velocity', motor['velocity']) tine.set(self.server_address + "/" + motor['motorAddr'], motor['setCmd'], motor['focusingModes'][str(focus_mode)]) time.sleep(0.5)
def before_unlock_actions(self): """Executes some commands bedore unlocking the doors""" for command in self.before_unlock_commands: addr = command["address"] prop = command["property"] if len(command["argument"]) == 0: arg = [0] else: try: arg = [eval(command["argument"])] except: arg = [command["argument"]] if command["type"] == "set": tine.set(addr, prop, arg) elif command["type"] == "query": tine.query(addr, prop, arg[0])
def setValue(self, newValue): listData = newValue try: ret = tine.set(self.tineName, self.attributeName, listData, self.timeout) except IOError as strerror: logging.getLogger("HWR").error("%s" % strerror)
def before_unlock_actions(self): if self.beforeUnlockCommandsPresent: for command in eval(self.beforeUnlockCommands): addr = command["address"] prop = command["property"] if len(command["argument"]) == 0: arg = [0] else: try: arg = [eval(command["argument"])] except: arg = [command["argument"]] if command["type"] == "set": tine.set(addr, prop, arg) elif command["type"] == "query": tine.query(addr, prop, arg[0])
def set_motor_position(self, motor_name, new_position, timeout=None): """Sets motor value. Direct tine.set cmd is used""" for motor in self.motors_list: if motor['motorName'] == motor_name: if motor['velocity'] is not None: tine.set(self.server_address + "/" + motor['motorAddr'], 'Velocity', motor['velocity']) motor['status'] = motor['statusModes']['Move'] tine.set(self.server_address + "/" + motor['motorAddr'], motor['setCmd'], new_position) logging.getLogger("HWR").debug("EMBLMotorsGroup: send %s : %.4f" % (motor['motorAddr'], new_position)) time.sleep(0.2) self.wait_motor_ready(motor_name, timeout=10) time.sleep(1) logging.getLogger("HWR").debug("EMBLMotorsGroup: motor %s ready" % motor['motorAddr']) break
def set_motor_group_focus_mode(self, focus_mode): """Sets a focus mode for the motors group""" for motor in self.motors_list: if motor['setCmd'] is not None \ and focus_mode in motor['focusingModes'].keys(): if motor['velocity'] is not None: tine.set(self.server_address + "/" + motor['motorAddr'], 'Velocity', motor['velocity']) motor['status'] = motor['statusModes']['Move'] tine.set(self.server_address + "/" + motor['motorAddr'], motor['setCmd'], motor['focusingModes'][str(focus_mode)]) time.sleep(0.1) if motor['motorName'] in ('In', 'Out', 'Top', 'But'): self.wait_motor_ready(motor['motorName'], timeout=10) time.sleep(1)
def set_motor_focus_mode(self, motor_name, focus_mode): """ Descript. : sets a focus mode for an individual motor Arguments : motor name, focus mode name Return : - """ for motor in self.motors_list: if motor['motorName'] == motor_name: if motor['setCmd'] is not None \ and focus_mode in motor['focusingModes'].keys(): if motor['velocity'] is not None: tine.set(self.server_address + "/" + motor['motorAddr'], 'Velocity', motor['velocity']) tine.set(self.server_address + "/" + motor['motorAddr'], motor['setCmd'], motor['focusingModes'][focus_mode]) time.sleep(0.5) break
def set_motor_position(self, motor_name, new_position, timeout=None): """ Descript. : sets motor value. Direct tine.set cmd is used Arguments : motor name, new value Return : - """ for motor in self.motors_list: if motor['motorName'] == motor_name: if motor['velocity'] is not None: tine.set(self.server_address + "/" + motor['motorAddr'], 'Velocity', motor['velocity']) motor['status'] = motor['statusModes']['Move'] tine.set(self.server_address + "/" + motor['motorAddr'], motor['setCmd'], new_position) time.sleep(0.2) self.wait_motor_ready(motor_name, timeout=10) time.sleep(1) break
def set_motor_focus_mode(self, motor_name, focus_mode): """ Descript. : sets a focus mode for an individual motor Arguments : motor name, focus mode name Return : - """ for motor in self.motors_list: if motor['motorName'] == motor_name: if motor['setCmd'] is not None \ and focus_mode in list(motor['focusingModes'].keys()): if motor['velocity'] is not None: tine.set( self.server_address + "/" + motor['motorAddr'], 'Velocity', motor['velocity']) tine.set(self.server_address + "/" + motor['motorAddr'], motor['setCmd'], motor['focusingModes'][focus_mode]) time.sleep(0.5) break
def __call__(self, *args, **kwargs): self.emit('commandBeginWaitReply', (str(self.name()), )) if ( len(args) == 0): commandArgument = [] else: commandArgument = args[0] try : ret = tine.set(self.tineName, self.commandName, commandArgument, self.timeout) self.emit('commandReplyArrived', (ret, str(self.name()))) except IOError as strerror: logging.getLogger("HWR").error("%s" %strerror) self.emit('commandFailed', ("hallo", self.name()))
def set_motor_group_focus_mode(self, focus_mode): """ Descript. : sets a focus mode for the motors group Arguments : focus mode name Return : - """ for motor in self.motors_list: if motor['setCmd'] is not None \ and focus_mode in motor['focusingModes'].keys(): if motor['velocity'] is not None: tine.set(self.server_address + "/" + motor['motorAddr'], 'Velocity', motor['velocity']) motor['status'] = motor['statusModes']['Move'] tine.set(self.server_address + "/" + motor['motorAddr'], motor['setCmd'], motor['focusingModes'][str(focus_mode)]) time.sleep(0.1) if motor['motorName'] in ('In', 'Out', 'Top', 'But'): self.wait_motor_ready(motor['motorName'], timeout=10) time.sleep(1)
def set_motor_group_focus_mode(self, focus_mode): """Sets a focus mode for the motors group""" for motor in self.motors_list: if motor['setCmd'] is not None \ and focus_mode in motor['focusingModes'].keys(): if motor['velocity'] is not None: tine.set(self.server_address + "/" + motor['motorAddr'], 'Velocity', motor['velocity']) time.sleep(0.5) motor['status'] = motor['statusModes']['Move'] tine.set(self.server_address + "/" + motor['motorAddr'], motor['setCmd'], motor['focusingModes'][str(focus_mode)]) logging.getLogger("HWR").debug("EMBLMotorsGroup: send %s : %.4f" % \ (motor['motorAddr'], motor['focusingModes'][str(focus_mode)])) time.sleep(0.1) if motor['motorName'] in ('In', 'Out', 'Top', 'But'): self.wait_motor_ready(motor['motorName'], timeout=10) time.sleep(1) logging.getLogger("HWR").debug("EMBLMotorsGroup: motor %s ready" % motor['motorAddr'])
def set_motor_focus_mode(self, motor_name, focus_mode): """Sets a focus mode for an individual motor""" for motor in self.motors_list: if motor["motorName"] == motor_name: if ( motor["setCmd"] is not None and focus_mode in motor["focusingModes"].keys() ): if motor["velocity"] is not None: tine.set( self.server_address + "/" + motor["motorAddr"], "Velocity", motor["velocity"], ) tine.set( self.server_address + "/" + motor["motorAddr"], motor["setCmd"], motor["focusingModes"][focus_mode], ) time.sleep(1) break
def __call__(self, *args, **kwargs): self.emit('commandBeginWaitReply', (str(self.name()), )) if (len(args) == 0): commandArgument = [] else: commandArgument = args[0] try: ret = tine.set(self.tineName, self.commandName, commandArgument, self.timeout) self.emit('commandReplyArrived', (ret, str(self.name()))) except IOError as strerror: logging.getLogger("HWR").error("%s" % strerror) self.emit('commandFailed', (strerror))
def setValue(self, newValue): listData = newValue try: ret = tine.set(self.tineName, self.attributeName, listData, self.timeout) except IOError as strerror: logging.getLogger("HWR").error("%s" %strerror)