Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def control_wait_for(self, goal, interval_sec=1):
"""
control_wait_for will poll Eva's state, waiting for Eva to reach the goal state
"""
parsed_goal = RobotState(goal)
while True:
robot_state = RobotState(self.data_snapshot()['control']['state'])
if robot_state == RobotState.ERROR:
eva_error('Eva is in error control state')
elif robot_state == parsed_goal:
return
time.sleep(interval_sec)