iCub-main
Loading...
Searching...
No Matches
straincalibgui.h
Go to the documentation of this file.
1#ifndef STRAINCALIBGUI_H
2#define STRAINCALIBGUI_H
3
4#include <QDialog>
5#include <QSignalMapper>
6#include <QFile>
7#include <stdio.h>
8#include <QLineEdit>
9#include <QTimer>
10#include <QFuture>
11#include <QFutureWatcher>
12#include <QValidator>
13
14//#include <conio.h>
15//#include <time.h>
16#include <iostream>
17#include <yarp/os/Network.h>
18#include <yarp/os/Os.h>
19#include <yarp/os/Time.h>
20#include <yarp/os/PeriodicThread.h>
21#include <yarp/dev/ControlBoardInterfaces.h>
22#include <yarp/dev/PolyDriver.h>
23#include <yarp/dev/CanBusInterface.h>
24#include <deque>
25#include "expected_values.h"
26#include "strainInterface.h"
27#include "firmwareupdatercore.h"
28namespace Ui {
29class StrainCalibGui;
30}
31
32class StrainCalibGui : public QDialog
33{
34 Q_OBJECT
35
36public:
37 explicit StrainCalibGui(QString device, int bus , int pid,
38 FirmwareUpdaterCore *core,QWidget *parent = 0);
40
41private:
42 void turnOnButtons();
43 void turnOffButtons();
44 void showMenu();
45 void bias_sensor();
46 void terminate_section();
47 void close_files();
48 int remap_trials();
49 bool get(const unsigned int number, vector<cDownloader::strain_value_t> &values, bool debugprint = true, bool updateprogress = true);
50 bool print(const vector<cDownloader::strain_value_t> &values, FILE *fp, QList<float> = QList<float>());
51#ifdef ATI_SENS
52 void acquire_1000_samples();
53#else
54 bool acquire_samples(int samples);
55#endif
56
57private:
58 Ui::StrainCalibGui *ui;
59 QDoubleValidator validator;
60 QFutureWatcher<bool> watcher;
63 QSignalMapper signalMapper;
64 QList <QPushButton*> buttons;
65 QList <QLineEdit*> readValues;
66 QList <QLineEdit*> expValues;
67 QList <QLineEdit*> errValues;
68 int currentBtnIndex;
69 expected_values_handler_class expected_values_handler;
70 //strainInterface sI;
71 int trial;
72 FILE *fp;
73 QFile file;
74 signed_elem_class trial_bias;
75 signed_elem_class last_value;
76 QTimer timer;
77 int current_trial;
78
79 volatile bool acquiringdata;
80 QMutex mutexacquisitionofdata;
81 QMutex mutexdriver;
82 void setAcquisitionOfDataActive(const bool active);
83 bool isAcquisitionOfDataActive();
84 void lockdriver(const bool on);
85
86 bool tick_acquisition(int samples);
87
88 bool enabledebugprints;
89 volatile bool enableacquisitions;
90
91 void stopacquisitions(bool forcestop = true);
92
93 static void progressbar(void *owner, float percent);
94
95 volatile int progressvalue;
96
97 bool checkDirectory();
98
99private slots:
100 void onButtonClick(bool b);
101 void onAcquireData(bool b);
102 void onTimerTimeout();
103 void onFutureFinished();
104 void onFreeAcqMode(bool);
105 void onClose();
106};
107
108#endif // STRAINCALIBGUI_H
grid on