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);
85 /************************************************************
87 ************************************************************/
88 void motionStatusReceived();
89 void actualPositionReceived();
90 void powerVoltageReceived();
93 /************************************************************
95 ************************************************************/
96 void createLeftLayout();
97 void createRightLayout();
99 void createPlaygroundGroupBox();
100 void createPositionGroupBox();
101 void createMiscGroupBox();
102 void createDebugGroupBox();
103 void createActuatorsGroupBox();
104 void createMotorsGroupBox();
105 void createDIOGroupBox();
106 void createSensorsGroupBox();
107 void createPowerGroupBox();
108 void createPickerGroupBox();
109 void createFSMGroupBox();
112 void createActions();
115 QVBoxLayout *leftLayout;
116 QVBoxLayout *rightLayout;
118 QGroupBox *playgroundGroupBox;
119 QGroupBox *positionGroupBox;
120 QGroupBox *miscGroupBox;
121 QGroupBox *debugGroupBox;
122 QGroupBox *actuatorsGroupBox;
123 QGroupBox *powerGroupBox;
124 QGroupBox *fsmGroupBox;
127 PlaygroundScene *playgroundScene;
129 PlaygroundView *playgroundSceneView;
134 QLineEdit *actPosPhi;
138 QLineEdit *estPosPhi;
141 QTextEdit *debugWindow;
142 bool debugWindowEnabled;
145 /* QSlider *leftMotorSlider; */
146 /* QSlider *rightMotorSlider; */
147 /* QCheckBox *bothMotorsCheckBox; */
148 /* QPushButton *stopMotorsPushButton; */
151 /* power management */
152 QCheckBox *voltage33CheckBox;
153 QCheckBox *voltage50CheckBox;
154 QCheckBox *voltage80CheckBox;
155 QLineEdit *voltage33LineEdit;
156 QLineEdit *voltage50LineEdit;
157 QLineEdit *voltage80LineEdit;
158 QLineEdit *voltageBATLineEdit;
161 QCheckBox *obstacleSimulationCheckBox;
162 QLabel *fsm_main_state;
163 QLabel *fsm_act_state;
164 QLabel *fsm_motion_state;
165 QCheckBox *startPlug;
166 QCheckBox *colorChoser;
170 Robot *robotEstPosBest;
171 Robot *robotEstPosIndepOdo;
172 Robot *robotEstPosOdo;
177 Trail *trailEstPosBest;
178 Trail *trailPosIndepOdo;
181 HokuyoScan *hokuyoScan;
184 double leftMotorValue;
185 double rightMotorValue;
188 void openSharedMemory();
189 bool sharedMemoryOpened;
192 /* obstacle simulation */
193 double distanceToWallHokuyo(int beamnum);
194 double distanceToObstacleHokuyo(int beamnum, Point obstacle, double obstacleSize);
195 double distanceToCircularObstacleHokuyo(int beamnum, Point center, double diameter);
196 int simulationEnabled;
198 QTimer *obstacleSimulationTimer;
199 Point simulatedObstacle;
201 /************************************************************
203 ************************************************************/
206 struct robottype_orte_data orte;
209 #endif /* ROBOMON_ATLANTIS_H */