Fawkes API  Fawkes Development Version
execution_thread.h
1 /***************************************************************************
2  * execution_thread.h - Execution thread for Golog++
3  *
4  * Created: Mon 26 Aug 2019 CEST 15:38
5  * Copyright 2019 Victor MatarĂ© <matare@fh-aachen.de>
6  ****************************************************************************/
7 
8 /* This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Library General Public License for more details.
17  *
18  * Read the full text in the LICENSE.GPL file in the doc directory.
19  */
20 
21 #ifndef FAWKES_GOLOGPP_THREAD_H_
22 #define FAWKES_GOLOGPP_THREAD_H_
23 
24 #include <aspect/blackboard.h>
25 #include <aspect/configurable.h>
26 #include <aspect/logging.h>
27 #include <blackboard/interface_listener.h>
28 #include <core/threading/thread.h>
29 #include <golog++/model/execution.h>
30 
31 #include <filesystem>
32 #include <string>
33 
34 namespace fawkes {
35 class SkillerInterface;
36 }
37 
38 namespace fawkes {
39 namespace gpp {
40 
41 class ExogManager;
42 
43 class GologppThread : public Thread,
44  public LoggingAspect,
45  public BlackBoardAspect,
46  public ConfigurableAspect
47 {
48 public:
49  GologppThread();
50 
51  virtual void init() override;
52  virtual void once() override;
53 
54  virtual bool prepare_finalize_user() override;
55 
56  virtual void finalize() override;
57 
58  gologpp::ExecutionContext &gologpp_context();
59 
60 private:
61  std::filesystem::path find_prog_file(const std::filesystem::path &spec) const;
62  std::unique_ptr<gologpp::Instruction> main_prog_;
63  SkillerInterface * skiller_if_;
64  ExogManager * exog_mgr_;
65  std::mutex run_mutex_;
66 };
67 
68 } // namespace gpp
69 } // namespace fawkes
70 
71 #endif
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to access configuration data.
Definition: configurable.h:33
Thread aspect to log output.
Definition: logging.h:33
SkillerInterface Fawkes BlackBoard Interface.
Thread class encapsulation of pthreads.
Definition: thread.h:46
Watch/observe blackboard interfaces according to the mappings specified for exogenous actions in the ...
Definition: exog_manager.h:51
Main golog++ thread that handles program execution, i.e.
gologpp::ExecutionContext & gologpp_context()
GologppThread::gologpp_context.
virtual void once() override
Execute an action exactly once.
virtual bool prepare_finalize_user() override
Prepare finalization user implementation.
virtual void init() override
Initialize the thread.
virtual void finalize() override
Finalize the thread.
Fawkes library namespace.