This commit is contained in:
gac-S_Changer
2018-09-17 16:56:55 +02:00
parent 531c3f5dfe
commit bc21bb95a3
21 changed files with 486 additions and 114 deletions

View File

@@ -4,7 +4,7 @@ def get_dewar(segment, puck, sample, force=False):
print "get_dewar: ", segment, puck, sample, force
#Initial checks
assertValidAddress(segment, puck, sample)
assert_valid_address(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()

View File

@@ -4,7 +4,7 @@ def mount(segment, puck, sample, force=False, read_dm=False):
print "mount: ", segment, puck, sample, force
start = time.time()
#Initial checks
assertValidAddress(segment, puck, sample)
assert_valid_address(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()
@@ -45,8 +45,11 @@ def mount(segment, puck, sample, force=False, read_dm=False):
smart_magnet.set_mount_current()
try:
robot.put_gonio()
robot.move_dewar()
if smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) == False:
robot.move_dewar()
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, sample_detected)
if sample_detected == False:
raise Exception("No pin detected on gonio")
finally:
smart_magnet.set_default_current()

View File

@@ -0,0 +1,18 @@
def move_cold():
"""
"""
print "move_cold"
#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_cold():
robot.move_cold()

View File

@@ -4,7 +4,7 @@ def put_dewar(segment, puck, sample, force=False):
print "put_dewar: ", segment, puck, sample, force
#Initial checks
assertValidAddress(segment, puck, sample)
assert_valid_address(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()

View File

@@ -128,7 +128,7 @@ def update_tool(tool=None, x_offset=0.0, y_offset=0.0, z_offset=0.0):
robot.save_program()
def assertValidAddress(segment, puck, sample):
def assert_valid_address(segment, puck, sample):
if is_string(segment):
segment = ord(segment.upper()) - ord('A') +1
if segment<=0 or segment >6:
@@ -137,4 +137,20 @@ def assertValidAddress(segment, puck, sample):
raise Exception ("Invalid puck")
if sample<=0 or sample >16:
raise Exception ("Invalid sample")
def get_puck_name(segment, puck):
try:
assert_valid_address(segment, puck, 1)
if type(segment) is int:
segment = chr( ord('A') + (pos-1))
elif type(segment) is str:
segment = pos.upper()
else:
return None
return segment + str(puck)
except:
return None

View File

@@ -4,7 +4,7 @@ def unmount(segment, puck, sample, force=False):
print "unmount: ", segment, puck, sample, force
#Initial checks
assertValidAddress(segment, puck, sample)
assert_valid_address(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()
@@ -34,6 +34,8 @@ def unmount(segment, puck, sample, force=False):
smart_magnet.set_unmount_current()
try:
robot.get_gonio()
#TODO: Shuld check if smart magnet detection is off?
update_samples_info_sample_unmount(get_puck_name(segment, puck))
robot.move_dewar()
robot.put_dewar(segment, puck, sample)
finally: