iCub-main
dumperThread.h
Go to the documentation of this file.
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 /*
4  * Copyright (C) 2010 RobotCub Consortium, European Commission FP6 Project IST-004370
5  * Author: Francesco Nori
6  * email: francesco.nori@iit.it
7  * website: www.robotcub.org
8  * Permission is granted to copy, distribute, and/or modify this program
9  * under the terms of the GNU General Public License, version 2 or any
10  * later version published by the Free Software Foundation.
11  *
12  * A copy of the license can be found at
13  * http://www.robotcub.org/icub/license/gpl.txt
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
18  * Public License for more details
19 */
20 
21 #include <string>
22 #include <cmath>
23 
24 #include <yarp/os/Network.h>
25 #include <yarp/os/Port.h>
26 #include <yarp/os/Bottle.h>
27 #include <yarp/os/Time.h>
28 
29 #include <yarp/os/PeriodicThread.h>
30 
32 
33 class boardDumperThread: public PeriodicThread
34 {
35 public:
36  void setDevice(PolyDriver *board_d, PolyDriver *debug_d, int rate, std::string portPrefix, std::string dataToDump, bool logOnDisk);
39  bool threadInit();
40  void setThetaMap(int *, int);
41  void threadRelease();
42  void run();
43  void setGetter(GetData *);
44 
45 private:
46  PolyDriver *board_dd;
47  PolyDriver *debug_dd;
48  GetData *getter;
49  Stamp stmp;
50 
51  std::string portName;
52  Port *port;
53  FILE * logFile;
54  bool logToFile;
55 
56  IPositionControl *pos;
57  IVelocityControl *vel;
58  IEncoders *enc;
59  IMotorEncoders *imotenc;
60  IPidControl *pid;
61  IAmplifierControl *amp;
62  IControlLimits *lim;
63  ITorqueControl *trq;
64  IControlMode *cmod;
65  IInteractionMode *imod;
66  IMotor *imot;
67 
68  int numberOfJoints;
69  double *data;
70 
71  int numberOfJointsRead;
72  double *dataRead;
73  int *dataMap;
74 
75 };
76 
void setThetaMap(int *, int)
void setGetter(GetData *)
void setDevice(PolyDriver *board_d, PolyDriver *debug_d, int rate, std::string portPrefix, std::string dataToDump, bool logOnDisk)