def turn(self,direction): if direction not in self.Directions: direction = random.choice(self.Directions) self.pomdp.observed = None PrintRobot.turn(self,direction) cost,obs = self.pomdp.perform(self.Directions[direction]) self.viewCache.update(direction,obs) return cost,obs
def travel(self): self.pomdp.observed = None PrintRobot.travel(self) if not self.pomdp.observed: logger.info('travel observing...') self.pomdp.observe() self.viewCache.update(Front,self.pomdp.observed) logger.info("post travel obs: %r; viewCache: %r", self.pomdp.observed, self.viewCache) return self.pomdp.perform('TravelFwd')
def recognize(self,description): PrintRobot.recognize(self,description) if not self.pomdp.observed: logger.info('recognize observing...') self.pomdp.observe() logger.info('Observed %r',self.pomdp.observed) self.viewCache.update(At,self.pomdp.observed) for desc in description: logger.info('.....Examining %s\n.....for %r', self.pomdp.observed, desc) if self.NLUQueue: self.NLUQueue.put(('Recognize', repr(desc))) turnDir,descSide = self.getLookTurn(desc) match = self.recognizer.recDesc(desc, self.viewCache) self.turnBack(turnDir,descSide) if not match: logger.info('.....Did NOT recognize %r',desc) return False logger.info('.....Recognized %r',desc) logger.info('.....Recognized entire description!') return True
def declareGoal(self): PrintRobot.declareGoal(self) cost, obs = self.pomdp.perform('DeclareGoal') self.completed = (cost < 0) return cost, obs
def teleport(self, pose): PrintRobot.teleport(self, pose) self.pomdp.observed = None self.pomdp.set(pose)
def setRoute(self, Start, Dest): PrintRobot.setRoute(self, Start, Dest) self.pomdp.setRoute(Start, Dest) self.teleport(Start)
def declareGoal(self): PrintRobot.declareGoal(self) cost,obs = self.pomdp.perform('DeclareGoal') self.completed = (cost < 0) return cost,obs
def teleport(self,pose): PrintRobot.teleport(self,pose) self.pomdp.observed = None self.pomdp.set(pose) self.viewCache.reset()
def setRoute(self,Start,Dest): PrintRobot.setRoute(self,Start,Dest) self.pomdp.setRoute(Start,Dest) self.teleport(Start)