RAPP Platform  v0.6.0
RAPP Platform is a collection of ROS nodes and back-end processes that aim to deliver ready-to-use generic services to robots
 All Classes Namespaces Files Functions Variables Macros
knowrob_wrapper_communications.cpp
Go to the documentation of this file.
1 /******************************************************************************
2 Copyright 2015 RAPP
3 
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 
16  Author: Athanassios Kintsakis
17  contact: akintsakis@issel.ee.auth.gr
18 
19 ******************************************************************************/
20 
22 #include <ros/package.h>
23 
29 {
30  ros::service::waitForService("json_prolog/query", -1);
31  ros::service::waitForService("/rapp/rapp_mysql_wrapper/register_user_ontology_alias", -1);
32  ros::service::waitForService("/rapp/rapp_mysql_wrapper/get_user_ontology_alias", -1);
33 
34 
35  if(!nh_.getParam("/rapp_knowrob_wrapper_subclasses_of_topic", subclasses_of_service_topic_))
36  {
37  ROS_ERROR("rapp_knowrob_wrapper_subclass_of_topic not found");
38  }
41 
42  if(!nh_.getParam("/rapp_knowrob_wrapper_superclasses_of_topic", superclasses_of_service_topic_))
43  {
44  ROS_ERROR("rapp_knowrob_wrapper_superclass_of_topic not found");
45  }
48 
49  if(!nh_.getParam("/rapp_knowrob_wrapper_is_subsuperclass_of_topic", is_subsuperclass_of_service_topic_))
50  {
51  ROS_ERROR("rapp_knowrob_wrapper_issubsuperclass_of_topic not found");
52  }
55 
56  if(!nh_.getParam("/rapp_knowrob_wrapper_create_instance_topic", createInstanceServiceTopic_))
57  {
58  ROS_ERROR("rapp_knowrob_wrapper_create_instance_topic not found");
59  }
62 
63  if(!nh_.getParam("/rapp_knowrob_wrapper_dump_ontology_topic", dumpOntologyServiceTopic_))
64  {
65  ROS_ERROR("rapp_knowrob_wrapper_dump_ontology_topic not found");
66  }
69 
70  if(!nh_.getParam("/rapp_knowrob_wrapper_load_ontology_topic", loadOntologyServiceTopic_))
71  {
72  ROS_ERROR("ontology_load_ontology_topic not found");
73  }
76 
77  if(!nh_.getParam("/rapp_knowrob_wrapper_user_instances_of_class", user_instances_of_class_topic_))
78  {
79  ROS_ERROR("ontologyuser_instances_of_class_topic not found");
80  }
83 
84  if(!nh_.getParam("/rapp_knowrob_wrapper_create_ontology_alias", create_ontology_alias_topic_))
85  {
86  ROS_ERROR("rapp_knowrob_wrapper_create_ontology_alias_topic not found");
87  }
90 
91  if(!nh_.getParam("/rapp_knowrob_wrapper_user_performance_cognitve_tests", user_performance_cognitve_tests_topic_))
92  {
93  ROS_ERROR("create_user_performance_cognitve_tests_topic not found");
94  }
97 
98  if(!nh_.getParam("/rapp_knowrob_wrapper_create_cognitve_tests", create_cognitve_tests_topic_))
99  {
100  ROS_ERROR("create_cognitve_tests_topic not found");
101  }
104 
105  if(!nh_.getParam("/rapp_knowrob_wrapper_cognitive_tests_of_type", cognitive_tests_of_type_topic_))
106  {
107  ROS_ERROR("cognitive_tests_of_type not found");
108  }
111 
112  if(!nh_.getParam("/rapp_knowrob_wrapper_record_user_cognitive_tests_performance", record_user_cognitive_tests_performance_topic_))
113  {
114  ROS_ERROR("record_user_cognitive_tests_performance not found");
115  }
118 
119  if(!nh_.getParam("/rapp_knowrob_wrapper_clear_user_cognitive_tests_performance_records", clear_user_cognitive_tests_performance_records_topic_))
120  {
121  ROS_ERROR("rapp_knowrob_wrapper_clear_user_cognitive_tests_performance_records not found");
122  }
125 
126  if(!nh_.getParam("/rapp_knowrob_wrapper_retract_user_ontology_alias", retract_user_ontology_alias_topic_))
127  {
128  ROS_ERROR("rapp_knowrob_wrapper_retract_user_ontology_alias not found");
129  }
132 
133  if(!nh_.getParam("/rapp_knowrob_wrapper_register_image_object_to_ontology", register_image_object_to_ontology_topic_))
134  {
135  ROS_ERROR("rapp_knowrob_wrapper_register_image_object_to_ontology not found");
136  }
139 
140  rapp_platform_ros_communications::ontologyLoadDumpSrv::Request req;
141  rapp_platform_ros_communications::ontologyLoadDumpSrv::Response res;
142 
143  req.file_url=std::string("currentOntologyVersion.owl");
145  if(res.success!=true)
146  {
147  ROS_ERROR("Ontology backup was not loaded.. Continuing with empty ontology");
148  ROS_ERROR_STREAM(res.error);
149  }
150  else
151  {
152  ROS_INFO("Ontology backup successfully loaded");
153  }
154  ROS_INFO("KnowRob ROS wrapper initialized");
155 }
156 
164  rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Request& req,
165  rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response& res)
166 {
168  return true;
169 }
170 
178  rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Request& req,
179  rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response& res)
180 {
182  return true;
183 }
184 
192  rapp_platform_ros_communications::ontologyIsSubSuperClassOfSrv::Request& req,
193  rapp_platform_ros_communications::ontologyIsSubSuperClassOfSrv::Response& res)
194 {
196  return true;
197 }
198 
206  rapp_platform_ros_communications::createInstanceSrv::Request& req,
207  rapp_platform_ros_communications::createInstanceSrv::Response& res)
208 {
210  return true;
211 }
212 
220  rapp_platform_ros_communications::ontologyLoadDumpSrv::Request& req,
221  rapp_platform_ros_communications::ontologyLoadDumpSrv::Response& res)
222 {
224  return true;
225 }
226 
234  rapp_platform_ros_communications::ontologyLoadDumpSrv::Request& req,
235  rapp_platform_ros_communications::ontologyLoadDumpSrv::Response& res)
236 {
238  return true;
239 }
240 
248  rapp_platform_ros_communications::createOntologyAliasSrv::Request& req,
249  rapp_platform_ros_communications::createOntologyAliasSrv::Response& res)
250 {
252  return true;
253 }
254 
262  rapp_platform_ros_communications::returnUserInstancesOfClassSrv::Request& req,
263  rapp_platform_ros_communications::returnUserInstancesOfClassSrv::Response& res)
264 {
266  return true;
267 }
268 
276  rapp_platform_ros_communications::userPerformanceCognitveTestsSrv::Request& req,
277  rapp_platform_ros_communications::userPerformanceCognitveTestsSrv::Response& res)
278 {
280  return true;
281 }
282 
290  rapp_platform_ros_communications::createCognitiveExerciseTestSrv::Request& req,
291  rapp_platform_ros_communications::createCognitiveExerciseTestSrv::Response& res)
292 {
294  return true;
295 }
296 
304  rapp_platform_ros_communications::cognitiveTestsOfTypeSrv::Request& req,
305  rapp_platform_ros_communications::cognitiveTestsOfTypeSrv::Response& res)
306 {
308  return true;
309 }
310 
318  rapp_platform_ros_communications::recordUserPerformanceCognitiveTestsSrv::Request& req,
319  rapp_platform_ros_communications::recordUserPerformanceCognitiveTestsSrv::Response& res)
320 {
322  return true;
323 }
324 
332  rapp_platform_ros_communications::clearUserPerformanceCognitveTestsSrv::Request& req,
333  rapp_platform_ros_communications::clearUserPerformanceCognitveTestsSrv::Response& res)
334 {
336  return true;
337 }
338 
346  rapp_platform_ros_communications::retractUserOntologyAliasSrv::Request& req,
347  rapp_platform_ros_communications::retractUserOntologyAliasSrv::Response& res)
348 {
350  return true;
351 }
352 
360  rapp_platform_ros_communications::registerImageObjectToOntologySrv::Request& req,
361  rapp_platform_ros_communications::registerImageObjectToOntologySrv::Response& res)
362 {
364  return true;
365 }
bool clear_user_cognitive_tests_performance_records_callback(rapp_platform_ros_communications::clearUserPerformanceCognitveTestsSrv::Request &req, rapp_platform_ros_communications::clearUserPerformanceCognitveTestsSrv::Response &res)
Serves the clear_user_cognitive_tests_performance_records ROS service callback.
bool retract_user_ontology_alias_callback(rapp_platform_ros_communications::retractUserOntologyAliasSrv::Request &req, rapp_platform_ros_communications::retractUserOntologyAliasSrv::Response &res)
Serves the retract_user_ontology_alias ROS service callback.
rapp_platform_ros_communications::createInstanceSrv::Response createInstanceQuery(rapp_platform_ros_communications::createInstanceSrv::Request req)
Implements the createInstance ROS service.
ros::ServiceServer clear_user_cognitive_tests_performance_records_service_
rapp_platform_ros_communications::returnUserInstancesOfClassSrv::Response user_instances_of_class(rapp_platform_ros_communications::returnUserInstancesOfClassSrv::Request req)
Implements the returnUserInstancesOfClass ROS service.
bool create_cognitve_tests_callback(rapp_platform_ros_communications::createCognitiveExerciseTestSrv::Request &req, rapp_platform_ros_communications::createCognitiveExerciseTestSrv::Response &res)
Serves the create_cognitve_tests ROS service callback.
bool loadOntologyCallback(rapp_platform_ros_communications::ontologyLoadDumpSrv::Request &req, rapp_platform_ros_communications::ontologyLoadDumpSrv::Response &res)
Serves the loadOntology ROS service callback.
rapp_platform_ros_communications::createCognitiveExerciseTestSrv::Response create_cognitve_tests(rapp_platform_ros_communications::createCognitiveExerciseTestSrv::Request req)
Implements the create_cognitve_tests ROS service.
rapp_platform_ros_communications::ontologyLoadDumpSrv::Response loadOntologyQuery(rapp_platform_ros_communications::ontologyLoadDumpSrv::Request req)
Implements the loadOntology ROS service.
bool record_user_cognitive_tests_performance_callback(rapp_platform_ros_communications::recordUserPerformanceCognitiveTestsSrv::Request &req, rapp_platform_ros_communications::recordUserPerformanceCognitiveTestsSrv::Response &res)
Serves the record_user_cognitive_tests_performance ROS service callback.
rapp_platform_ros_communications::recordUserPerformanceCognitiveTestsSrv::Response record_user_cognitive_tests_performance(rapp_platform_ros_communications::recordUserPerformanceCognitiveTestsSrv::Request req)
Implements the record_user_cognitive_tests_performance ROS service.
bool dumpOntologyCallback(rapp_platform_ros_communications::ontologyLoadDumpSrv::Request &req, rapp_platform_ros_communications::ontologyLoadDumpSrv::Response &res)
Serves the dumpOntology ROS service callback.
bool subclassesOfCallback(rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Request &req, rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response &res)
Serves the subclassesOf ROS service callback.
rapp_platform_ros_communications::registerImageObjectToOntologySrv::Response register_image_object_to_ontology(rapp_platform_ros_communications::registerImageObjectToOntologySrv::Request req)
Implements the register_image_object_to_ontology ROS service.
rapp_platform_ros_communications::createOntologyAliasSrv::Response create_ontology_alias(rapp_platform_ros_communications::createOntologyAliasSrv::Request req)
Implements the create_ontology_alias ROS service.
bool create_ontology_alias_callback(rapp_platform_ros_communications::createOntologyAliasSrv::Request &req, rapp_platform_ros_communications::createOntologyAliasSrv::Response &res)
Serves the create_ontology_alias ROS service callback.
rapp_platform_ros_communications::retractUserOntologyAliasSrv::Response retract_user_ontology_alias(rapp_platform_ros_communications::retractUserOntologyAliasSrv::Request req)
Implements the retract_user_ontology_alias ROS service.
bool cognitive_tests_of_type_callback(rapp_platform_ros_communications::cognitiveTestsOfTypeSrv::Request &req, rapp_platform_ros_communications::cognitiveTestsOfTypeSrv::Response &res)
Serves the cognitive_tests_of_type ROS service callback.
rapp_platform_ros_communications::clearUserPerformanceCognitveTestsSrv::Response clear_user_cognitive_tests_performance_records(rapp_platform_ros_communications::clearUserPerformanceCognitveTestsSrv::Request req)
Implements the clear_user_cognitive_tests_performance_records ROS service.
bool createInstanceCallback(rapp_platform_ros_communications::createInstanceSrv::Request &req, rapp_platform_ros_communications::createInstanceSrv::Response &res)
Serves the createInstance ROS service callback.
ros::ServiceServer register_image_object_to_ontology_service_
rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response subclassesOfQuery(rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Request req)
Implements the subclassesOf ROS service.
ros::ServiceServer user_performance_cognitve_tests_service_
rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response superclassesOfQuery(rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Request req)
Implements the superclassesOf ROS service.
bool user_performance_cognitve_tests_callback(rapp_platform_ros_communications::userPerformanceCognitveTestsSrv::Request &req, rapp_platform_ros_communications::userPerformanceCognitveTestsSrv::Response &res)
Serves the user_performance_cognitve_tests ROS service callback.
ros::ServiceServer record_user_cognitive_tests_performance_service_
rapp_platform_ros_communications::ontologyIsSubSuperClassOfSrv::Response isSubSuperclassOfQuery(rapp_platform_ros_communications::ontologyIsSubSuperClassOfSrv::Request req)
Implements the isSubSuperclass ROS service.
bool user_instances_of_class_callback(rapp_platform_ros_communications::returnUserInstancesOfClassSrv::Request &req, rapp_platform_ros_communications::returnUserInstancesOfClassSrv::Response &res)
Serves the user_instances_of_class ROS service callback.
rapp_platform_ros_communications::userPerformanceCognitveTestsSrv::Response user_performance_cognitve_tests(rapp_platform_ros_communications::userPerformanceCognitveTestsSrv::Request req)
Implements the user_performance_cognitve_tests ROS service.
rapp_platform_ros_communications::ontologyLoadDumpSrv::Response dumpOntologyQuery(rapp_platform_ros_communications::ontologyLoadDumpSrv::Request req)
Implements the dumpOntology ROS service.
bool superclassesOfCallback(rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Request &req, rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response &res)
Serves the superlassesOf ROS service callback.
rapp_platform_ros_communications::cognitiveTestsOfTypeSrv::Response cognitive_tests_of_type(rapp_platform_ros_communications::cognitiveTestsOfTypeSrv::Request req)
Implements the cognitive_tests_of_type ROS service.
bool isSubSuperclassOfCallback(rapp_platform_ros_communications::ontologyIsSubSuperClassOfSrv::Request &req, rapp_platform_ros_communications::ontologyIsSubSuperClassOfSrv::Response &res)
Serves the isSubSuperclassOf ROS service callback.
bool register_image_object_to_ontology_callback(rapp_platform_ros_communications::registerImageObjectToOntologySrv::Request &req, rapp_platform_ros_communications::registerImageObjectToOntologySrv::Response &res)
Serves the register_image_object_to_ontology ROS service callback.