diff --git a/devices/smart_magnet.properties b/devices/smart_magnet.properties index 0a1a7c4..f8c2f31 100644 --- a/devices/smart_magnet.properties +++ b/devices/smart_magnet.properties @@ -1,6 +1,6 @@ -#Wed Sep 12 12:51:56 CEST 2018 +#Fri Sep 21 16:29:05 CEST 2018 holdingCurrent=30.0 -mountCurrent=35.0 +mountCurrent=10.0 remanenceCurrent=-10.0 restingCurrent=10.0 -unmountCurrent=5.0 +unmountCurrent=10.0 diff --git a/plugins/Commands.form b/plugins/Commands.form index a3f24a0..ff1764c 100644 --- a/plugins/Commands.form +++ b/plugins/Commands.form @@ -411,7 +411,7 @@ - + @@ -431,7 +431,7 @@ - + diff --git a/plugins/Commands.java b/plugins/Commands.java index 540c066..e5ddfdb 100644 --- a/plugins/Commands.java +++ b/plugins/Commands.java @@ -319,13 +319,13 @@ public class Commands extends Panel { } }); - spinnerDryTime.setModel(new javax.swing.SpinnerNumberModel(10.0d, 1.0d, 30.0d, 1.0d)); + spinnerDryTime.setModel(new javax.swing.SpinnerNumberModel(30.0d, 1.0d, 30.0d, 1.0d)); jLabel6.setText("Heat time(s):"); jLabel7.setText("Speed(%):"); - spinnerDrySpeed.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.1d, 10.0d, 1.0d)); + spinnerDrySpeed.setModel(new javax.swing.SpinnerNumberModel(0.5d, 0.1d, 10.0d, 1.0d)); buttonRecover.setText("Recover"); buttonRecover.addActionListener(new java.awt.event.ActionListener() { diff --git a/script/devices/SmartMagnet.py b/script/devices/SmartMagnet.py index 2c3e28b..21b4b25 100644 --- a/script/devices/SmartMagnet.py +++ b/script/devices/SmartMagnet.py @@ -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) diff --git a/script/motion/dry.py b/script/motion/dry.py index 322f109..3ebdef1 100644 --- a/script/motion/dry.py +++ b/script/motion/dry.py @@ -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() \ No newline at end of file + if wait_cold >=0 : + robot.move_cold() + time.sleep(wait_cold) + else: + robot.move_dewar() \ No newline at end of file diff --git a/script/motion/mount.py b/script/motion/mount.py index cf8fc09..b8ae2b4 100644 --- a/script/motion/mount.py +++ b/script/motion/mount.py @@ -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) diff --git a/script/motion/scan_pin.py b/script/motion/scan_pin.py new file mode 100644 index 0000000..06e51e8 --- /dev/null +++ b/script/motion/scan_pin.py @@ -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) + + + \ No newline at end of file diff --git a/script/motion/unmount.py b/script/motion/unmount.py index 70ed473..029a939 100644 --- a/script/motion/unmount.py +++ b/script/motion/unmount.py @@ -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)