diff --git a/socs/agents/acu/agent.py b/socs/agents/acu/agent.py index bcacb9e56..d221486cf 100644 --- a/socs/agents/acu/agent.py +++ b/socs/agents/acu/agent.py @@ -69,6 +69,13 @@ SUN_MAP_REFRESH = 6 * avoidance.HOUR +#: Things the ACU might say when you've done things properly +OK_RESPONSES = [ + b'OK, Command executed.', + b'OK, Command send.', +] + + class ACUAgent: """Agent to acquire data from an ACU and control telescope pointing with the ACU. @@ -1121,9 +1128,6 @@ def _go_to_axis(self, session, axis, target, # platform moving around. UNREASONABLE_VEL = 0.1 - # Positive acknowledgment of AcuControl.go_to - OK_RESPONSE = b'OK, Command executed.' - # Enum for the motion states State = Enum(f'{axis}State', ['INIT', 'WAIT_MOVING', 'WAIT_STILL', 'FAIL', 'DONE']) @@ -1279,7 +1283,7 @@ def get_history(t): if state == State.INIT: # Set target position and change mode to Preset. result = yield ctrl.goto(target) - if result == OK_RESPONSE: + if result in OK_RESPONSES: state = State.WAIT_MOVING else: self.log.error(f'ACU rejected go_to with message: {result}') @@ -3027,8 +3031,6 @@ def log(msg): dset_cmd = 'ShutterClose' desired_key, undesired_key = 'Shutter_closed', 'Shutter_open' - OK_RESPONSE = b'OK, Command executed.' - # This just needs to be longer than 1 loop time. STATE_WAIT = 5. @@ -3060,7 +3062,7 @@ def log(msg): elif state == 'init': # Issue the command result = yield self.acu_control.Command(self.datasets['shutter'], dset_cmd) - if result == OK_RESPONSE: + if result in OK_RESPONSES: state = 'wait-moving' timeout = time.time() + STATE_WAIT else: