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
RobotinoSensorInterface.h
1
2
/***************************************************************************
3
* RobotinoSensorInterface.h - Fawkes BlackBoard Interface - RobotinoSensorInterface
4
*
5
* Templated created: Thu Oct 12 10:49:19 2006
6
* Copyright 2012 Tim Niemueller
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. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#ifndef __INTERFACES_ROBOTINOSENSORINTERFACE_H_
25
#define __INTERFACES_ROBOTINOSENSORINTERFACE_H_
26
27
#include <interface/interface.h>
28
#include <interface/message.h>
29
#include <interface/field_iterator.h>
30
31
namespace
fawkes {
32
33
class
RobotinoSensorInterface
:
public
Interface
34
{
35
/// @cond INTERNALS
36
INTERFACE_MGMT_FRIENDS(
RobotinoSensorInterface
)
37
/// @endcond
38
public
:
39
/* constants */
40
41
private
:
42
#pragma pack(push,4)
43
/** Internal data storage, do NOT modify! */
44
typedef
struct
{
45
int64_t timestamp_sec;
/**< Interface Unix timestamp, seconds */
46
int64_t timestamp_usec;
/**< Interface Unix timestamp, micro-seconds */
47
float
mot_velocity
[3];
/**< Velocities of the wheels. */
48
int32_t
mot_position
[3];
/**< Positions of the wheels. */
49
float
mot_current
[3];
/**< Motor currents. */
50
bool
bumper;
/**< Bumper pressed indicator. */
51
float
distance
[9];
/**< Distance sensor values. */
52
bool
digital_in[8];
/**< Digital input values. */
53
float
analog_in
[8];
/**< Analog input values. */
54
bool
gyro_available;
/**< True if gyro is available */
55
float
gyro_angle
;
/**< Gyro angle value; rad */
56
float
gyro_rate
;
/**< Gyro rate value; rad/sec */
57
} RobotinoSensorInterface_data_t;
58
#pragma pack(pop)
59
60
RobotinoSensorInterface_data_t *data;
61
62
public
:
63
/* messages */
64
virtual
bool
message_valid
(
const
Message
*message)
const
;
65
private
:
66
RobotinoSensorInterface
();
67
~
RobotinoSensorInterface
();
68
69
public
:
70
/* Methods */
71
float
*
mot_velocity
()
const
;
72
float
mot_velocity
(
unsigned
int
index)
const
;
73
void
set_mot_velocity
(
unsigned
int
index,
const
float
new_mot_velocity);
74
void
set_mot_velocity
(
const
float
* new_mot_velocity);
75
size_t
maxlenof_mot_velocity
()
const
;
76
int32_t *
mot_position
()
const
;
77
int32_t
mot_position
(
unsigned
int
index)
const
;
78
void
set_mot_position
(
unsigned
int
index,
const
int32_t new_mot_position);
79
void
set_mot_position
(
const
int32_t * new_mot_position);
80
size_t
maxlenof_mot_position
()
const
;
81
float
*
mot_current
()
const
;
82
float
mot_current
(
unsigned
int
index)
const
;
83
void
set_mot_current
(
unsigned
int
index,
const
float
new_mot_current);
84
void
set_mot_current
(
const
float
* new_mot_current);
85
size_t
maxlenof_mot_current
()
const
;
86
bool
is_bumper
()
const
;
87
void
set_bumper
(
const
bool
new_bumper);
88
size_t
maxlenof_bumper
()
const
;
89
float
*
distance
()
const
;
90
float
distance
(
unsigned
int
index)
const
;
91
void
set_distance
(
unsigned
int
index,
const
float
new_distance);
92
void
set_distance
(
const
float
* new_distance);
93
size_t
maxlenof_distance
()
const
;
94
bool
*
is_digital_in
()
const
;
95
bool
is_digital_in
(
unsigned
int
index)
const
;
96
void
set_digital_in
(
unsigned
int
index,
const
bool
new_digital_in);
97
void
set_digital_in
(
const
bool
* new_digital_in);
98
size_t
maxlenof_digital_in
()
const
;
99
float
*
analog_in
()
const
;
100
float
analog_in
(
unsigned
int
index)
const
;
101
void
set_analog_in
(
unsigned
int
index,
const
float
new_analog_in);
102
void
set_analog_in
(
const
float
* new_analog_in);
103
size_t
maxlenof_analog_in
()
const
;
104
bool
is_gyro_available
()
const
;
105
void
set_gyro_available
(
const
bool
new_gyro_available);
106
size_t
maxlenof_gyro_available
()
const
;
107
float
gyro_angle
()
const
;
108
void
set_gyro_angle
(
const
float
new_gyro_angle);
109
size_t
maxlenof_gyro_angle
()
const
;
110
float
gyro_rate
()
const
;
111
void
set_gyro_rate
(
const
float
new_gyro_rate);
112
size_t
maxlenof_gyro_rate
()
const
;
113
virtual
Message
*
create_message
(
const
char
*
type
)
const
;
114
115
virtual
void
copy_values
(
const
Interface
*other);
116
virtual
const
char
*
enum_tostring
(
const
char
*enumtype,
int
val)
const
;
117
118
};
119
120
}
// end namespace fawkes
121
122
#endif
src
libs
interfaces
RobotinoSensorInterface.h
Generated by
1.8.1.2