Fawkes API  Fawkes Development Version
roombajoy_thread.h
00001 
00002 /***************************************************************************
00003  *  roombajoy_thread.h - Roomba joystick control thread
00004  *
00005  *  Created: Sat Jan 29 14:34:11 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_ROOMBAJOY_THREAD_H_
00024 #define __PLUGINS_ROOMBAJOY_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/clock.h>
00031 #include <aspect/blackboard.h>
00032 
00033 namespace fawkes {
00034   class Roomba500Interface;
00035   class JoystickInterface;
00036 }
00037 
00038 class RoombaJoystickThread
00039 : public fawkes::Thread,
00040   public fawkes::BlockedTimingAspect,
00041   public fawkes::LoggingAspect,
00042   public fawkes::ConfigurableAspect,
00043   public fawkes::ClockAspect,
00044   public fawkes::BlackBoardAspect
00045 {
00046  public:
00047   RoombaJoystickThread();
00048 
00049   virtual void init();
00050   virtual void finalize();
00051   virtual void loop();
00052 
00053  private:
00054   void stop();
00055   unsigned int confval(const char *path, unsigned int default_value);
00056 
00057  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
00058  protected: virtual void run() { Thread::run(); }
00059 
00060  private:
00061   fawkes::JoystickInterface  *__joy_if;
00062   fawkes::Roomba500Interface *__roomba500_if;
00063 
00064   int __last_velo;
00065 
00066   bool __strong_rumble;
00067   bool __weak_rumble;
00068 
00069   bool __main_brush_enabled;
00070   bool __side_brush_enabled;
00071   bool __vacuuming_enabled;
00072 
00073   unsigned int __cfg_but_main_brush;
00074   unsigned int __cfg_but_side_brush;
00075   unsigned int __cfg_but_vacuuming;
00076   unsigned int __cfg_but_dock;
00077   unsigned int __cfg_but_spot;
00078   unsigned int __cfg_but_mode;
00079 
00080   unsigned int __cfg_axis_forward;
00081   unsigned int __cfg_axis_sideward;
00082   unsigned int __cfg_axis_speed;
00083 
00084   unsigned int __cfg_min_radius;
00085   unsigned int __cfg_max_radius;
00086   unsigned int __cfg_max_velocity;
00087 };
00088 
00089 #endif