2 * RobomonExplorer.h 07/10/31
4 * Robot's visualization and control GUI for robot of the
5 * Eurobot 2008 competition (Mission to Mars).
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
13 #ifndef ROBOMON_EXPLORER_H
14 #define ROBOMON_EXPLORER_H
16 #define SHARP_LONG_CNT 4
17 #define SHARP_SHORT_CNT 2
23 #include "PlaygroundScene.h"
25 #include <roboorte_generic.h>
26 #include <roboorte_eb2008.h>
46 #define TOP_LEFT QPointF(10,0)
50 class RobomonExplorer : public QWidget
55 RobomonExplorer(QWidget *parent = 0);
58 bool event(QEvent *event);
59 void keyPressEvent(QKeyEvent *event);
60 void keyReleaseEvent(QKeyEvent *event);
61 void closeEvent(QCloseEvent *event);
64 void motionStatusReceivedSignal();
65 void actualPositionReceivedSignal();
66 void estimatedPositionReceivedSignal();
67 void sharpsReceivedSignal();
68 void sharpLongsReceivedSignal(); //FIXME rm
69 void sharpShortsReceivedSignal(); //FIXME rm
70 void diReceivedSignal();
71 void accelerometerReceivedSignal();
72 void accumulatorReceivedSignal();
73 void powerVoltageReceivedSignal();
76 /************************************************************
78 ************************************************************/
79 void setVoltage33(int state);
80 void setVoltage50(int state);
81 void setVoltage80(int state);
82 void setLeftMotor(int value);
83 void setRightMotor(int value);
84 void setDrives(int value);
85 void setLeftBrushDriveCB(int value);
86 void setRightBrushDriveCB(int value);
87 void setBagrDriveCB(int value);
89 void moveServos(int value);
90 void moveFrontDoor(int state);
91 void moveTopDoor(int state);
92 void moveBackDoor(int state);
93 void moveLeftBrush(int state);
94 void moveRightBrush(int state);
95 void setDO(int state);
96 void setLaser(int state);
98 void showPlayground();
100 void setSharpValues(int value);
101 void setSimulation(int state);
102 void setObstacleSimulation(int state);
103 void simulateObstacles();
104 void changeObstacle(QPointF position);
106 /************************************************************
108 ************************************************************/
109 void motionStatusReceived();
110 void actualPositionReceived();
111 void estimatedPositionReceived();
112 void sharpsReceived();
114 void accelerometerReceived();
115 void accumulatorReceived();
116 void powerVoltageReceived();
119 /************************************************************
121 ************************************************************/
122 void createLeftLayout();
123 void createRightLayout();
125 void createPlaygroundGroupBox();
126 void createPositionGroupBox();
127 void createMiscGroupBox();
128 void createDebugGroupBox();
129 void createActuatorsGroupBox();
130 void createMotorsGroupBox();
131 void createServosGroupBox();
132 void createDrivesGroupBox();
133 void createDIOGroupBox();
134 void createSensorsGroupBox();
135 void createPowerGroupBox();
137 void createSharpSensorsLayout();
140 void createActions();
142 QVBoxLayout *leftLayout;
143 QVBoxLayout *rightLayout;
144 QVBoxLayout *sharpSensorsLayout;
146 QGroupBox *playgroundGroupBox;
147 QGroupBox *positionGroupBox;
148 QGroupBox *miscGroupBox;
149 QGroupBox *debugGroupBox;
150 QGroupBox *actuatorsGroupBox;
151 QGroupBox *enginesGroupBox;
152 QGroupBox *servosGroupBox;
153 QGroupBox *drivesGroupBox;
154 QGroupBox *dioGroupBox;
155 QGroupBox *sensorsGroupBox;
156 QGroupBox *powerGroupBox;
158 PlaygroundScene *playgroundScene;
159 QGraphicsView *playgroundSceneView;
164 QLineEdit *actPosPhi;
168 QLineEdit *estPosPhi;
171 QTextEdit *debugWindow;
172 bool debugWindowEnabled;
175 QSlider *leftMotorSlider;
176 QSlider *rightMotorSlider;
177 QCheckBox *bothMotorsCheckBox;
178 QPushButton *stopMotorsPushButton;
180 QCheckBox *bottomDoorCheckBox;
181 QCheckBox *backDoorCheckBox;
182 QCheckBox *topDoorCheckBox;
183 QCheckBox *leftBrushCheckBox;
184 QCheckBox *rightBrushCheckBox;
186 QDial *leftBrushDial;
187 QDial *rightBrushDial;
191 QCheckBox *leftBrushDriveCheckBox;
192 QCheckBox *rightBrushDriveCheckBox;
193 QCheckBox *bagrDriveCheckBox;
195 /* power management */
196 QCheckBox *voltage33CheckBox;
197 QCheckBox *voltage50CheckBox;
198 QCheckBox *voltage80CheckBox;
199 QLineEdit *voltage33LineEdit;
200 QLineEdit *voltage50LineEdit;
201 QLineEdit *voltage80LineEdit;
202 QLineEdit *voltageBATLineEdit;
205 QLabel *sharpLongsLabel[SHARP_LONG_CNT];
206 QLabel *sharpShortsLabel[SHARP_SHORT_CNT];
207 QProgressBar *sharpLongsProgressBar[SHARP_LONG_CNT];
208 QProgressBar *sharpShortsProgressBar[SHARP_SHORT_CNT];
209 QCheckBox *sensorsSimulationCheckBox;
210 QSlider *sharpLongsSlider[SHARP_LONG_CNT];
211 QSlider *sharpShortsSlider[SHARP_SHORT_CNT];
213 QCheckBox *diCheckBox[8];
214 QCheckBox *doCheckBox[8];
217 QCheckBox *sensorSimulationCheckBox;
218 QCheckBox *obstacleSimulationCheckBox;
219 QPushButton *showMapPushButton;
220 QCheckBox *laserEngineCheckBox;
227 double leftMotorValue;
228 double rightMotorValue;
231 void openSharedMemory();
232 bool sharedMemoryOpened;
236 /* obstacle simulation */
237 double distanceToWall(int sharpnum);
238 double distanceToObstacle(int sharpnum, Point obstacle, double obstacleSize);
239 int simulationEnabled;
241 QTimer *obstacleSimulationTimer;
242 Point simulatedObstacle;
244 /************************************************************
246 ************************************************************/
249 struct generic_orte_data orte_generic;
250 struct eb2008_orte_data orte_eb2008;
253 #endif /* ROBOMON_EXPLORER_H */