Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
sensor_thread.cpp
1
2
/***************************************************************************
3
* sensor_thread.cpp - Roomba plugin sensor thread
4
*
5
* Created: Mon Jan 03 00:05:32 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
#include "sensor_thread.h"
24
#include "thread_roomba_500.h"
25
26
using namespace
fawkes;
27
28
/** @class RoombaSensorThread "sensor_thread.h"
29
* Roomba sensor hook integration thread.
30
* This thread integrates into the Fawkes main loop at the SENSOR hook and
31
* triggers the Roomba thread to write new sensor data.
32
* @author Tim Niemueller
33
*/
34
35
/** Constructor.
36
* @param roomba500_thread Roomba 500 thread to trigger to write to blackboard.
37
*/
38
RoombaSensorThread::RoombaSensorThread
(
Roomba500Thread
*roomba500_thread)
39
:
Thread
(
"RoombaSensorThread"
,
Thread
::OPMODE_WAITFORWAKEUP),
40
BlockedTimingAspect
(
BlockedTimingAspect
::WAKEUP_HOOK_SENSOR_ACQUIRE)
41
{
42
__roomba500_thread = roomba500_thread;
43
}
44
45
46
47
void
48
RoombaSensorThread::loop
()
49
{
50
try
{
51
__roomba500_thread->
write_blackboard
();
52
}
catch
(
Exception
&e) {
53
logger
->
log_warn
(
name
(),
"%s failed to write to BB, exception follows."
,
54
__roomba500_thread->
name
());
55
logger
->
log_warn
(
name
(), e);
56
}
57
}
src
plugins
roomba
sensor_thread.cpp
Generated by
1.8.1.1