Fawkes API  Fawkes Development Version
robot_memory_thread.h
1 
2 /***************************************************************************
3  * robot_memory_thread.h - Robot Memory thread
4  *
5  * Created: Sun May 01 13:39:52 2016
6  * Copyright 2016 Frederik Zwilling
7  * 2017 Tim Niemueller [www.niemueller.de]
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_ROBOT_MEMORY_THREAD_H_
24 #define _PLUGINS_ROBOT_MEMORY_THREAD_H_
25 
26 #include "aspect/robot_memory_inifin.h"
27 #include "computables/blackboard_computable.h"
28 #include "computables/transform_computable.h"
29 #include "robot_memory.h"
30 
31 #include <aspect/aspect_provider.h>
32 #include <aspect/blackboard.h>
33 #include <aspect/blocked_timing.h>
34 #include <aspect/clock.h>
35 #include <aspect/configurable.h>
36 #include <aspect/logging.h>
37 #include <aspect/tf.h>
38 #include <core/threading/thread.h>
39 #include <plugins/mongodb/aspect/mongodb.h>
40 
41 #include <string>
42 
43 namespace fawkes {
44 class Mutex;
45 class RobotMemoryInterface;
46 class TimeWait;
47 #ifdef USE_TIMETRACKER
48 class TimeTracker;
49 #endif
50 } // namespace fawkes
51 
53  public fawkes::LoggingAspect,
55  public fawkes::ClockAspect,
56  public fawkes::MongoDBAspect,
60 {
61 public:
63  virtual ~RobotMemoryThread();
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:
78  RobotMemory * robot_memory;
79  fawkes::RobotMemoryIniFin robot_memory_inifin_;
80  BlackboardComputable * blackboard_computable;
81  TransformComputable * transform_computable;
82 
83  fawkes::TimeWait *timewait_;
84 
85 #ifdef USE_TIMETRACKER
87  unsigned int tt_loopcount_;
88  unsigned int ttc_msgproc_;
89  unsigned int ttc_rmloop_;
90 #endif
91 };
92 
93 #endif
fawkes::MongoDBAspect
Thread aspect to access MongoDB.
Definition: mongodb.h:39
fawkes::RobotMemoryIniFin
RobotMemoryAspect initializer/finalizer.
Definition: robot_memory_inifin.h:31
RobotMemoryThread::~RobotMemoryThread
virtual ~RobotMemoryThread()
Destructor.
Definition: robot_memory_thread.cpp:55
TransformComputable
Computable proving positions in other frames by using transforms.
Definition: transform_computable.h:34
RobotMemory
Access to the robot memory based on mongodb.
Definition: robot_memory.h:47
fawkes::AspectProviderAspect
Thread aspect provide a new aspect.
Definition: aspect_provider.h:36
RobotMemoryThread::RobotMemoryThread
RobotMemoryThread()
Constructor for thread.
Definition: robot_memory_thread.cpp:48
RobotMemoryThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: robot_memory_thread.h:72
BlackboardComputable
Computable providing access to blackboard interfaces.
Definition: blackboard_computable.h:38
RobotMemoryThread::finalize
virtual void finalize()
Finalize the thread.
Definition: robot_memory_thread.cpp:97
RobotMemoryThread::init
virtual void init()
Initialize the thread.
Definition: robot_memory_thread.cpp:60
RobotMemoryThread::loop
virtual void loop()
Code to execute in the thread.
Definition: robot_memory_thread.cpp:110
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::TransformAspect
Thread aspect to access the transform system.
Definition: tf.h:39
fawkes::TimeTracker
Time tracking utility.
Definition: tracker.h:37
fawkes::Thread
Thread class encapsulation of pthreads.
Definition: thread.h:46
fawkes::TimeWait
Time wait utility.
Definition: wait.h:33
fawkes::ConfigurableAspect
Thread aspect to access configuration data.
Definition: configurable.h:33
RobotMemoryThread
Thread that provides a robot memory with MongoDB.
Definition: robot_memory_thread.h:60
fawkes::ClockAspect
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34