Player
Frontpage
Contents
User
Installation
Quick start
Supported devices
Tutorials
Utilities
Client libraries
FAQ
Help
Developer
Architecture
libplayercore
libplayerinterface
interfaces
libplayerdrivers
drivers
libplayercommon
libplayersd
libplayertcp
libplayerxdr
TODO
Online
Homepage
Download
Project
Bugs
Help
server
drivers
wsn
mica2.h
1
/*
2
* Player - One Hell of a Robot Server
3
* Copyright (C) 2006 Radu Bogdan Rusu (rusu@cs.tum.edu)
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
*
19
*/
20
21
/*
22
* TinyOS data structures.
23
* Portions borrowed from the TinyOS project (http://www.tinyos.net),
24
* distributed according to the Intel Open Source License.
25
*/
26
27
#include <vector>
28
29
// Change to 19200 for Mica2DOT (!)
30
#define DEFAULT_MICA2_PORT "/dev/ttyS0"
31
#define DEFAULT_MICA2_RATE B57600
32
33
// ---[ Node calibration values ]---
34
class
NodeCalibrationValues
35
{
36
public
:
37
unsigned
int
node_id;
// node identifier
38
unsigned
int
group_id;
// group identifier
39
int
c_values[6];
// calibration values
40
};
41
typedef
std::vector<NodeCalibrationValues> NCV;
42
43
// ---[ MTS310 data packet structure ]---
44
typedef
struct
45
{
46
unsigned
short
vref;
47
unsigned
short
thermistor;
48
unsigned
short
light;
49
unsigned
short
mic;
50
unsigned
short
accelX;
51
unsigned
short
accelY;
52
unsigned
short
magX;
53
unsigned
short
magY;
54
}
MTS310Data
;
55
56
// ---[ MTS510 data packet structure ]---
57
typedef
struct
58
{
59
unsigned
short
light;
60
unsigned
short
accelX;
61
unsigned
short
accelY;
62
unsigned
short
sound[5];
63
}
MTS510Data
;
64
65
// ---[ M1-mini RFID reader command packet structure ]---
66
// (Attn: ASCII mode ! make time to change to BINARY!)
67
typedef
struct
68
{
69
unsigned
char
flags [2];
70
unsigned
char
request[2];
71
unsigned
char
type [2];
72
unsigned
char
TID [16];
73
unsigned
char
start [2];
74
unsigned
char
length [2];
75
unsigned
char
data [8];
76
}
M1miniCommand
;
77
78
// ---[ Generic sensor data packet structure ]---
79
typedef
struct
80
{
81
unsigned
char
board_id;
// unique sensorboard id
82
unsigned
char
packet_id;
// unique packet type for sensorboard
83
unsigned
char
node_id;
// ID of originating node
84
unsigned
char
parent;
// ID of node's parent
85
unsigned
short
data[12];
// data payload defaults to 24 bytes
86
unsigned
char
terminator;
// reserved for null terminator
87
}
SensorPacket
;
88
89
// ---[ The standard header for all TinyOS active messages ]---
90
typedef
struct
91
{
92
unsigned
short
addr;
93
unsigned
char
type;
94
unsigned
char
group;
95
unsigned
char
length;
96
}
__attribute__
((packed)) TOSMsgHeader;
97
98
// ---[ Packet structure for XCOMMAND ]---
99
typedef
struct
100
{
101
unsigned
short
cmd;
102
union
103
{
104
unsigned
int
new_rate;
// XCOMMAND_SET_RATE
105
unsigned
int
node_id;
// XCOMMAND_SET_NODEID
106
unsigned
char
group;
// XCOMMAND_SET_GROUP
107
unsigned
char
rf_power;
// XCOMMAND_SET_RF_POWER
108
unsigned
char
rf_channel;
// XCOMMAND_SET_RF_CHANNEL
109
struct
110
{
111
unsigned
short
device;
// device: LEDs, speaker, etc
112
unsigned
short
state;
// state : on/off, etc
113
} actuate;
114
} param;
115
}
__attribute__
((packed)) XCommandOp;
116
117
typedef
struct
118
{
119
TOSMsgHeader tos;
120
unsigned
short
seq_no;
121
unsigned
short
destination_id;
// 0xFFFF for all
122
XCommandOp inst[1];
123
}
__attribute__
((packed)) XCommandMsg;
124
125
// ---[ RFID data packet structure] ---
126
typedef
struct
{
127
TOSMsgHeader tos;
128
unsigned
char
ptotal;
// num of packets
129
unsigned
char
pi;
// index of current packet
130
unsigned
short
RID;
// receive id
131
unsigned
short
SG;
// signal strength
132
unsigned
char
data[23];
133
unsigned
short
crc;
134
}
__attribute__
((packed)) RFIDMsg;
135
136
// ---[ Health data packet structure ]---
137
/*typedef struct
138
{
139
unsigned short id;
140
unsigned char hop_count;
141
unsigned char send_est;
142
} DBGEstEntry;
143
typedef struct
144
{
145
unsigned short node_id;
146
unsigned short origin_addr;
147
short seq_no;
148
unsigned char hop_count;
149
// HealthMsg
150
unsigned char est_entries;
151
DBGEstEntry est_list[4];
152
} HealthData;
153
*/
__attribute__
Messages between wsn and a robot.
Definition:
er.h:86
MTS310Data
Definition:
mica2.h:44
MTS510Data
Definition:
mica2.h:57
SensorPacket
Definition:
mica2.h:79
M1miniCommand
Definition:
mica2.h:67
Generated on Wed Sep 2 2020 16:39:27 for Player by
1.8.13