Tell_client: fix state event handling, update tests
This commit is contained in:
1 parent
d43218eb19
commit
ef7d3cf157
2 files changed
+60
-26
No files matched your search
@@ -278,34 +278,22 @@ class TellClient:
|
||||
timeout=wait_timeout,
|
||||
)
|
||||
logger.info(f"event: {event} occurred with value: {value}")
|
||||
if event == "state" and str(value) == '"Ready"':
|
||||
try:
|
||||
msg = self.check_command_ok(
|
||||
timeout=wait_timeout, msg=f"Mount {segment}{puck}-{sample}: "
|
||||
)
|
||||
logger.info(f"Check command okay response: {msg}")
|
||||
return TellEventValueEnum.SUCCESS
|
||||
except Exception:
|
||||
raise
|
||||
if event == "state" and value == '"Busy"':
|
||||
logger.warning('got busy response form robot, waiting for mount to complete')
|
||||
try:
|
||||
msg = self.check_command_ok(
|
||||
timeout=wait_timeout, msg=f"Mount {segment}{puck}-{sample}: "
|
||||
)
|
||||
logger.info(f"Check command okay response: {msg}")
|
||||
return TellEventValueEnum.SUCCESS
|
||||
except Exception:
|
||||
raise
|
||||
if event is None or event == "state":
|
||||
# TELL reports a state transition (typically "Busy" then
|
||||
# "Ready"). Event timing means we sometimes observe the
|
||||
# intermediate "Busy", and the value can arrive quoted or
|
||||
# unquoted, so we do not trust the event value here. Instead
|
||||
# wait for the mount to finish and let check_command_ok be
|
||||
# the sole authority on success/failure.
|
||||
state_value = str(value).strip().strip('"\'').lower()
|
||||
if state_value == "busy":
|
||||
logger.warning("got busy response from robot, waiting for mount to complete")
|
||||
logger.info(f"event: {event} occurred with value: {value}, checking command completed okay")
|
||||
self.check_command_ok(
|
||||
msg = self.check_command_ok(
|
||||
timeout=wait_timeout, msg=f"Mount {segment}{puck}-{sample}: "
|
||||
)
|
||||
if value.lower() == "ready" or value.lower() == '"ready"' or value == "Ready" or str(value.lower()) == "ready" or str(value.lower()) == '"ready"':
|
||||
return TellEventValueEnum.SUCCESS
|
||||
else:
|
||||
raise Exception(f"Unexpected event: {event} occurred with value: {value}")
|
||||
logger.info(f"Check command okay response: {msg}")
|
||||
return TellEventValueEnum.SUCCESS
|
||||
elif (
|
||||
event == TellEventTypeEnum.GIPPER_DETECTION.value
|
||||
and value == TellEventValueEnum.NO_PIN_IN_GRIPPER.value
|
||||
|
||||
Reference in new issue
Block a user