45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
def trash_sample():
|
|
"""
|
|
"""
|
|
print "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()
|
|
|
|
gripping = robot.gripper_has_sample()
|
|
|
|
if gripping is not None:
|
|
raise Exception("unknown gripper state, cannot trash: dry gripper first")
|
|
|
|
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)
|
|
|
|
if not robot.is_trash():
|
|
robot.trash_sample()
|
|
|
|
robot.move_cold()
|
|
|
|
sample_det = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
|
Controller.getInstance().logEvent("Sample Detection", str(sample_det))
|
|
|
|
if sample_det:
|
|
raise Exception("sample detected *after* trash action!")
|
|
|
|
smart_magnet.set_default_current()
|
|
smart_magnet.set_supress(True)
|
|
|