Fawkes API  Fawkes Development Version
thread_roomba_500.h
1 
2 /***************************************************************************
3  * thread_roomba_500.h - Roomba 500 thread
4  *
5  * Created: Sun Jan 02 12:47:35 2011
6  * Copyright 2006-2010 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_ROOMBA_THREAD_ROOMBA_500_H_
24 #define _PLUGINS_ROOMBA_THREAD_ROOMBA_500_H_
25 
26 #include "roomba_500.h"
27 
28 #include <aspect/blackboard.h>
29 #include <aspect/blocked_timing.h>
30 #include <aspect/clock.h>
31 #include <aspect/configurable.h>
32 #include <aspect/logging.h>
33 #include <aspect/thread_producer.h>
34 #include <core/threading/thread.h>
35 #include <core/utils/refptr.h>
36 
37 namespace fawkes {
38 class LedInterface;
39 class SwitchInterface;
40 class MotorInterface;
41 class BatteryInterface;
42 class Roomba500Interface;
43 } // namespace fawkes
44 
45 class Roomba500Thread : public fawkes::Thread,
47  public fawkes::LoggingAspect,
49  public fawkes::ClockAspect,
51 {
52 public:
54 
55  virtual void init();
56  virtual void finalize();
57  virtual void loop();
58 
59  void write_blackboard();
60 
61  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
62 protected:
63  virtual void
64  run()
65  {
66  Thread::run();
67  }
68 
69 private:
70  void close_interfaces();
71  float led_process(fawkes::LedInterface *iface);
72  void set_mode(Roomba500::Mode mode);
73 
74 private:
75  fawkes::LedInterface * led_if_debris_;
76  fawkes::LedInterface * led_if_spot_;
77  fawkes::LedInterface * led_if_dock_;
78  fawkes::LedInterface * led_if_check_robot_;
79  fawkes::LedInterface * led_if_clean_color_;
80  fawkes::LedInterface * led_if_clean_intensity_;
81  fawkes::SwitchInterface *switch_if_vacuuming_;
82  fawkes::SwitchInterface *switch_if_but_clean_;
83  fawkes::SwitchInterface *switch_if_but_spot_;
84  fawkes::SwitchInterface *switch_if_but_dock_;
85  fawkes::SwitchInterface *switch_if_but_minute_;
86  fawkes::SwitchInterface *switch_if_but_hour_;
87  fawkes::SwitchInterface *switch_if_but_day_;
88  fawkes::SwitchInterface *switch_if_but_schedule_;
89  fawkes::SwitchInterface *switch_if_but_clock_;
90  //fawkes::MotorInterface *motor_if_;
91  fawkes::BatteryInterface * battery_if_;
92  fawkes::Roomba500Interface *roomba500_if_;
93 
95 
96  std::string cfg_conntype_;
97  std::string cfg_mode_;
98  std::string cfg_device_;
99  std::string cfg_bttype_;
100  bool cfg_btsave_;
101  bool cfg_btfast_;
102  bool cfg_query_mode_;
103  bool cfg_play_fanfare_;
104 
105  unsigned int greeting_loop_count_;
106 
107  int battery_percent_;
108 
109  class WorkerThread;
110  WorkerThread *wt_;
111 };
112 
113 #endif
Roomba500::Mode
Mode
Roomba 500 operation mode.
Definition: roomba_500.h:150
Roomba500Thread::init
virtual void init()
Initialize the thread.
Definition: thread_roomba_500.cpp:168
fawkes::SwitchInterface
Definition: SwitchInterface.h:37
fawkes::RefPtr< Roomba500 >
Roomba500Thread::loop
virtual void loop()
Code to execute in the thread.
Definition: thread_roomba_500.cpp:392
Roomba500Thread::Roomba500Thread
Roomba500Thread()
Constructor.
Definition: thread_roomba_500.cpp:161
fawkes::BlockedTimingAspect
Definition: blocked_timing.h:54
Roomba500Thread
Definition: thread_roomba_500.h:44
fawkes::BlackBoardAspect
Definition: blackboard.h:36
fawkes
fawkes::LoggingAspect
Definition: logging.h:36
Roomba500Thread::write_blackboard
void write_blackboard()
Write data to blackboard.
Definition: thread_roomba_500.cpp:556
fawkes::BatteryInterface
Definition: BatteryInterface.h:37
fawkes::LedInterface
Definition: LedInterface.h:37
Roomba500Thread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: thread_roomba_500.h:63
fawkes::Thread
Definition: thread.h:44
fawkes::ConfigurableAspect
Definition: configurable.h:36
fawkes::Roomba500Interface
Definition: Roomba500Interface.h:37
fawkes::ClockAspect
Definition: clock.h:38
Roomba500Thread::finalize
virtual void finalize()
Finalize the thread.
Definition: thread_roomba_500.cpp:366