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
33namespace fawkes {
34class Roomba500Interface;
35class JoystickInterface;
36} // namespace fawkes
37
44{
45public:
47
48 virtual void init();
49 virtual void finalize();
50 virtual void loop();
51
52private:
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() */
57protected:
58 virtual void
60 {
61 Thread::run();
62 }
63
64private:
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
Roomba joystick control thread.
virtual void init()
Initialize the thread.
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual void loop()
Code to execute in the thread.
RoombaJoystickThread()
Constructor.
virtual void finalize()
Finalize the thread.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to use blocked timing.
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34
Thread aspect to access configuration data.
Definition: configurable.h:33
JoystickInterface Fawkes BlackBoard Interface.
Thread aspect to log output.
Definition: logging.h:33
Roomba500Interface Fawkes BlackBoard Interface.
Thread class encapsulation of pthreads.
Definition: thread.h:46
Fawkes library namespace.