]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/robomon/RobomonAtlantis.h
robomon: Remove motor controls
[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
81         /************************************************************
82          * ORTE 
83          ************************************************************/
84         void motionStatusReceived();
85         void actualPositionReceived();
86         void powerVoltageReceived();
87
88 private:
89         /************************************************************
90          * GUI
91          ************************************************************/
92         void createLeftLayout();
93         void createRightLayout();
94
95         void createPlaygroundGroupBox();
96         void createPositionGroupBox();
97         void createMiscGroupBox();
98         void createDebugGroupBox();
99         void createActuatorsGroupBox();
100         void createMotorsGroupBox();
101         void createDIOGroupBox();
102         void createSensorsGroupBox();
103         void createPowerGroupBox();
104         void createPickerGroupBox();
105         void createFSMGroupBox();
106
107         void createRobots();
108         void createActions();
109
110         QVBoxLayout *leftLayout;
111         QVBoxLayout *rightLayout;
112
113         QGroupBox *playgroundGroupBox;
114         QGroupBox *positionGroupBox;
115         QGroupBox *miscGroupBox;
116         QGroupBox *debugGroupBox;
117         QGroupBox *actuatorsGroupBox;
118         QGroupBox *powerGroupBox;
119         QGroupBox *fsmGroupBox;
120
121         PlaygroundScene *playgroundScene;
122         PlaygroundView *playgroundSceneView;
123
124         /* position state */
125         QLineEdit *actPosX;
126         QLineEdit *actPosY;
127         QLineEdit *actPosPhi;
128
129         QLineEdit *estPosX;
130         QLineEdit *estPosY;
131         QLineEdit *estPosPhi;
132
133         /* debug window */
134         QTextEdit *debugWindow;
135         bool debugWindowEnabled;
136
137         /* actuators */
138 /*      QSlider *leftMotorSlider; */
139 /*      QSlider *rightMotorSlider; */
140 /*      QCheckBox *bothMotorsCheckBox; */
141 /*      QPushButton *stopMotorsPushButton; */
142
143         /* power management */
144         QCheckBox *voltage33CheckBox;
145         QCheckBox *voltage50CheckBox;
146         QCheckBox *voltage80CheckBox;
147         QLineEdit *voltage33LineEdit;
148         QLineEdit *voltage50LineEdit;
149         QLineEdit *voltage80LineEdit;
150         QLineEdit *voltageBATLineEdit;
151
152         /* misc */
153         QCheckBox *obstacleSimulationCheckBox;
154         QLabel *fsm_main_state;
155         QLabel *fsm_act_state;
156         QLabel *fsm_motion_state;
157         QCheckBox *startPlug;
158         QCheckBox *puckInside;
159 public:
160         /* robot */
161         Robot *robotRefPos;
162         Robot *robotEstPosBest;
163         Robot *robotEstPosIndepOdo;
164         Robot *robotEstPosOdo;
165 private:
166         Trail *trailRefPos;
167         Trail *trailEstPosBest;
168         Trail *trailPosIndepOdo;
169         Trail *trailOdoPos;
170
171         HokuyoScan *hokuyoScan;
172
173         /* keypad */
174         double leftMotorValue;
175         double rightMotorValue;
176
177         /* map */
178         void openSharedMemory();
179         bool sharedMemoryOpened;
180         QTimer *mapTimer;
181         
182         /* obstacle simulation */
183         double distanceToWallHokuyo(int beamnum);
184         double distanceToObstacleHokuyo(int beamnum, Point obstacle, double obstacleSize);
185         int simulationEnabled;
186
187         QTimer *obstacleSimulationTimer;
188         Point simulatedObstacle;
189
190         /************************************************************
191          * ORTE 
192          ************************************************************/
193         void createOrte();
194
195         struct robottype_orte_data orte;
196 };
197
198 #endif /* ROBOMON_ATLANTIS_H */