Fawkes API  Fawkes Development Version
static_transforms_thread.h
00001 
00002 /***************************************************************************
00003  *  static_transform_thread.h - Static transform publisher thread
00004  *
00005  *  Created: Tue Oct 25 16:32:04 2011
00006  *  Copyright  2011  Tim Niemueller [www.niemueller.de]
00007  ****************************************************************************/
00008 
00009 /*  This program is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  This program is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU Library General Public License for more details.
00018  *
00019  *  Read the full text in the LICENSE.GPL file in the doc directory.
00020  */
00021 
00022 #ifndef __PLUGINS_STATIC_TRANSFORMS_STATIC_TRANSFORMS_THREAD_H_
00023 #define __PLUGINS_STATIC_TRANSFORMS_STATIC_TRANSFORMS_THREAD_H_
00024 
00025 #include <core/threading/thread.h>
00026 #include <aspect/blocked_timing.h>
00027 #include <aspect/clock.h>
00028 #include <aspect/configurable.h>
00029 #include <aspect/logging.h>
00030 #include <aspect/blackboard.h>
00031 #include <aspect/tf.h>
00032 
00033 namespace fawkes {
00034   class Time;
00035 }
00036 
00037 class StaticTransformsThread
00038 : public fawkes::Thread,
00039   public fawkes::ClockAspect,
00040   public fawkes::LoggingAspect,
00041   public fawkes::ConfigurableAspect,
00042   public fawkes::BlockedTimingAspect,
00043   public fawkes::BlackBoardAspect,
00044   public fawkes::TransformAspect
00045 {
00046  public:
00047   StaticTransformsThread();
00048   virtual ~StaticTransformsThread();
00049 
00050   virtual void init();
00051   virtual void loop();
00052   virtual void finalize();
00053 
00054  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
00055  protected: virtual void run() { Thread::run(); }
00056 
00057  private:
00058   /** Static transform entry to publish. */
00059   typedef struct {
00060     std::string name;   /**< Transform name */
00061     fawkes::tf::StampedTransform *transform;    /**< Transform. */
00062   } Entry;
00063 
00064   std::list<Entry> __entries;
00065 
00066   float __cfg_update_interval;
00067   fawkes::Time *__last_update;
00068 };
00069 
00070 #endif