RCL - RoboCLuedo  v1.0
Francesco Ganci - S4143910 - Experimental Robotics Lab - Assignment 1
example_armor_cluedo_1.cpp
Go to the documentation of this file.
1 
2 
16 #include "ros/ros.h"
18 #include "armor_tools_armor_cluedo.h"
19 #include "armor_msgs/ArmorDirective.h"
20 #include "armor_msgs/ArmorDirectiveReq.h"
21 #include "armor_msgs/ArmorDirectiveRes.h"
22 
23 #include <iostream>
24 #include <string>
25 
26 int main( int argc, char* argv[] )
27 {
28  ros::init( argc, argv, "example_armor_cluedo_1" );
29  ros::NodeHandle nh;
30 
31 
32 
33  // === INIT
34 
35  // instanciation and connection
36  ArmorCluedo armor;
37  armor.Init( "/root/ontologies/my_super_ontology.owl" );
38 
39 
40 
41  // === ADDING INDIVIDUALS
42 
43  // add individuals
44  armor.AddIndiv( "John", "PERSON" );
45  armor.AddIndiv( "Broccoli", "WEAPON" );
46  armor.AddIndiv( "Stadium", "PLACE" );
47  armor.AddIndiv( "SmartHypothesis", "HYPOTHESIS" );
48 
49  // REMEMBER TO UPDATE!
50  armor.UpdateOntology( );
51 
52 
53 
54  // === INFORMATIONS about the individuals
55 
56  // get the classes an individual belongs to
57  std::vector<std::string> classes_of_john = armor.GetClassOfIndiv( "John" );
58 
59  // get the individuals belonging to a class
60  std::vector<std::string> indiv_of_class_weapon = armor.GetIndivOfClass( "WEAPON" );
61 
62  // check if an individual exists
63  if( armor.ExistsIndiv( "Tower" ) == false ) std::cout << "'Tower' not defined." << std::endl;
64  if( armor.ExistsIndiv( "Stadium" ) == true ) std::cout << "'Stadium' exists!" << std::endl;
65 
66 
67 
68  return 0;
69 }
ArmorCluedo::AddIndiv
bool AddIndiv(std::string indivname, std::string classname, bool makeDisjoint=true)
add an individual to the ontology
Definition: armor_cluedo.cpp:53
ArmorCluedo::Init
bool Init(std::string ontologyPath)
initizalize the interface
Definition: armor_cluedo.cpp:34
ArmorCluedo::GetIndivOfClass
std::vector< std::string > GetIndivOfClass(std::string classname)
find the individuals belonging to a class
Definition: armor_cluedo.cpp:97
ArmorTools::UpdateOntology
bool UpdateOntology()
send the command REASON
Definition: armor_tools.cpp:246
main
int main(int argc, char *argv[])
Definition: example_armor_cluedo_1.cpp:26
ArmorCluedo::GetClassOfIndiv
std::vector< std::string > GetClassOfIndiv(std::string indivname, bool deep)
get the class of a given individual
Definition: armor_cluedo.cpp:81
ArmorCluedo
additional utilities for aRMOR
Definition: armor_cluedo.h:56
ArmorCluedo::ExistsIndiv
bool ExistsIndiv(std::string indivname)
check if an individual exists
Definition: armor_cluedo.cpp:112
armor_tools.h
A minimal C++ client for aRMOR.