forked from NUbots/robocup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNUbot.h
126 lines (100 loc) · 3.38 KB
/
NUbot.h
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*! @file NUbot.h
@brief Declaration of top-level NUbot class.
@mainpage
The NUbot's RoboCup code doxygen documentation. This software makes robots (NAO, NAOWebots and Cycloid)
autonomously play soccer.
@author Jason Kulk
Copyright (c) 2009 Jason Kulk
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NUBOT_H
#define NUBOT_H
#include "targetconfig.h"
#include "nubotconfig.h"
class NUBlackboard;
class NUPlatform;
class NUIO;
#ifdef USE_VISION
class Vision;
#endif
#ifdef USE_LOCALISATION
class Localisation;
#endif
#ifdef USE_BEHAVIOUR
class Behaviour;
#endif
#ifdef USE_MOTION
class NUMotion;
#endif
#if defined(USE_VISION) or defined(USE_LOCALISATION) or defined(USE_BEHAVIOUR) or defined(USE_MOTION)
class SeeThinkThread;
#endif
class SenseMoveThread;
class WatchDogThread;
#include <exception>
/*! @brief The top-level class
*/
class NUbot
{
public:
NUbot(int argc, const char *argv[]);
~NUbot();
void run();
#ifdef USE_LOCALISATION
const Localisation* GetLocWm(){return m_localisation;};
#endif
private:
void createErrorHandling();
void createPlatform(int argc, const char *argv[]);
void destroyPlatform();
void createBlackboard();
void destroyBlackboard();
void createNetwork();
void destroyNetwork();
void createModules();
void destroyModules();
void createThreads();
void destroyThreads();
void periodicSleep(int period);
static void terminationHandler(int signum);
void unhandledExceptionHandler(std::exception& e);
private:
static NUbot* m_this; //!< a pointer to the last instance of a NUbot
NUPlatform* m_platform; //!< interface to robot platform
NUBlackboard* m_blackboard; //!< a pointer to the public store
#ifdef USE_VISION
Vision* m_vision; //!< vision module
#endif
#ifdef USE_LOCALISATION
Localisation* m_localisation; //!< localisation module
#endif
#ifdef USE_BEHAVIOUR
Behaviour* m_behaviour; //!< behaviour module
#endif
#ifdef USE_MOTION
NUMotion* m_motion; //!< motion module
#endif
NUIO* m_io; //!< io module
public: //! @todo TODO: this door should be closed. It is open atm because I need the sensemove_thread to connect to the serial comms of the bear.
friend class SeeThinkThread;
#if defined(USE_VISION) or defined(USE_LOCALISATION)
SeeThinkThread* m_seethink_thread;
#endif
friend class SenseMoveThread;
SenseMoveThread* m_sensemove_thread;
#if defined(TARGET_IS_NAO)
friend class NUNAO;
#endif
friend class WatchDogThread;
WatchDogThread* m_watchdog_thread;
};
#endif