8 external_port_name =
"/proactiveTagging/rpc";
9 from_sensation_port_name =
"/opcSensation/unknown_entities:o";
13 yInfo() <<
"Tagging::run";
14 yDebug() <<
"send rpc to proactiveTagging";
20 yDebug()<<args.toString() << args.size();
21 target = args.get(0).asList()->get(0).asString();
22 type = args.get(0).asList()->get(1).asString();
23 yDebug() <<
"Object selected: " << target <<
"Type: "<<type;
24 list<Entity*> lEntities = iCub->opc->EntitiesCache();
25 for (
auto& entity: lEntities)
27 string sName = entity->name();
28 if (sName == target) {
29 yDebug() <<
"Entity found: "<<target;
30 if (entity->entity_type() ==
"object")
32 Object* o =
dynamic_cast<Object*
>(iCub->opc->getEntity(sName));
33 yInfo() <<
"I found the entity in the opc: " << sName;
41 yInfo() <<
"I need to explore by name!";
42 yInfo() <<
"send rpc to proactiveTagging";
43 cmd.addString(
"searchingEntity");
45 cmd.addString(target);
46 rpc_out_port.write(cmd,rply);
49 yError()<<
"[Tagging::run]! Input not valid!!";
52 Bottle *sensation = sensation_port_in.read();
53 int id = yarp::os::Random::uniform(0, sensation->size()-1);
56 for (
unsigned int i = 0; i < sensation->size(); i++) {
57 string type = sensation->get(i).asList()->get(0).asString();
58 string target = sensation->get(i).asList()->get(1).asString();
66 type=sensation->get(
id).asList()->get(0).asString();
67 target=sensation->get(
id).asList()->get(1).asString();
68 yDebug() <<
"Object selected: " << target <<
"Type: "<<type;
72 cmd.addString(
"exploreUnknownEntity");
74 cmd.addString(target);
75 yInfo() <<
"Proactively tagging:" << cmd.toString();
78 rpc_out_port.write(cmd, rply);
80 if(type==
"bodypart" && target.find(
"unknown_self") == 0) {
81 iCub->opc->checkout();
84 iCub->lookAtPartner();
85 if(lHandVec.size()==0) {
86 iCub->say(
"Although I know our hands look the same I cannot point at your hand because I cannot see it right now.");
89 iCub->say(
"Look, because our hands look the same I know this is your hand.");
91 iCub->point(lHandVec);
96 yInfo() <<
"Proactive tagging ends";
void run(const yarp::os::Bottle &args)
double m_present
Is the object present in the scene A value of 1.0 means that the object currently is in the scene A v...
Represent any physical entity (including objects and agents) that can be stored within the OPC...
virtual std::string toString() const
Return a human readable description of the entity.