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>
42 class RobomonAtlantis : public QWidget
47 RobomonAtlantis(QWidget *parent = 0);
50 bool event(QEvent *event);
51 void keyPressEvent(QKeyEvent *event);
52 void keyReleaseEvent(QKeyEvent *event);
53 void closeEvent(QCloseEvent *event);
56 void motionStatusReceivedSignal();
57 void actualPositionReceivedSignal();
58 void estimatedPositionReceivedSignal();
59 void diReceivedSignal();
60 void accelerometerReceivedSignal();
61 void accumulatorReceivedSignal();
62 void powerVoltageReceivedSignal();
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);
74 void setDO(int state);
76 void showPlayground();
78 void setSimulation(int state);
79 void setObstacleSimulation(int state);
80 void simulateObstaclesHokuyo();
81 void changeObstacle(QPointF position);
83 void setBelts(int value);
84 void setChelae(int value);
85 void sendStart(int plug);
86 void sendPuckInside(int value);
88 /************************************************************
90 ************************************************************/
91 void motionStatusReceived();
92 void actualPositionReceived();
93 void estimatedPositionReceived();
95 void accelerometerReceived();
96 void accumulatorReceived();
97 void powerVoltageReceived();
100 /************************************************************
102 ************************************************************/
103 void createLeftLayout();
104 void createRightLayout();
106 void createPlaygroundGroupBox();
107 void createPositionGroupBox();
108 void createMiscGroupBox();
109 void createDebugGroupBox();
110 void createActuatorsGroupBox();
111 void createMotorsGroupBox();
112 void createDIOGroupBox();
113 void createSensorsGroupBox();
114 void createPowerGroupBox();
115 void createPickerGroupBox();
116 void createFSMGroupBox();
119 void createActions();
121 QVBoxLayout *leftLayout;
122 QVBoxLayout *rightLayout;
124 QGroupBox *playgroundGroupBox;
125 QGroupBox *positionGroupBox;
126 QGroupBox *miscGroupBox;
127 QGroupBox *debugGroupBox;
128 QGroupBox *actuatorsGroupBox;
129 QGroupBox *enginesGroupBox;
130 QGroupBox *dioGroupBox;
131 QGroupBox *sensorsGroupBox;
132 QGroupBox *powerGroupBox;
133 QGroupBox *pickerGroupBox;
134 QGroupBox *fsmGroupBox;
136 PlaygroundScene *playgroundScene;
137 QGraphicsView *playgroundSceneView;
142 QLineEdit *actPosPhi;
146 QLineEdit *estPosPhi;
149 QTextEdit *debugWindow;
150 bool debugWindowEnabled;
153 QSlider *leftMotorSlider;
154 QSlider *rightMotorSlider;
155 QCheckBox *bothMotorsCheckBox;
156 QPushButton *stopMotorsPushButton;
158 QCheckBox *leftBeltCheckBox;
159 QCheckBox *rightBeltCheckBox;
160 QCheckBox *leftChelaCheckBox;
161 QCheckBox *rightChelaCheckBox;
164 QDial *rightBeltDial;
165 QDial *leftChelaDial;
166 QDial *rightChelaDial;
167 QPushButton *pickPushButton;
169 /* power management */
170 QCheckBox *voltage33CheckBox;
171 QCheckBox *voltage50CheckBox;
172 QCheckBox *voltage80CheckBox;
173 QLineEdit *voltage33LineEdit;
174 QLineEdit *voltage50LineEdit;
175 QLineEdit *voltage80LineEdit;
176 QLineEdit *voltageBATLineEdit;
178 QCheckBox *diCheckBox[8];
179 QCheckBox *doCheckBox[8];
182 QCheckBox *obstacleSimulationCheckBox;
183 QCheckBox *showMapPushButton;
184 QLabel *fsm_main_state;
185 QLabel *fsm_act_state;
186 QLabel *fsm_motion_state;
187 QCheckBox *startPlug;
188 QCheckBox *puckInside;
192 Robot *robotEstPosUzv;
193 Robot *robotEstPosOdo;
200 double leftMotorValue;
201 double rightMotorValue;
204 void openSharedMemory();
205 bool sharedMemoryOpened;
209 QProgressBar *sharpPuck;
210 QProgressBar *liftPos;
211 QProgressBar *pusherPos;
213 /* obstacle simulation */
214 double distanceToWallHokuyo(int beamnum);
215 double distanceToObstacleHokuyo(int beamnum, Point obstacle, double obstacleSize);
216 int simulationEnabled;
218 QTimer *obstacleSimulationTimer;
219 Point simulatedObstacle;
221 /************************************************************
223 ************************************************************/
226 struct robottype_orte_data orte;
229 #endif /* ROBOMON_ATLANTIS_H */