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 void showMap(bool show);
65 void showTrails(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);
77 void setDO(int state);
79 void setSimulation(int state);
80 void setObstacleSimulation(int state);
81 void simulateObstaclesHokuyo();
82 void changeObstacle(QPointF position);
84 void setBelts(int value);
85 void setChelae(int value);
86 void sendStart(int plug);
87 void sendPuckInside(int value);
89 /************************************************************
91 ************************************************************/
92 void motionStatusReceived();
93 void actualPositionReceived();
94 void estimatedPositionReceived();
96 void accelerometerReceived();
97 void accumulatorReceived();
98 void powerVoltageReceived();
101 /************************************************************
103 ************************************************************/
104 void createLeftLayout();
105 void createRightLayout();
107 void createPlaygroundGroupBox();
108 void createPositionGroupBox();
109 void createMiscGroupBox();
110 void createDebugGroupBox();
111 void createActuatorsGroupBox();
112 void createMotorsGroupBox();
113 void createDIOGroupBox();
114 void createSensorsGroupBox();
115 void createPowerGroupBox();
116 void createPickerGroupBox();
117 void createFSMGroupBox();
120 void createActions();
122 QVBoxLayout *leftLayout;
123 QVBoxLayout *rightLayout;
125 QGroupBox *playgroundGroupBox;
126 QGroupBox *positionGroupBox;
127 QGroupBox *miscGroupBox;
128 QGroupBox *debugGroupBox;
129 QGroupBox *actuatorsGroupBox;
130 QGroupBox *enginesGroupBox;
131 QGroupBox *dioGroupBox;
132 QGroupBox *sensorsGroupBox;
133 QGroupBox *powerGroupBox;
134 QGroupBox *pickerGroupBox;
135 QGroupBox *fsmGroupBox;
137 PlaygroundScene *playgroundScene;
138 QGraphicsView *playgroundSceneView;
143 QLineEdit *actPosPhi;
147 QLineEdit *estPosPhi;
150 QTextEdit *debugWindow;
151 bool debugWindowEnabled;
154 QSlider *leftMotorSlider;
155 QSlider *rightMotorSlider;
156 QCheckBox *bothMotorsCheckBox;
157 QPushButton *stopMotorsPushButton;
159 QCheckBox *leftBeltCheckBox;
160 QCheckBox *rightBeltCheckBox;
161 QCheckBox *leftChelaCheckBox;
162 QCheckBox *rightChelaCheckBox;
165 QDial *rightBeltDial;
166 QDial *leftChelaDial;
167 QDial *rightChelaDial;
168 QPushButton *pickPushButton;
170 /* power management */
171 QCheckBox *voltage33CheckBox;
172 QCheckBox *voltage50CheckBox;
173 QCheckBox *voltage80CheckBox;
174 QLineEdit *voltage33LineEdit;
175 QLineEdit *voltage50LineEdit;
176 QLineEdit *voltage80LineEdit;
177 QLineEdit *voltageBATLineEdit;
179 QCheckBox *diCheckBox[8];
180 QCheckBox *doCheckBox[8];
183 QCheckBox *obstacleSimulationCheckBox;
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 */