]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/robomon/RobomonAtlantis.h
Remove more #include <roboorte.h>
[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 "trail.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 public slots:
64         void showMap(bool show);
65         void showTrails(bool show);
66         void resetTrails();
67 private slots:
68         /************************************************************
69          * GUI actions 
70          ************************************************************/
71         void setVoltage33(int state);
72         void setVoltage50(int state);
73         void setVoltage80(int state);
74         void setLeftMotor(int value);
75         void setRightMotor(int value);
76         void stopMotors();
77         void setDO(int state);
78         void paintMap();
79         void setSimulation(int state);
80         void setObstacleSimulation(int state);
81         void simulateObstaclesHokuyo();
82         void changeObstacle(QPointF position);
83         void pick();
84         void setBelts(int value);
85         void setChelae(int value);
86         void sendStart(int plug);
87         void sendPuckInside(int value);
88
89         /************************************************************
90          * ORTE 
91          ************************************************************/
92         void motionStatusReceived();
93         void actualPositionReceived();
94         void estimatedPositionReceived();
95         void diReceived();
96         void accelerometerReceived();
97         void accumulatorReceived();
98         void powerVoltageReceived();
99
100 private:
101         /************************************************************
102          * GUI
103          ************************************************************/
104         void createLeftLayout();
105         void createRightLayout();
106
107         void createPlaygroundGroupBox();
108         void createPositionGroupBox();
109         void createMiscGroupBox();
110         void createDebugGroupBox();
111         void createActuatorsGroupBox();
112         void createMotorsGroupBox();
113         void createDIOGroupBox();
114         void createSensorsGroupBox();
115         void createPowerGroupBox();
116         void createPickerGroupBox();
117         void createFSMGroupBox();
118
119         void createRobots();
120         void createActions();
121
122         QVBoxLayout *leftLayout;
123         QVBoxLayout *rightLayout;
124
125         QGroupBox *playgroundGroupBox;
126         QGroupBox *positionGroupBox;
127         QGroupBox *miscGroupBox;
128         QGroupBox *debugGroupBox;
129         QGroupBox *actuatorsGroupBox;
130         QGroupBox *enginesGroupBox;
131         QGroupBox *dioGroupBox;
132         QGroupBox *sensorsGroupBox;
133         QGroupBox *powerGroupBox;
134         QGroupBox *pickerGroupBox;
135         QGroupBox *fsmGroupBox;
136
137         PlaygroundScene *playgroundScene;
138         QGraphicsView *playgroundSceneView;
139
140         /* position state */
141         QLineEdit *actPosX;
142         QLineEdit *actPosY;
143         QLineEdit *actPosPhi;
144
145         QLineEdit *estPosX;
146         QLineEdit *estPosY;
147         QLineEdit *estPosPhi;
148
149         /* debug window */
150         QTextEdit *debugWindow;
151         bool debugWindowEnabled;
152
153         /* actuators */
154         QSlider *leftMotorSlider;
155         QSlider *rightMotorSlider;
156         QCheckBox *bothMotorsCheckBox;
157         QPushButton *stopMotorsPushButton;
158
159         QCheckBox *leftBeltCheckBox;
160         QCheckBox *rightBeltCheckBox;
161         QCheckBox *leftChelaCheckBox;
162         QCheckBox *rightChelaCheckBox;
163
164         QDial *leftBeltDial;
165         QDial *rightBeltDial;
166         QDial *leftChelaDial;
167         QDial *rightChelaDial;
168         QPushButton *pickPushButton;
169
170         /* power management */
171         QCheckBox *voltage33CheckBox;
172         QCheckBox *voltage50CheckBox;
173         QCheckBox *voltage80CheckBox;
174         QLineEdit *voltage33LineEdit;
175         QLineEdit *voltage50LineEdit;
176         QLineEdit *voltage80LineEdit;
177         QLineEdit *voltageBATLineEdit;
178
179         QCheckBox *diCheckBox[8];
180         QCheckBox *doCheckBox[8];
181
182         /* misc */
183         QCheckBox *obstacleSimulationCheckBox;
184         QLabel *fsm_main_state;
185         QLabel *fsm_act_state;
186         QLabel *fsm_motion_state;
187         QCheckBox *startPlug;
188         QCheckBox *puckInside;
189
190         /* robot */
191         Robot *robotActPos;
192         Robot *robotEstPosUzv;
193         Robot *robotEstPosOdo;
194         
195         Trail *trailRefPos;
196         Trail *trailUzvPos;
197         Trail *trailOdoPos;
198
199         /* keypad */
200         double leftMotorValue;
201         double rightMotorValue;
202
203         /* map */
204         void openSharedMemory();
205         bool sharedMemoryOpened;
206         QTimer *mapTimer;
207         
208         /* sensors */
209         QProgressBar *sharpPuck;
210         QProgressBar *liftPos;
211         QProgressBar *pusherPos;
212
213         /* obstacle simulation */
214         double distanceToWallHokuyo(int beamnum);
215         double distanceToObstacleHokuyo(int beamnum, Point obstacle, double obstacleSize);
216         int simulationEnabled;
217
218         QTimer *obstacleSimulationTimer;
219         Point simulatedObstacle;
220
221         /************************************************************
222          * ORTE 
223          ************************************************************/
224         void createOrte();
225
226         struct robottype_orte_data orte;
227 };
228
229 #endif /* ROBOMON_ATLANTIS_H */