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.h
1
2
/***************************************************************************
3
* sensor_thread.h - Robotino sensor thread
4
*
5
* Created: Sun Nov 13 15:33:04 2011
6
* Copyright 2011-2012 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_ROBOTINO_SENSOR_THREAD_H_
24
#define __PLUGINS_ROBOTINO_SENSOR_THREAD_H_
25
26
#include <core/threading/thread.h>
27
#include <aspect/blocked_timing.h>
28
#include <aspect/logging.h>
29
#include <aspect/configurable.h>
30
#include <aspect/blackboard.h>
31
32
#include <string>
33
#include <vector>
34
35
#define NUM_IR_SENSORS 9
36
37
namespace
rec {
38
namespace
robotino {
39
namespace
com {
40
class
Com;
41
}
42
}
43
namespace
sharedmemory {
44
template
<
typename
SharedType>
class
SharedMemory
;
45
}
46
namespace
iocontrol {
47
namespace
robotstate {
48
class
State;
49
}
50
}
51
}
52
53
namespace
fawkes {
54
class
BatteryInterface;
55
class
RobotinoSensorInterface;
56
}
57
58
class
RobotinoSensorThread
59
:
public
fawkes::Thread
,
60
public
fawkes::BlockedTimingAspect
,
61
public
fawkes::LoggingAspect
,
62
public
fawkes::ConfigurableAspect
,
63
public
fawkes::BlackBoardAspect
64
{
65
friend
class
RobotinoActThread
;
66
public
:
67
RobotinoSensorThread
();
68
69
virtual
void
init
();
70
virtual
void
loop
();
71
virtual
void
finalize
();
72
73
/** Stub to see name in backtrace for easier debugging. @see Thread::run() */
74
protected
:
virtual
void
run
() { Thread::run(); }
75
76
private
:
// methods
77
void
update_distances(
float
*distances);
78
79
private
:
// members
80
std::string cfg_hostname_;
81
bool
cfg_quit_on_disconnect_;
82
rec::robotino::com::Com *com_;
83
unsigned
int
last_seqnum_;
84
rec::sharedmemory::SharedMemory<rec::iocontrol::robotstate::State>
*statemem_;
85
rec::iocontrol::robotstate::State *state_;
86
87
fawkes::BatteryInterface
*batt_if_;
88
fawkes::RobotinoSensorInterface
*sens_if_;
89
90
// Voltage to distance data points
91
std::vector<std::pair<double, double> > voltage_to_dist_dps_;
92
};
93
94
95
#endif
src
plugins
robotino
sensor_thread.h
Generated by
1.8.3.1