import struct """ RC packet sent over network looks as follows. All fields are little-endian. Start Byte Size Description 0 8 Timestamp, usec since some epoch 8 2 Sequence number 10 2 Channel 1 12 2 Channel 2 14 2 Channel 3 16 2 Channel 4 18 2 Channel 5 20 2 Channel 6 22 2 Channel 7 24 2 Channel 8 26 (packet length) """ LENGTH = 26 # Input is binary packet (string) # Output is tuple (timestamp, sequence, channels[]) def unpack(s): if len(s) != LENGTH: return None ts, seq = struct.unpack("