Skip to content

Common

busy_wait(timeout)

Busy wait untill timeout value is reached, timeout : sec returns true if timeout occured

Source code in dod/common.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def busy_wait(timeout: int):
  '''
        Busy wait untill timeout value is reached,
        timeout : sec
        returns true if timeout occured
  '''
  start = time.time()
  r = client.get_status()
  delta = 0

  while(r.STATUS['Status'] == "Busy"):
    if delta > timeout:
      return True

    time.sleep(0.1) #Wait a ms to stop spamming robot
    r = client.get_status()
    delta = time.time() - start

  return False