This commit is contained in:
gac-S_Changer
2018-10-16 18:05:43 +02:00
parent cfc4b3a0da
commit 3d86c27140
19 changed files with 333 additions and 111 deletions

21
script/motion/get_aux.py Normal file
View File

@@ -0,0 +1,21 @@
def get_aux(sample):
"""
"""
print "get_aux: ",sample
#Initial checks
assert_valid_sample(sample)
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()
robot.assert_cleared()
hexiposi.assert_homed()
#Enabling
enable_motion()
if not robot.is_aux():
robot.move_aux()
robot.get_aux(sample)

View File

@@ -9,6 +9,7 @@ def mount(segment, puck, sample, force=False, read_dm=False):
start = time.time()
is_aux = segment == AUX_SEGMENT
puck_address = get_puck_address(puck)
if puck_address is None:
puck_obj = get_puck_obj_by_id(puck)
@@ -39,16 +40,24 @@ def mount(segment, puck, sample, force=False, read_dm=False):
#Enabling
enable_motion()
set_hexiposi(segment)
if not force:
visual_check_hexiposi(segment)
if not robot.is_dewar():
robot.move_dewar()
if is_aux:
if not robot.is_aux():
robot.move_aux()
robot.get_dewar(segment, puck, sample)
robot.get_aux(sample)
robot.move_home()
else:
set_hexiposi(segment)
if not force:
visual_check_hexiposi(segment)
if not robot.is_dewar():
robot.move_dewar()
robot.get_dewar(segment, puck, sample)
set_setting("mounted_sample_position", get_sample_name(segment, puck, sample))
@@ -77,18 +86,22 @@ def mount(segment, puck, sample, force=False, read_dm=False):
dry_mount_count = 0
set_setting("dry_mount_counter", dry_mount_count+1)
#TODO: Auto-dry procedure
robot.move_cold()
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
#TODO: Should do on finally?
update_samples_info_sample_mount(get_puck_name(segment, puck), sample, mount_sample_detected, mount_sample_id)
if mount_sample_detected == False:
raise Exception("No pin detected on gonio")
if is_force_dry():
print "Auto dry"
log("Starting auto dry", False)
dry()
if is_aux:
robot.move_home()
else:
robot.move_cold()
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
#TODO: Should do on finally?
update_samples_info_sample_mount(get_puck_name(segment, puck), sample, mount_sample_detected, mount_sample_id)
if mount_sample_detected == False:
raise Exception("No pin detected on gonio")
if is_force_dry():
print "Auto dry"
log("Starting auto dry", False)
dry()
return [mount_sample_detected, mount_sample_id]
finally:
smart_magnet.set_default_current()

18
script/motion/move_aux.py Normal file
View File

@@ -0,0 +1,18 @@
def move_aux():
"""
"""
print "move_aux"
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()
#Enabling
enable_motion()
if not robot.is_aux():
robot.move_aux()

21
script/motion/put_aux.py Normal file
View File

@@ -0,0 +1,21 @@
def put_aux(sample):
"""
"""
print "put_aux: ",sample
#Initial checks
assert_valid_sample(sample)
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()
robot.assert_cleared()
hexiposi.assert_homed()
#Enabling
enable_motion()
if not robot.is_aux():
robot.move_aux()
robot.put_aux(sample)

View File

@@ -6,14 +6,15 @@ RECOVER_DESC = "mRecovery"
RECOVER_TOOL = TOOL_DEFAULT
known_segments = [ ("pHome", "pPark", 50), \
("pHome", "pGonioHome", 30), \
("pHome", "pScanHome", 25), \
("pHome", "pHeaterHome", 75), \
("pHome", "pDewarWait", 10), \
("pHome", "pGonioH", 30), \
("pHome", "pScan", 25), \
("pHome", "pHeater", 75), \
("pHome", "pDewar", 10), \
("pHome", "pHelium", 230), \
("pGonioHome", "pGonioGet", 10), \
("pPark", "pHeater", 40), \
("pHeaterHome", "pHeaterBottom", 10), \
("pGonioH", "pGonioG", 10), \
("pPark", "pHeat", 40), \
("pHeater", "pHeatB", 10), \
("pPark", "pAux", 30), \
]
def get_dist_to_line(segment):

View File

@@ -31,8 +31,13 @@ def scan_pin(segment, puck, sample, force=False):
robot.move_dewar()
robot.put_dewar(segment, puck, sample)
return (detected, dm)
ret = "Empty"
if detected:
if (dm is None) or (len(dm.strip())==0):
ret = "Present"
else:
ret = str(dm)
return ret
def scan_puck(segment, puck, force=False):

View File

@@ -129,6 +129,8 @@ def update_tool(tool=None, x_offset=0.0, y_offset=0.0, z_offset=0.0):
def assert_valid_address(segment, puck, sample):
if (segment == AUX_SEGMENT) and (puck == 1):
return
if is_string(segment):
segment = ord(segment.upper()) - ord('A') +1
if segment<=0 or segment >6:
@@ -137,6 +139,10 @@ def assert_valid_address(segment, puck, sample):
raise Exception ("Invalid puck")
if sample<=0 or sample >16:
raise Exception ("Invalid sample")
def assert_valid_sample(sample):
if sample<=0 or sample >16:
raise Exception ("Invalid sample")
def get_puck_name(segment, puck):
try:

View File

@@ -9,6 +9,7 @@ def unmount(segment = None, puck = None, sample = None, force=False):
raise Exception("Mounted sample position is not defined")
segment, puck , sample = pos[0:1], int(pos[1]), int(pos[2])
print "Mounted sample position: ", segment, puck , sample
is_aux = segment == AUX_SEGMENT
#Initial checks
assert_valid_address(segment, puck, sample)
@@ -31,11 +32,12 @@ def unmount(segment = None, puck = None, sample = None, force=False):
#Enabling
enable_motion()
if not is_aux:
set_hexiposi(segment)
set_hexiposi(segment)
if not force:
visual_check_hexiposi(segment)
if not force:
visual_check_hexiposi(segment)
#location = robot.get_current_point()
@@ -45,10 +47,17 @@ def unmount(segment = None, puck = None, sample = None, force=False):
smart_magnet.set_unmount_current()
robot.get_gonio()
#TODO: Shuld check if smart magnet detection is off?
update_samples_info_sample_unmount(get_puck_name(segment, puck), sample)
robot.move_dewar()
robot.put_dewar(segment, puck, sample)
if is_aux:
robot.move_dewar()
robot.move_aux()
robot.put_aux( sample)
robot.move_home()
else:
#TODO: Shuld check if smart magnet detection is off?
update_samples_info_sample_unmount(get_puck_name(segment, puck), sample)
robot.move_dewar()
robot.put_dewar(segment, puck, sample)
set_setting("mounted_sample_position", None)
finally:
smart_magnet.set_default_current()