This commit is contained in:
gac-S_Changer
2018-09-21 16:51:33 +02:00
parent 7deba9eee4
commit ea1b2bad2a
8 changed files with 131 additions and 64 deletions

View File

@@ -6,7 +6,6 @@ class SmartMagnet(DeviceBase):
"restingCurrent":0.0,
"mountCurrent":0.0,
"unmountCurrent":0.0,
"remanenceCurrent":0.0,
}))
def doInitialize(self):
@@ -98,7 +97,17 @@ class SmartMagnet(DeviceBase):
self.set_holding_current()
else:
self.set_resting_current()
def is_resting_current(self):
return self.get_current() != self.config.getFieldValue("restingCurrent")
#Setting resting curren t to better detect sample
def enforce_sample_detection(self):
if not self.is_resting_current():
self.set_resting_current()
time.sleep(0.2)
add_device(SmartMagnet("smart_magnet"), force = True)

View File

@@ -1,9 +1,11 @@
def dry(heat_time, speed):
def dry(heat_time=30.0, speed=0.5, wait_cold = 30.0):
"""
heat_time (float): in seconds
speed (float): % of nominal speed
wait_cold(float): if negative, move to dewar after drying
Else move to cold and wait (in seconds) before returning.
"""
print "dry"
#Initial checks
@@ -27,4 +29,8 @@ def dry(heat_time, speed):
set_heater(False)
set_air_stream(False)
robot.move_dewar()
if wait_cold >=0 :
robot.move_cold()
time.sleep(wait_cold)
else:
robot.move_dewar()

View File

@@ -26,42 +26,44 @@ def mount(segment, puck, sample, force=False, read_dm=False):
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)
set_setting("mounted_sample_position", get_sample_name(segment, puck, sample))
if read_dm:
barcode_reader.start_read(10.0)
robot.move_scanner()
time.sleep(1.0)
robot.move_gonio()
if read_dm:
mount_sample_id = barcode_reader.get_readout()
print "Datamatrix: " , mount_sample_id
else:
mount_sample_id = None
smart_magnet.set_mount_current()
try:
smart_magnet.enforce_sample_detection()
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)
set_setting("mounted_sample_position", get_sample_name(segment, puck, sample))
if read_dm:
barcode_reader.start_read(10.0)
robot.move_scanner()
time.sleep(1.0)
robot.move_gonio()
if read_dm:
mount_sample_id = barcode_reader.get_readout()
print "Datamatrix: " , mount_sample_id
else:
mount_sample_id = None
smart_magnet.set_mount_current()
robot.put_gonio()
robot.move_dewar()
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)

48
script/motion/scan_pin.py Normal file
View File

@@ -0,0 +1,48 @@
segment, puck, sample, force = "B",1,1, True
pin_name = get_sample_name(segment, puck, sample)
print "scan pin", pin_name
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()
#Enabling
enable_motion()
set_hexiposi(segment)
if not force:
visual_check_hexiposi(segment)
robot.move_park()
gripper_cam.update()
background_img = gripper_cam.getImage()
if not robot.is_dewar():
robot.move_dewar()
robot.get_dewar(segment, puck, sample)
robot.move_park()
gripper_cam.update()
sample_img = gripper_cam.getImage()
barcode_reader.start_read(10.0)
robot.move_scanner()
time.sleep(1.0)
mount_sample_id = barcode_reader.get_readout()
print "Datamatrix: " , mount_sample_id
robot.move_dewar()
robot.put_dewar(segment, puck, sample)

View File

@@ -13,7 +13,7 @@ def unmount(segment = None, puck = None, sample = None, force=False):
#Initial checks
assert_valid_address(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()
@@ -21,25 +21,27 @@ def unmount(segment = None, puck = None, sample = None, force=False):
#robot.assert_in_known_point()
hexiposi.assert_homed()
if smart_magnet.check_mounted(idle_time=0.5, timeout = 3.0) == False:
raise Exception("No pin detected on gonio")
#Enabling
enable_motion()
set_hexiposi(segment)
if not force:
visual_check_hexiposi(segment)
#location = robot.get_current_point()
if not robot.is_gonio():
robot.move_gonio()
smart_magnet.set_unmount_current()
try:
smart_magnet.enforce_sample_detection()
if smart_magnet.check_mounted(idle_time=0.5, timeout = 3.0) == False:
raise Exception("No pin detected on gonio")
#Enabling
enable_motion()
set_hexiposi(segment)
if not force:
visual_check_hexiposi(segment)
#location = robot.get_current_point()
if not robot.is_gonio():
robot.move_gonio()
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)