52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
def trash_sample():
|
|
"""
|
|
"""
|
|
evlog = Controller.getInstance().logEvent
|
|
evlog("trash_sample")
|
|
|
|
aerotech_x.waitValueInRange(-78, 1.0, 20000)
|
|
|
|
#Initial checks
|
|
robot.assert_no_task()
|
|
robot.reset_motion()
|
|
robot.wait_ready()
|
|
robot.assert_cleared()
|
|
#robot.assert_in_known_point()
|
|
|
|
#Enabling
|
|
enable_motion()
|
|
|
|
curpos = cryopos.getPosition()
|
|
speed = cryopos.getSpeed()
|
|
movetime = int(round(5000 + (15. - curpos) / speed))
|
|
cryopos.move(15.0, movetime)
|
|
cryopos.waitValueInRange(15.0, 1.0, movetime)
|
|
|
|
smart_magnet.set_supress(False)
|
|
smart_magnet.set_current(10.0)
|
|
time.sleep(0.5)
|
|
if not robot.is_trash():
|
|
robot.trash_sample()
|
|
|
|
robot.move_cold()
|
|
time.sleep(0.5)
|
|
smart_magnet.set_current(30.0)
|
|
|
|
sample_det = False
|
|
msg = None
|
|
try:
|
|
sample_det = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
|
evlog("SMC Detection", str(sample_det))
|
|
except:
|
|
msg = "failed to check SMC status"
|
|
|
|
if sample_det:
|
|
msg = "sample detected *after* trash action!"
|
|
|
|
smart_magnet.set_default_current()
|
|
smart_magnet.set_supress(True)
|
|
|
|
if msg:
|
|
raise Exception(msg)
|
|
|
|
|