diff --git a/config/settings.properties b/config/settings.properties index 6aab4be..3414cd1 100644 --- a/config/settings.properties +++ b/config/settings.properties @@ -1,4 +1,4 @@ -#Fri Apr 28 11:44:01 CEST 2023 +#Fri May 05 13:39:50 CEST 2023 dry_mount_counter=0 room_temperature_enabled=true pin_offset=0.0 diff --git a/plugins/Commands.java b/plugins/Commands.java index e891955..61ab793 100644 --- a/plugins/Commands.java +++ b/plugins/Commands.java @@ -1022,7 +1022,7 @@ public class Commands extends Panel { String segment = (String) spinnerSegment.getValue(); int puck = 1; int sample = (Integer) spinnerSample.getValue(); - execute("get_rt('" + segment + "'," + puck + "," + sample + ")"); + execute("put_rt('" + segment + "'," + puck + "," + sample + ")"); } else { int puck = (Integer) spinnerPuck.getValue(); int sample = (Integer) spinnerSample.getValue(); diff --git a/plugins/MXSC-1.19.0.jar b/plugins/MXSC-1.19.0.jar index ac0c6f1..d1e36b2 100644 Binary files a/plugins/MXSC-1.19.0.jar and b/plugins/MXSC-1.19.0.jar differ diff --git a/script/devices/RobotSCRT.py b/script/devices/RobotSCRT.py index d552b31..a64745a 100644 --- a/script/devices/RobotSCRT.py +++ b/script/devices/RobotSCRT.py @@ -21,8 +21,8 @@ simulation = False class RobotSC(RobotTCP): def __init__(self, name, server, timeout = 1000, retries = 1): RobotTCP.__init__(self, name, server, timeout, retries) - self.set_tasks([ "mvGonio","putGonio", "getGonio", "recover", "mvPark", "mvGonioW","mvHome", "mvRT", "mvAux" "getRT", "putRT","getAux","putAux", "mvScanner", "openLid", "closeLid"]) - self.set_known_points(["pPark", "pGonio", "pGonioG","pHome", "pRTHome","pGonio", "pAux", "pScan"]) + self.set_tasks([ "mvGonio","putGonio", "getGonio", "recover", "mvPark","mvHome", "mvRT", "mvAux" "getRT", "putRT","getAux","putAux", "mvScanner", "openLid", "closeLid"]) + self.set_known_points(["pPark", "pGonioWait", "pGonioG","pHome", "pDewarTempRT", "pAux", "pScan"]) self.setPolling(DEFAULT_ROBOT_POLLING) self.last_command_timestamp = None self.last_command_position = None @@ -66,14 +66,13 @@ class RobotSC(RobotTCP): segment = self.toSegmentNumber(segment) self.start_task('getRT',segment, sample) self.wait_task_finished(TASK_WAIT_ROBOT_POLLING) - if not mounting_in_same_segment: - self.assert_rt() + #self.assert_rt() self.last_command_position = "rt" self.last_command_timestamp = time.time() def put_rt(self, segment, puck, sample, mounting_in_same_segment=False): segment = self.toSegmentNumber(segment) - self.assert_rt() + self.assert_home() self.start_task('putRT',segment, sample) self.wait_task_finished(TASK_WAIT_ROBOT_POLLING) #self.assert_rt() @@ -146,14 +145,6 @@ class RobotSC(RobotTCP): #self.start_task('mvGonio') #self.wait_task_finished(TASK_WAIT_ROBOT_POLLING) #self.assert_gonio() - - - def move_gonio_wait(self): - self.start_task('mvGonioW') - self.wait_task_finished(TASK_WAIT_ROBOT_POLLING) - self.assert_gonio_wait() - self.last_command_position = "gonio_wait" - self.last_command_timestamp = time.time() def move_park_async(self): self.start_task('mvPark') @@ -188,7 +179,7 @@ class RobotSC(RobotTCP): segment = self.toSegmentNumber(segment) self.start_task('openLid', segment) self.wait_task_finished(TASK_WAIT_ROBOT_POLLING) - self.assert_rt() + self.assert_home() self.last_command_position = "open_lid" self.last_command_timestamp = time.time() @@ -196,7 +187,7 @@ class RobotSC(RobotTCP): segment = self.toSegmentNumber(segment) self.start_task('closeLid', segment) self.wait_task_finished(TASK_WAIT_ROBOT_POLLING) - self.assert_rt() + self.assert_home() self.last_command_position = "close_lid" self.last_command_timestamp = time.time() @@ -238,16 +229,13 @@ class RobotSC(RobotTCP): robot.set_profile("default") def is_park(self): - return self.is_in_point("pPark") - - def is_gonio_wait(self): - return self.is_in_point("pGonioW") + return self.is_in_point("pPark") def is_home(self): return self.is_in_point("pHome") def is_gonio(self): - return self.is_in_point("pGonio") + return self.is_in_point("pGonioWait") def is_scanner(self): @@ -257,7 +245,7 @@ class RobotSC(RobotTCP): return self.is_in_point("pAux") def is_rt(self): - return self.is_in_point("pRTHome") + return self.is_in_point("pDewarTempRT") #def is_scan_stop(self): # return self.is_in_point("pScanStop") @@ -268,15 +256,12 @@ class RobotSC(RobotTCP): def assert_park(self): self.assert_in_point("pPark") - - def assert_gonio_wait(self): - self.assert_in_point("pGonio") def assert_home(self): self.assert_in_point("pHome") def assert_gonio(self): - self.assert_in_point("pGonio") + self.assert_in_point("pGonioWait") def assert_scanner(self): self.assert_in_point("pScan") @@ -285,7 +270,7 @@ class RobotSC(RobotTCP): self.assert_in_point("pAux") def assert_rt(self): - self.assert_in_point("pRTHome") + self.assert_in_point("pDewarTempRT") def assert_cleared(self): if not self.is_cleared(): diff --git a/script/devices/RobotTCP.py b/script/devices/RobotTCP.py index 126a786..265c741 100644 --- a/script/devices/RobotTCP.py +++ b/script/devices/RobotTCP.py @@ -621,9 +621,16 @@ class RobotTCP(TcpDevice, Stoppable): self.check_task() if self.current_task is not None: print "Ongoing task: " + self.current_task - if (not self.settled) or (self.current_task is not None): self.setState(State.Busy) - elif not self.empty: self.setState(State.Paused) - else: self.setState(State.Ready) + if (not self.settled) or (self.current_task is not None): + self.setState(State.Busy) + elif not self.empty: + if self.state!=State.Paused: + self.get_current_points() + self.setState(State.Paused) + else: + if self.state!=State.Ready: + self.get_current_points() + self.setState(State.Ready) def doUpdate(self): try: diff --git a/script/motion_rt/get_rt.py b/script/motion_rt/get_rt.py index 0561a30..9f7b0aa 100644 --- a/script/motion_rt/get_rt.py +++ b/script/motion_rt/get_rt.py @@ -21,9 +21,13 @@ def get_rt(segment, puck, sample): #Enabling enable_motion() + + if not robot.is_home(): + robot.move_home() set_hexiposi(segment) + robot.open_lid(segment) - if not robot.is_rt(): - robot.move_rt() - robot.get_rt(segment, puck, sample) + robot.close_lid(segment) + + diff --git a/script/motion_rt/mount.py b/script/motion_rt/mount.py index b514053..67579fb 100644 --- a/script/motion_rt/mount.py +++ b/script/motion_rt/mount.py @@ -38,7 +38,7 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False) hexiposi.assert_homed() assert_mount_position() - + lid_open_by_unmount = False try: if smart_magnet.get_supress() == True: @@ -49,9 +49,13 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False) smart_magnet.apply_resting() time.sleep(0.5) if smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) == True: - if auto_unmount and (get_setting("mounted_sample_position") is not None): + mounted_sample = get_setting("mounted_sample_position") + if auto_unmount and ( mounted_sample is not None): + previous_segment = mounted_sample[0:1] #auto_unmount set to true so detection remains enabled unmount(force = True, auto_unmount = True) + #We know the lid is open for sure + lid_open_by_unmount = True else: raise Exception("Pin detected on gonio") set_status("Mounting: " + str(segment) + str(puck) + str(sample)) @@ -61,17 +65,21 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False) enable_motion() + if not robot.is_home(): + if (not lid_open_by_unmount) or (segment != previous_segment): + robot.move_home() + set_hexiposi(segment) if not force: - visual_check_hexiposi(segment) - - if not robot.is_rt(): - robot.move_rt() - - robot.get_rt(segment, puck, sample) - - + visual_check_hexiposi(segment) + + if not lid_open_by_unmount: + robot.open_lid(segment) + lid_open_by_unmount = False + + robot.get_rt(segment, puck, sample) #Should we close lid if this command raise exception? + robot.close_lid(segment) robot.move_gonio() if read_dm: @@ -83,7 +91,7 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False) robot.put_gonio() - robot.move_home() + #robot.move_home() mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) @@ -93,6 +101,10 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False) set_setting("mounted_sample_position", get_sample_name(segment, puck, sample)) return [mount_sample_detected, mount_sample_id] + except: + if lid_open_by_unmount: + robot.close_lid(segment) + raise finally: smart_magnet.set_default_current() smart_magnet.set_supress(True) diff --git a/script/motion_rt/put_rt.py b/script/motion_rt/put_rt.py index a753718..70952b6 100644 --- a/script/motion_rt/put_rt.py +++ b/script/motion_rt/put_rt.py @@ -17,9 +17,10 @@ def put_rt(segment, puck, sample): #Enabling enable_motion() + if not robot.is_home(): + robot.move_home() set_hexiposi(segment) - - if not robot.is_rt(): - robot.move_rt() - + robot.open_lid(segment) + robot.put_rt(segment, puck, sample) + robot.close_lid(segment) diff --git a/script/motion_rt/recover.py b/script/motion_rt/recover.py index 4bd517a..d64b76d 100644 --- a/script/motion_rt/recover.py +++ b/script/motion_rt/recover.py @@ -8,7 +8,6 @@ RECOVER_DESC = "mRecovery" known_segments = [ ("pPark", "pHome", 50), \ ("pGonio", "pGonioG", 10), \ ("pHome", "pGonioWait", 230), \ - ("pHome", "pGonio", 30), \ ("pHome", "pScan", 25), \ ("pHome", "pRTHome", 10), \ ("pPark", "pAux", 50), \ diff --git a/script/motion_rt/unmount.py b/script/motion_rt/unmount.py index a5922b6..85e49dc 100644 --- a/script/motion_rt/unmount.py +++ b/script/motion_rt/unmount.py @@ -61,9 +61,15 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun #TODO: Shuld check if smart magnet detection is off? update_samples_info_sample_unmount(get_puck_name(segment, puck), sample) - robot.move_rt() + robot.move_home() + robot.open_lid(segment) robot.put_rt(segment, puck, sample) set_setting("mounted_sample_position", None) + + #imporant to be the very last command for the logic on chained mount + if not auto_unmount: + robot.close_lid(segment) + robot.move_park() finally: if not auto_unmount: smart_magnet.set_default_current()