00001 /* 00002 * world_collection.cpp 00003 * 00004 * Created on: Oct 13, 2014 00005 * Author: jorge 00006 */ 00007 00008 #include <ros/ros.h> 00009 #include <world_canvas_msgs/ListWorlds.h> 00010 00011 #include "world_canvas_client_cpp/world_collection.hpp" 00012 00013 00014 namespace wcf 00015 { 00016 00017 WorldCollection::WorldCollection(const std::string& srv_namespace) 00018 : WorldCanvasClient(srv_namespace) 00019 { 00020 ros::ServiceClient client = 00021 this->getServiceHandle<world_canvas_msgs::ListWorlds>("list_worlds"); 00022 00023 world_canvas_msgs::ListWorlds srv; 00024 if (client.call(srv)) 00025 { 00026 world_names = srv.response.names; 00027 ROS_DEBUG("Loaded %lu world names", world_names.size()); 00028 } 00029 else 00030 { 00031 throw ros::Exception("Failed to call list_worlds service"); 00032 } 00033 } 00034 00035 00036 } // namespace wcf