This repository has been archived by the owner on Sep 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
NUbot.h
162 lines (120 loc) · 4.71 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*! @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/>.
@page useful_links Useful Links
@section RoboCup
<a href="http://www.tzi.de/spl/pub/Website/Downloads/GameController2011.zip">Game Controller (Direct Download Link)</a>
The game controller can be used to control the robots states. It also keeps track of the game statistics.
<a href="https://github.com/nubots/robocup">Source Repository</a>
The NUbout source control used is Git and is hosted online at github.com
<a href="http://www.tzi.de/spl/bin/view/Website/WebHome">Standard Plaform League (SPL) Website</a>
The official website for the RoboCup SPL.
<a href="http://www.tzi.de/humanoid/bin/view/Website/WebHome">Humanoid Legaue Website</a>
The official website for the RoboCup Humanoid League.
@section Darwin
<a href="http://darwin-op.springnote.com/">Darwin Documentation</a>
The online documentation page on the Darwin robot.
<a href="http://sourceforge.net/projects/darwinop/">Darwin Source Code</a>
The sourceforge project page for the Darwin-op code.
@section NAO
<a href="http://www.aldebaran-robotics.com/documentation/index.html">NAO Documentation</a>
Documentation for the NAO robot. (May require login)
*/
#ifndef NUBOT_H
#define NUBOT_H
#include "targetconfig.h"
#include "nubotconfig.h"
#include "NUPlatform/NUAPI.h"
class NUBlackboard;
class NUPlatform;
class NUIO;
#ifdef USE_VISION
class VisionControlWrapper;
#endif
#ifdef USE_LOCALISATION
class SelfLocalisation;
#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 SelfLocalisation* 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
VisionControlWrapper* m_vision; //!< vision module
#endif
#ifdef USE_LOCALISATION
SelfLocalisation* 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
NUAPI* m_api; //!< new api module (replaces m_io)
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