Fawkes API  Fawkes Development Version
exec_thread.h
1 /***************************************************************************
2  * exec_thread.h - Simulate skill execution
3  *
4  * Created: Mon 06 May 2019 08:53:11 CEST 08:53
5  * Copyright 2019 Till Hofmann <hofmann@kbsg.rwth-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 _PLUGINS_SKILLER_SIMULATOR_EXEC_THREAD_H_
22 #define _PLUGINS_SKILLER_SIMULATOR_EXEC_THREAD_H_
23 
24 #include <aspect/blackboard.h>
25 #include <aspect/blocked_timing.h>
26 #include <aspect/clock.h>
27 #include <aspect/configurable.h>
28 #include <aspect/logging.h>
29 #include <core/threading/thread.h>
30 #include <execution_time_estimator/aspect/execution_time_estimator.h>
31 #include <interfaces/SkillerInterface.h>
32 #include <plugins/skiller/skiller_feature.h>
33 
36  public fawkes::LoggingAspect,
40 {
41 public:
43  virtual void init();
44  virtual void loop();
45  virtual void finalize();
46 
47 protected:
48  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
49  virtual void
50  run()
51  {
52  Thread::run();
53  }
54 
55 private:
56  float get_skill_runtime(const std::string &skill) const;
57  std::pair<fawkes::SkillerInterface::SkillStatusEnum, std::string>
58  execute_skill(const std::string &skill);
59  fawkes::SkillerInterface *skiller_if_;
60  float current_skill_runtime_;
61  fawkes::Time skill_starttime_;
62 };
63 
64 #endif /* !_PLUGINS_SKILLER_SIMULATOR_EXEC_THREAD_H_ */
Simulated Skill Execution Thread.
Definition: exec_thread.h:40
virtual void finalize()
Finalize the thread.
virtual void init()
Initialize the thread.
Definition: exec_thread.cpp:42
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: exec_thread.h:50
SkillerSimulatorExecutionThread()
Constructor.
Definition: exec_thread.cpp:35
virtual void loop()
Code to execute in the thread.
Definition: exec_thread.cpp:49
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to use blocked timing.
Thread aspect to access configuration data.
Definition: configurable.h:33
An aspect to give access to the execution time estimator manager.
Thread aspect to log output.
Definition: logging.h:33
SkillerInterface Fawkes BlackBoard Interface.
Thread class encapsulation of pthreads.
Definition: thread.h:46
A class for handling time.
Definition: time.h:93