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_client_vs;
27  prop_client_vs.put("device", "visualservoingclient");
28  prop_client_vs.put("verbosity", true);
29  prop_client_vs.put("local", "/VisualServoingClientTest");
30  prop_client_vs.put("remote", "/visualservoing");
31  bool use_fwd_kin = false;
32 
33  PolyDriver drv_client_vs(prop_client_vs);
34  if (!drv_client_vs.isValid())
35  {
36  yError("Could not run VisualServoingClient!");
37  return EXIT_FAILURE;
38  }
39 
40  IVisualServoing *visual_servoing;
41  drv_client_vs.view(visual_servoing);
42  if (visual_servoing == YARP_NULLPTR)
43  {
44  yError("Could not get interfacate to VisualServoingClient!");
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)