def turn_and_capture(counter):
    imaging.capture('rotationtest','capturing')
    analysis.red_spot('rotationtest')
    ser.write(chr(5))
    counter = counter+1
    if(counter < 100):
        turn_and_capture(counter)
Ejemplo n.º 2
0
def looping():
    global session_status_request_error_counter
    while True:
        try:
            req = requests.get('http://digitalfoodone.appspot.com/controllersessionstatus', params={'session_name':session_name})
            print(str(req.status_code))
            data = req.json()
            print(data['state'])
            if data['state'] == 'play_two':
                respons = imaging.capture(session_name,'capturing')
                print('Image capture response: '+respons['status'])
            else:
                print('waiting...')
            break
        except requests.exceptions.Timeout:
            print("session status request: request timeout")
        except requests.exceptions.TooManyRedirects:
            print('session status request: too many redirects')
        except requests.exceptions.RequestException as e:
            print('session status request: request exception:')
            print e
        print('apparently not successful - trying again in 10 sec')
        session_status_request_error_counter += 1
        print('number of status request errors: '+str(session_status_request_error_counter))
        time.sleep(10)
Ejemplo n.º 3
0
 def imagestuff():
     resp = imaging.capture(session_name,'capturing')
     print('Received http status code: '+str(resp.status_code))
     data = resp.json()
     print('Status: '+data['status'])
     analysis_resp = analysis.red_spot(session_name)
     print('Received http status code: '+str(analysis_resp.status_code))
     if analysis_resp.status_code == 200:
         analysis_data = analysis_resp.json()
         print('Analysis status: '+analysis_data['status'])
     else:
         print('500 error on analysis post')
Ejemplo n.º 4
0
def turn_and_capture(counter):
    imaging.capture('no session')
    ser.write(chr(5))
    counter = counter+1
    if(counter < 100):
        turn_and_capture(counter)