Tuesday, November 8, 2011

Data packets for xbees

Message/Packet types:
1: from base to proximity patches telling them it’s the beginning of a turn. [5 BYTES]
2: from prox. patches to base providing sensor readings. [6 BYTES]
3: from base to gloves telling them what intensity to vibrate. [2 BYTES]
4: from accelerometer anklets to base providing sensor readings. [5 BYTES]
5: Config. from base to proximity patches. [3 BYTES]
6: Ack. of configuration messages, send from prox. patches to base in response to config. [4 BYTES]
7: Messages from gloves to base, for button presses on gloves, UI control. [3 BYTES]

More Info about Packets

2fake: data simulation packet outgoing of patch:
“sent” approximately every 50 ms, with a small percentage of dropped packets:
time (ms)
player #: 0 or 1
patch #: 0-3
touched: 0-1
prox: 0-1028

4fake: data simulation packet outgoing of accelerometer:
set every 50 ms, with a small percentage of dropped packets:
player#
patch#
accel: 1-255

2real: real packet outgoing of patch
sent by patch arduino software
every 50 ms
highest prox reading of interval

7real: real packet outgoing of patch: button press

4real: real packet outgoing of accelerometer
sent by anklet arduino software
every 50 ms
highest accel. reading of interval

Packet structure
Packet structures, by byte:

Type #1: Base to Prox
0: Packet type
1: Step number (high order bits)
2: Step number (low order bits)
3: patches active this turn (4 bits) and patches active next turn (4 bits) - patch is active or not: 1 or 0
4: patches active two turns from now (4 bits) and patches active 3 turns from now (4 bits)

Type #2: Prox to Base
0: Message Type
1: Patch Address (7 bits, expect 1-4, 9-12) | touched (1 bit)
2: Step number (high order bits)
3: Step number (low order bits)
4: Proximity reading (high order bits)
5: Proximity reading (low order bits)

Type #3: Base to Gloves
0: Message Type
1: Vibe intensity (higher -> more vibration)

Type #4: Accel to Base
0: Message type
1: Patch Address (expect 7-8, 15-16)
2: X axis reading
3: Y axis reading
4: Z axis reading

Type #5: Config, base to prox
0: Message Type
1: Length of step (high order bits) - tells the patches how long each “step” will be during this level
2: Length of step (low order bits)

Type #7: Glove to Base
0: Message Type
1: Patch address (expect 5-6, 13-14)
2: Which button was touched

Button touch data is an int encoded thus:
0: no touch, or ambiguous touch that we shouldn’t react to
1: left button ONLY was touched
2: right button ONLY was touched
3: center button ONLY was touched
4: all three buttons were touched

No comments:

Post a Comment