icub-test
DemoRedBallTest.h
1 /*
2  * iCub Robot Unit Tests (Robot Testing Framework)
3  *
4  * Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef _DEMOREDBALL_H_
22 #define _DEMOREDBALL_H_
23 
24 #include <string>
25 #include <yarp/robottestingframework/TestCase.h>
26 #include <yarp/os/Bottle.h>
27 #include <yarp/os/Property.h>
28 #include <yarp/os/RpcClient.h>
29 #include <yarp/os/BufferedPort.h>
30 #include <yarp/dev/PolyDriver.h>
31 #include <yarp/dev/IEncoders.h>
32 #include <yarp/dev/CartesianControl.h>
33 #include <yarp/sig/Vector.h>
34 
50 class DemoRedBallTest : public yarp::robottestingframework::TestCase
51 {
52  struct {
53  std::string robot;
54  std::string eye;
55  double reach_tol;
56  bool use_torso;
57  bool use_left;
58  bool use_right;
59  yarp::sig::Vector home_arm;
60  } params;
61 
62  yarp::dev::PolyDriver drvJointArmL;
63  yarp::dev::PolyDriver drvJointArmR;
64  yarp::dev::PolyDriver drvJointTorso;
65  yarp::dev::PolyDriver drvJointHead;
66  yarp::dev::PolyDriver drvCartArmL;
67  yarp::dev::PolyDriver drvCartArmR;
68  yarp::dev::PolyDriver drvGaze;
69 
70  struct {
71  yarp::dev::ICartesianControl *iarm;
72  yarp::dev::IEncoders *ienc;
73  } arm_under_test;
74 
75  yarp::os::RpcClient rpcPort;
76  yarp::os::BufferedPort<yarp::os::Bottle> guiPort;
77  void testBallPosition(const yarp::sig::Vector &pos);
78  bool getBallPosition(const yarp::os::Bottle* b, yarp::sig::Vector& pos);
79 
80 public:
82  virtual ~DemoRedBallTest();
83  virtual bool setup(yarp::os::Property& property);
84  virtual void tearDown();
85  virtual void run();
86 };
87 
88 #endif
This test verifies the point-to-point cartesian movement.