Fawkes API  Fawkes Development Version
wm_thread.h
1 
2 /***************************************************************************
3  * wm_thread.h - Fawkes WorldModel Plugin Thread
4  *
5  * Created: Fri Jun 29 11:54:58 2007 (on flight to RoboCup 2007, Atlanta)
6  * Copyright 2006-2007 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __PLUGINS_WORLDMODEL_WM_THREAD_H_
24 #define __PLUGINS_WORLDMODEL_WM_THREAD_H_
25 
26 #include <core/threading/thread.h>
27 #include <core/utils/lock_list.h>
28 #include <aspect/blocked_timing.h>
29 #include <aspect/logging.h>
30 #include <aspect/configurable.h>
31 #include <aspect/blackboard.h>
32 #include <aspect/network.h>
33 #include <aspect/clock.h>
34 
35 namespace fawkes {
36  class WorldInfoTransceiver;
37  class ObjectPositionInterface;
38 }
39 
41 class WorldModelFuser;
42 
44 : public fawkes::Thread,
46  public fawkes::LoggingAspect,
49  public fawkes::ClockAspect,
51 {
52  public:
54  virtual ~WorldModelThread();
55 
56  virtual void init();
57  virtual void loop();
58  virtual void finalize();
59 
60  void init_failure_cleanup();
61 
62  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
63  protected: virtual void run() { Thread::run(); }
64 
65  private:
66  std::string __cfg_confspace;
67 
68  WorldModelNetworkThread *__net_thread;
69 
70  std::list<WorldModelFuser *> __fusers;
71  std::list<WorldModelFuser *>::iterator __fit;
72 
73  bool __wi_send_enabled;
74  unsigned int __wi_send_interval;
75  unsigned int __wi_send_counter;
76 
77  fawkes::ObjectPositionInterface* __wi_send_ball;
78  fawkes::ObjectPositionInterface* __wi_send_pose;
79 };
80 
81 
82 #endif
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:36
void init_failure_cleanup()
Clean up when init failed.
Definition: wm_thread.cpp:195
ObjectPositionInterface Fawkes BlackBoard Interface.
Fawkes library namespace.
virtual void loop()
Code to execute in the thread.
Definition: wm_thread.cpp:220
virtual void finalize()
Finalize the thread.
Definition: wm_thread.cpp:201
virtual ~WorldModelThread()
Destructor.
Definition: wm_thread.cpp:74
Thread aspect for network communication.
Definition: network.h:37
Thread class encapsulation of pthreads.
Definition: thread.h:42
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: wm_thread.h:63
Thread aspect to use blocked timing.
Main thread of worldmodel plugin.
Definition: wm_thread.h:43
WorldModelThread(WorldModelNetworkThread *net_thread)
Constructor.
Definition: wm_thread.cpp:54
virtual void init()
Initialize the thread.
Definition: wm_thread.cpp:79
Thread aspect to log output.
Definition: logging.h:35
Thread aspect to access configuration data.
Definition: configurable.h:35
Network thread of worldmodel plugin.
Definition: net_thread.h:45
Interface for data fusers for the world model.
Definition: fuser.h:26