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();
116 void createActions();
118 QVBoxLayout *leftLayout;
119 QVBoxLayout *rightLayout;
121 QGroupBox *playgroundGroupBox;
122 QGroupBox *positionGroupBox;
123 QGroupBox *miscGroupBox;
124 QGroupBox *debugGroupBox;
125 QGroupBox *actuatorsGroupBox;
126 QGroupBox *enginesGroupBox;
127 QGroupBox *dioGroupBox;
128 QGroupBox *sensorsGroupBox;
129 QGroupBox *powerGroupBox;
130 QGroupBox *pickerGroupBox;
131 QGroupBox *fsmGroupBox;
133 PlaygroundScene *playgroundScene;
134 QGraphicsView *playgroundSceneView;
139 QLineEdit *actPosPhi;
143 QLineEdit *estPosPhi;
146 QTextEdit *debugWindow;
147 bool debugWindowEnabled;
150 QSlider *leftMotorSlider;
151 QSlider *rightMotorSlider;
152 QCheckBox *bothMotorsCheckBox;
153 QPushButton *stopMotorsPushButton;
155 QCheckBox *leftBeltCheckBox;
156 QCheckBox *rightBeltCheckBox;
157 QCheckBox *leftChelaCheckBox;
158 QCheckBox *rightChelaCheckBox;
161 QDial *rightBeltDial;
162 QDial *leftChelaDial;
163 QDial *rightChelaDial;
164 QPushButton *pickPushButton;
166 /* power management */
167 QCheckBox *voltage33CheckBox;
168 QCheckBox *voltage50CheckBox;
169 QCheckBox *voltage80CheckBox;
170 QLineEdit *voltage33LineEdit;
171 QLineEdit *voltage50LineEdit;
172 QLineEdit *voltage80LineEdit;
173 QLineEdit *voltageBATLineEdit;
175 QCheckBox *diCheckBox[8];
176 QCheckBox *doCheckBox[8];
179 QCheckBox *obstacleSimulationCheckBox;
180 QCheckBox *showMapPushButton;
181 QLabel *fsm_main_state;
182 QLabel *fsm_act_state;
183 QLabel *fsm_motion_state;
190 double leftMotorValue;
191 double rightMotorValue;
194 void openSharedMemory();
195 bool sharedMemoryOpened;
199 QProgressBar *sharpPuck;
200 QProgressBar *liftPos;
201 QProgressBar *pusherPos;
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 */