icub-client
|
Provide a compact way to access the iCub functionalities within the icub-client framework. More...
Classes | |
class | icubclient::ICubClient |
Grants access to high level motor commands (grasp, touch, look, goto, etc) of the robot as well as its internal state (drives, emotions, beliefs) and its interaction means (speech). More... | |
class | icubclient::OPCClient |
An OPC client using the datastructures defined within the icub-client library. More... | |
Provide a compact way to access the iCub functionalities within the icub-client framework.
class icubclient::ICubClient |
Grants access to high level motor commands (grasp, touch, look, goto, etc) of the robot as well as its internal state (drives, emotions, beliefs) and its interaction means (speech).
Definition at line 66 of file icubClient.h.
Public Member Functions | |
template<class T > | |
T * | getSubSystem (const std::string &subSystemName) |
template<class T > | |
T * | getSubSystem (T) |
get a subsystem by just providing the type untested, just to play around with C++11 More... | |
SubSystem_agentDetector * | getAgentDetectorClient () |
SubSystem_ARE * | getARE () |
SubSystem_babbling * | getBabblingClient () |
SubSystem_IOL2OPC * | getIOL2OPCClient () |
SubSystem_KARMA * | getKARMA () |
SubSystem_Recog * | getRecogClient () |
SubSystem_Speech * | getSpeechClient () |
SubSystem_SAM * | getSAMClient () |
SubSystem_emotion * | getEmotionClient () |
ICubClient (const std::string &moduleName, const std::string &context="icubClient", const std::string &clientConfigFile="client.ini", bool isRFVerbose=false) | |
Create an iCub client. More... | |
bool | connect (const std::string &opcName="OPC") |
Try to connect all functionalities. More... | |
bool | connectOPC (const std::string &opcName="OPC") |
Try to connect to OPC. More... | |
bool | connectSubSystems () |
Try to connect to all sub-systems. More... | |
void | updateAgent () |
Retrieve fresh definition of the iCub agent from the OPC. More... | |
void | commitAgent () |
Commit the local definition of iCub agent to the OPC. More... | |
bool | home (const std::string &part="all") |
Go in home position. More... | |
bool | release (const std::string &oLocation, const yarp::os::Bottle &options=yarp::os::Bottle()) |
Release the hand-held object on a given location. More... | |
bool | release (const yarp::sig::VectorOf< double > &target, const yarp::os::Bottle &options=yarp::os::Bottle()) |
Release the hand-held object on a given location. More... | |
bool | point (const yarp::sig::VectorOf< double > &target, const yarp::os::Bottle &options=yarp::os::Bottle()) |
Point at a specified location from the iCub. More... | |
bool | point (const double x, const double y, const double z, const yarp::os::Bottle &options=yarp::os::Bottle()) |
bool | point (const std::string &oLocation, const yarp::os::Bottle &options=yarp::os::Bottle()) |
Point at a specified location. More... | |
bool | waving (const bool sw) |
Enable/disable arms waving. More... | |
bool | push (const std::string &oLocation, const yarp::os::Bottle &options=yarp::os::Bottle()) |
Push at a specified location. More... | |
bool | take (const std::string &oName, const yarp::os::Bottle &options=yarp::os::Bottle()) |
Take (grasp) an object. More... | |
bool | pushKarmaLeft (const std::string &objName, const double &targetPosYLeft, const std::string &armType="selectable", const yarp::os::Bottle &options=yarp::os::Bottle()) |
pushKarmaLeft: push an object by name to left side See the SubSystem_KARMA::pushAside documentation for more details. More... | |
bool | pushKarmaRight (const std::string &objName, const double &targetPosYRight, const std::string &armType="selectable", const yarp::os::Bottle &options=yarp::os::Bottle()) |
pushKarmaRight: push an object by name to right side See the SubSystem_KARMA::pushAside documentation for more details. More... | |
bool | pushKarmaFront (const std::string &objName, const double &targetPosXFront, const std::string &armType="selectable", const yarp::os::Bottle &options=yarp::os::Bottle()) |
pushKarmaFront: push an object by name to front See the SubSystem_KARMA::pushFront documentation for more details. More... | |
bool | pullKarmaBack (const std::string &objName, const double &targetPosXBack, const std::string &armType="selectable", const yarp::os::Bottle &options=yarp::os::Bottle()) |
pullKarmaBack: pull an object by name back See the SubSystem_KARMA::pullBack documentation for more details. More... | |
bool | pushKarma (const yarp::sig::VectorOf< double > &targetCenter, const double &theta, const double &radius, const yarp::os::Bottle &options=yarp::os::Bottle()) |
pushKarma (KARMA): push to certain position, along a direction See the SubSystem_KARMA::push documentation for more details. More... | |
bool | drawKarma (const yarp::sig::VectorOf< double > &targetCenter, const double &theta, const double &radius, const double &dist, const yarp::os::Bottle &options=yarp::os::Bottle()) |
drawKarma (KARMA): draw action, along the positive direction of the x-axis (in robot FoR) See the SubSystem_KARMA::draw documentation for more details. More... | |
bool | look (const std::string &target, const yarp::os::Bottle &options=yarp::os::Bottle()) |
Look at a specified target object. More... | |
bool | look (const yarp::sig::VectorOf< double > &target, const yarp::os::Bottle &options=yarp::os::Bottle()) |
Look at a specified target location. More... | |
bool | lookAtPartner () |
Looks at the agent if present in the scene. More... | |
bool | lookAtBodypart (const std::string &sBodypartName) |
Looks at the agent specific bodypart if present in the scene. More... | |
std::string | getPartnerName (bool verbose=true) |
Extract the name of the agent interaction with the iCub (present, not iCub nor 'unnamed' partner) More... | |
yarp::sig::VectorOf< double > | getPartnerBodypartLoc (std::string sBodypartName) |
Extract the location of the bodypart name of the partner. More... | |
bool | babbling (int jointNumber, const std::string &babblingArm, double train_dur=-1.0) |
Babbling using a single joint. More... | |
bool | babbling (const std::string &bpName, const std::string &babblingArm, double train_dur=-1.0) |
Babbling with a single joint using the name of a corresponding bodypart See the SubSystem_babbling::babbling documentation for more details. More... | |
bool | say (const std::string &text, bool shouldWait=true) |
Ask the robot to perform speech synthesis of a given sentence. More... | |
bool | changeName (Entity *e, const std::string &newName) |
Change the name of a given entity. More... | |
std::tuple< std::string, double > | getHighestEmotion () |
Get the strongest emotion. More... | |
std::list< Action * > | getKnownActions () |
Get the list of actions known the iCub. More... | |
std::list< Object * > | getObjectsInSight () |
Get the list of object that are in front of the iCub Warning: this will update the local icubAgent. More... | |
std::list< Object * > | getObjectsInRange () |
Get the list of objects that are graspable by the iCub See isTargetInRange() for a definition of how an object is defined to be in range Warning: this will update the local icubAgent. More... | |
bool | isTargetInRange (const yarp::sig::VectorOf< double > &target) const |
Check if a given cartesian position is within the reach of the robot This can be adjusted using the reachingRangeMin and reachingRangeMax parameters in the configuration file (client.ini) More... | |
void | close () |
Properly closes all ports which were opened. More... | |
virtual | ~ICubClient () |
Destructor. More... | |
Public Attributes | |
OPCClient * | opc |
Agent * | icubAgent |
Protected Attributes | |
std::map< std::string, SubSystem * > | subSystems |
bool | closed |
std::list< Action * > | actionsKnown |
double | xRangeMin |
double | yRangeMin |
double | zRangeMin |
double | xRangeMax |
double | yRangeMax |
double | zRangeMax |
std::string | robot |
ICubClient::ICubClient | ( | const std::string & | moduleName, |
const std::string & | context = "icubClient" , |
||
const std::string & | clientConfigFile = "client.ini" , |
||
bool | isRFVerbose = false |
||
) |
Create an iCub client.
moduleName | The port namespace that will precede the client ports names. |
context | The yarp context to be used. |
clientConfigFile | The yarp config file to be used. |
isRFVerbose | Whether the yarp resource finder should be verbose |
Definition at line 37 of file icubClient.cpp.
|
virtual |
Destructor.
Definition at line 161 of file icubClient.cpp.
bool ICubClient::babbling | ( | int | jointNumber, |
const std::string & | babblingArm, | ||
double | train_dur = -1.0 |
||
) |
Babbling using a single joint.
See the SubSystem_babbling::babbling documentation for more details.
jointNumber | contains the int corresponding to an arm joint |
babblingArm | contains the string corresponding to the side of the arm used ("left" or "right") |
train_dur | set the babbling time, if "-1" use default time |
Definition at line 344 of file icubClient.cpp.
bool ICubClient::babbling | ( | const std::string & | bpName, |
const std::string & | babblingArm, | ||
double | train_dur = -1.0 |
||
) |
Babbling with a single joint using the name of a corresponding bodypart See the SubSystem_babbling::babbling documentation for more details.
bpName | contains the string with the name of the bodypart |
babblingArm | contains the string corresponding to the side of the arm used ("left" or "right") |
train_dur | set the babbling time, if "-1" use default time |
Definition at line 312 of file icubClient.cpp.
bool ICubClient::changeName | ( | Entity * | e, |
const std::string & | newName | ||
) |
Change the name of a given entity.
e | - the entity whose name should be changed |
newName | - the new name of the entity |
Definition at line 183 of file icubClient.cpp.
void ICubClient::close | ( | ) |
Properly closes all ports which were opened.
This is being called automatically in the destructor, there is typically no need to call this manually.
Definition at line 140 of file icubClient.cpp.
void ICubClient::commitAgent | ( | ) |
Commit the local definition of iCub agent to the OPC.
Definition at line 245 of file icubClient.cpp.
bool ICubClient::connect | ( | const std::string & | opcName = "OPC" | ) |
Try to connect all functionalities.
opcName | the stem-name of the OPC server. |
Definition at line 132 of file icubClient.cpp.
bool ICubClient::connectOPC | ( | const std::string & | opcName = "OPC" | ) |
Try to connect to OPC.
opcName | the stem-name of the OPC server. |
Definition at line 107 of file icubClient.cpp.
bool ICubClient::connectSubSystems | ( | ) |
Try to connect to all sub-systems.
Definition at line 117 of file icubClient.cpp.
bool ICubClient::drawKarma | ( | const yarp::sig::VectorOf< double > & | targetCenter, |
const double & | theta, | ||
const double & | radius, | ||
const double & | dist, | ||
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
drawKarma (KARMA): draw action, along the positive direction of the x-axis (in robot FoR) See the SubSystem_KARMA::draw documentation for more details.
targetCenter | center of a circle |
theta | angle between the y-axis (in robot FoR) and starting position of draw action. |
radius | radius of the circle with center at |
dist | moving distance of draw action |
options | options to be passed to Karma |
Definition at line 199 of file icubClient_KARMArelated.cpp.
SubSystem_agentDetector * ICubClient::getAgentDetectorClient | ( | ) |
Definition at line 454 of file icubClient.cpp.
SubSystem_ARE * ICubClient::getARE | ( | ) |
Definition at line 474 of file icubClient.cpp.
SubSystem_babbling * ICubClient::getBabblingClient | ( | ) |
Definition at line 459 of file icubClient.cpp.
SubSystem_emotion * ICubClient::getEmotionClient | ( | ) |
Definition at line 501 of file icubClient.cpp.
std::tuple< std::string, double > ICubClient::getHighestEmotion | ( | ) |
Get the strongest emotion.
Definition at line 354 of file icubClient.cpp.
SubSystem_IOL2OPC * ICubClient::getIOL2OPCClient | ( | ) |
Definition at line 464 of file icubClient.cpp.
SubSystem_KARMA * ICubClient::getKARMA | ( | ) |
Definition at line 479 of file icubClient.cpp.
list< Action * > ICubClient::getKnownActions | ( | ) |
Get the list of actions known the iCub.
Definition at line 387 of file icubClient.cpp.
list< Object * > ICubClient::getObjectsInRange | ( | ) |
Get the list of objects that are graspable by the iCub See isTargetInRange() for a definition of how an object is defined to be in range Warning: this will update the local icubAgent.
Definition at line 422 of file icubClient.cpp.
list< Object * > ICubClient::getObjectsInSight | ( | ) |
Get the list of object that are in front of the iCub Warning: this will update the local icubAgent.
Definition at line 399 of file icubClient.cpp.
yarp::sig::VectorOf< double > ICubClient::getPartnerBodypartLoc | ( | std::string | sBodypartName | ) |
Extract the location of the bodypart name of the partner.
sBodypartName | is the name of the bodypart (kinect skeleton node) to be looked at |
Definition at line 274 of file icubClient.cpp.
std::string ICubClient::getPartnerName | ( | bool | verbose = true | ) |
Extract the name of the agent interaction with the iCub (present, not iCub nor 'unnamed' partner)
verbose | - whether a yInfo output should happen if the partner is found |
Definition at line 251 of file icubClient.cpp.
SubSystem_Recog * ICubClient::getRecogClient | ( | ) |
Definition at line 469 of file icubClient.cpp.
SubSystem_SAM * ICubClient::getSAMClient | ( | ) |
Definition at line 496 of file icubClient.cpp.
SubSystem_Speech * ICubClient::getSpeechClient | ( | ) |
Definition at line 484 of file icubClient.cpp.
|
inline |
Definition at line 81 of file icubClient.h.
|
inline |
get a subsystem by just providing the type untested, just to play around with C++11
Definition at line 93 of file icubClient.h.
bool ICubClient::home | ( | const std::string & | part = "all" | ) |
Go in home position.
See the SubSystem_ARE::home documentation for more details.
part | the part to be homed ("gaze", "head", "arms", "fingers", "all"; "all" by default). |
Definition at line 27 of file icubClient_ARErelated.cpp.
bool ICubClient::isTargetInRange | ( | const yarp::sig::VectorOf< double > & | target | ) | const |
Check if a given cartesian position is within the reach of the robot This can be adjusted using the reachingRangeMin and reachingRangeMax parameters in the configuration file (client.ini)
Definition at line 444 of file icubClient.cpp.
bool ICubClient::look | ( | const std::string & | target, |
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
Look at a specified target object.
See the subSystem_ARE::look documentation for more details.
target | is the name of the entity in the OPC where the robot should look. |
options | contains options to be passed on the gaze controller. |
Definition at line 162 of file icubClient_ARErelated.cpp.
bool ICubClient::look | ( | const yarp::sig::VectorOf< double > & | target, |
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
Look at a specified target location.
See the subSystem_ARE::look documentation for more details.
target | is a vector where the robot should look. |
options | contains options to be passed on the gaze controller. |
Definition at line 178 of file icubClient_ARErelated.cpp.
bool ICubClient::lookAtBodypart | ( | const std::string & | sBodypartName | ) |
Looks at the agent specific bodypart if present in the scene.
sBodypartName | is the name of the bodypart (kinect skeleton node) to be looked at |
Definition at line 189 of file icubClient_ARErelated.cpp.
bool ICubClient::lookAtPartner | ( | ) |
Looks at the agent if present in the scene.
Definition at line 307 of file icubClient.cpp.
bool icubclient::ICubClient::point | ( | const yarp::sig::VectorOf< double > & | target, |
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
Point at a specified location from the iCub.
See the SubSystem_ARE::point documentation for more details.
target | contains spatial information about the location where pointing at. The target can be far away from the iCub |
options | bottle containing a list of options (e.g. force to use specific hand with "left"|"right" option). |
Definition at line 89 of file icubClient_ARErelated.cpp.
|
inline |
Definition at line 203 of file icubClient.h.
bool icubclient::ICubClient::point | ( | const std::string & | oLocation, |
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
Point at a specified location.
See the SubSystem_ARE::point documentation for more details.
oLocation | is the name of the entity in the OPC where the robot should point at. |
options | bottle containing a list of options (e.g. force to use specific hand with "left"|"right" option). |
Definition at line 104 of file icubClient_ARErelated.cpp.
bool ICubClient::pullKarmaBack | ( | const std::string & | objName, |
const double & | targetPosXBack, | ||
const std::string & | armType = "selectable" , |
||
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
pullKarmaBack: pull an object by name back See the SubSystem_KARMA::pullBack documentation for more details.
objName | name of object, which will be looked for in OPC |
targetPosXBack | X coordinate of object to pull back |
armType | "left" or "right" arm to conduct action, otherwise arm will be chosen by KARMA |
options | options to be passed to Karma |
Definition at line 160 of file icubClient_KARMArelated.cpp.
bool ICubClient::push | ( | const std::string & | oLocation, |
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
Push at a specified location.
This method is deprecated, and ICubClient::pushKarmaLeft or ICubClient::pushKarmaRight should be used instead. See the SubSystem_ARE::push documentation for more details.
oLocation | is the name of the entity in the OPC where the robot should push at. |
options | bottle containing a list of options (e.g. force to use specific hand with "left"|"right" option). |
Definition at line 131 of file icubClient_ARErelated.cpp.
bool ICubClient::pushKarma | ( | const yarp::sig::VectorOf< double > & | targetCenter, |
const double & | theta, | ||
const double & | radius, | ||
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
pushKarma (KARMA): push to certain position, along a direction See the SubSystem_KARMA::push documentation for more details.
targetCenter | position to push to. |
theta | angle between the y-axis (in robot FoR) and starting position of push action, defines the direction of push action |
radius | radius of the circle with center at |
options | options to be passed to Karma |
Definition at line 147 of file icubClient_KARMArelated.cpp.
bool ICubClient::pushKarmaFront | ( | const std::string & | objName, |
const double & | targetPosXFront, | ||
const std::string & | armType = "selectable" , |
||
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
pushKarmaFront: push an object by name to front See the SubSystem_KARMA::pushFront documentation for more details.
objName | name of object, which will be looked for in OPC |
targetPosXFront | X coordinate of object to push to |
armType | "left" or "right" arm to conduct action, otherwise arm will be chosen by KARMA |
options | options to be passed to Karma |
Definition at line 108 of file icubClient_KARMArelated.cpp.
bool ICubClient::pushKarmaLeft | ( | const std::string & | objName, |
const double & | targetPosYLeft, | ||
const std::string & | armType = "selectable" , |
||
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
pushKarmaLeft: push an object by name to left side See the SubSystem_KARMA::pushAside documentation for more details.
objName | is the name of object, which will be looked for in OPC |
targetPosYLeft | Y coordinate of object to push to |
armType | "left" or "right" arm to conduct action, otherwise arm will be chosen by KARMA |
options | options to be passed to Karma |
Definition at line 30 of file icubClient_KARMArelated.cpp.
bool ICubClient::pushKarmaRight | ( | const std::string & | objName, |
const double & | targetPosYRight, | ||
const std::string & | armType = "selectable" , |
||
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
pushKarmaRight: push an object by name to right side See the SubSystem_KARMA::pushAside documentation for more details.
objName | is the name of object, which will be looked for in OPC |
targetPosYRight | Y coordinate of object to push to |
armType | "left" or "right" arm to conduct action, otherwise arm will be chosen by KARMA |
options | options to be passed to Karma |
Definition at line 69 of file icubClient_KARMArelated.cpp.
bool ICubClient::release | ( | const std::string & | oLocation, |
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
Release the hand-held object on a given location.
See the SubSystem_ARE::release documentation for more details.
oLocation | is the name of the entity in the OPC where the robot should release. |
options | bottle containing a list of options (e.g. force to use specific hand with "left"|"right" option). |
Definition at line 39 of file icubClient_ARErelated.cpp.
bool ICubClient::release | ( | const yarp::sig::VectorOf< double > & | target, |
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
Release the hand-held object on a given location.
See the SubSystem_ARE::release documentation for more details.
target | contains spatial information about the location where releasing the object. |
options | bottle containing a list of options (e.g. force to use specific hand with "left"|"right" option). |
Definition at line 59 of file icubClient_ARErelated.cpp.
bool ICubClient::say | ( | const std::string & | text, |
bool | shouldWait = true |
||
) |
Ask the robot to perform speech synthesis of a given sentence.
text | to be said. |
shouldWait | Whether the method should wait until the speech was produced, or return immediately |
Definition at line 374 of file icubClient.cpp.
bool ICubClient::take | ( | const std::string & | oName, |
const yarp::os::Bottle & | options = yarp::os::Bottle() |
||
) |
Take (grasp) an object.
See the subSystem_ARE::take documentation for more details.
oName | is the name of the entity in the OPC where the robot should take at. |
options | bottle containing a list of options (e.g. force to use specific hand with "left"|"right" option). |
Definition at line 147 of file icubClient_ARErelated.cpp.
void ICubClient::updateAgent | ( | ) |
Retrieve fresh definition of the iCub agent from the OPC.
Definition at line 169 of file icubClient.cpp.
bool ICubClient::waving | ( | const bool | sw | ) |
Enable/disable arms waving.
See the SubSystem_ARE::waving documentation for more details.
sw | enable/disable if true/false. |
Definition at line 77 of file icubClient_ARErelated.cpp.
|
protected |
Definition at line 71 of file icubClient.h.
|
protected |
Definition at line 70 of file icubClient.h.
Agent* icubclient::ICubClient::icubAgent |
Definition at line 113 of file icubClient.h.
OPCClient* icubclient::ICubClient::opc |
Definition at line 112 of file icubClient.h.
|
protected |
Definition at line 77 of file icubClient.h.
|
protected |
Definition at line 69 of file icubClient.h.
|
protected |
Definition at line 75 of file icubClient.h.
|
protected |
Definition at line 74 of file icubClient.h.
|
protected |
Definition at line 75 of file icubClient.h.
|
protected |
Definition at line 74 of file icubClient.h.
|
protected |
Definition at line 75 of file icubClient.h.
|
protected |
Definition at line 74 of file icubClient.h.
class icubclient::OPCClient |
An OPC client using the datastructures defined within the icub-client library.
Using this ensures you that your manipulation of the OPC will be done with correct formatting.
Definition at line 35 of file opcClient.h.
Public Member Functions | |
OPCClient (const std::string &moduleName) | |
Create an OPC client. More... | |
template<class T > | |
T * | addEntity (const std::string &name) |
Creates a new entity. More... | |
template<class T > | |
T * | addOrRetrieveEntity (const std::string &name) |
Obtains an entity with the given name. More... | |
bool | isConnected () |
Check if the client is already connected to the OPC server. More... | |
bool | connect (const std::string &opcName) |
Try to connect the client to an OPC server. More... | |
void | interrupt () |
Interrupt communications of the client ports. More... | |
void | close () |
Close the client ports. More... | |
void | clear () |
Clear the OPC content. More... | |
bool | setEntityProperty (std::string sourceEntityName, std::string propertyName, std::string targetEntityName) |
Try to assign a property from an entity to another entity, using a specific property name. More... | |
bool | addRelation (const Relation &r, double lifeTime=-1) |
Obtains a relation between two entities. More... | |
bool | addRelation (Entity *subject, Entity *verb, Entity *object=nullptr, double lifeTime=-1, Entity *complement_place=nullptr, Entity *complement_time=nullptr, Entity *complement_manner=nullptr) |
Obtains a relation between two entities. More... | |
bool | removeRelation (const Relation &r) |
Try to remove a relation between two entities. More... | |
bool | removeRelation (Entity *subject, Entity *verb, Entity *object=nullptr, Entity *complement_place=nullptr, Entity *complement_time=nullptr, Entity *complement_manner=nullptr) |
Try to remove a relation between two entities. More... | |
bool | containsRelation (Entity *subject, Entity *verb, Entity *object=nullptr, Entity *complement_place=nullptr, Entity *complement_time=nullptr, Entity *complement_manner=nullptr) |
Check if a relation exists. More... | |
bool | containsRelation (const Relation &r) |
Check if a relation exists. More... | |
std::list< Relation > | getRelations () |
Returns a list of all existing relations between entities. More... | |
std::list< Relation > | getRelations (std::string entity) |
Returns a list of all existing relations involving a specific entities. More... | |
std::list< Relation > | getRelations (Entity *entity) |
Returns a list of all existing relations involving a specific entities. More... | |
std::list< Relation > | getRelationsMatching (std::string subject="any", std::string verb="any", std::string object="any", std::string c_place="any", std::string c_time="any", std::string c_manner="any") |
Returns a list of all existing relations between entities. More... | |
std::list< Relation > | getRelationsMatchingLoosly (std::string subject="any", std::string verb="any", std::string object="any", std::string c_place="any", std::string c_time="any", std::string c_manner="any") |
Returns a list of all existing relations between entities. More... | |
bool | setLifeTime (int id, double lifeTime) |
Set the lifetime property of a relation in the OPC. More... | |
Entity * | getEntity (const std::string &name, bool forceUpdate=false) |
Gets an entity based on its name, but do no create it if it doesn't exist yet. More... | |
Entity * | getEntity (int id, bool forceUpdate=false) |
Gets an entity based on its id, but do no create it if it doesn't exist yet. More... | |
bool | removeEntity (const std::string &name) |
Removes an entity based on its name. More... | |
bool | removeEntity (int id) |
Removes an entity based on its id. More... | |
void | checkout (bool updateCache=true) |
Poll the OPC for all entities and relations and store them locally. More... | |
void | update () |
Update the properties of all locally stored entities & relations. More... | |
void | update (Entity *e) |
Poll the OPC for updating a given entity properties. More... | |
void | commit () |
Commit all the entities & relations stored locally, erasing the server copies. More... | |
void | commit (Entity *e) |
Commit a single local entity, erasing the server copies. More... | |
std::list< Entity * > | Entities (const yarp::os::Bottle &condition) |
Getter of the list of entities of matching a complex condition (e.g "(entity "==" agent) "&&" (isPresent "==" 1) ) and update them locally. More... | |
std::list< Entity * > | Entities (const std::string &prop, const std::string &op, const std::string &value) |
Getter of the list of entities matching a condition and update them locally. More... | |
std::list< Entity * > | EntitiesCache () const |
Getter of the list of entities stored locally. More... | |
std::list< std::shared_ptr< Entity > > | EntitiesCacheCopy () const |
Getter of the list of the copies of the entities stored locally. More... | |
std::string | toString () |
Returns a human readable description of the client content (Entities & Relations) More... | |
Public Attributes | |
bool | isVerbose |
Protected Member Functions | |
bool | write (yarp::os::Bottle &cmd, yarp::os::Bottle &reply, bool Verbose=false) |
Send a command to the OPC and return the reply. More... | |
void | addEntity (Entity *e) |
Send a the request to add a new entity to the OPC. More... | |
int | getRelationID (Entity *subject, Entity *verb, Entity *object=nullptr, Entity *complement_place=nullptr, Entity *complement_time=nullptr, Entity *complement_manner=nullptr) |
bool | changeName (Entity *e, const std::string &newName) |
Change the name of an entity and send messages to relevant subsystems. More... | |
Protected Attributes | |
yarp::os::Port | opc |
Port which connects to /OPC/rpc. More... | |
std::map< int, Entity * > | entitiesByID |
std::string | opcName |
Friends | |
class | ICubClient |
OPCClient::OPCClient | ( | const std::string & | moduleName | ) |
Create an OPC client.
moduleName | The port namespace that will precede the client ports names. |
Definition at line 32 of file opcClient.cpp.
|
protected |
Send a the request to add a new entity to the OPC.
e | Pointer to the entity to be added. After executing the method, it will contain the updated entity. |
Definition at line 95 of file opcClient.cpp.
|
inline |
Creates a new entity.
If an Entity with the provided name is already existing, a new Entity with an appended number is returned. It is a template method, so all subclasses of Entity can be created like this
name | Name of the new entity |
Definition at line 92 of file opcClient.h.
|
inline |
Obtains an entity with the given name.
If this name is already present, then the existing entity is returned, otherwise a new one is created. It is a template method, so all subclasses of Entity can be created like this
name | Name of the entity to be retrieved / created |
Definition at line 119 of file opcClient.h.
bool OPCClient::addRelation | ( | const Relation & | r, |
double | lifeTime = -1 |
||
) |
Obtains a relation between two entities.
If this relation is already present on the server side then the local relations are updated, else a new one is created. The relation is directly added on the server side.
r | - The relation to be added on the server |
lifeTime | - how long the relation should last for |
Definition at line 390 of file opcClient.cpp.
bool OPCClient::addRelation | ( | Entity * | subject, |
Entity * | verb, | ||
Entity * | object = nullptr , |
||
double | lifeTime = -1 , |
||
Entity * | complement_place = nullptr , |
||
Entity * | complement_time = nullptr , |
||
Entity * | complement_manner = nullptr |
||
) |
Obtains a relation between two entities.
If this relation already present on the server side then the local relations are updated, else a new one is created. The relation is directly added on the server side.
lifeTime | - how long the relation should last for |
Definition at line 408 of file opcClient.cpp.
|
protected |
Change the name of an entity and send messages to relevant subsystems.
e | Entity whose name is to be changed |
newName | Desired name of e |
Definition at line 969 of file opcClient.cpp.
void OPCClient::checkout | ( | bool | updateCache = true | ) |
Poll the OPC for all entities and relations and store them locally.
updateCache | If this option is turned on the local cache will be wiped |
Definition at line 754 of file opcClient.cpp.
void OPCClient::clear | ( | ) |
Clear the OPC content.
Definition at line 80 of file opcClient.cpp.
void OPCClient::close | ( | ) |
Close the client ports.
Definition at line 69 of file opcClient.cpp.
void OPCClient::commit | ( | ) |
Commit all the entities & relations stored locally, erasing the server copies.
Definition at line 835 of file opcClient.cpp.
void OPCClient::commit | ( | Entity * | e | ) |
Commit a single local entity, erasing the server copies.
e | A pointer to the entity to be commited |
Definition at line 844 of file opcClient.cpp.
|
inline |
Try to connect the client to an OPC server.
opcName | the name of the OPC module to connect to. |
Definition at line 157 of file opcClient.h.
bool OPCClient::containsRelation | ( | Entity * | subject, |
Entity * | verb, | ||
Entity * | object = nullptr , |
||
Entity * | complement_place = nullptr , |
||
Entity * | complement_time = nullptr , |
||
Entity * | complement_manner = nullptr |
||
) |
Check if a relation exists.
Definition at line 501 of file opcClient.cpp.
bool OPCClient::containsRelation | ( | const Relation & | r | ) |
Check if a relation exists.
r | - relation to be checked |
Definition at line 513 of file opcClient.cpp.
std::list< Entity * > OPCClient::Entities | ( | const yarp::os::Bottle & | condition | ) |
Getter of the list of entities of matching a complex condition (e.g "(entity "==" agent) "&&" (isPresent "==" 1) ) and update them locally.
Definition at line 865 of file opcClient.cpp.
list< Entity * > OPCClient::Entities | ( | const std::string & | prop, |
const std::string & | op, | ||
const std::string & | value | ||
) |
Getter of the list of entities matching a condition and update them locally.
Definition at line 893 of file opcClient.cpp.
list< Entity * > OPCClient::EntitiesCache | ( | ) | const |
Getter of the list of entities stored locally.
Definition at line 905 of file opcClient.cpp.
std::list< std::shared_ptr< Entity > > OPCClient::EntitiesCacheCopy | ( | ) | const |
Getter of the list of the copies of the entities stored locally.
Definition at line 917 of file opcClient.cpp.
Entity * OPCClient::getEntity | ( | const std::string & | name, |
bool | forceUpdate = false |
||
) |
Gets an entity based on its name, but do no create it if it doesn't exist yet.
name | The name of the entity to retrieve. |
forceUpdate | Update the entity instead of retrieving from the cache. (false by default) |
Definition at line 134 of file opcClient.cpp.
Entity * OPCClient::getEntity | ( | int | id, |
bool | forceUpdate = false |
||
) |
Gets an entity based on its id, but do no create it if it doesn't exist yet.
id | The ID of the entity to retrieve. |
forceUpdate | Update the entity instead of retrieving from the cache. (false by default) |
Definition at line 181 of file opcClient.cpp.
|
protected |
Definition at line 302 of file opcClient.cpp.
list< Relation > OPCClient::getRelations | ( | ) |
Returns a list of all existing relations between entities.
Definition at line 570 of file opcClient.cpp.
std::list< Relation > OPCClient::getRelations | ( | std::string | entity | ) |
Returns a list of all existing relations involving a specific entities.
Definition at line 729 of file opcClient.cpp.
Returns a list of all existing relations involving a specific entities.
Definition at line 748 of file opcClient.cpp.
std::list< Relation > OPCClient::getRelationsMatching | ( | std::string | subject = "any" , |
std::string | verb = "any" , |
||
std::string | object = "any" , |
||
std::string | c_place = "any" , |
||
std::string | c_time = "any" , |
||
std::string | c_manner = "any" |
||
) |
Returns a list of all existing relations between entities.
All the roles with something other than "any" will act as filters for the relation.
Definition at line 617 of file opcClient.cpp.
std::list< Relation > OPCClient::getRelationsMatchingLoosly | ( | std::string | subject = "any" , |
std::string | verb = "any" , |
||
std::string | object = "any" , |
||
std::string | c_place = "any" , |
||
std::string | c_time = "any" , |
||
std::string | c_manner = "any" |
||
) |
Returns a list of all existing relations between entities.
All the roles with something else than "any" will act as filters for the relation. All relations with at least one role matching will be returned.
Definition at line 710 of file opcClient.cpp.
void OPCClient::interrupt | ( | ) |
Interrupt communications of the client ports.
Definition at line 64 of file opcClient.cpp.
|
inline |
Check if the client is already connected to the OPC server.
Warning, this method tries to connect to the OPC again in case it is not connected yet.
Definition at line 141 of file opcClient.h.
bool OPCClient::removeEntity | ( | const std::string & | name | ) |
Removes an entity based on its name.
name | The name of the entity to remove. |
Definition at line 246 of file opcClient.cpp.
bool OPCClient::removeEntity | ( | int | id | ) |
Removes an entity based on its id.
id | The ID of the entity to retrieve. |
Definition at line 273 of file opcClient.cpp.
bool OPCClient::removeRelation | ( | const Relation & | r | ) |
Try to remove a relation between two entities.
The relation is directly removed on the server side.
r | - relation to be removed |
Definition at line 450 of file opcClient.cpp.
bool OPCClient::removeRelation | ( | Entity * | subject, |
Entity * | verb, | ||
Entity * | object = nullptr , |
||
Entity * | complement_place = nullptr , |
||
Entity * | complement_time = nullptr , |
||
Entity * | complement_manner = nullptr |
||
) |
Try to remove a relation between two entities.
The relation is directly removed on the server side.
Definition at line 462 of file opcClient.cpp.
bool OPCClient::setEntityProperty | ( | std::string | sourceEntityName, |
std::string | propertyName, | ||
std::string | targetEntityName | ||
) |
Try to assign a property from an entity to another entity, using a specific property name.
sourceEntityName | Name of the entity the property should be copied from |
propertyName | Name of the property to be copied |
targetEntityName | Name of the entity where the property should be copied into |
Definition at line 122 of file opcClient.cpp.
bool OPCClient::setLifeTime | ( | int | id, |
double | lifeTime | ||
) |
Set the lifetime property of a relation in the OPC.
Definition at line 524 of file opcClient.cpp.
string OPCClient::toString | ( | ) |
Returns a human readable description of the client content (Entities & Relations)
Definition at line 954 of file opcClient.cpp.
void OPCClient::update | ( | ) |
Update the properties of all locally stored entities & relations.
Definition at line 794 of file opcClient.cpp.
void OPCClient::update | ( | Entity * | e | ) |
Poll the OPC for updating a given entity properties.
e | A pointer on the entity to update. |
Definition at line 803 of file opcClient.cpp.
|
protected |
Send a command to the OPC and return the reply.
cmd | the command to be send to the OPC |
reply | reference to the reply of the OPC |
Verbose | Whether to output additional information using yInfo() |
Definition at line 39 of file opcClient.cpp.
|
friend |
Definition at line 37 of file opcClient.h.
|
protected |
Definition at line 50 of file opcClient.h.
bool icubclient::OPCClient::isVerbose |
Definition at line 82 of file opcClient.h.
|
protected |
Port which connects to /OPC/rpc.
Definition at line 40 of file opcClient.h.
|
protected |
Definition at line 73 of file opcClient.h.