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"
22 #include <roboorte_robottype.h>
24 #include "hokuyoscan.h"
41 class RobomonAtlantis : public QWidget
46 RobomonAtlantis(QWidget *parent = 0);
49 bool event(QEvent *event);
50 void keyPressEvent(QKeyEvent *event);
51 void keyReleaseEvent(QKeyEvent *event);
52 void closeEvent(QCloseEvent *event);
55 void motionStatusReceivedSignal();
56 void actualPositionReceivedSignal();
57 void powerVoltageReceivedSignal();
60 void showMap(bool show);
61 void useOpenGL(bool use);
62 void showTrails(bool show);
65 /************************************************************
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);
75 void setSimulation(int state);
76 void setObstacleSimulation(int state);
77 void simulateObstaclesHokuyo();
78 void changeObstacle(QPointF position);
79 void sendStart(int plug);
81 /************************************************************
83 ************************************************************/
84 void motionStatusReceived();
85 void actualPositionReceived();
86 void powerVoltageReceived();
89 /************************************************************
91 ************************************************************/
92 void createLeftLayout();
93 void createRightLayout();
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();
108 void createActions();
110 QVBoxLayout *leftLayout;
111 QVBoxLayout *rightLayout;
113 QGroupBox *playgroundGroupBox;
114 QGroupBox *positionGroupBox;
115 QGroupBox *miscGroupBox;
116 QGroupBox *debugGroupBox;
117 QGroupBox *actuatorsGroupBox;
118 QGroupBox *enginesGroupBox;
119 QGroupBox *powerGroupBox;
120 QGroupBox *fsmGroupBox;
122 PlaygroundScene *playgroundScene;
123 PlaygroundView *playgroundSceneView;
128 QLineEdit *actPosPhi;
132 QLineEdit *estPosPhi;
135 QTextEdit *debugWindow;
136 bool debugWindowEnabled;
139 QSlider *leftMotorSlider;
140 QSlider *rightMotorSlider;
141 QCheckBox *bothMotorsCheckBox;
142 QPushButton *stopMotorsPushButton;
144 /* power management */
145 QCheckBox *voltage33CheckBox;
146 QCheckBox *voltage50CheckBox;
147 QCheckBox *voltage80CheckBox;
148 QLineEdit *voltage33LineEdit;
149 QLineEdit *voltage50LineEdit;
150 QLineEdit *voltage80LineEdit;
151 QLineEdit *voltageBATLineEdit;
154 QCheckBox *obstacleSimulationCheckBox;
155 QLabel *fsm_main_state;
156 QLabel *fsm_act_state;
157 QLabel *fsm_motion_state;
158 QCheckBox *startPlug;
159 QCheckBox *puckInside;
163 Robot *robotEstPosBest;
164 Robot *robotEstPosIndepOdo;
165 Robot *robotEstPosOdo;
168 Trail *trailEstPosBest;
169 Trail *trailPosIndepOdo;
172 HokuyoScan *hokuyoScan;
175 double leftMotorValue;
176 double rightMotorValue;
179 void openSharedMemory();
180 bool sharedMemoryOpened;
183 /* obstacle simulation */
184 double distanceToWallHokuyo(int beamnum);
185 double distanceToObstacleHokuyo(int beamnum, Point obstacle, double obstacleSize);
186 int simulationEnabled;
188 QTimer *obstacleSimulationTimer;
189 Point simulatedObstacle;
191 /************************************************************
193 ************************************************************/
196 struct robottype_orte_data orte;
199 #endif /* ROBOMON_ATLANTIS_H */