def set_location_function(name, pose_in=None):
    global pose
    if pose_in is None:
        pose_in = pose.pose
    # print pose
    # rospy.INFO('Setting location to %s' % name)
    interface.add_instance('location', name, pose_in)
def handle_create_new_person(req):
    if req.name != "":
	rospy.loginfo("Creating %s with id %s" % (str(req.name) ,str(req.id)))
	human = Human(req.name, req.id)
	population[req.id] = human
	with open(pop_file, 'w') as file:
	    pickle.dump(population, file)
	interface.add_instance('person', human._person.name, human) 
	return True
    else:
	return False
def handle_create_new_person(req):
    if req.name != "":
	rospy.loginfo("Creating %s with id %s" % (str(req.name) ,str(req.id)))
	human = Human(req.name, req.id)
	population[req.id] = human
	with open(pop_file, 'w') as file:
	    pickle.dump(population, file)
	interface.add_instance('person', human._person.name, human) 
	return True
    else:
	return False


if __name__ == '__main__':
    rospy.init_node("name_provider_node")
    interface.init()

    pop_file = '/home/yochan/names.pickle'
    if os.path.isfile(pop_file):
	with open(pop_file, 'r') as file:
	    population = pickle.load(file)

    for key in population:
	h = population[key]
	interface.add_instance('person', h._person.name, h) 

    get_name_service = rospy.Service("get_real_name", GetRealName, handle_get_real_name)
    get_name_service = rospy.Service("create_new_person", CreateNewPerson, handle_create_new_person)
    rospy.spin()
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)
Example #5
0
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)