]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/robomon/RobomonAtlantis.h
Merge branch 'master' of kubiaj1@rtime.felk.cvut.cz:/var/git/eurobot
[eurobot/public.git] / src / robomon / RobomonAtlantis.h
1 /*
2  * RobomonAtlantis.h                    07/10/31
3  *
4  * Robot's visualization and control GUI for robot of the
5  * Eurobot 2008 competition (Mission to Mars).
6  *
7  * Copyright: (c) 2008 CTU Dragons
8  *            CTU FEE - Department of Control Engineering
9  * Authors: Martin Zidek, Michal Sojka, Tran Duy Khanh
10  * License: GNU GPL v.2
11  */
12
13 #ifndef ROBOMON_ATLANTIS_H
14 #define ROBOMON_ATLANTIS_H
15
16 #define SIM_OBST_SIZE_M 0.5
17
18 #include <QDialog>
19
20 #include <trgen.h>
21 #include "PlaygroundScene.h"
22 #include "Robot.h"
23 #include <roboorte_robottype.h>
24 #include <roboorte.h>
25
26 class QHBoxLayout;
27 class QVBoxLayout;
28 class QGridLayout;
29 class QGroupBox;
30 class QGraphicsView;
31 class QLabel;
32 class QPushButton;
33 class QCheckBox;
34 class QLineEdit;
35 class QTextEdit;
36 class QDial;
37 class QSlider;
38 class QProgressBar;
39 class QFont;
40
41 class RobomonAtlantis : public QWidget
42 {
43         Q_OBJECT
44
45 public:
46         RobomonAtlantis(QWidget *parent = 0);
47
48 protected:
49         bool event(QEvent *event);
50         void keyPressEvent(QKeyEvent *event);
51         void keyReleaseEvent(QKeyEvent *event);
52         void closeEvent(QCloseEvent *event);
53
54 signals:
55         void motionStatusReceivedSignal();
56         void actualPositionReceivedSignal();
57         void estimatedPositionReceivedSignal();
58         void diReceivedSignal();
59         void accelerometerReceivedSignal();
60         void accumulatorReceivedSignal();
61         void powerVoltageReceivedSignal();
62
63 private slots:
64         /************************************************************
65          * GUI actions 
66          ************************************************************/
67         void setVoltage33(int state);
68         void setVoltage50(int state);
69         void setVoltage80(int state);
70         void setLeftMotor(int value);
71         void setRightMotor(int value);
72         void stopMotors();
73         void setDO(int state);
74         void showMap();
75         void showPlayground();
76         void paintMap();
77         void setSimulation(int state);
78         void setObstacleSimulation(int state);
79         void simulateObstaclesHokuyo();
80         void changeObstacle(QPointF position);
81         void pick();
82         void setBelts(int value);
83         void setChelae(int value);
84
85         /************************************************************
86          * ORTE 
87          ************************************************************/
88         void motionStatusReceived();
89         void actualPositionReceived();
90         void estimatedPositionReceived();
91         void diReceived();
92         void accelerometerReceived();
93         void accumulatorReceived();
94         void powerVoltageReceived();
95
96 private:
97         /************************************************************
98          * GUI
99          ************************************************************/
100         void createLeftLayout();
101         void createRightLayout();
102
103         void createPlaygroundGroupBox();
104         void createPositionGroupBox();
105         void createMiscGroupBox();
106         void createDebugGroupBox();
107         void createActuatorsGroupBox();
108         void createMotorsGroupBox();
109         void createDIOGroupBox();
110         void createSensorsGroupBox();
111         void createPowerGroupBox();
112         void createPickerGroupBox();
113
114         void createSharpSensorsLayout();
115
116         void createRobots();
117         void createActions();
118
119         QVBoxLayout *leftLayout;
120         QVBoxLayout *rightLayout;
121         QVBoxLayout *sharpSensorsLayout;
122
123         QGroupBox *playgroundGroupBox;
124         QGroupBox *positionGroupBox;
125         QGroupBox *miscGroupBox;
126         QGroupBox *debugGroupBox;
127         QGroupBox *actuatorsGroupBox;
128         QGroupBox *enginesGroupBox;
129         QGroupBox *dioGroupBox;
130         QGroupBox *sensorsGroupBox;
131         QGroupBox *powerGroupBox;
132         QGroupBox *pickerGroupBox;
133
134         PlaygroundScene *playgroundScene;
135         QGraphicsView *playgroundSceneView;
136
137         /* position state */
138         QLineEdit *actPosX;
139         QLineEdit *actPosY;
140         QLineEdit *actPosPhi;
141
142         QLineEdit *estPosX;
143         QLineEdit *estPosY;
144         QLineEdit *estPosPhi;
145
146         /* debug window */
147         QTextEdit *debugWindow;
148         bool debugWindowEnabled;
149
150         /* actuators */
151         QSlider *leftMotorSlider;
152         QSlider *rightMotorSlider;
153         QCheckBox *bothMotorsCheckBox;
154         QPushButton *stopMotorsPushButton;
155
156         QCheckBox *leftBeltCheckBox;
157         QCheckBox *rightBeltCheckBox;
158         QCheckBox *leftChelaCheckBox;
159         QCheckBox *rightChelaCheckBox;
160
161         QDial *leftBeltDial;
162         QDial *rightBeltDial;
163         QDial *leftChelaDial;
164         QDial *rightChelaDial;
165         QPushButton *pickPushButton;
166
167         /* power management */
168         QCheckBox *voltage33CheckBox;
169         QCheckBox *voltage50CheckBox;
170         QCheckBox *voltage80CheckBox;
171         QLineEdit *voltage33LineEdit;
172         QLineEdit *voltage50LineEdit;
173         QLineEdit *voltage80LineEdit;
174         QLineEdit *voltageBATLineEdit;
175
176         QCheckBox *diCheckBox[8];
177         QCheckBox *doCheckBox[8];
178
179         /* misc */
180         QCheckBox *obstacleSimulationCheckBox;
181         QPushButton *showMapPushButton;
182
183         /* robot */
184         Robot *robotActPos;
185         Robot *robotEstPos;
186
187         /* keypad */
188         double leftMotorValue;
189         double rightMotorValue;
190
191         /* map */
192         void openSharedMemory();
193         bool sharedMemoryOpened;
194         QTimer *mapTimer;
195
196         /* obstacle simulation */
197         double distanceToWallHokuyo(int beamnum);
198         double distanceToObstacleHokuyo(int beamnum, Point obstacle, double obstacleSize);
199         int simulationEnabled;
200
201         QTimer *obstacleSimulationTimer;
202         Point simulatedObstacle;
203
204         /************************************************************
205          * ORTE 
206          ************************************************************/
207         void createOrte();
208
209         struct robottype_orte_data orte;
210 };
211
212 #endif /* ROBOMON_ATLANTIS_H */