messageToSend = 'RESPOND' + ' ' + str(motherWalkResponse /paramIKWalk) + ' ' + str(0) + ' ' + str(0) + ' ' + str(simulationTime) + ' ' + str(motherRecResponse[0] /paramIKReach2) + ' ' + str(motherRecResponse[1] /paramIKReach2) + ' ' + str(motherRecResponse[2] /paramIKReach2) else: motherPullResponse = np.array(baWristInit - motherWrist) messageToSend = 'RESPOND' + ' ' + str(motherWalkResponse /paramIKWalk) + ' ' + str(0) + ' ' + str(0) + ' ' + str(simulationTime) + ' ' + str(motherPullResponse[0] /paramIKReach1) + ' ' + str(motherPullResponse[1] /paramIKReach1) + ' ' + str(motherPullResponse[2] /paramIKReach1) intActivity[0] = intActivity[0] + paramIntIncPull else: messageToSend = 'DO_NOTHING' motherEpisodeStatus = 'END' elif(motherEpisodeStatus == 'END'): print "MOTHER END" messageToSend = 'DO_NOTHING' timer2 = timer2 +1 if(timer2 > paramTimer2): runEpisode = 0 motherFile.close() win32file.WriteFile(p, bytearray(messageToSend, 'utf-8')) if(numEpisodes < paramEpNum): #pyp.plot(rnnActivityAUX) #pyp.show() #pyp.plot(intActivity) #pyp.show() motherWeights = uf.motherLearnWeights(motherWeights) # should be involved in intActivity 'growth' over time ## End program / pipes animMessage = win32file.ReadFile(p, 4096)[1] win32file.WriteFile(p, bytearray('STOP', 'utf-8')) #pyp.plot(rnnActivityAUX) #pyp.show() print("Last message received") win32file.CloseHandle(p)