Fawkes API  Fawkes Development Version
act_thread.h
00001 
00002 /***************************************************************************
00003  *  act_thread.h - Robotino act thread
00004  *
00005  *  Created: Sun Nov 13 16:05:34 2011
00006  *  Copyright  2011  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __PLUGINS_ROBOTINO_ACT_THREAD_H_
00024 #define __PLUGINS_ROBOTINO_ACT_THREAD_H_
00025 
00026 #include <core/threading/thread.h>
00027 #include <aspect/blocked_timing.h>
00028 #include <aspect/logging.h>
00029 #include <aspect/configurable.h>
00030 #include <aspect/blackboard.h>
00031 #include <aspect/clock.h>
00032 #ifdef HAVE_TF
00033 #  include <aspect/tf.h>
00034 #endif
00035 
00036 #include <string>
00037 
00038 namespace rec {
00039   namespace robotino {
00040     namespace com {
00041       class Com;
00042       class OmniDrive;
00043     }
00044   }
00045 }
00046 
00047 namespace fawkes {
00048   class MotorInterface;
00049 }
00050 
00051 class RobotinoSensorThread;
00052 
00053 class RobotinoActThread
00054 : public fawkes::Thread,
00055   public fawkes::LoggingAspect,
00056   public fawkes::ConfigurableAspect,
00057   public fawkes::ClockAspect,
00058 #ifdef HAVE_TF
00059   public fawkes::TransformAspect,
00060 #endif
00061   public fawkes::BlockedTimingAspect,
00062   public fawkes::BlackBoardAspect
00063 {
00064  public:
00065   RobotinoActThread(RobotinoSensorThread *sensor_thread);
00066 
00067   virtual void init();
00068   virtual void loop();
00069   virtual void finalize();
00070 
00071  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
00072  protected: virtual void run() { Thread::run(); }
00073 
00074  private:
00075   RobotinoSensorThread           *sensor_thread_;
00076   rec::robotino::com::Com        *com_;
00077   rec::robotino::com::OmniDrive  *omni_drive_;
00078   unsigned int                    last_seqnum_;
00079   fawkes::MotorInterface         *motor_if_;
00080 };
00081 
00082 
00083 #endif