Bug on ScanPuck - hexiposi

This commit is contained in:
gac-S_Changer
2021-01-26 15:55:31 +01:00
parent 539a51dc66
commit 49c8d1d4b5
16 changed files with 115 additions and 46 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
#Tue Sep 08 11:55:02 CEST 2020
#Tue Jan 26 15:45:35 CET 2021
autoSaveScanData=true
simulation=false
commandExecutionEvents=false
@@ -19,7 +19,7 @@ hideServerMessages=true
serverPort=8080
versionTrackingEnabled=true
dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name}
serverEnabled=true
serverEnabled=false
dataScanReleaseRecords=false
depthDimension=0
dataScanPreserveTypes=false
+8 -8
View File
@@ -3,10 +3,10 @@ img=ch.psi.pshell.prosilica.Prosilica|204464 "PacketSize=1504;PixelFormat=Mono8;
#monitoring_cam=ch.psi.pshell.imaging.MjpegSource|http://axis-accc8ea5e463.psi.ch/axis-cgi/mjpg/video.cgi?camera=2 reopen||-200|
#top_cam=ch.psi.pshell.imaging.MjpegSource|http://axis-accc8ea5e463.psi.ch/axis-cgi/mjpg/video.cgi?camera=3 true||-200|
#cam=ch.psi.pshell.epics.AreaDetector|MX-SAMCAM|||
mscan_pin=ch.psi.pshell.serial.TcpDevice|129.129.110.109:2001|||
mscan_pin_cmd=ch.psi.pshell.serial.TcpDevice|129.129.110.109:2003|||
mscan_puck=ch.psi.pshell.serial.TcpDevice|129.129.110.93:2001|||
mscan_puck_cmd=ch.psi.pshell.serial.TcpDevice|129.129.110.93:2003|||
mscan_pin=ch.psi.pshell.serial.TcpDevice|129.129.110.87:2001|||
mscan_pin_cmd=ch.psi.pshell.serial.TcpDevice|129.129.110.87:2003|||
mscan_puck=ch.psi.pshell.serial.TcpDevice|129.129.110.88:2001|||
mscan_puck_cmd=ch.psi.pshell.serial.TcpDevice|129.129.110.88:2003|||
ue=LaserUE|COM3 50 35|||true
puck_detection=ch.psi.mxsc.PuckDetection|tell6d-raspberrypi:5556|||
wago=ch.psi.pshell.modbus.ModbusTCP|tell6d-wago:502|||
@@ -55,7 +55,7 @@ led_ctrl_1=ch.psi.pshell.modbus.ProcessVariable|wago 0|||
led_ctrl_2=ch.psi.pshell.modbus.ProcessVariable|wago 1|||
led_ctrl_3=ch.psi.pshell.modbus.ProcessVariable|wago 2|||
smc_current=ch.psi.pshell.modbus.ProcessVariable|wago 3|||
th2e=ch.psi.pshell.modbus.ModbusTCP|129.129.110.:502|||
temperature=ch.psi.pshell.modbus.ReadonlyProcessVariable|th2e 1||10000|
humidity=ch.psi.pshell.modbus.ReadonlyProcessVariable|th2e 5||10000|
dew_point=ch.psi.pshell.modbus.ReadonlyProcessVariable|th2e 9||10000|
#th2e=ch.psi.pshell.modbus.ModbusTCP|129.129.110.:502|||
#temperature=ch.psi.pshell.modbus.ReadonlyProcessVariable|th2e 1||10000|
#humidity=ch.psi.pshell.modbus.ReadonlyProcessVariable|th2e 5||10000|
#dew_point=ch.psi.pshell.modbus.ReadonlyProcessVariable|th2e 9||10000|
+4 -5
View File
@@ -1,12 +1,11 @@
#Tue Oct 06 10:03:09 CEST 2020
dry_mount_counter=7
mounted_sample_position=C11
#Tue Jan 26 15:46:23 CET 2021
dry_mount_counter=4
room_temperature_enabled=false
pin_offset=0.508
pin_offset=1.0
puck_types=true
pin_cleaner_timer=60
imaging_enabled=false
dry_timestamp=1.601971335576E9
dry_timestamp=1.611668783052E9
roi_h=1000
led_level=0.0
beamline_status_enabled=false
+2 -2
View File
@@ -1,2 +1,2 @@
#Tue Sep 01 09:11:47 CEST 2020
FileSequentialNumber=184
#Thu Jan 21 10:33:11 CET 2021
FileSequentialNumber=207
+1 -1
View File
@@ -1,3 +1,3 @@
#Wed Dec 11 08:55:08 CET 2019
#Thu Jan 21 09:38:30 CET 2021
detection=Mechanical
disabled=false
+1 -1
View File
@@ -1,3 +1,3 @@
#Thu Sep 19 08:23:37 CEST 2019
#Thu Nov 12 13:39:42 CET 2020
detection=Mechanical
disabled=false
+1 -1
View File
@@ -1,3 +1,3 @@
#Wed Dec 11 08:56:26 CET 2019
#Tue Dec 01 08:46:40 CET 2020
detection=Mechanical
disabled=false
+1 -1
View File
@@ -1,4 +1,4 @@
#Fri Oct 02 14:37:21 CEST 2020
#Thu Jan 21 10:56:46 CET 2021
minValue=0.0
unit=V
offset=0.0
+1 -1
View File
@@ -1,4 +1,4 @@
#Fri Oct 02 14:37:21 CEST 2020
#Thu Jan 21 10:56:46 CET 2021
minValue=0.0
unit=V
offset=0.0
+1 -1
View File
@@ -1,4 +1,4 @@
#Fri Oct 02 14:37:21 CEST 2020
#Thu Jan 21 10:56:46 CET 2021
minValue=0.0
unit=V
offset=0.0
+20
View File
@@ -134,6 +134,26 @@ def get_puck_datamatrix():
ret[si["puckBarcode"]] = si["puckAddress"]
return ret
def get_puck_datamatrix_info():
ret = {}
for si in samples_info:
if si["puckBarcode"] is not None and si["puckBarcode"]!="":
info = {}
info["address"] = si["puckAddress"]
info["dewar"] = si ["dewarName"]
info["name"] = si ["puckName"]
info["user"] = si ["userName"]
info["type"] = si ["puckType"]
ret[si["puckBarcode"]] = info
return ret
def get_puck_address(barcode):
try:
return get_puck_datamatrix()[barcode]
except:
return None
def get_puck_address(barcode):
try:
return get_puck_datamatrix()[barcode]
+30 -17
View File
@@ -21,7 +21,7 @@ class Hexiposi(DiscretePositionerBase):
def doInitialize(self):
super(Hexiposi, self).doInitialize()
self.val = self.doReadReadback()
self.val = self._posNameToIndex(self.doReadReadback())
def get_response(self, response):
if (response.status_code!=200):
@@ -40,14 +40,10 @@ class Hexiposi(DiscretePositionerBase):
self.moving = self.status["moving"]
self.offset = self.status["offset"]
self.dpos = self.status["discretePosition"]
if (self.homed==False): rback = self.UNKNOWN_POSITION
elif self.dpos == 1: rback = "B" # "A"
elif self.dpos == 2: rback = "C" # "B"
elif self.dpos == 4: rback = "D" # "C"
elif self.dpos == 8: rback = "E" # "D"
elif self.dpos == 16: rback = "F" # "E"
elif self.dpos == 32: rback = "A" # "F"
else: rback = self.UNKNOWN_POSITION
if (self.homed==False):
rback = self.UNKNOWN_POSITION
else:
rback = self._posIndexToName(self.dpos)
if (rback == self.UNKNOWN_POSITION) or (rback != self.rback):
self.moved = True
self.rback = rback
@@ -58,7 +54,7 @@ class Hexiposi(DiscretePositionerBase):
self.updateState()
raise
def set_deadband(self, value = 0.1): #degrees
def set_deadband(self, value = 1.0): #degrees
ret = self.get_response(requests.get(url=self.url_set+"setDeadband?deadband=" + str(value), timeout=self.timeout))
if ret["deadbandOutput"] == value:
return value
@@ -96,13 +92,30 @@ class Hexiposi(DiscretePositionerBase):
self.get_status()
return self.rback
def doWrite(self, val):
#val = ord(val) - ord('A') +1
def _posNameToIndex(self, val):
if val == self.UNKNOWN_POSITION:
return None
val = ord(val) - ord('B') +1
if val==0: val=6 #A
if val<1 or val>6:
return val
def _posIndexToName(self, val):
if self.dpos == 1: return "B" # "A"
elif self.dpos == 2:return "C" # "B"
elif self.dpos == 4:return "D" # "C"
elif self.dpos == 8:return "E" # "D"
elif self.dpos == 16:return "F" # "E"
elif self.dpos == 32:return "A" # "F"
else: return self.UNKNOWN_POSITION
def doWrite(self, val):
self.assert_homed()
#val = ord(val) - ord('A') +1
val = self._posNameToIndex(val)
if (val is None) or val<1 or val>6:
raise Exception("Invalid value: " + str(val))
moving = val != self.val
print "Moving hexiposi to:", val, " current:", self.val, " moving:",moving
self.val = val
self.move_pos(self.val)
#Workaround as state does not changes immediatelly
@@ -123,8 +136,8 @@ class Hexiposi(DiscretePositionerBase):
def assert_in_position(self, pos):
if not is_in_position(pos):
raise Exception ("Hexiposi is not in position")
if not self.is_in_position(pos):
raise Exception ("Hexiposi is not in position: " + str(pos))
def assert_homed(self):
if self.homed == False:
@@ -133,7 +146,7 @@ class Hexiposi(DiscretePositionerBase):
def assert_in_known_position(self):
self.get_status()
if self.rback == 'Unknown':
raise Exception("Hexiposi is in an unknown position, please home.")
raise Exception("Hexiposi is in an unknown position.")
#def isReady(self):
# self.get_status()
@@ -172,4 +185,4 @@ class hexiposi_position(ReadonlyRegisterBase):
add_device(hexiposi_position(), True)
hexiposi_position.polling = 1000
hexiposi.set_deadband(1.0)
hexiposi.set_deadband(1.3)
+1 -1
View File
@@ -90,7 +90,7 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
robot.get_aux(sample)
else:
set_hexiposi(segment)
set_hexiposi(segment, force=True)
if not force:
visual_check_hexiposi(segment)
+39 -3
View File
@@ -34,9 +34,9 @@ def scan_pin(segment, puck, sample, force=False):
robot.get_aux(sample)
else:
# set_hexiposi(segment)
# if not force:
# visual_check_hexiposi(segment)
set_hexiposi(segment)
if not force:
visual_check_hexiposi(segment)
if not robot.is_dewar():
robot.move_dewar()
@@ -70,6 +70,42 @@ def scan_puck(segment, puck, force=False):
return ret
def mount_pucks(pucks):
"""mount evry position from the given pucks
pucks is a list of puck specification in the format: [segment][puck]
Example: mount_pucks(['c4', e3', 'e2', 'f1'])
"""
for p in pucks:
seg, puc = list(p)
seg = seg.upper()
puc = int(puc)
print "Mounting all positions from {} {}".format(seg.upper(), puc)
mount_puck_pins(seg, puc)
# mount_puck_pins(seg, puc, [1, 2, 3]) # mount only pins 1, 2, 3 for each puck
def mount_puck_pins(segment, puck, positions=None):
""" Mounts every position from the given segment/puck."""
from time import sleep
results = []
if positions is None:
positions = range(1, 17)
for i in positions:
#b = magnet_position.getValue()
mount(segment, puck, i, True, False, True)
#a = magnet_position.getValue()
#results.append((b, a))
#print "{:^8.3f}|{:^8.3f}".format(b, a)
sleep(1.0)
# print results
print "{:^8s}|{:^8s}".format("Before", "After")
for b,a in results:
print "{:^8.3f}|{:^8.3f}".format(b, a)
def scan_gripper():
print "scan gripper"
#Initial checks
+2 -1
View File
@@ -41,7 +41,7 @@ def enable_motion():
raise Exception("Cannot enable power: robot state is " + str(robot.state))
robot.enable()
def set_hexiposi(pos, force = False):
def set_hexiposi(pos, force = True):
"""
Set the hexiposi position in remote mode, or wait for it to be set in manual mode
"""
@@ -58,6 +58,7 @@ def set_hexiposi(pos, force = False):
set_status(None)
else:
hexiposi.move(pos)
#hexiposi.assert_in_position(pos)
#Can be used if cover has following error (no checking readback)
def _set_hexiposi(pos):
+1 -1
View File
@@ -67,7 +67,7 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
enable_motion()
if not is_aux:
set_hexiposi(segment)
set_hexiposi(segment, force=True)
if not force:
visual_check_hexiposi(segment)