iCub-main
mainwindow.h
Go to the documentation of this file.
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3 
4 #include <QMainWindow>
5 #include "portthread.h"
6 #include "loadingwidget.h"
7 
8 #include <QTimer>
9 
10 #include <string>
11 #include <sstream>
12 #include <iomanip> // io manipulator (setw, setfill)
13 #include <cstdarg>
14 //#include <cstdlib>
15 #include <math.h>
16 #include <vector>
17 
18 
19 #include <yarp/os/Time.h>
20 #include <yarp/os/Port.h>
21 #include <yarp/os/BufferedPort.h>
22 #include <yarp/os/Bottle.h>
23 #include <yarp/sig/Vector.h>
24 #include <yarp/os/Network.h>
25 #include <yarp/os/RFModule.h>
26 
28 
29 using namespace std;
30 using namespace yarp::os;
31 using namespace yarp::sig;
32 using namespace iCub::skinManager;
33 
34 
35 namespace Ui {
36 class MainWindow;
37 }
38 
39 class MainWindow : public QMainWindow
40 {
41  Q_OBJECT
42 
43 public:
44  explicit MainWindow(ResourceFinder *rf, QWidget *parent = 0);
46 public:
47  void initGui();
48  bool initGuiStatus();
49  void printLog(QString);
50  double round(double value, int decimalDigit);
51 
52 private:
53  void changeSmooth(int val);
54  void setMsgFreq(bool freqUpdated, double freq);
55 
56 private:
57  Ui::MainWindow *ui;
58  ResourceFinder *rf;
59  PortThread portThread;
60  LoadingWidget loadingWidget;
61  QTimer calibratingTimer;
62  QTimer updateTimer;
63  bool smoothSliderPressed;
64  double prevFreq;
65 
66  // global data
67  uint timeoutId; // id of the timeout callback function
68  vector<string> portNames; // names of the skin input ports
69  vector<unsigned int> portDim; // number of taxels of the input ports
70  double currentSmoothFactor; // current smooth factor value
71  bool initDone; // true if the gui has been initialized
72  unsigned int currentThreshold; // current safety threshold
73  double currentCompGain; // current compensation gain
74  double currentContCompGain; // current contact compensation gain
75  double currentMaxNeighDist; // current max neighbor distance
76  int currentSampleFreq;
77  int currentSampleNum; // size of the dataPlot array
78 
79 
80 private slots:
81  void onUpdateTimer();
82  void onPortCreated();
83  void onOpenErrorDialog(QString);
84  void onCalibratingTimer();
85  void onCalibrate();
86  void onThreashold();
87  void onBinarization(bool btnState);
88  void onSmooth(bool btnState);
89  void onSmoothValueChanged(int);
90  void onSmoothValuePressed();
91  void onSmoothValueReleased();
92  void onSpinNeighborChanged(double);
93  void onSpinCompContactGainChanged(double);
94  void onSpinCompGainChanged(double);
95  void onSpinThresholdChanged(int);
96  void onSampleFreqChanged(int);
97 
98 };
99 
100 #endif // MAINWINDOW_H