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 void showMap(bool show);
66 void showTrails(bool show);
69 /************************************************************
71 ************************************************************/
72 void setVoltage33(int state);
73 void setVoltage50(int state);
74 void setVoltage80(int state);
75 void setLeftMotor(int value);
76 void setRightMotor(int value);
78 void setDO(int state);
80 void setSimulation(int state);
81 void setObstacleSimulation(int state);
82 void simulateObstaclesHokuyo();
83 void changeObstacle(QPointF position);
85 void setBelts(int value);
86 void setChelae(int value);
87 void sendStart(int plug);
88 void sendPuckInside(int value);
90 /************************************************************
92 ************************************************************/
93 void motionStatusReceived();
94 void actualPositionReceived();
95 void estimatedPositionReceived();
97 void accelerometerReceived();
98 void accumulatorReceived();
99 void powerVoltageReceived();
102 /************************************************************
104 ************************************************************/
105 void createLeftLayout();
106 void createRightLayout();
108 void createPlaygroundGroupBox();
109 void createPositionGroupBox();
110 void createMiscGroupBox();
111 void createDebugGroupBox();
112 void createActuatorsGroupBox();
113 void createMotorsGroupBox();
114 void createDIOGroupBox();
115 void createSensorsGroupBox();
116 void createPowerGroupBox();
117 void createPickerGroupBox();
118 void createFSMGroupBox();
121 void createActions();
123 QVBoxLayout *leftLayout;
124 QVBoxLayout *rightLayout;
126 QGroupBox *playgroundGroupBox;
127 QGroupBox *positionGroupBox;
128 QGroupBox *miscGroupBox;
129 QGroupBox *debugGroupBox;
130 QGroupBox *actuatorsGroupBox;
131 QGroupBox *enginesGroupBox;
132 QGroupBox *dioGroupBox;
133 QGroupBox *sensorsGroupBox;
134 QGroupBox *powerGroupBox;
135 QGroupBox *pickerGroupBox;
136 QGroupBox *fsmGroupBox;
138 PlaygroundScene *playgroundScene;
139 QGraphicsView *playgroundSceneView;
144 QLineEdit *actPosPhi;
148 QLineEdit *estPosPhi;
151 QTextEdit *debugWindow;
152 bool debugWindowEnabled;
155 QSlider *leftMotorSlider;
156 QSlider *rightMotorSlider;
157 QCheckBox *bothMotorsCheckBox;
158 QPushButton *stopMotorsPushButton;
160 QCheckBox *leftBeltCheckBox;
161 QCheckBox *rightBeltCheckBox;
162 QCheckBox *leftChelaCheckBox;
163 QCheckBox *rightChelaCheckBox;
166 QDial *rightBeltDial;
167 QDial *leftChelaDial;
168 QDial *rightChelaDial;
169 QPushButton *pickPushButton;
171 /* power management */
172 QCheckBox *voltage33CheckBox;
173 QCheckBox *voltage50CheckBox;
174 QCheckBox *voltage80CheckBox;
175 QLineEdit *voltage33LineEdit;
176 QLineEdit *voltage50LineEdit;
177 QLineEdit *voltage80LineEdit;
178 QLineEdit *voltageBATLineEdit;
180 QCheckBox *diCheckBox[8];
181 QCheckBox *doCheckBox[8];
184 QCheckBox *obstacleSimulationCheckBox;
185 QLabel *fsm_main_state;
186 QLabel *fsm_act_state;
187 QLabel *fsm_motion_state;
188 QCheckBox *startPlug;
189 QCheckBox *puckInside;
193 Robot *robotEstPosUzv;
194 Robot *robotEstPosOdo;
201 double leftMotorValue;
202 double rightMotorValue;
205 void openSharedMemory();
206 bool sharedMemoryOpened;
210 QProgressBar *sharpPuck;
211 QProgressBar *liftPos;
212 QProgressBar *pusherPos;
214 /* obstacle simulation */
215 double distanceToWallHokuyo(int beamnum);
216 double distanceToObstacleHokuyo(int beamnum, Point obstacle, double obstacleSize);
217 int simulationEnabled;
219 QTimer *obstacleSimulationTimer;
220 Point simulatedObstacle;
222 /************************************************************
224 ************************************************************/
227 struct robottype_orte_data orte;
230 #endif /* ROBOMON_ATLANTIS_H */