Files
mxsc/script/motion/mount.py
gac-S_Changer 4c38bcba7c
2018-07-06 09:56:19 +02:00

53 lines
1.4 KiB
Python

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_puck_detected(segment, puck)
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()
hexiposi.assert_homed()
if smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) == True:
raise Exception("Pin detected on gonio")
#location = robot.get_current_point()
#Enabling
enable_motion()
set_hexiposi(segment)
if not force:
visual_check_hexiposi(segment)
if not robot.is_dewar():
robot.move_dewar()
robot.get_dewar(segment, puck, sample)
if read_dm:
barcode_reader.start_read(10.0)
robot.move_scanner()
robot.move_gonio()
if read_dm:
dm = barcode_reader.get_readout()
print "Datamatrix: " , dm
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:
raise Exception("No pin detected on gonio")
finally:
smart_magnet.set_default_current()