iCub-main
Loading...
Searching...
No Matches
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
29using namespace std;
30using namespace yarp::os;
31using namespace yarp::sig;
32using namespace iCub::skinManager;
33
34
35namespace Ui {
36class MainWindow;
37}
38
39class MainWindow : public QMainWindow
40{
41 Q_OBJECT
42
43public:
44 explicit MainWindow(ResourceFinder *rf, QWidget *parent = 0);
46public:
47 void initGui();
48 bool initGuiStatus();
49 void printLog(QString);
50 double round(double value, int decimalDigit);
51
52private:
53 void changeSmooth(int val);
54 void setMsgFreq(bool freqUpdated, double freq);
55
56private:
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
80private 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
double round(double value, int decimalDigit)
void printLog(QString)
bool initGuiStatus()
void initGui()