In this little example I want to show you which are the main features of the class ArmorTools. It can speed up really the usage of aRMOR, making easier the coding phase.
The proposed workflow is always the same:
-
Constructor, setting the user infos
-
Connection to the service
-
Loading the ontology
-
(optional) check the calidity of the connection
Done this, using armor is simple: just call a function!
- Warning
- this code was written only for your understanding. Probably it won't compile.
#include "ros/ros.h"
#include "armor_msgs/ArmorDirective.h"
#include "armor_msgs/ArmorDirectiveReq.h"
#include "armor_msgs/ArmorDirectiveRes.h"
#include <iostream>
#include <string>
int main(
int argc,
char* argv[] )
{
ros::init( argc, argv, "example_armor_tools_1" );
ros::NodeHandle nh;
{
std::cout << "connection error!" << std::endl;
return 0;
}
if( !armor.
LoadOntology(
"/root/ontology/my_pizza_ontology.owl" ) )
{
}
{
}
armor.
SendCommand(
"ADD",
"IND",
"CLASS",
"Giampiero",
"PERSON" );
armor_msgs::ArmorDirective srvmsg = armor.
GetRequest(
"ADD",
"IND",
"CLASS",
"Susanna",
"PERSON" );
armor_msgs::ArmorDirectiveReq& req = armor.
GetLastReq( );
armor_msgs::ArmorDirectiveRes& res = armor.
GetLastRes( );
return 0;
}
- 001 - Essential usage of ArmorTools