Fawkes API  Fawkes Development Version
periodic_exec_thread.h
1 
2 /***************************************************************************
3  * periodic_exec_thread.h - Fawkes LuaAgent: Periodic Execution Thread
4  *
5  * Created: Thu Jan 01 11:12:13 2009
6  * Copyright 2006-2011 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_LUAAGENT_PERIODIC_EXEC_THREAD_H_
24 #define _PLUGINS_LUAAGENT_PERIODIC_EXEC_THREAD_H_
25 
26 #include <aspect/blackboard.h>
27 #include <aspect/blocked_timing.h>
28 #include <aspect/clock.h>
29 #include <aspect/configurable.h>
30 #include <aspect/logging.h>
31 #include <core/threading/thread.h>
32 #ifdef HAVE_TF
33 # include <aspect/tf.h>
34 #endif
35 #include <blackboard/interface_listener.h>
36 #include <utils/system/fam.h>
37 
38 #include <cstdlib>
39 #include <string>
40 
41 namespace fawkes {
42 class ComponentLogger;
43 class Mutex;
44 class LuaContext;
45 class LuaInterfaceImporter;
46 class Interface;
47 class SkillerInterface;
48 class SkillerDebugInterface;
49 } // namespace fawkes
50 
53  public fawkes::LoggingAspect,
56 #ifdef HAVE_TF
58 #endif
59  public fawkes::ClockAspect
60 {
61 public:
64 
65  virtual void init();
66  virtual void loop();
67  virtual void finalize();
68 
69  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
70 protected:
71  virtual void
72  run()
73  {
74  Thread::run();
75  }
76 
77 private: /* methods */
78  void init_failure_cleanup();
79  void process_agdbg_messages();
80 
81 private: /* members */
83 
84  // config values
85  std::string cfg_agent_;
86  bool cfg_watch_files_;
87 
88  fawkes::SkillerInterface * skiller_if_;
90 
91  fawkes::LuaContext * lua_;
93 };
94 
95 #endif
LuaAgentPeriodicExecutionThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: periodic_exec_thread.h:72
fawkes::LuaContext
Lua C++ wrapper.
Definition: context.h:44
fawkes::ComponentLogger
Component logger.
Definition: component.h:36
fawkes::LuaInterfaceImporter
Lua interface importer.
Definition: interface_importer.h:42
LuaAgentPeriodicExecutionThread::init
virtual void init()
Initialize the thread.
Definition: periodic_exec_thread.cpp:91
LuaAgentPeriodicExecutionThread::LuaAgentPeriodicExecutionThread
LuaAgentPeriodicExecutionThread()
Constructor.
Definition: periodic_exec_thread.cpp:51
fawkes::BlockedTimingAspect
Thread aspect to use blocked timing.
Definition: blocked_timing.h:51
LuaAgentPeriodicExecutionThread::loop
virtual void loop()
Code to execute in the thread.
Definition: periodic_exec_thread.cpp:220
LuaAgentPeriodicExecutionThread::~LuaAgentPeriodicExecutionThread
virtual ~LuaAgentPeriodicExecutionThread()
Destructor.
Definition: periodic_exec_thread.cpp:59
fawkes::BlackBoardAspect
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
fawkes
Fawkes library namespace.
fawkes::LoggingAspect
Thread aspect to log output.
Definition: logging.h:33
fawkes::SkillerDebugInterface
SkillerDebugInterface Fawkes BlackBoard Interface.
Definition: SkillerDebugInterface.h:34
fawkes::TransformAspect
Thread aspect to access the transform system.
Definition: tf.h:39
LuaAgentPeriodicExecutionThread::finalize
virtual void finalize()
Finalize the thread.
Definition: periodic_exec_thread.cpp:168
LuaAgentPeriodicExecutionThread
LuaAgent Periodic Execution Thread.
Definition: periodic_exec_thread.h:60
fawkes::SkillerInterface
SkillerInterface Fawkes BlackBoard Interface.
Definition: SkillerInterface.h:34
fawkes::Thread
Thread class encapsulation of pthreads.
Definition: thread.h:46
fawkes::ConfigurableAspect
Thread aspect to access configuration data.
Definition: configurable.h:33
fawkes::ClockAspect
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34