def read_obstacles_server(): rospy.init_node('read_obstacles_server') rospy.Service('read_obstacles', ReadObstacles, handle_obstacles) # Store obstacles in Parameter Server vec, size = obstacles_functions.read_obstacles_function(file_path) rospy.set_param(PARAM_NAME_OBSTACLES, vec) rospy.set_param(PARAM_NAME_SIZE, size) rospy.spin()
def handle_obstacles(req): """ Callback to read obstacles :param req: :return: """ # print("Returning obstacles from file [%s]" % req.file) vec, size = obstacles_functions.read_obstacles_function(req.file) # print("Obstacles of size %s are : [%s]" % (size, vec)) return ReadObstaclesResponse(size, vec)
def check_point_server(file_path): rospy.init_node('check_point_server') rospy.Service('check_point', CheckPoint, check_if_valid) # Store obstacles in Parameter Server vec, size = obstacles_functions.read_obstacles_function(file_path) rospy.set_param(PARAM_NAME_OBSTACLES, vec) rospy.set_param(PARAM_NAME_SIZE, size) print("Loaded obstacles in file: " + file_path) print("Now ready to check if point is valid") rospy.spin()
def check_connection_server(file_path): """ Define server for check_connection :param file_path: path from which one can retrieve obstacles """ rospy.init_node('check_connection_server') rospy.Service('check_connection', CheckConnection, check_if_valid) # Store obstacles in Parameter Server vec, size = obstacles_functions.read_obstacles_function(file_path) rospy.set_param(PARAM_NAME_OBSTACLES, vec) rospy.set_param(PARAM_NAME_SIZE, size) print("Loaded obstacles from file: " + file_path) print("Now ready to check if connections are valid") rospy.spin()
def handle_obstacles(req): print("Returning obstacles from file [%s]" % req.file) vec, size = obstacles_functions.read_obstacles_function(req.file) print("Obstacles of size %s are : [%s]" % (size, vec)) return ReadObstaclesResponse(size, vec)