Fawkes API  Fawkes Development Version
roombajoy_thread.h
1 
2 /***************************************************************************
3  * roombajoy_thread.h - Roomba joystick control thread
4  *
5  * Created: Sat Jan 29 14:34:11 2011
6  * Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _PLUGINS_ROOMBAJOY_THREAD_H_
24 #define _PLUGINS_ROOMBAJOY_THREAD_H_
25 
26 #include <aspect/blackboard.h>
27 #include <aspect/blocked_timing.h>
28 #include <aspect/clock.h>
29 #include <aspect/configurable.h>
30 #include <aspect/logging.h>
31 #include <core/threading/thread.h>
32 
33 namespace fawkes {
34 class Roomba500Interface;
35 class JoystickInterface;
36 } // namespace fawkes
37 
40  public fawkes::LoggingAspect,
42  public fawkes::ClockAspect,
44 {
45 public:
47 
48  virtual void init();
49  virtual void finalize();
50  virtual void loop();
51 
52 private:
53  void stop();
54  unsigned int confval(const char *path, unsigned int default_value);
55 
56  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
57 protected:
58  virtual void
59  run()
60  {
61  Thread::run();
62  }
63 
64 private:
65  fawkes::JoystickInterface * joy_if_;
66  fawkes::Roomba500Interface *roomba500_if_;
67 
68  int last_velo_;
69 
70  bool strong_rumble_;
71  bool weak_rumble_;
72 
73  bool main_brush_enabled_;
74  bool side_brush_enabled_;
75  bool vacuuming_enabled_;
76 
77  unsigned int cfg_but_main_brush_;
78  unsigned int cfg_but_side_brush_;
79  unsigned int cfg_but_vacuuming_;
80  unsigned int cfg_but_dock_;
81  unsigned int cfg_but_spot_;
82  unsigned int cfg_but_mode_;
83 
84  unsigned int cfg_axis_forward_;
85  unsigned int cfg_axis_sideward_;
86  unsigned int cfg_axis_speed_;
87 
88  unsigned int cfg_min_radius_;
89  unsigned int cfg_max_radius_;
90  unsigned int cfg_max_velocity_;
91 };
92 
93 #endif
RoombaJoystickThread::RoombaJoystickThread
RoombaJoystickThread()
Constructor.
Definition: roombajoy_thread.cpp:54
RoombaJoystickThread::init
virtual void init()
Initialize the thread.
Definition: roombajoy_thread.cpp:61
fawkes::BlockedTimingAspect
Definition: blocked_timing.h:54
RoombaJoystickThread
Definition: roombajoy_thread.h:37
fawkes::BlackBoardAspect
Definition: blackboard.h:36
fawkes
fawkes::LoggingAspect
Definition: logging.h:36
fawkes::Thread
Definition: thread.h:44
fawkes::ConfigurableAspect
Definition: configurable.h:36
fawkes::Roomba500Interface
Definition: Roomba500Interface.h:37
fawkes::ClockAspect
Definition: clock.h:38
RoombaJoystickThread::loop
virtual void loop()
Code to execute in the thread.
Definition: roombajoy_thread.cpp:122
RoombaJoystickThread::finalize
virtual void finalize()
Finalize the thread.
Definition: roombajoy_thread.cpp:115
fawkes::JoystickInterface
Definition: JoystickInterface.h:37
RoombaJoystickThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: roombajoy_thread.h:58