![]() |
RCL - RoboCLuedo
v1.0
Francesco Ganci - S4143910 - Experimental Robotics Lab - Assignment 1
|
A minimal C++ client for aRMOR. More...
#include <armor_tools.h>
Public Member Functions | |
ArmorTools (std::string client=ARMOR_DEFAULT_CLIENT, std::string reference=ARMOR_DEFAULT_REFERENCE, bool dbmode=false) | |
Class Constructor, 3 arguments. More... | |
ArmorTools (bool dbmode) | |
Class Constructor, only one argument. More... | |
~ArmorTools () | |
class destructor (empty) More... | |
armor_msgs::ArmorDirective | GetRequest (std::string command, std::string first_spec="", std::string second_spec="", std::string arg1="", std::string arg2="", std::string arg3="", std::string arg4="", std::string arg5="") |
quick generation of an aRMOR request More... | |
bool | CallArmor (armor_msgs::ArmorDirective &data) |
send a command to the aRMOR service. More... | |
bool | LoadOntology (std::string path, std::string uri=ARMOR_DEFAULT_URI, bool manipulationFlag=true, std::string reasoner=ARMOR_DEFAULT_REASONER, bool buffered_reasoner=true) |
load the ontology from file. More... | |
bool | Connect (float timeout=ARMOR_DEFAULT_TIMEOUT) |
open a connection with the aRMOR service. More... | |
bool | ConnectAndLoad (std::string path, std::string uri=ARMOR_DEFAULT_URI, bool manipulationFlag=true, std::string reasoner=ARMOR_DEFAULT_REASONER, bool buffered_reasoner=true) |
connect to the server and load the ontology from file. More... | |
bool | SaveOntology (std::string path) |
save the ontology on file More... | |
bool | UpdateOntology () |
send the command REASON More... | |
void | PrintRequest (armor_msgs::ArmorDirective &d) |
print a request to the screen. More... | |
void | PrintResponse (armor_msgs::ArmorDirective &d) |
print the response to the screen. More... | |
void | SwitchDebugMode () |
toggle the debug mode More... | |
int | GetLastErrorCode () |
err code referred to the last call More... | |
std::string | GetLastErrorDescription () |
last err description More... | |
bool | Success () |
check the 'success' flag referred to the last aRMOR call More... | |
bool | LoadedOntology () |
check if the ontology was loaded or not More... | |
bool | TestInterface () |
check the status of the interface More... | |
bool | SendCommand (std::string command, std::string first_spec="", std::string second_spec="", std::string arg1="", std::string arg2="", std::string arg3="", std::string arg4="", std::string arg5="", bool printRequest=false) |
fill in a command and send it to aRMOR More... | |
armor_msgs::ArmorDirectiveRes & | GetLastRes () |
get a reference to the last response More... | |
armor_msgs::ArmorDirectiveReq & | GetLastReq () |
get a reference to the last request More... | |
void | PrintLastRes () |
print the last response More... | |
void | PrintLastReq () |
print the last request More... | |
Protected Attributes | |
bool | DebugMode = false |
debug mode enabled or not More... | |
A minimal C++ client for aRMOR.
The class ArmorTools aims at giving a first abstraction of the service aRMOR by providing few "shortcuts". A strong point of this interface lies in the fact that a roscpp node can communicate with aRMOR through functions instead of direct callings to the service.
Another important feature is the debug mode: the programmer can turn on and off the messages inside the code, in order to understand what is going on "underneath the hood".
The class lets the programmer to not waste time in fill in the ArmorDirective message each time: client_name and reference_name are set only once in the constructor, whereas the remaining fields can be set using functions. Also the connection is contained in the class, and there are checks for understanding if the connection is valid or not.
In the end, the class stores the last request and the last response at each call, so the programmer can easily retrieve them and print, again using function calls.
Definition at line 90 of file armor_tools.h.