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
16 #define SIM_OBST_SIZE_M 0.5
21 #include "PlaygroundScene.h"
23 #include <roboorte_robottype.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 estimatedPositionReceivedSignal();
58 void diReceivedSignal();
59 void accelerometerReceivedSignal();
60 void accumulatorReceivedSignal();
61 void powerVoltageReceivedSignal();
64 /************************************************************
66 ************************************************************/
67 void setVoltage33(int state);
68 void setVoltage50(int state);
69 void setVoltage80(int state);
70 void setLeftMotor(int value);
71 void setRightMotor(int value);
73 void setDO(int state);
75 void showPlayground();
77 void setSimulation(int state);
78 void setObstacleSimulation(int state);
79 void simulateObstaclesHokuyo();
80 void changeObstacle(QPointF position);
82 void setBelts(int value);
83 void setChelae(int value);
85 /************************************************************
87 ************************************************************/
88 void motionStatusReceived();
89 void actualPositionReceived();
90 void estimatedPositionReceived();
92 void accelerometerReceived();
93 void accumulatorReceived();
94 void powerVoltageReceived();
97 /************************************************************
99 ************************************************************/
100 void createLeftLayout();
101 void createRightLayout();
103 void createPlaygroundGroupBox();
104 void createPositionGroupBox();
105 void createMiscGroupBox();
106 void createDebugGroupBox();
107 void createActuatorsGroupBox();
108 void createMotorsGroupBox();
109 void createDIOGroupBox();
110 void createSensorsGroupBox();
111 void createPowerGroupBox();
112 void createPickerGroupBox();
113 void createFSMGroupBox();
115 void createSharpSensorsLayout();
118 void createActions();
120 QVBoxLayout *leftLayout;
121 QVBoxLayout *rightLayout;
123 QGroupBox *playgroundGroupBox;
124 QGroupBox *positionGroupBox;
125 QGroupBox *miscGroupBox;
126 QGroupBox *debugGroupBox;
127 QGroupBox *actuatorsGroupBox;
128 QGroupBox *enginesGroupBox;
129 QGroupBox *dioGroupBox;
130 QGroupBox *sensorsGroupBox;
131 QGroupBox *powerGroupBox;
132 QGroupBox *pickerGroupBox;
133 QGroupBox *fsmGroupBox;
135 PlaygroundScene *playgroundScene;
136 QGraphicsView *playgroundSceneView;
141 QLineEdit *actPosPhi;
145 QLineEdit *estPosPhi;
148 QTextEdit *debugWindow;
149 bool debugWindowEnabled;
152 QSlider *leftMotorSlider;
153 QSlider *rightMotorSlider;
154 QCheckBox *bothMotorsCheckBox;
155 QPushButton *stopMotorsPushButton;
157 QCheckBox *leftBeltCheckBox;
158 QCheckBox *rightBeltCheckBox;
159 QCheckBox *leftChelaCheckBox;
160 QCheckBox *rightChelaCheckBox;
163 QDial *rightBeltDial;
164 QDial *leftChelaDial;
165 QDial *rightChelaDial;
166 QPushButton *pickPushButton;
168 /* power management */
169 QCheckBox *voltage33CheckBox;
170 QCheckBox *voltage50CheckBox;
171 QCheckBox *voltage80CheckBox;
172 QLineEdit *voltage33LineEdit;
173 QLineEdit *voltage50LineEdit;
174 QLineEdit *voltage80LineEdit;
175 QLineEdit *voltageBATLineEdit;
177 QCheckBox *diCheckBox[8];
178 QCheckBox *doCheckBox[8];
181 QCheckBox *obstacleSimulationCheckBox;
182 QCheckBox *showMapPushButton;
183 QLabel *fsm_main_state;
184 QLabel *fsm_act_state;
185 QLabel *fsm_motion_state;
192 double leftMotorValue;
193 double rightMotorValue;
196 void openSharedMemory();
197 bool sharedMemoryOpened;
201 QProgressBar *sharpPuck;
203 /* obstacle simulation */
204 double distanceToWallHokuyo(int beamnum);
205 double distanceToObstacleHokuyo(int beamnum, Point obstacle, double obstacleSize);
206 int simulationEnabled;
208 QTimer *obstacleSimulationTimer;
209 Point simulatedObstacle;
211 /************************************************************
213 ************************************************************/
216 struct robottype_orte_data orte;
219 #endif /* ROBOMON_ATLANTIS_H */