Well, validation is done implicitly and not completely.
Arduino:
Serial1 << "#" << _FLOAT(theta,4) << ";" << X_pos << ";" << Y_pos << ";" << PING2cm(PingCM[0]) << ";" << PING2cm(PingCM[1]) << ";" << endl;
Processing:
if (myString.substring(0, 1).equals ("#")) {
float[] nums = float(splitTokens(new String(myString.substring(1)), ";"));
theta=nums[0];
x_pos=nums[1]; x_pos_MAP = round(Size/2 + x_pos);
y_pos=nums[2]; y_pos_MAP = round(Size/2 - y_pos);
lastPingL = nums[3];
lastPingR = nums[4];
drawSonar(int(lastPingL), 10, -5, 8);
drawSonar(int(lastPingR), -10, 5,8);
}
So if the # ist lost or any number is no longe a falid float - the message will cause an exception and will be droped. But as long as the basic structure isn't changed the message is still valid.
So far I didn't notice bad effects from altered messages. There is a non valid one once in a while. But more often my commands sent from the PC to the robot are dropped because hte robot is currently sending. So I need to implement a kind of "allowance to talk" whcih gets handed over between the two. Some true message validation wouldn't hurt either.