visual-tracking-control
main.cpp
Go to the documentation of this file.
1 #include <yarp/os/LogStream.h>
2 #include <yarp/os/Property.h>
3 #include <yarp/dev/Drivers.h>
4 #include <yarp/dev/IVisualServoing.h>
5 #include <yarp/dev/PolyDriver.h>
6 #include <yarp/math/Math.h>
7 
8 using namespace yarp::os;
9 using namespace yarp::sig;
10 using namespace yarp::dev;
11 using namespace yarp::math;
12 
13 YARP_DECLARE_PLUGINS(visualservoingplugin);
14 
15 int main(int argc, char **argv)
16 {
17  Network yarp;
18  if (!yarp.checkNetwork(3.0))
19  {
20  yError("YARP seems unavailable!");
21  return EXIT_FAILURE;
22  }
23 
24  YARP_REGISTER_PLUGINS(visualservoingplugin);
25 
26  Property prop_server_vs;
27  prop_server_vs.put("device", "visualservoingserver");
28  prop_server_vs.put("verbosity", true);
29  prop_server_vs.put("simulate", true);
30  prop_server_vs.put("robot", "icubSim");
31  bool use_fwd_kin = false;
32 
33  PolyDriver drv_server_vs(prop_server_vs);
34  if (!drv_server_vs.isValid())
35  {
36  yError("Could not run VisualServoingServer!");
37  return EXIT_FAILURE;
38  }
39 
40  IVisualServoing *visual_servoing;
41  drv_server_vs.view(visual_servoing);
42  if (visual_servoing == YARP_NULLPTR)
43  {
44  yError("Could not get interfacate to VisualServoingServer!");
45  return EXIT_FAILURE;
46  }
47 
48  /* Set visual servoing control*/
49  visual_servoing->setVisualServoControl("decoupled");
50 
51  /* Stored set-up: t170904 */
52  visual_servoing->storedInit("t170904");
53 
54  visual_servoing->initFacilities(use_fwd_kin);
55  visual_servoing->storedGoToGoal("t170904");
56 
57  visual_servoing->checkVisualServoingController();
58  visual_servoing->waitVisualServoingDone();
59 
60  visual_servoing->stopFacilities();
61 
62  /* Stored set-up: t170427 */
63  visual_servoing->storedInit("t170427");
64 
65  visual_servoing->initFacilities(use_fwd_kin);
66  visual_servoing->storedGoToGoal("t170427");
67 
68  visual_servoing->checkVisualServoingController();
69  visual_servoing->waitVisualServoingDone();
70 
71  visual_servoing->stopFacilities();
72 
73  return EXIT_SUCCESS;
74 }
int main(int argc, char *argv[])
Definition: main.cpp:38
YARP_DECLARE_PLUGINS(visualservoingplugin)