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);
84 void sendStart(int plug);
86 /************************************************************
88 ************************************************************/
89 void motionStatusReceived();
90 void actualPositionReceived();
91 void estimatedPositionReceived();
93 void accelerometerReceived();
94 void accumulatorReceived();
95 void powerVoltageReceived();
98 /************************************************************
100 ************************************************************/
101 void createLeftLayout();
102 void createRightLayout();
104 void createPlaygroundGroupBox();
105 void createPositionGroupBox();
106 void createMiscGroupBox();
107 void createDebugGroupBox();
108 void createActuatorsGroupBox();
109 void createMotorsGroupBox();
110 void createDIOGroupBox();
111 void createSensorsGroupBox();
112 void createPowerGroupBox();
113 void createPickerGroupBox();
114 void createFSMGroupBox();
117 void createActions();
119 QVBoxLayout *leftLayout;
120 QVBoxLayout *rightLayout;
122 QGroupBox *playgroundGroupBox;
123 QGroupBox *positionGroupBox;
124 QGroupBox *miscGroupBox;
125 QGroupBox *debugGroupBox;
126 QGroupBox *actuatorsGroupBox;
127 QGroupBox *enginesGroupBox;
128 QGroupBox *dioGroupBox;
129 QGroupBox *sensorsGroupBox;
130 QGroupBox *powerGroupBox;
131 QGroupBox *pickerGroupBox;
132 QGroupBox *fsmGroupBox;
134 PlaygroundScene *playgroundScene;
135 QGraphicsView *playgroundSceneView;
140 QLineEdit *actPosPhi;
144 QLineEdit *estPosPhi;
147 QTextEdit *debugWindow;
148 bool debugWindowEnabled;
151 QSlider *leftMotorSlider;
152 QSlider *rightMotorSlider;
153 QCheckBox *bothMotorsCheckBox;
154 QPushButton *stopMotorsPushButton;
156 QCheckBox *leftBeltCheckBox;
157 QCheckBox *rightBeltCheckBox;
158 QCheckBox *leftChelaCheckBox;
159 QCheckBox *rightChelaCheckBox;
162 QDial *rightBeltDial;
163 QDial *leftChelaDial;
164 QDial *rightChelaDial;
165 QPushButton *pickPushButton;
167 /* power management */
168 QCheckBox *voltage33CheckBox;
169 QCheckBox *voltage50CheckBox;
170 QCheckBox *voltage80CheckBox;
171 QLineEdit *voltage33LineEdit;
172 QLineEdit *voltage50LineEdit;
173 QLineEdit *voltage80LineEdit;
174 QLineEdit *voltageBATLineEdit;
176 QCheckBox *diCheckBox[8];
177 QCheckBox *doCheckBox[8];
180 QCheckBox *obstacleSimulationCheckBox;
181 QCheckBox *showMapPushButton;
182 QLabel *fsm_main_state;
183 QLabel *fsm_act_state;
184 QLabel *fsm_motion_state;
185 QCheckBox *startPlug;
192 double leftMotorValue;
193 double rightMotorValue;
196 void openSharedMemory();
197 bool sharedMemoryOpened;
201 QProgressBar *sharpPuck;
202 QProgressBar *liftPos;
203 QProgressBar *pusherPos;
205 /* obstacle simulation */
206 double distanceToWallHokuyo(int beamnum);
207 double distanceToObstacleHokuyo(int beamnum, Point obstacle, double obstacleSize);
208 int simulationEnabled;
210 QTimer *obstacleSimulationTimer;
211 Point simulatedObstacle;
213 /************************************************************
215 ************************************************************/
218 struct robottype_orte_data orte;
221 #endif /* ROBOMON_ATLANTIS_H */