Fawkes API  Fawkes Development Version
pddl_robot_memory_thread.h
1 
2 /***************************************************************************
3  * pddl_robot_memory_thread.h - pddl_robot_memory
4  *
5  * Plugin created: Thu Oct 13 13:34:05 2016
6 
7  * Copyright 2016 Frederik Zwilling
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL file in the doc directory.
22  */
23 
24 #ifndef _PLUGINS_PDDL_ROBOT_MEMORYTHREAD_H_
25 #define _PLUGINS_PDDL_ROBOT_MEMORYTHREAD_H_
26 
27 #include "interfaces/PddlGenInterface.h"
28 
29 #include <aspect/blackboard.h>
30 #include <aspect/configurable.h>
31 #include <aspect/logging.h>
32 #include <blackboard/interface_listener.h>
33 #include <core/threading/thread.h>
34 #include <ctemplate/template.h>
35 #include <plugins/robot-memory/aspect/robot_memory_aspect.h>
36 
37 #include <string>
38 
39 namespace fawkes {
40 }
41 
43  public fawkes::LoggingAspect,
48 {
49 public:
51 
52  virtual void init();
53  virtual void finalize();
54  virtual void loop();
55 
56  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
57 protected:
58  virtual void
59  run()
60  {
61  Thread::run();
62  }
63 
64 private:
65  fawkes::PddlGenInterface *gen_if;
66 
67  std::string collection;
68  std::string input_path;
69  std::string output_path;
70  std::string goal;
71 
72  void fill_dict_from_document(ctemplate::TemplateDictionary *dict,
73  mongo::BSONObj obj,
74  std::string prefix = "");
75  void generate();
76 
77  virtual bool bb_interface_message_received(fawkes::Interface *interface,
78  fawkes::Message * message) throw();
79 };
80 
81 #endif
Thread aspect to get access to a the RobotMemory.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:33
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:41
virtual void init()
Initialize the thread.
Fawkes library namespace.
Thread class encapsulation of pthreads.
Definition: thread.h:45
virtual void finalize()
Finalize the thread.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:78
virtual void loop()
Thread is only waked up if there is a new interface message to generate a pddl.
virtual void run()
Stub to see name in backtrace for easier debugging.
Thread aspect to log output.
Definition: logging.h:32
Thread aspect to access configuration data.
Definition: configurable.h:32
Generate PDDL files from the robot memory.
BlackBoard interface listener.