def delivermessage(msg, loc): print "started %s" % msg try: filename = plans.get_instance('message', msg, String)[0].data except Exception as e: print e print "got instance" + str(filename) try: res = play(filename) except Exception as e: print e print res if not res: print "file not found %s" % filename raise Exception plans.add_predicate('hasdeliveredmessage', x=msg, y=loc)
def recieve_message(msg, sender=None, loc=None): res = listen() if not res: raise Exception plans.add_instance('message', msg, String(res)) plans.add_predicate('hasmessage', msg)
def bring_msg(source, dest): msg_name = planner.add_instance('message') planner.add_predicate('has_message', person=source, msg=msg_name) return planner.gen_predicate('has_message', person=dest, msg=msg_name)
def finish(self): interface.rm_predicate('robotat', x=self.arguments['loca']) interface.add_predicate('robotat', x=self.arguments['locb']) interface.add_predicate('hasvisited', x=self.arguments['locb']) self.report_success()