Fawkes API  Fawkes Development Version
odometry_thread.h
00001 /***************************************************************************
00002  *  odometry_thread.h - Thread to publish odometry to ROS
00003  *
00004  *  Created: Fri Jun 1 13:29:39 CEST
00005  *  Copyright  2012  Sebastian Reuter
00006  ****************************************************************************/
00007 
00008 /*  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; either version 2 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU Library General Public License for more details.
00017  *
00018  *  Read the full text in the LICENSE.GPL file in the doc directory.
00019  */
00020 
00021 #ifndef __PLUGINS_ROS_ODOMETRY_THREAD_H_
00022 #define __PLUGINS_ROS_ODOMETRY_THREAD_H_
00023 
00024 #include <core/threading/thread.h>
00025 #include <core/utils/lockptr.h>
00026 #include <aspect/logging.h>
00027 #include <aspect/configurable.h>
00028 #include <aspect/blocked_timing.h>
00029 #include <aspect/blackboard.h>
00030 #include <plugins/ros/aspect/ros.h>
00031 #include <ros/node_handle.h>
00032 
00033 
00034 namespace fawkes {
00035   class MotorInterface;
00036 }
00037 
00038 class ROSOdometryThread
00039 : public fawkes::Thread,
00040   public fawkes::BlockedTimingAspect,
00041   public fawkes::LoggingAspect,
00042   public fawkes::ConfigurableAspect,
00043   public fawkes::BlackBoardAspect,
00044   public fawkes::ROSAspect
00045 {
00046  public:
00047   ROSOdometryThread();
00048 
00049   virtual void init();
00050   virtual void loop();
00051   virtual void finalize();
00052 
00053   /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
00054  protected: virtual void run() { Thread::run(); }
00055 
00056  private:
00057   void publish_odom();
00058 
00059 private:
00060   fawkes::MotorInterface *motor_if_;
00061   ros::Publisher pub_;
00062   std::string cfg_odom_frame_id_;
00063   std::string cfg_base_frame_id_;
00064 };
00065 
00066 #endif