TELL: major refactor, removing redundant code, added a simulated tell client, updated docstrings and comments and converted wait functions to use inbuilt pshell functionality.
This commit is contained in:
@@ -23,22 +23,27 @@ from pshell import PShellClient
|
||||
logger = setup_logger("aareDAQ")
|
||||
|
||||
class ManualMountException(Exception):
|
||||
"""Custom exception for manual mounting"""
|
||||
pass
|
||||
|
||||
|
||||
class SmartMagnetFaultException(Exception):
|
||||
"""Custom exception for smart magnet fault"""
|
||||
pass
|
||||
|
||||
|
||||
class TellMountFailedException(Exception):
|
||||
"""Custom exception for mount failure"""
|
||||
pass
|
||||
|
||||
|
||||
class TellCommandWhileBusyException(Exception):
|
||||
"""Custom exception for trying to move Tell when it is busy"""
|
||||
pass
|
||||
|
||||
|
||||
class TellConnectionException(Exception):
|
||||
"""Custom exception for connection problems"""
|
||||
pass
|
||||
|
||||
VALID_DEWAR_POSITIONS = [f"{p}{n}" for n in "12345" for p in "ABCDEFX"]
|
||||
@@ -217,8 +222,8 @@ class TellClient:
|
||||
return output
|
||||
|
||||
def set_samples_info(self, info: List[PuckWithTellPosition]):
|
||||
if self.__simulation:
|
||||
return
|
||||
"""sets the samples in the robot dewar based on the given list of PuckWithTellPosition objects
|
||||
and runs set_sample_info in the background"""
|
||||
|
||||
j = []
|
||||
for x in info:
|
||||
@@ -242,8 +247,7 @@ class TellClient:
|
||||
# self.pshell.eval("set_samples_info(" + json.dumps(info) + ")&")
|
||||
|
||||
def start_cmd(self, cmd, *argv):
|
||||
if self.__simulation:
|
||||
return 666 # FIXME should be different?
|
||||
"""starts a command on the robot and returns the command id"""
|
||||
cmd = cmd + "("
|
||||
for a in argv:
|
||||
cmd = cmd + (("'" + a + "'") if type(a) is str else str(a)) + ", "
|
||||
@@ -280,7 +284,9 @@ class TellClient:
|
||||
time.sleep(0.2)
|
||||
|
||||
def check_command_ok(self, timeout: float = 360.0, msg: str = ""):
|
||||
self.wait_mount_complete(timeout)
|
||||
"""checks to see if the last command issued to the robot was completed and returns the result
|
||||
Returns an exception if the command result doesnt return completed or removed"""
|
||||
self.wait_not_busy(timeout)
|
||||
result = self.get_result(self._last_cmd_id)
|
||||
logger.debug(f"{msg} {result}")
|
||||
status = result["status"]
|
||||
|
||||
Reference in New Issue
Block a user