def phraseTwo(): global phraseTwoPath print "phase two begin" global returnPath, phaseTwoPath returnPath.append(startPosition) print "RETURN PATH: "+str(returnPath) setRunningPhrase(2) utility.startTimer() pathTwo = phaseTwoPath #pathTwo=[] print "===========" print pathTwo if(pathTwo==[]): print "no optimal path find so go back on the same path as phase one" pathTwo=returnPath while True: time.sleep(0.01) if(len(pathTwo)!=0): print "aaaaaaaaaaaa" moveFromCurrentPositionTo(pathTwo[0]) pathTwo.pop(0) elif(currentPosition==startPosition): sendMessages("Reached StartPosition, total running time: "+str(utility.getTime())+" seconds",3) break startingCheck()
def phraseTwo(): #global phraseTwoPath print "phase two begin" global returnPath, phaseTwoPath returnPath.append(startPosition) print "RETURN PATH: "+str(returnPath) setRunningPhrase(2) utility.startTimer() pathTwo = phaseTwoPath print "===========" print pathTwo if(pathTwo==[]): print "no optimal path find so go back on the same path as phase one" pathTwo=returnPath while True: time.sleep(0.01) if(len(pathTwo)!=0): print "aaaaaaaaaaaa" moveFromCurrentPositionTo(pathTwo[0]) pathTwo.pop(0) elif(currentPosition==startPosition): sendMessages("Reached StartPosition, total running time: "+str(utility.getTime())+" seconds",3) break
import utility import threading import time threading.Thread(target=utility.startTimer).start() time.sleep(2) print utility.getTime() time.sleep(1) print utility.getTime() utility.startTimer() time.sleep(1) print utility.getTime() time.sleep(1) print utility.getTime()