forked from mllofriu/robobulls2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
64 lines (53 loc) · 1.66 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//#include <QCoreApplication>
#include <QApplication>
#include <stdio.h>
#include <csignal>
#include "communication/refcomm.h"
#include "communication/visioncomm.h"
#include "communication/robcomm.h"
#include "communication/simrobcomm.h"
#include "model/gamemodel.h"
#include "model/robot.h"
#include "include/messages_robocup_ssl_detection.pb.h"
#include "include/messages_robocup_ssl_geometry.pb.h"
#include "include/messages_robocup_ssl_wrapper.pb.h"
#include "include/robocup_ssl_client.h"
#include "behavior/behavior.h"
//#include "gui/mainwindow.h"
#include "gui/guiinterface.h"
using namespace std;
void exitStopRobot(int param)
{
UNUSED_PARAM(param);
GameModel* gm = GameModel::getModel();
RobComm* rc = RobComm::getRobComm();
for(Robot* rob : gm->getMyTeam()) {
rob->setL(0);
rob->setR(0);
}
rc->sendVelsLarge(gm->getMyTeam());
exit(1);
}
// RefComm Test
int main(int argc, char *argv[])
{
StrategyController *sc = new StrategyController();
GameModel * myGameModel = GameModel::getModel();
sc->setGameModel(myGameModel);
myGameModel->setStrategyController(sc);
// QCoreApplication a(argc, argv);
QApplication a(argc, argv);
// MainWindow * w = MainWindow::getMainWindow();
// w->show();
GuiInterface * gui = GuiInterface::getGuiInterface();
gui->show();
RefComm refCommunicator(myGameModel);
VisionComm visionCommunicator(myGameModel);
std::signal(SIGSEGV, exitStopRobot);
std::signal(SIGABRT, exitStopRobot);
std::signal(SIGTERM, exitStopRobot);
std::signal(SIGHUP, exitStopRobot);
visionCommunicator.start();
refCommunicator.start();
return a.exec();
}