Fawkes API  Fawkes Development Version
wm_thread.h
00001 
00002 /***************************************************************************
00003  *  wm_thread.h - Fawkes WorldModel Plugin Thread
00004  *
00005  *  Created: Fri Jun 29 11:54:58 2007 (on flight to RoboCup 2007, Atlanta)
00006  *  Copyright  2006-2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __PLUGINS_WORLDMODEL_WM_THREAD_H_
00024 #define __PLUGINS_WORLDMODEL_WM_THREAD_H_
00025 
00026 #include <core/threading/thread.h>
00027 #include <core/utils/lock_list.h>
00028 #include <aspect/blocked_timing.h>
00029 #include <aspect/logging.h>
00030 #include <aspect/configurable.h>
00031 #include <aspect/blackboard.h>
00032 #include <aspect/network.h>
00033 #include <aspect/clock.h>
00034 
00035 namespace fawkes {
00036   class WorldInfoTransceiver;
00037   class ObjectPositionInterface;
00038 }
00039 
00040 class WorldModelNetworkThread;
00041 class WorldModelFuser;
00042 
00043 class WorldModelThread
00044 : public fawkes::Thread,
00045   public fawkes::BlockedTimingAspect,
00046   public fawkes::LoggingAspect,
00047   public fawkes::ConfigurableAspect,
00048   public fawkes::BlackBoardAspect,
00049   public fawkes::ClockAspect,
00050   public fawkes::NetworkAspect
00051 {
00052  public:
00053   WorldModelThread(WorldModelNetworkThread *net_thread);
00054   virtual ~WorldModelThread();
00055 
00056   virtual void init();
00057   virtual void loop();
00058   virtual void finalize();
00059 
00060   void init_failure_cleanup();
00061 
00062  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
00063  protected: virtual void run() { Thread::run(); }
00064 
00065  private:
00066   std::string   __cfg_confspace;
00067 
00068   WorldModelNetworkThread *__net_thread;
00069 
00070   std::list<WorldModelFuser *>           __fusers;
00071   std::list<WorldModelFuser *>::iterator __fit;
00072 
00073   bool __wi_send_enabled;
00074   unsigned int __wi_send_interval;
00075   unsigned int __wi_send_counter;
00076 
00077   fawkes::ObjectPositionInterface* __wi_send_ball;
00078   fawkes::ObjectPositionInterface* __wi_send_pose;
00079 };
00080 
00081 
00082 #endif