21 #include <robottestingframework/dll/Plugin.h>
22 #include <robottestingframework/TestAssert.h>
23 #include <yarp/os/Time.h>
24 #include <yarp/dev/GazeControl.h>
25 #include <yarp/sig/Vector.h>
27 #include "GazeControlSimpleLookTest.h"
30 using namespace robottestingframework;
31 using namespace yarp::os;
32 using namespace yarp::dev;
33 using namespace yarp::sig;
40 GazeControlSimpleLookTest::GazeControlSimpleLookTest() :
41 yarp::robottestingframework::TestCase(
"GazeControlSimpleLookTest")
47 GazeControlSimpleLookTest::~GazeControlSimpleLookTest()
53 bool GazeControlSimpleLookTest::setup(Property &property)
56 option.put(
"device",
"gazecontrollerclient");
57 option.put(
"remote",
"/iKinGazeCtrl");
58 option.put(
"local",(
"/"+getName()+
"/gaze"));
60 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Opening Gaze Controller Client");
61 ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(driver.open(option),
"Unable to open the client!");
67 void GazeControlSimpleLookTest::tearDown()
69 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Closing Gaze Controller Client");
70 ROBOTTESTINGFRAMEWORK_ASSERT_FAIL_IF_FALSE(driver.close(),
"Unable to close the client!");
75 void GazeControlSimpleLookTest::run()
78 ROBOTTESTINGFRAMEWORK_TEST_CHECK(driver.view(igaze),
"Opening the view on the device!");
83 double t0=Time::now();
84 while (Time::now()-t0<5.0)
86 done=igaze->getFixationPoint(fp);
91 ROBOTTESTINGFRAMEWORK_TEST_CHECK(done,
"Initial fixation-point retrieved!");
93 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Setting up the context");
95 igaze->storeContext(&context);
97 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Looking at the target");
98 Vector fpd(3,0.0); fp[0]=-0.4;
99 igaze->lookAtFixationPoint(fpd);
101 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Waiting");
102 igaze->waitMotionDone(1.0,5.0);
104 igaze->checkMotionDone(&done);
105 ROBOTTESTINGFRAMEWORK_TEST_CHECK(done,
"Target reached!");
107 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Going back");
108 igaze->lookAtFixationPoint(fp);
110 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Waiting");
111 igaze->waitMotionDone(1.0,5.0);
113 igaze->checkMotionDone(&done);
114 ROBOTTESTINGFRAMEWORK_TEST_CHECK(done,
"Done!");
116 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Cleaning up the context");
117 igaze->restoreContext(context);
118 igaze->deleteContext(context);
This test verifies the simple gaze movements.