world_model.hpp
Go to the documentation of this file.
1 
18 #pragma once
19 
20 // Global Inclusion
21 #include <boost/shared_ptr.hpp>
22 #include <boost/lexical_cast.hpp>
23 #include <vector>
24 #include <map>
25 #include <list>
26 #include <algorithm>
27 #include <fstream>
28 #include <sstream>
29 #include <memory>
30 #include <rapidxml.hpp>
31 
32 // ROS Main Inclusion
33 #include <ros/ros.h>
34 
35 // ROS-wide Inclusion
36 #include <ISM/utility/TableHelper.hpp>
37 #include <asr_msgs/AsrObject.h>
38 #include <dynamic_reconfigure/server.h>
39 
40 #include <asr_world_model/DynamicParametersConfig.h>
41 
50 
51 
52 namespace world_model
53 {
54 
55 
60 {
61 public:
62  /* ----------------- Public members ------------------ */
63  // Wrapped Constants
64 
65  // Object visualization
66  static const inline std::string GetObjectVisualizationParamName()
67  { return "found_object_visualization"; }
68 
69 private:
70  static const inline std::string GetClientGetObjectMetaDataServiceName()
71  { return "/asr_object_database/object_meta_data"; }
72 
73  static const inline std::string GetClientGetRecognizerListServiceName()
74  { return "/asr_object_database/recognizer_list"; }
75 private:
76  /* ----------------- Private members ------------------ */
77  // Services
82 
88 
93 
97 
98  // the node handles
100 
102  dynamic_reconfigure::Server<asr_world_model::DynamicParametersConfig> mDynamicReconfigServer;
103 
104  // handles
109 
110 
112 
114 
115 public:
116  /* ----------------- Public functions ------------------ */
120  WorldModel();
121 
122 private:
123 
124 template<typename T>
127  bool test = true;
128  while(test) {
129  std::size_t found = map.find(";");
130  if (found != std::string::npos) {
131  std::string temp;
132  temp = map.substr(0,found);
133  std::size_t temp_found = temp.find(",");
134  (*returnMap)[temp.substr(0,temp_found)] = boost::lexical_cast<T>(temp.substr(temp_found+1));
135  map = map.substr(found+1);
136  } else {
137  test = false;
138  break;
139  }
140  }
141  std::size_t temp_found = map.find(",");
142  if (temp_found != std::string::npos) {
143  (*returnMap)[map.substr(0,temp_found)] = boost::lexical_cast<T>(map.substr(temp_found+1));
144  }
145  return returnMap;
146 }
147 
148 template<typename T>
151  boost::shared_ptr<std::vector<std::pair<std::string, T>>>(new std::vector<std::pair<std::string, T>>);
152  bool test = true;
153  while(test) {
154  std::size_t found = map.find(";");
155  if (found != std::string::npos) {
156  std::string temp;
157  temp = map.substr(0,found);
158  std::size_t temp_found = temp.find(",");
159  returnVector->push_back(std::make_pair(temp.substr(0,temp_found), boost::lexical_cast<T>(temp.substr(temp_found+1))));
160  map = map.substr(found+1);
161  } else {
162  test = false;
163  break;
164  }
165  }
166  std::size_t temp_found = map.find(",");
167  if (temp_found != std::string::npos) {
168  returnVector->push_back(std::make_pair(map.substr(0,temp_found), boost::lexical_cast<T>(map.substr(temp_found+1))));
169  }
170  return returnVector;
171 }
172 
173 void dynamicReconfigureCallback(asr_world_model::DynamicParametersConfig &config, uint32_t level);
174 
176 
177 void initParams();
178 void initMapsFromSqlTable();
179 void initIntermediateObjectWeights(const ISM::TableHelperPtr &table_helper);
181 
182 void advertiseServices();
183 
184 bool processEmptyFoundObjectListServiceCall(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response);
185 bool processGetAllObjectsListServiceCall(asr_world_model::GetAllObjectsList::Request &request, asr_world_model::GetAllObjectsList::Response &response);
186 
187 };
188 
189 }
ros::ServiceServer get_viewport_list_service_server_
Definition: world_model.hpp:80
ros::ServiceServer push_found_object_service_server_
Definition: world_model.hpp:83
static const std::string GetObjectVisualizationParamName()
Definition: world_model.hpp:66
ros::ServiceServer filter_viewport_depending_on_already_visited_viewports
Definition: world_model.hpp:81
ros::ServiceServer get_recognizer_name_service_server_
Definition: world_model.hpp:89
static boost::shared_ptr< std::vector< std::pair< std::string, T > > > processStringVector(std::string &map)
ros::ServiceServer get_all_objects_list_service_server_
Definition: world_model.hpp:91
static const std::string GetClientGetRecognizerListServiceName()
Definition: world_model.hpp:73
boost::shared_ptr< CompletePatternsHandler > complete_patterns_handler_ptr_
WorldModel()
Creates a new instance of the world model and starts the services.
Definition: world_model.cpp:26
ros::ServiceServer visualize_sampled_poses_service_server_
Definition: world_model.hpp:87
ros::ServiceServer get_missing_object_list_service_server_
Definition: world_model.hpp:92
ros::ServiceServer get_found_object_list_service_server_
Definition: world_model.hpp:86
void dynamicReconfigureCallback(asr_world_model::DynamicParametersConfig &config, uint32_t level)
Definition: world_model.cpp:59
ros::ServiceServer get_complete_patterns_service_server_
Definition: world_model.hpp:94
bool processGetAllObjectsListServiceCall(asr_world_model::GetAllObjectsList::Request &request, asr_world_model::GetAllObjectsList::Response &response)
boost::shared_ptr< CommonInformationHandler > common_information_handler_ptr_
WorldModel class provides services for adding the viewports of the next best views to a list and retr...
Definition: world_model.hpp:59
ros::NodeHandle local_handle_
Definition: world_model.hpp:99
ros::ServiceServer get_intermediate_object_weight_service_server_
Definition: world_model.hpp:90
ros::ServiceServer push_viewport_service_server_
Definition: world_model.hpp:78
ros::ServiceServer push_complete_patterns_service_server_
Definition: world_model.hpp:96
boost::shared_ptr< FoundObjectHandler > found_object_handler_ptr_
void initIntermediateObjectWeights(const ISM::TableHelperPtr &table_helper)
static boost::shared_ptr< std::map< std::string, T > > processStringMap(std::string &map)
ros::ServiceServer empty_complete_patterns_service_server_
Definition: world_model.hpp:95
DebugHelperPtr debug_helper_ptr_
bool processEmptyFoundObjectListServiceCall(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response)
static const std::string GetClientGetObjectMetaDataServiceName()
Definition: world_model.hpp:70
ModelTypePtrPerTypeMapPtr model_type_ptr_per_type_map_ptr_
ros::ServiceServer push_found_object_list_service_server_
Definition: world_model.hpp:84
boost::shared_ptr< ViewPortHandler > view_port_handler_ptr_
ros::ServiceServer empty_found_object_list_service_server_
Definition: world_model.hpp:85
ros::ServiceServer empty_viewport_list_service_server_
Definition: world_model.hpp:79
dynamic_reconfigure::Server< asr_world_model::DynamicParametersConfig > mDynamicReconfigServer


asr_world_model
Author(s): Aumann Florian, Borella Jocelyn, Hutmacher Robin, Karrenbauer Oliver, Meißner Pascal, Schleicher Ralf, Stöckle Patrick, Trautmann Jeremias
autogenerated on Thu Jan 9 2020 07:20:01