]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/robomon/RobomonAtlantis.h
robomon: Comment out vidle dial widget
[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 #include <QDialog>
17
18 #include <trgen.h>
19 #include "PlaygroundScene.h"
20 #include "playgroundview.h"
21 #include "Robot.h"
22 #include <roboorte_robottype.h>
23 #include "trail.h"
24 #include "hokuyoscan.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 powerVoltageReceivedSignal();
58         
59 public slots:
60         void showMap(bool show);
61         void useOpenGL(bool use);
62         void showTrails(bool show);
63         void resetTrails();
64 private slots:
65         /************************************************************
66          * GUI actions 
67          ************************************************************/
68         void setVoltage33(int state);
69         void setVoltage50(int state);
70         void setVoltage80(int state);
71 /*      void setLeftMotor(int value); */
72 /*      void setRightMotor(int value); */
73 /*      void stopMotors(); */
74         void paintMap();
75         void setSimulation(int state);
76         void setObstacleSimulation(int state);
77         void simulateObstaclesHokuyo();
78         void changeObstacle(QPointF position);
79         void sendStart(int plug);
80         void setTeamColor(int plug);
81
82         /************************************************************
83          * ORTE 
84          ************************************************************/
85         void motionStatusReceived();
86         void actualPositionReceived();
87         void powerVoltageReceived();
88
89 private:
90         /************************************************************
91          * GUI
92          ************************************************************/
93         void createLeftLayout();
94         void createRightLayout();
95
96         void createPlaygroundGroupBox();
97         void createPositionGroupBox();
98         void createMiscGroupBox();
99         void createDebugGroupBox();
100         void createActuatorsGroupBox();
101         void createMotorsGroupBox();
102         void createDIOGroupBox();
103         void createSensorsGroupBox();
104         void createPowerGroupBox();
105         void createPickerGroupBox();
106         void createFSMGroupBox();
107
108         void createRobots();
109         void createActions();
110
111         QVBoxLayout *leftLayout;
112         QVBoxLayout *rightLayout;
113
114         QGroupBox *playgroundGroupBox;
115         QGroupBox *positionGroupBox;
116         QGroupBox *miscGroupBox;
117         QGroupBox *debugGroupBox;
118         QGroupBox *actuatorsGroupBox;
119         QGroupBox *powerGroupBox;
120         QGroupBox *fsmGroupBox;
121
122 public:
123         PlaygroundScene *playgroundScene;
124 private:
125         PlaygroundView *playgroundSceneView;
126
127         /* position state */
128         QLineEdit *actPosX;
129         QLineEdit *actPosY;
130         QLineEdit *actPosPhi;
131
132         QLineEdit *estPosX;
133         QLineEdit *estPosY;
134         QLineEdit *estPosPhi;
135
136         /* debug window */
137         QTextEdit *debugWindow;
138         bool debugWindowEnabled;
139
140         /* actuators */
141 /*      QSlider *leftMotorSlider; */
142 /*      QSlider *rightMotorSlider; */
143 /*      QCheckBox *bothMotorsCheckBox; */
144 /*      QPushButton *stopMotorsPushButton; */
145         //QDial *vidle;
146
147         /* power management */
148         QCheckBox *voltage33CheckBox;
149         QCheckBox *voltage50CheckBox;
150         QCheckBox *voltage80CheckBox;
151         QLineEdit *voltage33LineEdit;
152         QLineEdit *voltage50LineEdit;
153         QLineEdit *voltage80LineEdit;
154         QLineEdit *voltageBATLineEdit;
155
156         /* misc */
157         QCheckBox *obstacleSimulationCheckBox;
158         QLabel *fsm_main_state;
159         QLabel *fsm_act_state;
160         QLabel *fsm_motion_state;
161         QCheckBox *startPlug;
162         QCheckBox *colorChoser;
163 public:
164         /* robot */
165         Robot *robotRefPos;
166         Robot *robotEstPosBest;
167         Robot *robotEstPosIndepOdo;
168         Robot *robotEstPosOdo;
169 private:
170         Trail *trailRefPos;
171         Trail *trailEstPosBest;
172         Trail *trailPosIndepOdo;
173         Trail *trailOdoPos;
174
175         HokuyoScan *hokuyoScan;
176
177         /* keypad */
178         double leftMotorValue;
179         double rightMotorValue;
180
181         /* map */
182         void openSharedMemory();
183         bool sharedMemoryOpened;
184         QTimer *mapTimer;
185         
186         /* obstacle simulation */
187         double distanceToWallHokuyo(int beamnum);
188         double distanceToObstacleHokuyo(int beamnum, Point obstacle, double obstacleSize);
189         int simulationEnabled;
190
191         QTimer *obstacleSimulationTimer;
192         Point simulatedObstacle;
193
194         /************************************************************
195          * ORTE 
196          ************************************************************/
197         void createOrte();
198
199         struct robottype_orte_data orte;
200 };
201
202 #endif /* ROBOMON_ATLANTIS_H */