handleOsc method
Parses an OSC bundle from a list of bytes.
Implementation
void handleOsc(List<int> data) {
try {
// skip 8 byte "#bundle" + 8 byte timestamp + 4 byte data length
final buffer = data.sublist(20);
final message = OSCMessage.fromBytes(buffer);
if (message.address != "/euler") return;
final orientation = Orientation(
x: message.arguments[0] as double,
y: message.arguments[1] as double,
z: message.arguments[2] as double,
);
final position = RoverPosition(orientation: orientation, version: positionVersion);
collection.server.sendMessage(position);
collection.server.sendMessage(position, destination: autonomySocket);
} catch (error) {
/* Ignore corrupt data */
}
}