22 #include <yarp/os/all.h> 23 #include <yarp/sig/all.h> 34 volatile std::sig_atomic_t gSignalStatus;
46 if (!yarp.checkNetwork())
48 yError()<<
"YARP network seems unavailable!";
53 rf.configure(argc,argv);
55 ICubClient icub(
"test_cartesian_sim",
"icubClient",
"test_cartesian_sim.ini");
58 yError()<<
"One or more functionalities seem unavailable!";
77 obj1->
m_color[0] = Random::uniform(0, 80);
78 obj1->
m_color[1] = Random::uniform(80, 180);
79 obj1->
m_color[2] = Random::uniform(180, 250);
86 obj2->
m_color[0] = Random::uniform(0, 180);
87 obj2->
m_color[1] = Random::uniform(0, 80);
88 obj2->
m_color[2] = Random::uniform(180, 250);
95 obj3->
m_color[0] = Random::uniform(100, 180);
96 obj3->
m_color[1] = Random::uniform(80, 180);
97 obj3->
m_color[2] = Random::uniform(0, 80);
104 obj4->
m_color[0] = Random::uniform(100, 180);
105 obj4->
m_color[1] = Random::uniform(0, 80);
106 obj4->
m_color[2] = Random::uniform(180, 250);
108 vector<Object*> vObject;
109 vObject.push_back(obj1);
110 vObject.push_back(obj2);
111 vObject.push_back(obj3);
112 vObject.push_back(obj4);
116 if (rf.check(
"populate-only"))
123 for (
int i = 0; i < 5; i++)
125 for (vector<Object*>::iterator itOb = vObject.begin(); itOb != vObject.end(); itOb++)
127 string obj_name=(*itOb)->name();
128 string obj_pos=(*itOb)->m_ego_position.toString(3,3).c_str();
130 yInfo() <<
"Object " << obj_name <<
" is in position (" << obj_pos <<
") [m]";
132 if (gSignalStatus==SIGINT)
134 yWarning(
"SIGINT detected: closing ...");
138 yInfo() <<
"\t\t" <<
"looking at it for a while ...";
142 if (gSignalStatus==SIGINT)
144 yWarning(
"SIGINT detected: closing ...");
148 yInfo() <<
"\t\t" <<
"pointing initiated";
149 icub.
point(obj_name);
150 yInfo() <<
"\t\t" <<
"pointing complete";
152 if (gSignalStatus==SIGINT)
154 yWarning(
"SIGINT detected: closing ...");
158 yInfo() <<
"\t\t" <<
"homing initiated";
160 yInfo() <<
"\t\t" <<
"homing complete";
163 if (gSignalStatus==SIGINT)
yarp::sig::VectorOf< double > m_color
Mean color of the object (r,g,b) used mainly for debugging/displaying purposes in the iCubGUI...
bool point(const yarp::sig::VectorOf< double > &target, const yarp::os::Bottle &options=yarp::os::Bottle())
Point at a specified location from the iCub.
Grants access to high level motor commands (grasp, touch, look, goto, etc) of the robot as well as it...
bool connect(const std::string &opcName="OPC")
Try to connect all functionalities.
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...
void commit()
Commit all the entities & relations stored locally, erasing the server copies.
T * addOrRetrieveEntity(const std::string &name)
Obtains an entity with the given name.
void signal_handler(int signal)
Represent any physical entity (including objects and agents) that can be stored within the OPC...
yarp::sig::VectorOf< double > m_ego_position
Position of the Object, in the initial ego-centered reference frame of the agent mainting the OPC (in...
bool home(const std::string &part="all")
Go in home position.
bool look(const std::string &target, const yarp::os::Bottle &options=yarp::os::Bottle())
Look at a specified target object.
void clear()
Clear the OPC content.