Fawkes API  Fawkes Development Version
node_thread.h
00001 
00002 /***************************************************************************
00003  *  node_thread.h - ROS node handle providing thread
00004  *
00005  *  Created: Thu May 05 18:35:12 2011
00006  *  Copyright  2006-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_ROS_NODE_THREAD_H_
00024 #define __PLUGINS_ROS_NODE_THREAD_H_
00025 
00026 #include <core/threading/thread.h>
00027 #include <core/utils/lockptr.h>
00028 #include <aspect/logging.h>
00029 #include <aspect/configurable.h>
00030 #include <aspect/clock.h>
00031 #include <aspect/blocked_timing.h>
00032 #include <aspect/aspect_provider.h>
00033 #include <plugins/ros/aspect/ros_inifin.h>
00034 #include <utils/time/time.h>
00035 
00036 #include <sys/types.h>
00037 
00038 namespace ros {
00039   class NodeHandle;
00040 }
00041 
00042 class ROSNodeThread
00043 : public fawkes::Thread,
00044   public fawkes::BlockedTimingAspect,
00045   public fawkes::LoggingAspect,
00046   public fawkes::ConfigurableAspect,
00047   public fawkes::ClockAspect,
00048   public fawkes::AspectProviderAspect
00049 {
00050  public:
00051   ROSNodeThread();
00052   virtual ~ROSNodeThread();
00053 
00054   virtual void init();
00055   virtual void loop();
00056   virtual void finalize();
00057 
00058  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
00059  protected: virtual void run() { Thread::run(); }
00060 
00061  private:
00062   fawkes::LockPtr<ros::NodeHandle>  __rosnode;
00063   fawkes::ROSAspectIniFin           __ros_aspect_inifin;
00064 
00065 };
00066 
00067 #endif