def main(): #print "Enter the IP of the robot: " #robotIP = raw_input() #print "Enter the PORT of the robot: " #robotPORT = int(raw_input()) global searchTime searchTime = time.clock() global memoryProxy global postureProxy global motionProxy global speechProxy global ballSub global faceSub goal.Goal.target = "Nothing" print goal.Goal.target a = actions.actionsInit() a.init() a.toggleAutoLife() r = actions.rest() r.rest() action = actionsList.actionsList() action.init() memoryProxy = ALProxy("ALMemory") postureProxy = ALProxy("ALRobotPosture") motionProxy = ALProxy("ALMotion") speechProxy = ALProxy("ALAnimatedSpeech") global ballEvent ballEvent = ballEventListener("ballEvent") global faceEvent faceEvent = faceEventListener("faceEvent") actions.actionsInit.goalAchieved = True try: while True: aStarPlanner() time.sleep(1) except KeyboardInterrupt: ballEvent.unsub() faceEvent.unsub() actions.stopTracking() quit()
def finiteStateMachine(): if actions.actionsInit.goalAchieved == True: actions.stopTracking() return global step global listOfActions a = actionsList.actionsList() goal.Goal.target = "Nothing" print "The precondition is: " + str( a.checkEffect(a.findPrecondition(listOfActions[0]))) if a.checkEffect(a.findPrecondition( listOfActions[0])) == True and step > 1: perform(listOfActions[0]) del listOfActions[0] step -= 1 elif a.checkEffect(a.findPrecondition( listOfActions[0])) == True and step == 1: perform(listOfActions[0]) del listOfActions[0] step -= 1 print "Goalachieved is: " + str(actions.actionsInit.goalAchieved) if actions.actionsInit.goalAchieved == True: for index in range(len(listOfActions)): del listOfActions[0] print "returning" return print listOfActions if step == 0: actions.actionsInit.goalAchieved = True else: actions.actionsInit.goalAchieved = False
def finiteStateMachine(): if actions.actionsInit.goalAchieved == True: actions.stopTracking() return global step global listOfActions a = actionsList.actionsList() goal.Goal.target = "Nothing" print "The precondition is: " + str(a.checkEffect(a.findPrecondition(listOfActions[0]))) if a.checkEffect(a.findPrecondition(listOfActions[0])) == True and step > 1: perform(listOfActions[0]) del listOfActions[0] step-=1 elif a.checkEffect(a.findPrecondition(listOfActions[0])) == True and step == 1: perform(listOfActions[0]) del listOfActions[0] step-=1 print "Goalachieved is: " + str(actions.actionsInit.goalAchieved) if actions.actionsInit.goalAchieved == True: for index in range(len(listOfActions)): del listOfActions[0] print "returning" return print listOfActions if step == 0: actions.actionsInit.goalAchieved = True else: actions.actionsInit.goalAchieved = False