icub-test
Loading...
Searching...
No Matches
Public Member Functions
CartesianControlSimpleP2pMovementTest Class Reference

This test verifies the point-to-point cartesian movement. More...

#include <CartesianControlSimpleP2pMovementTest.h>

Inherits yarp::robottestingframework::TestCase.

Public Member Functions

virtual bool setup (yarp::os::Property &property)
 
virtual void tearDown ()
 
virtual void run ()
 

Detailed Description

This test verifies the point-to-point cartesian movement.

Accepts the following parameters:

Parameter name Type Units Default Value Required Description Notes
robot string - icubSim No robot name -
arm-type string - left No left or right -

Definition at line 39 of file CartesianControlSimpleP2pMovementTest.h.

Constructor & Destructor Documentation

◆ CartesianControlSimpleP2pMovementTest()

CartesianControlSimpleP2pMovementTest::CartesianControlSimpleP2pMovementTest ( )

Definition at line 41 of file CartesianControlSimpleP2pMovementTest.cpp.

41 :
42 yarp::robottestingframework::TestCase("CartesianControlSimpleP2pMovementTest")
43{
44}

◆ ~CartesianControlSimpleP2pMovementTest()

CartesianControlSimpleP2pMovementTest::~CartesianControlSimpleP2pMovementTest ( )
virtual

Definition at line 48 of file CartesianControlSimpleP2pMovementTest.cpp.

49{
50}

Member Function Documentation

◆ run()

void CartesianControlSimpleP2pMovementTest::run ( )
virtual

Definition at line 79 of file CartesianControlSimpleP2pMovementTest.cpp.

80{
81 ICartesianControl *iarm;
82 ROBOTTESTINGFRAMEWORK_TEST_CHECK(driver.view(iarm),"Opening the view on the device!");
83
84 bool done;
85
86 Vector x,o;
87 double t0=Time::now();
88 while (Time::now()-t0<5.0)
89 {
90 done=iarm->getPose(x,o);
91 if (done)
92 break;
93 Time::delay(0.1);
94 }
95 ROBOTTESTINGFRAMEWORK_TEST_CHECK(done,"Initial pose retrieved!");
96
97 ROBOTTESTINGFRAMEWORK_TEST_REPORT("Setting up the context");
98 int context;
99 iarm->storeContext(&context);
100
101 Vector dof;
102 iarm->getDOF(dof); dof=1.0;
103 iarm->setDOF(dof,dof);
104 iarm->setTrajTime(1.0);
105
106 ROBOTTESTINGFRAMEWORK_TEST_REPORT("Reaching for the target");
107 Vector xd(3,0.0); xd[0]=-0.4;
108 iarm->goToPositionSync(xd);
109
110 ROBOTTESTINGFRAMEWORK_TEST_REPORT("Waiting");
111 done=iarm->waitMotionDone(1.0,5.0);
112 ROBOTTESTINGFRAMEWORK_TEST_CHECK(done,"Target reached!");
113
114 ROBOTTESTINGFRAMEWORK_TEST_REPORT("Going back to starting pose");
115 iarm->setLimits(0,0.0,0.0);
116 iarm->setLimits(1,0.0,0.0);
117 iarm->setLimits(2,0.0,0.0);
118 iarm->goToPoseSync(x,o);
119
120 ROBOTTESTINGFRAMEWORK_TEST_REPORT("Waiting");
121 done=iarm->waitMotionDone(1.0,5.0);
122 ROBOTTESTINGFRAMEWORK_TEST_CHECK(done,"Starting pose reached!");
123
124 ROBOTTESTINGFRAMEWORK_TEST_REPORT("Cleaning up the context");
125 iarm->restoreContext(context);
126 iarm->deleteContext(context);
127}

◆ setup()

bool CartesianControlSimpleP2pMovementTest::setup ( yarp::os::Property &  property)
virtual

Definition at line 54 of file CartesianControlSimpleP2pMovementTest.cpp.

55{
56 string robot=property.check("robot",Value("icubSim")).asString();
57 string arm=property.check("arm-type",Value("left")).asString();
58
59 Property option;
60 option.put("device","cartesiancontrollerclient");
61 option.put("remote",("/"+robot+"/"+"cartesianController/"+arm+"_arm"));
62 option.put("local",("/"+getName()+"/"+arm+"_arm"));
63
64 ROBOTTESTINGFRAMEWORK_TEST_REPORT(Asserter::format("Opening Cartesian Controller Client for %s_arm",arm.c_str()));
65 ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(driver.open(option),"Unable to open the client!");
66 return true;
67}

◆ tearDown()

void CartesianControlSimpleP2pMovementTest::tearDown ( )
virtual

Definition at line 71 of file CartesianControlSimpleP2pMovementTest.cpp.

72{
73 ROBOTTESTINGFRAMEWORK_TEST_REPORT("Closing Cartesian Controller Client");
74 ROBOTTESTINGFRAMEWORK_ASSERT_FAIL_IF_FALSE(driver.close(),"Unable to close the client!");
75}

The documentation for this class was generated from the following files: