2 * RobomonAtlantis.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_ATLANTIS_H
14 #define ROBOMON_ATLANTIS_H
19 #include "PlaygroundScene.h"
20 #include "playgroundview.h"
23 #include <roboorte_robottype.h>
25 #include "hokuyoscan.h"
43 class RobomonAtlantis : public QWidget
48 RobomonAtlantis(QWidget *parent = 0);
51 bool event(QEvent *event);
52 void keyPressEvent(QKeyEvent *event);
53 void keyReleaseEvent(QKeyEvent *event);
54 void closeEvent(QCloseEvent *event);
57 void motionStatusReceivedSignal();
58 void actualPositionReceivedSignal();
59 void powerVoltageReceivedSignal();
62 void showMap(bool show);
63 void useOpenGL(bool use);
64 void showTrails(bool show);
65 void showShapeDetect(bool show);
68 /************************************************************
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(); */
78 void setSimulation(int state);
79 void setObstacleSimulation(int state);
80 void simulateObstaclesHokuyo();
81 void changeObstacle(QPointF position);
82 void sendStart(int plug);
83 void setTeamColor(int plug);
84 void changeStrategy_1();
85 void changeStrategy_0();
87 /************************************************************
89 ************************************************************/
90 void motionStatusReceived();
91 void actualPositionReceived();
92 void powerVoltageReceived();
95 /************************************************************
97 ************************************************************/
98 void createLeftLayout();
99 void createRightLayout();
101 void createPlaygroundGroupBox();
102 void createPositionGroupBox();
103 void createMiscGroupBox();
104 void createDebugGroupBox();
105 void createActuatorsGroupBox();
106 void createMotorsGroupBox();
107 void createDIOGroupBox();
108 void createSensorsGroupBox();
109 void createPowerGroupBox();
110 void createPickerGroupBox();
111 void createFSMGroupBox();
114 void createActions();
117 QVBoxLayout *leftLayout;
118 QVBoxLayout *rightLayout;
120 QGroupBox *playgroundGroupBox;
121 QGroupBox *positionGroupBox;
122 QGroupBox *miscGroupBox;
123 QGroupBox *debugGroupBox;
124 QGroupBox *actuatorsGroupBox;
125 QGroupBox *powerGroupBox;
126 QGroupBox *fsmGroupBox;
129 PlaygroundScene *playgroundScene;
131 PlaygroundView *playgroundSceneView;
136 QLineEdit *actPosPhi;
140 QLineEdit *estPosPhi;
143 QTextEdit *debugWindow;
144 bool debugWindowEnabled;
147 /* QSlider *leftMotorSlider; */
148 /* QSlider *rightMotorSlider; */
149 /* QCheckBox *bothMotorsCheckBox; */
150 /* QPushButton *stopMotorsPushButton; */
153 /* power management */
154 QCheckBox *voltage33CheckBox;
155 QCheckBox *voltage50CheckBox;
156 QCheckBox *voltage80CheckBox;
157 QLineEdit *voltage33LineEdit;
158 QLineEdit *voltage50LineEdit;
159 QLineEdit *voltage80LineEdit;
160 QLineEdit *voltageBATLineEdit;
163 QCheckBox *obstacleSimulationCheckBox;
164 QLabel *fsm_main_state;
165 QLabel *fsm_act_state;
166 QLabel *fsm_motion_state;
167 QCheckBox *startPlug;
168 QCheckBox *colorChoser;
169 QPushButton *strategyButton;
173 Robot *robotEstPosBest;
174 Robot *robotEstPosIndepOdo;
175 Robot *robotEstPosOdo;
180 Trail *trailEstPosBest;
181 Trail *trailPosIndepOdo;
184 HokuyoScan *hokuyoScan;
187 double leftMotorValue;
188 double rightMotorValue;
191 void openSharedMemory();
192 bool sharedMemoryOpened;
195 /* obstacle simulation */
196 double distanceToWallHokuyo(int beamnum);
197 double distanceToObstacleHokuyo(int beamnum, Point obstacle, double obstacleSize);
198 double distanceToCircularObstacleHokuyo(int beamnum, Point center, double diameter);
199 int simulationEnabled;
201 QTimer *obstacleSimulationTimer;
202 Point simulatedObstacle;
204 /************************************************************
206 ************************************************************/
209 struct robottype_orte_data orte;
212 #endif /* ROBOMON_ATLANTIS_H */