def talk2server(cmd='connect', devN=1): """ Communicate with server 'if active' inputs: cmd = str 'connect' ,'check' , 'sync' or 'close' devN = int 1, 2, ... n, (must be declared in server_threads.py) outputs: server_reponse = str, server response server_time = str, server timestamp usage: server_response, server_time = talk2server(cmd='connect',devN=1) """ try: server_response, server_time = client.check_tcp_server(cmd=cmd,dev=devN).split("_") server_response,server_time = clientConnectThread.get_command() except: # noserver response server_time="na" server_response="none" # print "server reponse: {} and timestamp: {}".format(server_response, server_time) return server_response, server_time
# hdf5 file h5filename = root+actionname+"/"+actorname+"/mmSLEEP_"+str(dev)+".h5" # Verify that the hdf5 file exists h5file, group = checkh5exists(h5filename) #create a new table: devTable devTable = h5file.createTable(group, actorname, arc.ARCtable, actorname) # initialize the arrays for the joint coordinates & confidences confidences = np.zeros((15,1), dtype=float) p_jnts = np.zeros((15,3), dtype=float) r_jnts = np.zeros((15,3), dtype=float) ##--- main loop --- # connect to server! client.check_tcp_server(cmd='connect', dev=dev) # rr,kk = timeEvent(1,.5) # comment out for instantaneous activation done = False while not done: # view <= nviews if view == nviews: done = True # checking the running time if run_time >= minutes*60: view +=1 print "Moving onto the next view: ", view*arcstep print "\t Pausing for 5 seconds to record again" viewframe = 0 time.sleep(5) # sleep 5 seconds print "Begin recording... again!" run_time = 0 # if time
h5filename = root + actionname + "/" + actorname + "/mmSLEEP_" + str( dev) + ".h5" # Verify that the hdf5 file exists h5file, group = checkh5exists(h5filename) #create a new table: devTable devTable = h5file.createTable(group, actorname, arc.ARCtable, actorname) # initialize the arrays for the joint coordinates & confidences confidences = np.zeros((15, 1), dtype=float) p_jnts = np.zeros((15, 3), dtype=float) r_jnts = np.zeros((15, 3), dtype=float) ##--- main loop --- # connect to server! client.check_tcp_server(cmd='connect', dev=dev) # rr,kk = timeEvent(1,.5) # comment out for instantaneous activation done = False while not done: # view <= nviews if view == nviews: done = True # checking the running time if run_time >= minutes * 60: view += 1 print "Moving onto the next view: ", view * arcstep print "\t Pausing for 5 seconds to record again" viewframe = 0 time.sleep(5) # sleep 5 seconds print "Begin recording... again!" run_time = 0 # if time