Privacy
An open-source, flexible 3D physical simulation framework
main.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2011, 2012 DFKI GmbH Robotics Innovation Center
3
*
4
* This file is part of the MARS simulation framework.
5
*
6
* MARS is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License
8
* as published by the Free Software Foundation, either version 3
9
* of the License, or (at your option) any later version.
10
*
11
* MARS is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with MARS. If not, see <http://www.gnu.org/licenses/>.
18
*
19
*/
20
21
#include "
Viz.h
"
22
#include "
GraphicsTimer.h
"
23
#include "
MyApp.h
"
24
25
#include <signal.h>
26
27
#include <stdexcept>
28
29
void
qtExitHandler
(
int
sig) {
30
qApp->quit();
31
mars::viz::exit_main
(sig);
32
}
33
34
void
ignoreSignal
(
int
sig)
35
{ (void)(sig); }
36
41
int
main
(
int
argc,
char
*argv[]) {
42
43
// Q_INIT_RESOURCE(resources);
44
#ifndef WIN32
45
signal(SIGQUIT,
qtExitHandler
);
46
signal(SIGPIPE,
qtExitHandler
);
47
//signal(SIGKILL, qtExitHandler);
48
signal(SIGUSR1,
ignoreSignal
);
49
#else
50
signal(SIGFPE,
qtExitHandler
);
51
signal(SIGILL,
qtExitHandler
);
52
signal(SIGSEGV,
qtExitHandler
);
53
signal(SIGBREAK,
qtExitHandler
);
54
#endif
55
signal(SIGABRT,
qtExitHandler
);
56
signal(SIGTERM,
qtExitHandler
);
57
signal(SIGINT,
qtExitHandler
);
58
59
60
mars::viz::Viz
*viz =
new
mars::viz::Viz
();
61
62
mars::viz::MyApp
*app =
new
mars::viz::MyApp
(argc, argv);
63
64
viz->
init
();
65
66
mars::viz::GraphicsTimer
*graphicsTimer =
new
mars::viz::GraphicsTimer
(viz->
graphics
);
67
graphicsTimer->
run
();
68
69
if
(argc > 2) {
70
viz->
loadScene
(argv[2], argv[1]);
71
}
72
else
if
(argc > 1) {
73
viz->
loadScene
(argv[1]);
74
}
75
76
int
state;
77
state = app->exec();
78
79
delete
viz;
80
return
state;
81
}
qtExitHandler
void qtExitHandler(int sig)
Definition:
main.cpp:33
mars::viz::GraphicsTimer::run
void run()
Definition:
GraphicsTimer.cpp:37
Viz.h
mars::viz::exit_main
void exit_main(int signal)
Definition:
Viz.cpp:57
mars::viz::GraphicsTimer
Definition:
GraphicsTimer.h:32
mars::viz::Viz::init
void init(bool createWindow=true)
Definition:
Viz.cpp:108
MyApp.h
mars::viz::Viz::graphics
interfaces::GraphicsManagerInterface * graphics
Definition:
Viz.h:85
mars::viz::Viz
Definition:
Viz.h:58
ignoreSignal
void ignoreSignal(int sig)
Definition:
main.cpp:40
GraphicsTimer.h
mars::viz::Viz::loadScene
void loadScene(std::string filename, std::string robotname="")
Definition:
Viz.cpp:185
mars::viz::MyApp
This function provides a clean exit of the simulation in case of a kill-signal.
Definition:
MyApp.h:43
main
int main(int argc, char *argv[])
The main function, that starts the GUI and init the physical environment.
Definition:
main.cpp:48
viz
src
main.cpp
Generated on Fri May 25 2018 11:46:19 by
1.8.13